Commit 6623b419 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 3bea8edd dc5f2de6
...@@ -4877,10 +4877,10 @@ void e1000_tbi_adjust_stats(struct e1000_hw *hw, struct e1000_hw_stats *stats, ...@@ -4877,10 +4877,10 @@ void e1000_tbi_adjust_stats(struct e1000_hw *hw, struct e1000_hw_stats *stats,
* since the test for a multicast frame will test positive on * since the test for a multicast frame will test positive on
* a broadcast frame. * a broadcast frame.
*/ */
if ((mac_addr[0] == (u8) 0xff) && (mac_addr[1] == (u8) 0xff)) if (is_broadcast_ether_addr(mac_addr))
/* Broadcast packet */ /* Broadcast packet */
stats->bprc++; stats->bprc++;
else if (*mac_addr & 0x01) else if (is_multicast_ether_addr(mac_addr))
/* Multicast packet */ /* Multicast packet */
stats->mprc++; stats->mprc++;
......
...@@ -1365,6 +1365,7 @@ static const struct e1000_mac_operations es2_mac_ops = { ...@@ -1365,6 +1365,7 @@ static const struct e1000_mac_operations es2_mac_ops = {
.setup_led = e1000e_setup_led_generic, .setup_led = e1000e_setup_led_generic,
.config_collision_dist = e1000e_config_collision_dist_generic, .config_collision_dist = e1000e_config_collision_dist_generic,
.rar_set = e1000e_rar_set_generic, .rar_set = e1000e_rar_set_generic,
.rar_get_count = e1000e_rar_get_count_generic,
}; };
static const struct e1000_phy_operations es2_phy_ops = { static const struct e1000_phy_operations es2_phy_ops = {
......
...@@ -1896,6 +1896,7 @@ static const struct e1000_mac_operations e82571_mac_ops = { ...@@ -1896,6 +1896,7 @@ static const struct e1000_mac_operations e82571_mac_ops = {
.config_collision_dist = e1000e_config_collision_dist_generic, .config_collision_dist = e1000e_config_collision_dist_generic,
.read_mac_addr = e1000_read_mac_addr_82571, .read_mac_addr = e1000_read_mac_addr_82571,
.rar_set = e1000e_rar_set_generic, .rar_set = e1000e_rar_set_generic,
.rar_get_count = e1000e_rar_get_count_generic,
}; };
static const struct e1000_phy_operations e82_phy_ops_igp = { static const struct e1000_phy_operations e82_phy_ops_igp = {
......
...@@ -391,6 +391,8 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca); ...@@ -391,6 +391,8 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca);
* 25MHz 46-bit 2^46 / 10^9 / 3600 = 19.55 hours * 25MHz 46-bit 2^46 / 10^9 / 3600 = 19.55 hours
*/ */
#define E1000_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 60 * 4) #define E1000_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 60 * 4)
#define E1000_MAX_82574_SYSTIM_REREADS 50
#define E1000_82574_SYSTIM_EPSILON (1ULL << 35ULL)
/* hardware capability, feature, and workaround flags */ /* hardware capability, feature, and workaround flags */
#define FLAG_HAS_AMT (1 << 0) #define FLAG_HAS_AMT (1 << 0)
...@@ -573,35 +575,8 @@ static inline u32 __er32(struct e1000_hw *hw, unsigned long reg) ...@@ -573,35 +575,8 @@ static inline u32 __er32(struct e1000_hw *hw, unsigned long reg)
#define er32(reg) __er32(hw, E1000_##reg) #define er32(reg) __er32(hw, E1000_##reg)
/** s32 __ew32_prepare(struct e1000_hw *hw);
* __ew32_prepare - prepare to write to MAC CSR register on certain parts void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val);
* @hw: pointer to the HW structure
*
* When updating the MAC CSR registers, the Manageability Engine (ME) could
* be accessing the registers at the same time. Normally, this is handled in
* h/w by an arbiter but on some parts there is a bug that acknowledges Host
* accesses later than it should which could result in the register to have
* an incorrect value. Workaround this by checking the FWSM register which
* has bit 24 set while ME is accessing MAC CSR registers, wait if it is set
* and try again a number of times.
**/
static inline s32 __ew32_prepare(struct e1000_hw *hw)
{
s32 i = E1000_ICH_FWSM_PCIM2PCI_COUNT;
while ((er32(FWSM) & E1000_ICH_FWSM_PCIM2PCI) && --i)
udelay(50);
return i;
}
static inline void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val)
{
if (hw->adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA)
__ew32_prepare(hw);
writel(val, hw->hw_addr + reg);
}
#define ew32(reg, val) __ew32(hw, E1000_##reg, (val)) #define ew32(reg, val) __ew32(hw, E1000_##reg, (val))
......
...@@ -469,8 +469,9 @@ struct e1000_mac_operations { ...@@ -469,8 +469,9 @@ struct e1000_mac_operations {
s32 (*setup_led)(struct e1000_hw *); s32 (*setup_led)(struct e1000_hw *);
void (*write_vfta)(struct e1000_hw *, u32, u32); void (*write_vfta)(struct e1000_hw *, u32, u32);
void (*config_collision_dist)(struct e1000_hw *); void (*config_collision_dist)(struct e1000_hw *);
void (*rar_set)(struct e1000_hw *, u8 *, u32); int (*rar_set)(struct e1000_hw *, u8 *, u32);
s32 (*read_mac_addr)(struct e1000_hw *); s32 (*read_mac_addr)(struct e1000_hw *);
u32 (*rar_get_count)(struct e1000_hw *);
}; };
/* When to use various PHY register access functions: /* When to use various PHY register access functions:
......
...@@ -139,8 +139,9 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link); ...@@ -139,8 +139,9 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw); static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw);
static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw); static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw);
static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw); static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw);
static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index); static int e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index);
static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index); static int e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index);
static u32 e1000_rar_get_count_pch_lpt(struct e1000_hw *hw);
static s32 e1000_k1_workaround_lv(struct e1000_hw *hw); static s32 e1000_k1_workaround_lv(struct e1000_hw *hw);
static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate); static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate);
static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force); 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) ...@@ -704,6 +705,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw)
mac->ops.rar_set = e1000_rar_set_pch_lpt; mac->ops.rar_set = e1000_rar_set_pch_lpt;
mac->ops.setup_physical_interface = mac->ops.setup_physical_interface =
e1000_setup_copper_link_pch_lpt; e1000_setup_copper_link_pch_lpt;
mac->ops.rar_get_count = e1000_rar_get_count_pch_lpt;
} }
/* Enable PCS Lock-loss workaround for ICH8 */ /* Enable PCS Lock-loss workaround for ICH8 */
...@@ -1635,9 +1637,9 @@ static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw) ...@@ -1635,9 +1637,9 @@ static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw)
u32 fwsm; u32 fwsm;
fwsm = er32(FWSM); fwsm = er32(FWSM);
return ((fwsm & E1000_ICH_FWSM_FW_VALID) && return (fwsm & E1000_ICH_FWSM_FW_VALID) &&
((fwsm & E1000_FWSM_MODE_MASK) == ((fwsm & E1000_FWSM_MODE_MASK) ==
(E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT))); (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT));
} }
/** /**
...@@ -1668,7 +1670,7 @@ static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw) ...@@ -1668,7 +1670,7 @@ static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw)
* contain the MAC address but RAR[1-6] are reserved for manageability (ME). * contain the MAC address but RAR[1-6] are reserved for manageability (ME).
* Use SHRA[0-3] in place of those reserved for ME. * Use SHRA[0-3] in place of those reserved for ME.
**/ **/
static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index) static int e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
{ {
u32 rar_low, rar_high; u32 rar_low, rar_high;
...@@ -1690,7 +1692,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index) ...@@ -1690,7 +1692,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
e1e_flush(); e1e_flush();
ew32(RAH(index), rar_high); ew32(RAH(index), rar_high);
e1e_flush(); e1e_flush();
return; return 0;
} }
/* RAR[1-6] are owned by manageability. Skip those and program the /* RAR[1-6] are owned by manageability. Skip those and program the
...@@ -1713,7 +1715,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index) ...@@ -1713,7 +1715,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
/* verify the register updates */ /* verify the register updates */
if ((er32(SHRAL(index - 1)) == rar_low) && if ((er32(SHRAL(index - 1)) == rar_low) &&
(er32(SHRAH(index - 1)) == rar_high)) (er32(SHRAH(index - 1)) == rar_high))
return; return 0;
e_dbg("SHRA[%d] might be locked by ME - FWSM=0x%8.8x\n", e_dbg("SHRA[%d] might be locked by ME - FWSM=0x%8.8x\n",
(index - 1), er32(FWSM)); (index - 1), er32(FWSM));
...@@ -1721,6 +1723,43 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index) ...@@ -1721,6 +1723,43 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
out: out:
e_dbg("Failed to write receive address at index %d\n", index); e_dbg("Failed to write receive address at index %d\n", index);
return -E1000_ERR_CONFIG;
}
/**
* e1000_rar_get_count_pch_lpt - Get the number of available SHRA
* @hw: pointer to the HW structure
*
* Get the number of available receive registers that the Host can
* program. SHRA[0-10] are the shared receive address registers
* that are shared between the Host and manageability engine (ME).
* ME can reserve any number of addresses and the host needs to be
* able to tell how many available registers it has access to.
**/
static u32 e1000_rar_get_count_pch_lpt(struct e1000_hw *hw)
{
u32 wlock_mac;
u32 num_entries;
wlock_mac = er32(FWSM) & E1000_FWSM_WLOCK_MAC_MASK;
wlock_mac >>= E1000_FWSM_WLOCK_MAC_SHIFT;
switch (wlock_mac) {
case 0:
/* All SHRA[0..10] and RAR[0] available */
num_entries = hw->mac.rar_entry_count;
break;
case 1:
/* Only RAR[0] available */
num_entries = 1;
break;
default:
/* SHRA[0..(wlock_mac - 1)] available + RAR[0] */
num_entries = wlock_mac + 1;
break;
}
return num_entries;
} }
/** /**
...@@ -1734,7 +1773,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index) ...@@ -1734,7 +1773,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
* contain the MAC address. SHRA[0-10] are the shared receive address * contain the MAC address. SHRA[0-10] are the shared receive address
* registers that are shared between the Host and manageability engine (ME). * registers that are shared between the Host and manageability engine (ME).
**/ **/
static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index) static int e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index)
{ {
u32 rar_low, rar_high; u32 rar_low, rar_high;
u32 wlock_mac; u32 wlock_mac;
...@@ -1756,7 +1795,7 @@ static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index) ...@@ -1756,7 +1795,7 @@ static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index)
e1e_flush(); e1e_flush();
ew32(RAH(index), rar_high); ew32(RAH(index), rar_high);
e1e_flush(); e1e_flush();
return; return 0;
} }
/* The manageability engine (ME) can lock certain SHRAR registers that /* 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) ...@@ -1788,12 +1827,13 @@ static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index)
/* verify the register updates */ /* verify the register updates */
if ((er32(SHRAL_PCH_LPT(index - 1)) == rar_low) && if ((er32(SHRAL_PCH_LPT(index - 1)) == rar_low) &&
(er32(SHRAH_PCH_LPT(index - 1)) == rar_high)) (er32(SHRAH_PCH_LPT(index - 1)) == rar_high))
return; return 0;
} }
} }
out: out:
e_dbg("Failed to write receive address at index %d\n", index); e_dbg("Failed to write receive address at index %d\n", index);
return -E1000_ERR_CONFIG;
} }
/** /**
...@@ -4977,6 +5017,7 @@ static const struct e1000_mac_operations ich8_mac_ops = { ...@@ -4977,6 +5017,7 @@ static const struct e1000_mac_operations ich8_mac_ops = {
/* id_led_init dependent on mac type */ /* id_led_init dependent on mac type */
.config_collision_dist = e1000e_config_collision_dist_generic, .config_collision_dist = e1000e_config_collision_dist_generic,
.rar_set = e1000e_rar_set_generic, .rar_set = e1000e_rar_set_generic,
.rar_get_count = e1000e_rar_get_count_generic,
}; };
static const struct e1000_phy_operations ich8_phy_ops = { static const struct e1000_phy_operations ich8_phy_ops = {
......
...@@ -211,6 +211,11 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) ...@@ -211,6 +211,11 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
return 0; return 0;
} }
u32 e1000e_rar_get_count_generic(struct e1000_hw *hw)
{
return hw->mac.rar_entry_count;
}
/** /**
* e1000e_rar_set_generic - Set receive address register * e1000e_rar_set_generic - Set receive address register
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
...@@ -220,7 +225,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) ...@@ -220,7 +225,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
* Sets the receive address array register at index to the address passed * Sets the receive address array register at index to the address passed
* in by addr. * in by addr.
**/ **/
void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) int e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
{ {
u32 rar_low, rar_high; u32 rar_low, rar_high;
...@@ -244,6 +249,8 @@ void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) ...@@ -244,6 +249,8 @@ void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
e1e_flush(); e1e_flush();
ew32(RAH(index), rar_high); ew32(RAH(index), rar_high);
e1e_flush(); e1e_flush();
return 0;
} }
/** /**
......
...@@ -61,7 +61,8 @@ void e1000e_update_adaptive(struct e1000_hw *hw); ...@@ -61,7 +61,8 @@ void e1000e_update_adaptive(struct e1000_hw *hw);
void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value); void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value);
void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw);
void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); u32 e1000e_rar_get_count_generic(struct e1000_hw *hw);
int e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index);
void e1000e_config_collision_dist_generic(struct e1000_hw *hw); void e1000e_config_collision_dist_generic(struct e1000_hw *hw);
#endif #endif
...@@ -123,6 +123,36 @@ static const struct e1000_reg_info e1000_reg_info_tbl[] = { ...@@ -123,6 +123,36 @@ static const struct e1000_reg_info e1000_reg_info_tbl[] = {
{0, NULL} {0, NULL}
}; };
/**
* __ew32_prepare - prepare to write to MAC CSR register on certain parts
* @hw: pointer to the HW structure
*
* When updating the MAC CSR registers, the Manageability Engine (ME) could
* be accessing the registers at the same time. Normally, this is handled in
* h/w by an arbiter but on some parts there is a bug that acknowledges Host
* accesses later than it should which could result in the register to have
* an incorrect value. Workaround this by checking the FWSM register which
* has bit 24 set while ME is accessing MAC CSR registers, wait if it is set
* and try again a number of times.
**/
s32 __ew32_prepare(struct e1000_hw *hw)
{
s32 i = E1000_ICH_FWSM_PCIM2PCI_COUNT;
while ((er32(FWSM) & E1000_ICH_FWSM_PCIM2PCI) && --i)
udelay(50);
return i;
}
void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val)
{
if (hw->adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA)
__ew32_prepare(hw);
writel(val, hw->hw_addr + reg);
}
/** /**
* e1000_regdump - register printout routine * e1000_regdump - register printout routine
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
...@@ -3311,9 +3341,11 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev) ...@@ -3311,9 +3341,11 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev)
{ {
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
unsigned int rar_entries = hw->mac.rar_entry_count; unsigned int rar_entries;
int count = 0; int count = 0;
rar_entries = hw->mac.ops.rar_get_count(hw);
/* save a rar entry for our hardware address */ /* save a rar entry for our hardware address */
rar_entries--; rar_entries--;
...@@ -3332,9 +3364,13 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev) ...@@ -3332,9 +3364,13 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev)
* combining * combining
*/ */
netdev_for_each_uc_addr(ha, netdev) { netdev_for_each_uc_addr(ha, netdev) {
int rval;
if (!rar_entries) if (!rar_entries)
break; break;
hw->mac.ops.rar_set(hw, ha->addr, rar_entries--); rval = hw->mac.ops.rar_set(hw, ha->addr, rar_entries--);
if (rval < 0)
return -ENOMEM;
count++; count++;
} }
} }
...@@ -4093,12 +4129,37 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc) ...@@ -4093,12 +4129,37 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter, struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter,
cc); cc);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
cycle_t systim; cycle_t systim, systim_next;
/* latch SYSTIMH on read of SYSTIML */ /* latch SYSTIMH on read of SYSTIML */
systim = (cycle_t)er32(SYSTIML); systim = (cycle_t)er32(SYSTIML);
systim |= (cycle_t)er32(SYSTIMH) << 32; systim |= (cycle_t)er32(SYSTIMH) << 32;
if ((hw->mac.type == e1000_82574) || (hw->mac.type == e1000_82583)) {
u64 incvalue, time_delta, rem, temp;
int i;
/* errata for 82574/82583 possible bad bits read from SYSTIMH/L
* check to see that the time is incrementing at a reasonable
* rate and is a multiple of incvalue
*/
incvalue = er32(TIMINCA) & E1000_TIMINCA_INCVALUE_MASK;
for (i = 0; i < E1000_MAX_82574_SYSTIM_REREADS; i++) {
/* latch SYSTIMH on read of SYSTIML */
systim_next = (cycle_t)er32(SYSTIML);
systim_next |= (cycle_t)er32(SYSTIMH) << 32;
time_delta = systim_next - systim;
temp = time_delta;
rem = do_div(temp, incvalue);
systim = systim_next;
if ((time_delta < E1000_82574_SYSTIM_EPSILON) &&
(rem == 0))
break;
}
}
return systim; return systim;
} }
...@@ -4499,7 +4560,7 @@ static void e1000e_update_phy_task(struct work_struct *work) ...@@ -4499,7 +4560,7 @@ static void e1000e_update_phy_task(struct work_struct *work)
e1000_get_phy_info(hw); e1000_get_phy_info(hw);
/* Enable EEE on 82579 after link up */ /* Enable EEE on 82579 after link up */
if (hw->phy.type == e1000_phy_82579) if (hw->phy.type >= e1000_phy_82579)
e1000_set_eee_pchlan(hw); e1000_set_eee_pchlan(hw);
} }
......
...@@ -845,7 +845,7 @@ static void i40evf_set_rx_mode(struct net_device *netdev) ...@@ -845,7 +845,7 @@ static void i40evf_set_rx_mode(struct net_device *netdev)
list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {
bool found = false; bool found = false;
if (f->macaddr[0] & 0x01) { if (is_multicast_ether_addr(f->macaddr)) {
netdev_for_each_mc_addr(mca, netdev) { netdev_for_each_mc_addr(mca, netdev) {
if (ether_addr_equal(mca->addr, f->macaddr)) { if (ether_addr_equal(mca->addr, f->macaddr)) {
found = true; found = true;
......
...@@ -2204,16 +2204,10 @@ s32 igb_phy_init_script_igp3(struct e1000_hw *hw) ...@@ -2204,16 +2204,10 @@ s32 igb_phy_init_script_igp3(struct e1000_hw *hw)
void igb_power_up_phy_copper(struct e1000_hw *hw) void igb_power_up_phy_copper(struct e1000_hw *hw)
{ {
u16 mii_reg = 0; u16 mii_reg = 0;
u16 power_reg = 0;
/* The PHY will retain its settings across a power down/up cycle */ /* The PHY will retain its settings across a power down/up cycle */
hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg); hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg);
mii_reg &= ~MII_CR_POWER_DOWN; mii_reg &= ~MII_CR_POWER_DOWN;
if (hw->phy.type == e1000_phy_i210) {
hw->phy.ops.read_reg(hw, GS40G_COPPER_SPEC, &power_reg);
power_reg &= ~GS40G_CS_POWER_DOWN;
hw->phy.ops.write_reg(hw, GS40G_COPPER_SPEC, power_reg);
}
hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg); hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg);
} }
...@@ -2227,18 +2221,10 @@ void igb_power_up_phy_copper(struct e1000_hw *hw) ...@@ -2227,18 +2221,10 @@ void igb_power_up_phy_copper(struct e1000_hw *hw)
void igb_power_down_phy_copper(struct e1000_hw *hw) void igb_power_down_phy_copper(struct e1000_hw *hw)
{ {
u16 mii_reg = 0; u16 mii_reg = 0;
u16 power_reg = 0;
/* The PHY will retain its settings across a power down/up cycle */ /* The PHY will retain its settings across a power down/up cycle */
hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg); hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg);
mii_reg |= MII_CR_POWER_DOWN; mii_reg |= MII_CR_POWER_DOWN;
/* i210 Phy requires an additional bit for power up/down */
if (hw->phy.type == e1000_phy_i210) {
hw->phy.ops.read_reg(hw, GS40G_COPPER_SPEC, &power_reg);
power_reg |= GS40G_CS_POWER_DOWN;
hw->phy.ops.write_reg(hw, GS40G_COPPER_SPEC, power_reg);
}
hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg); hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg);
usleep_range(1000, 2000); usleep_range(1000, 2000);
} }
......
...@@ -151,7 +151,6 @@ s32 igb_check_polarity_m88(struct e1000_hw *hw); ...@@ -151,7 +151,6 @@ s32 igb_check_polarity_m88(struct e1000_hw *hw);
#define GS40G_MAC_LB 0x4140 #define GS40G_MAC_LB 0x4140
#define GS40G_MAC_SPEED_1G 0X0006 #define GS40G_MAC_SPEED_1G 0X0006
#define GS40G_COPPER_SPEC 0x0010 #define GS40G_COPPER_SPEC 0x0010
#define GS40G_CS_POWER_DOWN 0x0002
#define GS40G_LINE_LB 0x4000 #define GS40G_LINE_LB 0x4000
/* SFP modules ID memory locations */ /* SFP modules ID memory locations */
......
...@@ -957,6 +957,7 @@ static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring) ...@@ -957,6 +957,7 @@ static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring)
} }
void ixgbe_ptp_init(struct ixgbe_adapter *adapter); void ixgbe_ptp_init(struct ixgbe_adapter *adapter);
void ixgbe_ptp_suspend(struct ixgbe_adapter *adapter);
void ixgbe_ptp_stop(struct ixgbe_adapter *adapter); void ixgbe_ptp_stop(struct ixgbe_adapter *adapter);
void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter);
void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter); void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter);
......
...@@ -5659,6 +5659,17 @@ static int ixgbe_open(struct net_device *netdev) ...@@ -5659,6 +5659,17 @@ static int ixgbe_open(struct net_device *netdev)
return err; return err;
} }
static void ixgbe_close_suspend(struct ixgbe_adapter *adapter)
{
ixgbe_ptp_suspend(adapter);
ixgbe_down(adapter);
ixgbe_free_irq(adapter);
ixgbe_free_all_tx_resources(adapter);
ixgbe_free_all_rx_resources(adapter);
}
/** /**
* ixgbe_close - Disables a network interface * ixgbe_close - Disables a network interface
* @netdev: network interface device structure * @netdev: network interface device structure
...@@ -5676,14 +5687,10 @@ static int ixgbe_close(struct net_device *netdev) ...@@ -5676,14 +5687,10 @@ static int ixgbe_close(struct net_device *netdev)
ixgbe_ptp_stop(adapter); ixgbe_ptp_stop(adapter);
ixgbe_down(adapter); ixgbe_close_suspend(adapter);
ixgbe_free_irq(adapter);
ixgbe_fdir_filter_exit(adapter); ixgbe_fdir_filter_exit(adapter);
ixgbe_free_all_tx_resources(adapter);
ixgbe_free_all_rx_resources(adapter);
ixgbe_release_hw_control(adapter); ixgbe_release_hw_control(adapter);
return 0; return 0;
...@@ -5750,12 +5757,8 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) ...@@ -5750,12 +5757,8 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
netif_device_detach(netdev); netif_device_detach(netdev);
rtnl_lock(); rtnl_lock();
if (netif_running(netdev)) { if (netif_running(netdev))
ixgbe_down(adapter); ixgbe_close_suspend(adapter);
ixgbe_free_irq(adapter);
ixgbe_free_all_tx_resources(adapter);
ixgbe_free_all_rx_resources(adapter);
}
rtnl_unlock(); rtnl_unlock();
ixgbe_clear_interrupt_scheme(adapter); ixgbe_clear_interrupt_scheme(adapter);
...@@ -8449,8 +8452,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -8449,8 +8452,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ixgbe_dbg_adapter_init(adapter); ixgbe_dbg_adapter_init(adapter);
/* Need link setup for MNG FW, else wait for IXGBE_UP */ /* setup link for SFP devices with MNG FW, else wait for IXGBE_UP */
if (ixgbe_mng_enabled(hw) && hw->mac.ops.setup_link) if (ixgbe_mng_enabled(hw) && ixgbe_is_sfp(hw) && hw->mac.ops.setup_link)
hw->mac.ops.setup_link(hw, hw->mac.ops.setup_link(hw,
IXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL, IXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL,
true); true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment