Skip to content

Commit 6623b41

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates This series contains updates to e1000, e1000e, ixgbe and i40evf. Emil provides a fix for ixgbe so that non-fiber devices with MNG FW enabled are able to link at 100Mbps. Jacob provides several changes for ixgbe, most of which are PTP related. Renames ixgbe_ptp_enable() to ixgbe_ptp_feature_enable() to better reflect the functions purpose. Extracts the hardware setup logic for the PTP hardware bits from the ixgbe_ptp_set_ts_config() to enable future work for the ixgbe_ptp_reset(). Maintain the hwstamp configuration through a reset and extracts the creation of the PTP clock device from ptp_init() in order to properly handle a suspend/resume cycle and only calls it if we don't already have a ptp_clock pointer. David provides a patch to expend the e1000e driver to turn on unicast PROMISC when there is failure to write to a shared receive address register. The fix update_phy_task() for 82579 is expanded to include newer PHYs as well so that the dev_spec->eee_lp_ability has the correct value when going into SX states. Todd provides a e1000e fix an errata for 82574/82583 where it is possible bad bits are read from SYSTIMH/L so check to see that the time is incrementing at a reasonable rate and is a multiple of the time incremental value. Removes a redundant igb PHY power down register write. Andi Kleen out of lines two write functions for e1000e to save 30k text size. Tobias Klauser converts the e1000 and i40evf drivers to use the is_broadcast_ether_addr() and is_multicast_ether_addr(). ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 3bea8ed + dc5f2de commit 6623b41

File tree

15 files changed

+277
-117
lines changed

15 files changed

+277
-117
lines changed

drivers/net/ethernet/intel/e1000/e1000_hw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4877,10 +4877,10 @@ void e1000_tbi_adjust_stats(struct e1000_hw *hw, struct e1000_hw_stats *stats,
48774877
* since the test for a multicast frame will test positive on
48784878
* a broadcast frame.
48794879
*/
4880-
if ((mac_addr[0] == (u8) 0xff) && (mac_addr[1] == (u8) 0xff))
4880+
if (is_broadcast_ether_addr(mac_addr))
48814881
/* Broadcast packet */
48824882
stats->bprc++;
4883-
else if (*mac_addr & 0x01)
4883+
else if (is_multicast_ether_addr(mac_addr))
48844884
/* Multicast packet */
48854885
stats->mprc++;
48864886

drivers/net/ethernet/intel/e1000e/80003es2lan.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,7 @@ static const struct e1000_mac_operations es2_mac_ops = {
13651365
.setup_led = e1000e_setup_led_generic,
13661366
.config_collision_dist = e1000e_config_collision_dist_generic,
13671367
.rar_set = e1000e_rar_set_generic,
1368+
.rar_get_count = e1000e_rar_get_count_generic,
13681369
};
13691370

13701371
static const struct e1000_phy_operations es2_phy_ops = {

drivers/net/ethernet/intel/e1000e/82571.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,6 +1896,7 @@ static const struct e1000_mac_operations e82571_mac_ops = {
18961896
.config_collision_dist = e1000e_config_collision_dist_generic,
18971897
.read_mac_addr = e1000_read_mac_addr_82571,
18981898
.rar_set = e1000e_rar_set_generic,
1899+
.rar_get_count = e1000e_rar_get_count_generic,
18991900
};
19001901

19011902
static const struct e1000_phy_operations e82_phy_ops_igp = {

drivers/net/ethernet/intel/e1000e/e1000.h

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,8 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca);
391391
* 25MHz 46-bit 2^46 / 10^9 / 3600 = 19.55 hours
392392
*/
393393
#define E1000_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 60 * 4)
394+
#define E1000_MAX_82574_SYSTIM_REREADS 50
395+
#define E1000_82574_SYSTIM_EPSILON (1ULL << 35ULL)
394396

395397
/* hardware capability, feature, and workaround flags */
396398
#define FLAG_HAS_AMT (1 << 0)
@@ -573,35 +575,8 @@ static inline u32 __er32(struct e1000_hw *hw, unsigned long reg)
573575

574576
#define er32(reg) __er32(hw, E1000_##reg)
575577

576-
/**
577-
* __ew32_prepare - prepare to write to MAC CSR register on certain parts
578-
* @hw: pointer to the HW structure
579-
*
580-
* When updating the MAC CSR registers, the Manageability Engine (ME) could
581-
* be accessing the registers at the same time. Normally, this is handled in
582-
* h/w by an arbiter but on some parts there is a bug that acknowledges Host
583-
* accesses later than it should which could result in the register to have
584-
* an incorrect value. Workaround this by checking the FWSM register which
585-
* has bit 24 set while ME is accessing MAC CSR registers, wait if it is set
586-
* and try again a number of times.
587-
**/
588-
static inline s32 __ew32_prepare(struct e1000_hw *hw)
589-
{
590-
s32 i = E1000_ICH_FWSM_PCIM2PCI_COUNT;
591-
592-
while ((er32(FWSM) & E1000_ICH_FWSM_PCIM2PCI) && --i)
593-
udelay(50);
594-
595-
return i;
596-
}
597-
598-
static inline void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val)
599-
{
600-
if (hw->adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA)
601-
__ew32_prepare(hw);
602-
603-
writel(val, hw->hw_addr + reg);
604-
}
578+
s32 __ew32_prepare(struct e1000_hw *hw);
579+
void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val);
605580

606581
#define ew32(reg, val) __ew32(hw, E1000_##reg, (val))
607582

drivers/net/ethernet/intel/e1000e/hw.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,9 @@ struct e1000_mac_operations {
469469
s32 (*setup_led)(struct e1000_hw *);
470470
void (*write_vfta)(struct e1000_hw *, u32, u32);
471471
void (*config_collision_dist)(struct e1000_hw *);
472-
void (*rar_set)(struct e1000_hw *, u8 *, u32);
472+
int (*rar_set)(struct e1000_hw *, u8 *, u32);
473473
s32 (*read_mac_addr)(struct e1000_hw *);
474+
u32 (*rar_get_count)(struct e1000_hw *);
474475
};
475476

476477
/* When to use various PHY register access functions:

drivers/net/ethernet/intel/e1000e/ich8lan.c

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
139139
static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw);
140140
static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw);
141141
static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw);
142-
static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index);
143-
static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index);
142+
static int e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index);
143+
static int e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index);
144+
static u32 e1000_rar_get_count_pch_lpt(struct e1000_hw *hw);
144145
static s32 e1000_k1_workaround_lv(struct e1000_hw *hw);
145146
static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate);
146147
static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force);
@@ -704,6 +705,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw)
704705
mac->ops.rar_set = e1000_rar_set_pch_lpt;
705706
mac->ops.setup_physical_interface =
706707
e1000_setup_copper_link_pch_lpt;
708+
mac->ops.rar_get_count = e1000_rar_get_count_pch_lpt;
707709
}
708710

709711
/* Enable PCS Lock-loss workaround for ICH8 */
@@ -1635,9 +1637,9 @@ static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw)
16351637
u32 fwsm;
16361638

16371639
fwsm = er32(FWSM);
1638-
return ((fwsm & E1000_ICH_FWSM_FW_VALID) &&
1640+
return (fwsm & E1000_ICH_FWSM_FW_VALID) &&
16391641
((fwsm & E1000_FWSM_MODE_MASK) ==
1640-
(E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT)));
1642+
(E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT));
16411643
}
16421644

16431645
/**
@@ -1668,7 +1670,7 @@ static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw)
16681670
* contain the MAC address but RAR[1-6] are reserved for manageability (ME).
16691671
* Use SHRA[0-3] in place of those reserved for ME.
16701672
**/
1671-
static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
1673+
static int e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
16721674
{
16731675
u32 rar_low, rar_high;
16741676

@@ -1690,7 +1692,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
16901692
e1e_flush();
16911693
ew32(RAH(index), rar_high);
16921694
e1e_flush();
1693-
return;
1695+
return 0;
16941696
}
16951697

16961698
/* RAR[1-6] are owned by manageability. Skip those and program the
@@ -1713,14 +1715,51 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
17131715
/* verify the register updates */
17141716
if ((er32(SHRAL(index - 1)) == rar_low) &&
17151717
(er32(SHRAH(index - 1)) == rar_high))
1716-
return;
1718+
return 0;
17171719

17181720
e_dbg("SHRA[%d] might be locked by ME - FWSM=0x%8.8x\n",
17191721
(index - 1), er32(FWSM));
17201722
}
17211723

17221724
out:
17231725
e_dbg("Failed to write receive address at index %d\n", index);
1726+
return -E1000_ERR_CONFIG;
1727+
}
1728+
1729+
/**
1730+
* e1000_rar_get_count_pch_lpt - Get the number of available SHRA
1731+
* @hw: pointer to the HW structure
1732+
*
1733+
* Get the number of available receive registers that the Host can
1734+
* program. SHRA[0-10] are the shared receive address registers
1735+
* that are shared between the Host and manageability engine (ME).
1736+
* ME can reserve any number of addresses and the host needs to be
1737+
* able to tell how many available registers it has access to.
1738+
**/
1739+
static u32 e1000_rar_get_count_pch_lpt(struct e1000_hw *hw)
1740+
{
1741+
u32 wlock_mac;
1742+
u32 num_entries;
1743+
1744+
wlock_mac = er32(FWSM) & E1000_FWSM_WLOCK_MAC_MASK;
1745+
wlock_mac >>= E1000_FWSM_WLOCK_MAC_SHIFT;
1746+
1747+
switch (wlock_mac) {
1748+
case 0:
1749+
/* All SHRA[0..10] and RAR[0] available */
1750+
num_entries = hw->mac.rar_entry_count;
1751+
break;
1752+
case 1:
1753+
/* Only RAR[0] available */
1754+
num_entries = 1;
1755+
break;
1756+
default:
1757+
/* SHRA[0..(wlock_mac - 1)] available + RAR[0] */
1758+
num_entries = wlock_mac + 1;
1759+
break;
1760+
}
1761+
1762+
return num_entries;
17241763
}
17251764

17261765
/**
@@ -1734,7 +1773,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
17341773
* contain the MAC address. SHRA[0-10] are the shared receive address
17351774
* registers that are shared between the Host and manageability engine (ME).
17361775
**/
1737-
static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index)
1776+
static int e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index)
17381777
{
17391778
u32 rar_low, rar_high;
17401779
u32 wlock_mac;
@@ -1756,7 +1795,7 @@ static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index)
17561795
e1e_flush();
17571796
ew32(RAH(index), rar_high);
17581797
e1e_flush();
1759-
return;
1798+
return 0;
17601799
}
17611800

17621801
/* The manageability engine (ME) can lock certain SHRAR registers that
@@ -1788,12 +1827,13 @@ static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index)
17881827
/* verify the register updates */
17891828
if ((er32(SHRAL_PCH_LPT(index - 1)) == rar_low) &&
17901829
(er32(SHRAH_PCH_LPT(index - 1)) == rar_high))
1791-
return;
1830+
return 0;
17921831
}
17931832
}
17941833

17951834
out:
17961835
e_dbg("Failed to write receive address at index %d\n", index);
1836+
return -E1000_ERR_CONFIG;
17971837
}
17981838

17991839
/**
@@ -4977,6 +5017,7 @@ static const struct e1000_mac_operations ich8_mac_ops = {
49775017
/* id_led_init dependent on mac type */
49785018
.config_collision_dist = e1000e_config_collision_dist_generic,
49795019
.rar_set = e1000e_rar_set_generic,
5020+
.rar_get_count = e1000e_rar_get_count_generic,
49805021
};
49815022

49825023
static const struct e1000_phy_operations ich8_phy_ops = {

drivers/net/ethernet/intel/e1000e/mac.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
211211
return 0;
212212
}
213213

214+
u32 e1000e_rar_get_count_generic(struct e1000_hw *hw)
215+
{
216+
return hw->mac.rar_entry_count;
217+
}
218+
214219
/**
215220
* e1000e_rar_set_generic - Set receive address register
216221
* @hw: pointer to the HW structure
@@ -220,7 +225,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
220225
* Sets the receive address array register at index to the address passed
221226
* in by addr.
222227
**/
223-
void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
228+
int e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
224229
{
225230
u32 rar_low, rar_high;
226231

@@ -244,6 +249,8 @@ void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
244249
e1e_flush();
245250
ew32(RAH(index), rar_high);
246251
e1e_flush();
252+
253+
return 0;
247254
}
248255

249256
/**

drivers/net/ethernet/intel/e1000e/mac.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ void e1000e_update_adaptive(struct e1000_hw *hw);
6161
void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value);
6262

6363
void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw);
64-
void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index);
64+
u32 e1000e_rar_get_count_generic(struct e1000_hw *hw);
65+
int e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index);
6566
void e1000e_config_collision_dist_generic(struct e1000_hw *hw);
6667

6768
#endif

drivers/net/ethernet/intel/e1000e/netdev.c

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,36 @@ static const struct e1000_reg_info e1000_reg_info_tbl[] = {
123123
{0, NULL}
124124
};
125125

126+
/**
127+
* __ew32_prepare - prepare to write to MAC CSR register on certain parts
128+
* @hw: pointer to the HW structure
129+
*
130+
* When updating the MAC CSR registers, the Manageability Engine (ME) could
131+
* be accessing the registers at the same time. Normally, this is handled in
132+
* h/w by an arbiter but on some parts there is a bug that acknowledges Host
133+
* accesses later than it should which could result in the register to have
134+
* an incorrect value. Workaround this by checking the FWSM register which
135+
* has bit 24 set while ME is accessing MAC CSR registers, wait if it is set
136+
* and try again a number of times.
137+
**/
138+
s32 __ew32_prepare(struct e1000_hw *hw)
139+
{
140+
s32 i = E1000_ICH_FWSM_PCIM2PCI_COUNT;
141+
142+
while ((er32(FWSM) & E1000_ICH_FWSM_PCIM2PCI) && --i)
143+
udelay(50);
144+
145+
return i;
146+
}
147+
148+
void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val)
149+
{
150+
if (hw->adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA)
151+
__ew32_prepare(hw);
152+
153+
writel(val, hw->hw_addr + reg);
154+
}
155+
126156
/**
127157
* e1000_regdump - register printout routine
128158
* @hw: pointer to the HW structure
@@ -3311,9 +3341,11 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev)
33113341
{
33123342
struct e1000_adapter *adapter = netdev_priv(netdev);
33133343
struct e1000_hw *hw = &adapter->hw;
3314-
unsigned int rar_entries = hw->mac.rar_entry_count;
3344+
unsigned int rar_entries;
33153345
int count = 0;
33163346

3347+
rar_entries = hw->mac.ops.rar_get_count(hw);
3348+
33173349
/* save a rar entry for our hardware address */
33183350
rar_entries--;
33193351

@@ -3332,9 +3364,13 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev)
33323364
* combining
33333365
*/
33343366
netdev_for_each_uc_addr(ha, netdev) {
3367+
int rval;
3368+
33353369
if (!rar_entries)
33363370
break;
3337-
hw->mac.ops.rar_set(hw, ha->addr, rar_entries--);
3371+
rval = hw->mac.ops.rar_set(hw, ha->addr, rar_entries--);
3372+
if (rval < 0)
3373+
return -ENOMEM;
33383374
count++;
33393375
}
33403376
}
@@ -4093,12 +4129,37 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
40934129
struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter,
40944130
cc);
40954131
struct e1000_hw *hw = &adapter->hw;
4096-
cycle_t systim;
4132+
cycle_t systim, systim_next;
40974133

40984134
/* latch SYSTIMH on read of SYSTIML */
40994135
systim = (cycle_t)er32(SYSTIML);
41004136
systim |= (cycle_t)er32(SYSTIMH) << 32;
41014137

4138+
if ((hw->mac.type == e1000_82574) || (hw->mac.type == e1000_82583)) {
4139+
u64 incvalue, time_delta, rem, temp;
4140+
int i;
4141+
4142+
/* errata for 82574/82583 possible bad bits read from SYSTIMH/L
4143+
* check to see that the time is incrementing at a reasonable
4144+
* rate and is a multiple of incvalue
4145+
*/
4146+
incvalue = er32(TIMINCA) & E1000_TIMINCA_INCVALUE_MASK;
4147+
for (i = 0; i < E1000_MAX_82574_SYSTIM_REREADS; i++) {
4148+
/* latch SYSTIMH on read of SYSTIML */
4149+
systim_next = (cycle_t)er32(SYSTIML);
4150+
systim_next |= (cycle_t)er32(SYSTIMH) << 32;
4151+
4152+
time_delta = systim_next - systim;
4153+
temp = time_delta;
4154+
rem = do_div(temp, incvalue);
4155+
4156+
systim = systim_next;
4157+
4158+
if ((time_delta < E1000_82574_SYSTIM_EPSILON) &&
4159+
(rem == 0))
4160+
break;
4161+
}
4162+
}
41024163
return systim;
41034164
}
41044165

@@ -4499,7 +4560,7 @@ static void e1000e_update_phy_task(struct work_struct *work)
44994560
e1000_get_phy_info(hw);
45004561

45014562
/* Enable EEE on 82579 after link up */
4502-
if (hw->phy.type == e1000_phy_82579)
4563+
if (hw->phy.type >= e1000_phy_82579)
45034564
e1000_set_eee_pchlan(hw);
45044565
}
45054566

drivers/net/ethernet/intel/i40evf/i40evf_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ static void i40evf_set_rx_mode(struct net_device *netdev)
845845
list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {
846846
bool found = false;
847847

848-
if (f->macaddr[0] & 0x01) {
848+
if (is_multicast_ether_addr(f->macaddr)) {
849849
netdev_for_each_mc_addr(mca, netdev) {
850850
if (ether_addr_equal(mca->addr, f->macaddr)) {
851851
found = true;

0 commit comments

Comments
 (0)