Commit c2962897 authored by David S. Miller's avatar David S. Miller

Merge branch 'intel'

Jeff Kirsher says:

====================
This series contains updates to ixgbe and igb.

The ixgbe changes contains 2 patches from the community, one which is a
fix from akepner to fix a issue where netif_running() in shutdown was
not done under rtnl_lock.  The other community fix from Joe Perches
cleans up #ifdef CONFIG_DEBUG_FS which is no longer necessary.  The
last ixgbe patch, from Jacob Keller, adds support for WoL on 82559
SFP+ LOM.

The remaining patches are against igb, 10 of which were previously
submitted in a pull request where changes were requested.

The following igb patches:
 igb: Support for 100base-fx SFP
 igb: Support to read and export SFF-8472/8079 data
are v2 based on feedback from Dan Carpenter and Ben Hutchings in
the previous pull request.

The largest set of changes are in my patch to cleanup code comments
and whitespace to align the igb driver with the networking style of
code comments.  While cleaning up the code comments, fixed several
other whitespace/checkpatch.pl code formatting issues.

Other notable igb patches are EEE capable devices query the PHY to
determine what the link partner is advertising, added support for
i354 devices and added support for spoofchk config.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c1cb0d3b ceb5f13b
...@@ -100,6 +100,7 @@ static bool igb_sgmii_uses_mdio_82575(struct e1000_hw *hw) ...@@ -100,6 +100,7 @@ static bool igb_sgmii_uses_mdio_82575(struct e1000_hw *hw)
break; break;
case e1000_82580: case e1000_82580:
case e1000_i350: case e1000_i350:
case e1000_i354:
case e1000_i210: case e1000_i210:
case e1000_i211: case e1000_i211:
reg = rd32(E1000_MDICNFG); reg = rd32(E1000_MDICNFG);
...@@ -149,6 +150,7 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw) ...@@ -149,6 +150,7 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
switch (hw->mac.type) { switch (hw->mac.type) {
case e1000_82580: case e1000_82580:
case e1000_i350: case e1000_i350:
case e1000_i354:
phy->ops.read_reg = igb_read_phy_reg_82580; phy->ops.read_reg = igb_read_phy_reg_82580;
phy->ops.write_reg = igb_write_phy_reg_82580; phy->ops.write_reg = igb_write_phy_reg_82580;
break; break;
...@@ -174,13 +176,14 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw) ...@@ -174,13 +176,14 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
/* Verify phy id and set remaining function pointers */ /* Verify phy id and set remaining function pointers */
switch (phy->id) { switch (phy->id) {
case M88E1545_E_PHY_ID:
case I347AT4_E_PHY_ID: case I347AT4_E_PHY_ID:
case M88E1112_E_PHY_ID: case M88E1112_E_PHY_ID:
case M88E1111_I_PHY_ID: case M88E1111_I_PHY_ID:
phy->type = e1000_phy_m88; phy->type = e1000_phy_m88;
phy->ops.check_polarity = igb_check_polarity_m88;
phy->ops.get_phy_info = igb_get_phy_info_m88; phy->ops.get_phy_info = igb_get_phy_info_m88;
if (phy->id == I347AT4_E_PHY_ID || if (phy->id != M88E1111_I_PHY_ID)
phy->id == M88E1112_E_PHY_ID)
phy->ops.get_cable_length = phy->ops.get_cable_length =
igb_get_cable_length_m88_gen2; igb_get_cable_length_m88_gen2;
else else
...@@ -227,7 +230,7 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw) ...@@ -227,7 +230,7 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
* igb_init_nvm_params_82575 - Init NVM func ptrs. * igb_init_nvm_params_82575 - Init NVM func ptrs.
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
**/ **/
s32 igb_init_nvm_params_82575(struct e1000_hw *hw) static s32 igb_init_nvm_params_82575(struct e1000_hw *hw)
{ {
struct e1000_nvm_info *nvm = &hw->nvm; struct e1000_nvm_info *nvm = &hw->nvm;
u32 eecd = rd32(E1000_EECD); u32 eecd = rd32(E1000_EECD);
...@@ -287,6 +290,7 @@ s32 igb_init_nvm_params_82575(struct e1000_hw *hw) ...@@ -287,6 +290,7 @@ s32 igb_init_nvm_params_82575(struct e1000_hw *hw)
nvm->ops.read = igb_read_nvm_spi; nvm->ops.read = igb_read_nvm_spi;
nvm->ops.write = igb_write_nvm_spi; nvm->ops.write = igb_write_nvm_spi;
break; break;
case e1000_i354:
case e1000_i350: case e1000_i350:
nvm->ops.validate = igb_validate_nvm_checksum_i350; nvm->ops.validate = igb_validate_nvm_checksum_i350;
nvm->ops.update = igb_update_nvm_checksum_i350; nvm->ops.update = igb_update_nvm_checksum_i350;
...@@ -352,6 +356,7 @@ static s32 igb_init_mac_params_82575(struct e1000_hw *hw) ...@@ -352,6 +356,7 @@ static s32 igb_init_mac_params_82575(struct e1000_hw *hw)
mac->rar_entry_count = E1000_RAR_ENTRIES_82580; mac->rar_entry_count = E1000_RAR_ENTRIES_82580;
break; break;
case e1000_i350: case e1000_i350:
case e1000_i354:
mac->rar_entry_count = E1000_RAR_ENTRIES_I350; mac->rar_entry_count = E1000_RAR_ENTRIES_I350;
break; break;
default: default:
...@@ -445,14 +450,18 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) ...@@ -445,14 +450,18 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
case E1000_DEV_ID_I211_COPPER: case E1000_DEV_ID_I211_COPPER:
mac->type = e1000_i211; mac->type = e1000_i211;
break; break;
case E1000_DEV_ID_I354_BACKPLANE_1GBPS:
case E1000_DEV_ID_I354_SGMII:
case E1000_DEV_ID_I354_BACKPLANE_2_5GBPS:
mac->type = e1000_i354;
break;
default: default:
return -E1000_ERR_MAC_INIT; return -E1000_ERR_MAC_INIT;
break; break;
} }
/* Set media type */ /* Set media type */
/* /* The 82575 uses bits 22:23 for link mode. The mode can be changed
* The 82575 uses bits 22:23 for link mode. The mode can be changed
* based on the EEPROM. We cannot rely upon device ID. There * based on the EEPROM. We cannot rely upon device ID. There
* is no distinguishable difference between fiber and internal * is no distinguishable difference between fiber and internal
* SerDes mode on the 82575. There can be an external PHY attached * SerDes mode on the 82575. There can be an external PHY attached
...@@ -621,8 +630,7 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw) ...@@ -621,8 +630,7 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
u32 ctrl_ext; u32 ctrl_ext;
u32 mdic; u32 mdic;
/* /* For SGMII PHYs, we try the list of possible addresses until
* For SGMII PHYs, we try the list of possible addresses until
* we find one that works. For non-SGMII PHYs * we find one that works. For non-SGMII PHYs
* (e.g. integrated copper PHYs), an address of 1 should * (e.g. integrated copper PHYs), an address of 1 should
* work. The result of this function should mean phy->phy_addr * work. The result of this function should mean phy->phy_addr
...@@ -644,6 +652,7 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw) ...@@ -644,6 +652,7 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
break; break;
case e1000_82580: case e1000_82580:
case e1000_i350: case e1000_i350:
case e1000_i354:
case e1000_i210: case e1000_i210:
case e1000_i211: case e1000_i211:
mdic = rd32(E1000_MDICNFG); mdic = rd32(E1000_MDICNFG);
...@@ -665,8 +674,7 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw) ...@@ -665,8 +674,7 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
wrfl(); wrfl();
msleep(300); msleep(300);
/* /* The address field in the I2CCMD register is 3 bits and 0 is invalid.
* The address field in the I2CCMD register is 3 bits and 0 is invalid.
* Therefore, we need to test 1-7 * Therefore, we need to test 1-7
*/ */
for (phy->addr = 1; phy->addr < 8; phy->addr++) { for (phy->addr = 1; phy->addr < 8; phy->addr++) {
...@@ -674,8 +682,7 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw) ...@@ -674,8 +682,7 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
if (ret_val == 0) { if (ret_val == 0) {
hw_dbg("Vendor ID 0x%08X read at address %u\n", hw_dbg("Vendor ID 0x%08X read at address %u\n",
phy_id, phy->addr); phy_id, phy->addr);
/* /* At the time of this writing, The M88 part is
* At the time of this writing, The M88 part is
* the only supported SGMII PHY product. * the only supported SGMII PHY product.
*/ */
if (phy_id == M88_VENDOR) if (phy_id == M88_VENDOR)
...@@ -711,15 +718,13 @@ static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *hw) ...@@ -711,15 +718,13 @@ static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *hw)
{ {
s32 ret_val; s32 ret_val;
/* /* This isn't a true "hard" reset, but is the only reset
* This isn't a true "hard" reset, but is the only reset
* available to us at this time. * available to us at this time.
*/ */
hw_dbg("Soft resetting SGMII attached PHY...\n"); hw_dbg("Soft resetting SGMII attached PHY...\n");
/* /* SFP documentation requires the following to configure the SPF module
* SFP documentation requires the following to configure the SPF module
* to work on SGMII. No further documentation is given. * to work on SGMII. No further documentation is given.
*/ */
ret_val = hw->phy.ops.write_reg(hw, 0x1B, 0x8084); ret_val = hw->phy.ops.write_reg(hw, 0x1B, 0x8084);
...@@ -774,8 +779,7 @@ static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active) ...@@ -774,8 +779,7 @@ static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active)
data &= ~IGP02E1000_PM_D0_LPLU; data &= ~IGP02E1000_PM_D0_LPLU;
ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT,
data); data);
/* /* LPLU and SmartSpeed are mutually exclusive. LPLU is used
* LPLU and SmartSpeed are mutually exclusive. LPLU is used
* during Dx states where the power conservation is most * during Dx states where the power conservation is most
* important. During driver activity we should enable * important. During driver activity we should enable
* SmartSpeed, so performance is maintained. * SmartSpeed, so performance is maintained.
...@@ -838,8 +842,7 @@ static s32 igb_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active) ...@@ -838,8 +842,7 @@ static s32 igb_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active)
} else { } else {
data &= ~E1000_82580_PM_D0_LPLU; data &= ~E1000_82580_PM_D0_LPLU;
/* /* LPLU and SmartSpeed are mutually exclusive. LPLU is used
* LPLU and SmartSpeed are mutually exclusive. LPLU is used
* during Dx states where the power conservation is most * during Dx states where the power conservation is most
* important. During driver activity we should enable * important. During driver activity we should enable
* SmartSpeed, so performance is maintained. * SmartSpeed, so performance is maintained.
...@@ -867,7 +870,7 @@ static s32 igb_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active) ...@@ -867,7 +870,7 @@ static s32 igb_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active)
* During driver activity, SmartSpeed should be enabled so performance is * During driver activity, SmartSpeed should be enabled so performance is
* maintained. * maintained.
**/ **/
s32 igb_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active) static s32 igb_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active)
{ {
struct e1000_phy_info *phy = &hw->phy; struct e1000_phy_info *phy = &hw->phy;
s32 ret_val = 0; s32 ret_val = 0;
...@@ -877,8 +880,7 @@ s32 igb_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active) ...@@ -877,8 +880,7 @@ s32 igb_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active)
if (!active) { if (!active) {
data &= ~E1000_82580_PM_D3_LPLU; data &= ~E1000_82580_PM_D3_LPLU;
/* /* LPLU and SmartSpeed are mutually exclusive. LPLU is used
* LPLU and SmartSpeed are mutually exclusive. LPLU is used
* during Dx states where the power conservation is most * during Dx states where the power conservation is most
* important. During driver activity we should enable * important. During driver activity we should enable
* SmartSpeed, so performance is maintained. * SmartSpeed, so performance is maintained.
...@@ -964,8 +966,7 @@ static s32 igb_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask) ...@@ -964,8 +966,7 @@ static s32 igb_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask)
if (!(swfw_sync & (fwmask | swmask))) if (!(swfw_sync & (fwmask | swmask)))
break; break;
/* /* Firmware currently using resource (fwmask)
* Firmware currently using resource (fwmask)
* or other software thread using resource (swmask) * or other software thread using resource (swmask)
*/ */
igb_put_hw_semaphore(hw); igb_put_hw_semaphore(hw);
...@@ -1065,8 +1066,7 @@ static s32 igb_check_for_link_82575(struct e1000_hw *hw) ...@@ -1065,8 +1066,7 @@ static s32 igb_check_for_link_82575(struct e1000_hw *hw)
if (hw->phy.media_type != e1000_media_type_copper) { if (hw->phy.media_type != e1000_media_type_copper) {
ret_val = igb_get_pcs_speed_and_duplex_82575(hw, &speed, ret_val = igb_get_pcs_speed_and_duplex_82575(hw, &speed,
&duplex); &duplex);
/* /* Use this flag to determine if link needs to be checked or
* Use this flag to determine if link needs to be checked or
* not. If we have link clear the flag so that we do not * not. If we have link clear the flag so that we do not
* continue to check for link. * continue to check for link.
*/ */
...@@ -1135,15 +1135,13 @@ static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, ...@@ -1135,15 +1135,13 @@ static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed,
*speed = 0; *speed = 0;
*duplex = 0; *duplex = 0;
/* /* Read the PCS Status register for link state. For non-copper mode,
* Read the PCS Status register for link state. For non-copper mode,
* the status register is not accurate. The PCS status register is * the status register is not accurate. The PCS status register is
* used instead. * used instead.
*/ */
pcs = rd32(E1000_PCS_LSTAT); pcs = rd32(E1000_PCS_LSTAT);
/* /* The link up bit determines when link is up on autoneg. The sync ok
* The link up bit determines when link is up on autoneg. The sync ok
* gets set once both sides sync up and agree upon link. Stable link * gets set once both sides sync up and agree upon link. Stable link
* can be determined by checking for both link up and link sync ok * can be determined by checking for both link up and link sync ok
*/ */
...@@ -1214,8 +1212,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw) ...@@ -1214,8 +1212,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)
u32 ctrl, icr; u32 ctrl, icr;
s32 ret_val; s32 ret_val;
/* /* Prevent the PCI-E bus from sticking if there is no TLP connection
* Prevent the PCI-E bus from sticking if there is no TLP connection
* on the last TLP read/write transaction when MAC is reset. * on the last TLP read/write transaction when MAC is reset.
*/ */
ret_val = igb_disable_pcie_master(hw); ret_val = igb_disable_pcie_master(hw);
...@@ -1244,8 +1241,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw) ...@@ -1244,8 +1241,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)
ret_val = igb_get_auto_rd_done(hw); ret_val = igb_get_auto_rd_done(hw);
if (ret_val) { if (ret_val) {
/* /* When auto config read does not complete, do not
* When auto config read does not complete, do not
* return with an error. This can happen in situations * return with an error. This can happen in situations
* where there is no eeprom and prevents getting link. * where there is no eeprom and prevents getting link.
*/ */
...@@ -1287,7 +1283,7 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw) ...@@ -1287,7 +1283,7 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)
/* Disabling VLAN filtering */ /* Disabling VLAN filtering */
hw_dbg("Initializing the IEEE VLAN\n"); hw_dbg("Initializing the IEEE VLAN\n");
if (hw->mac.type == e1000_i350) if ((hw->mac.type == e1000_i350) || (hw->mac.type == e1000_i354))
igb_clear_vfta_i350(hw); igb_clear_vfta_i350(hw);
else else
igb_clear_vfta(hw); igb_clear_vfta(hw);
...@@ -1308,8 +1304,7 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw) ...@@ -1308,8 +1304,7 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)
/* Setup link and flow control */ /* Setup link and flow control */
ret_val = igb_setup_link(hw); ret_val = igb_setup_link(hw);
/* /* Clear all of the statistics registers (clear on read). It is
* Clear all of the statistics registers (clear on read). It is
* important that we do this after we have tried to establish link * important that we do this after we have tried to establish link
* because the symbol error count will increment wildly if there * because the symbol error count will increment wildly if there
* is no link. * is no link.
...@@ -1364,6 +1359,7 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw) ...@@ -1364,6 +1359,7 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw)
switch (hw->phy.id) { switch (hw->phy.id) {
case I347AT4_E_PHY_ID: case I347AT4_E_PHY_ID:
case M88E1112_E_PHY_ID: case M88E1112_E_PHY_ID:
case M88E1545_E_PHY_ID:
case I210_I_PHY_ID: case I210_I_PHY_ID:
ret_val = igb_copper_link_setup_m88_gen2(hw); ret_val = igb_copper_link_setup_m88_gen2(hw);
break; break;
...@@ -1412,17 +1408,17 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw) ...@@ -1412,17 +1408,17 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw)
return ret_val; return ret_val;
/* /* On the 82575, SerDes loopback mode persists until it is
* On the 82575, SerDes loopback mode persists until it is
* explicitly turned off or a power cycle is performed. A read to * explicitly turned off or a power cycle is performed. A read to
* the register does not indicate its status. Therefore, we ensure * the register does not indicate its status. Therefore, we ensure
* loopback mode is disabled during initialization. * loopback mode is disabled during initialization.
*/ */
wr32(E1000_SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK); wr32(E1000_SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK);
/* power on the sfp cage if present */ /* power on the sfp cage if present and turn on I2C */
ctrl_ext = rd32(E1000_CTRL_EXT); ctrl_ext = rd32(E1000_CTRL_EXT);
ctrl_ext &= ~E1000_CTRL_EXT_SDP3_DATA; ctrl_ext &= ~E1000_CTRL_EXT_SDP3_DATA;
ctrl_ext |= E1000_CTRL_I2C_ENA;
wr32(E1000_CTRL_EXT, ctrl_ext); wr32(E1000_CTRL_EXT, ctrl_ext);
ctrl_reg = rd32(E1000_CTRL); ctrl_reg = rd32(E1000_CTRL);
...@@ -1466,8 +1462,7 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw) ...@@ -1466,8 +1462,7 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw)
pcs_autoneg = false; pcs_autoneg = false;
} }
/* /* non-SGMII modes only supports a speed of 1000/Full for the
* non-SGMII modes only supports a speed of 1000/Full for the
* link so it is best to just force the MAC and let the pcs * link so it is best to just force the MAC and let the pcs
* link either autoneg or be forced to 1000/Full * link either autoneg or be forced to 1000/Full
*/ */
...@@ -1481,8 +1476,7 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw) ...@@ -1481,8 +1476,7 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw)
wr32(E1000_CTRL, ctrl_reg); wr32(E1000_CTRL, ctrl_reg);
/* /* New SerDes mode allows for forcing speed or autonegotiating speed
* New SerDes mode allows for forcing speed or autonegotiating speed
* at 1gb. Autoneg should be default set by most drivers. This is the * at 1gb. Autoneg should be default set by most drivers. This is the
* mode that will be compatible with older link partners and switches. * mode that will be compatible with older link partners and switches.
* However, both are supported by the hardware and some drivers/tools. * However, both are supported by the hardware and some drivers/tools.
...@@ -1592,8 +1586,7 @@ static s32 igb_read_mac_addr_82575(struct e1000_hw *hw) ...@@ -1592,8 +1586,7 @@ static s32 igb_read_mac_addr_82575(struct e1000_hw *hw)
{ {
s32 ret_val = 0; s32 ret_val = 0;
/* /* If there's an alternate MAC address place it in RAR0
* If there's an alternate MAC address place it in RAR0
* so that it will override the Si installed default perm * so that it will override the Si installed default perm
* address. * address.
*/ */
...@@ -1777,8 +1770,7 @@ static s32 igb_set_pcie_completion_timeout(struct e1000_hw *hw) ...@@ -1777,8 +1770,7 @@ static s32 igb_set_pcie_completion_timeout(struct e1000_hw *hw)
if (gcr & E1000_GCR_CMPL_TMOUT_MASK) if (gcr & E1000_GCR_CMPL_TMOUT_MASK)
goto out; goto out;
/* /* if capabilities version is type 1 we can write the
* if capababilities version is type 1 we can write the
* timeout of 10ms to 200ms through the GCR register * timeout of 10ms to 200ms through the GCR register
*/ */
if (!(gcr & E1000_GCR_CAP_VER2)) { if (!(gcr & E1000_GCR_CAP_VER2)) {
...@@ -1786,8 +1778,7 @@ static s32 igb_set_pcie_completion_timeout(struct e1000_hw *hw) ...@@ -1786,8 +1778,7 @@ static s32 igb_set_pcie_completion_timeout(struct e1000_hw *hw)
goto out; goto out;
} }
/* /* for version 2 capabilities we need to write the config space
* for version 2 capabilities we need to write the config space
* directly in order to set the completion timeout value for * directly in order to set the completion timeout value for
* 16ms to 55ms * 16ms to 55ms
*/ */
...@@ -1825,6 +1816,7 @@ void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) ...@@ -1825,6 +1816,7 @@ void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf)
reg_offset = E1000_DTXSWC; reg_offset = E1000_DTXSWC;
break; break;
case e1000_i350: case e1000_i350:
case e1000_i354:
reg_offset = E1000_TXSWC; reg_offset = E1000_TXSWC;
break; break;
default: default:
...@@ -1866,6 +1858,7 @@ void igb_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable) ...@@ -1866,6 +1858,7 @@ void igb_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable)
dtxswc &= ~E1000_DTXSWC_VMDQ_LOOPBACK_EN; dtxswc &= ~E1000_DTXSWC_VMDQ_LOOPBACK_EN;
wr32(E1000_DTXSWC, dtxswc); wr32(E1000_DTXSWC, dtxswc);
break; break;
case e1000_i354:
case e1000_i350: case e1000_i350:
dtxswc = rd32(E1000_TXSWC); dtxswc = rd32(E1000_TXSWC);
if (enable) if (enable)
...@@ -1879,7 +1872,6 @@ void igb_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable) ...@@ -1879,7 +1872,6 @@ void igb_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable)
break; break;
} }
} }
/** /**
...@@ -1914,7 +1906,6 @@ static s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data) ...@@ -1914,7 +1906,6 @@ static s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data)
{ {
s32 ret_val; s32 ret_val;
ret_val = hw->phy.ops.acquire(hw); ret_val = hw->phy.ops.acquire(hw);
if (ret_val) if (ret_val)
goto out; goto out;
...@@ -2016,8 +2007,7 @@ static s32 igb_reset_hw_82580(struct e1000_hw *hw) ...@@ -2016,8 +2007,7 @@ static s32 igb_reset_hw_82580(struct e1000_hw *hw)
/* Get current control state. */ /* Get current control state. */
ctrl = rd32(E1000_CTRL); ctrl = rd32(E1000_CTRL);
/* /* Prevent the PCI-E bus from sticking if there is no TLP connection
* Prevent the PCI-E bus from sticking if there is no TLP connection
* on the last TLP read/write transaction when MAC is reset. * on the last TLP read/write transaction when MAC is reset.
*/ */
ret_val = igb_disable_pcie_master(hw); ret_val = igb_disable_pcie_master(hw);
...@@ -2052,8 +2042,7 @@ static s32 igb_reset_hw_82580(struct e1000_hw *hw) ...@@ -2052,8 +2042,7 @@ static s32 igb_reset_hw_82580(struct e1000_hw *hw)
ret_val = igb_get_auto_rd_done(hw); ret_val = igb_get_auto_rd_done(hw);
if (ret_val) { if (ret_val) {
/* /* When auto config read does not complete, do not
* When auto config read does not complete, do not
* return with an error. This can happen in situations * return with an error. This can happen in situations
* where there is no eeprom and prevents getting link. * where there is no eeprom and prevents getting link.
*/ */
...@@ -2197,7 +2186,8 @@ static s32 igb_validate_nvm_checksum_82580(struct e1000_hw *hw) ...@@ -2197,7 +2186,8 @@ static s32 igb_validate_nvm_checksum_82580(struct e1000_hw *hw)
if (nvm_data & NVM_COMPATIBILITY_BIT_MASK) { if (nvm_data & NVM_COMPATIBILITY_BIT_MASK) {
/* if checksums compatibility bit is set validate checksums /* if checksums compatibility bit is set validate checksums
* for all 4 ports. */ * for all 4 ports.
*/
eeprom_regions_count = 4; eeprom_regions_count = 4;
} }
...@@ -2308,6 +2298,41 @@ static s32 igb_update_nvm_checksum_i350(struct e1000_hw *hw) ...@@ -2308,6 +2298,41 @@ static s32 igb_update_nvm_checksum_i350(struct e1000_hw *hw)
return ret_val; return ret_val;
} }
/**
* __igb_access_emi_reg - Read/write EMI register
* @hw: pointer to the HW structure
* @addr: EMI address to program
* @data: pointer to value to read/write from/to the EMI address
* @read: boolean flag to indicate read or write
**/
static s32 __igb_access_emi_reg(struct e1000_hw *hw, u16 address,
u16 *data, bool read)
{
s32 ret_val = E1000_SUCCESS;
ret_val = hw->phy.ops.write_reg(hw, E1000_EMIADD, address);
if (ret_val)
return ret_val;
if (read)
ret_val = hw->phy.ops.read_reg(hw, E1000_EMIDATA, data);
else
ret_val = hw->phy.ops.write_reg(hw, E1000_EMIDATA, *data);
return ret_val;
}
/**
* igb_read_emi_reg - Read Extended Management Interface register
* @hw: pointer to the HW structure
* @addr: EMI address to program
* @data: value to be read from the EMI address
**/
s32 igb_read_emi_reg(struct e1000_hw *hw, u16 addr, u16 *data)
{
return __igb_access_emi_reg(hw, addr, data, true);
}
/** /**
* igb_set_eee_i350 - Enable/disable EEE support * igb_set_eee_i350 - Enable/disable EEE support
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
...@@ -2338,7 +2363,6 @@ s32 igb_set_eee_i350(struct e1000_hw *hw) ...@@ -2338,7 +2363,6 @@ s32 igb_set_eee_i350(struct e1000_hw *hw)
if (eee_su & E1000_EEE_SU_LPI_CLK_STP) if (eee_su & E1000_EEE_SU_LPI_CLK_STP)
hw_dbg("LPI Clock Stop Bit should not be set!\n"); hw_dbg("LPI Clock Stop Bit should not be set!\n");
} else { } else {
ipcnfg &= ~(E1000_IPCNFG_EEE_1G_AN | ipcnfg &= ~(E1000_IPCNFG_EEE_1G_AN |
E1000_IPCNFG_EEE_100M_AN); E1000_IPCNFG_EEE_100M_AN);
...@@ -2355,6 +2379,108 @@ s32 igb_set_eee_i350(struct e1000_hw *hw) ...@@ -2355,6 +2379,108 @@ s32 igb_set_eee_i350(struct e1000_hw *hw)
return ret_val; return ret_val;
} }
/**
* igb_set_eee_i354 - Enable/disable EEE support
* @hw: pointer to the HW structure
*
* Enable/disable EEE legacy mode based on setting in dev_spec structure.
*
**/
s32 igb_set_eee_i354(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val = 0;
u16 phy_data;
if ((hw->phy.media_type != e1000_media_type_copper) ||
(phy->id != M88E1545_E_PHY_ID))
goto out;
if (!hw->dev_spec._82575.eee_disable) {
/* Switch to PHY page 18. */
ret_val = phy->ops.write_reg(hw, E1000_M88E1545_PAGE_ADDR, 18);
if (ret_val)
goto out;
ret_val = phy->ops.read_reg(hw, E1000_M88E1545_EEE_CTRL_1,
&phy_data);
if (ret_val)
goto out;
phy_data |= E1000_M88E1545_EEE_CTRL_1_MS;
ret_val = phy->ops.write_reg(hw, E1000_M88E1545_EEE_CTRL_1,
phy_data);
if (ret_val)
goto out;
/* Return the PHY to page 0. */
ret_val = phy->ops.write_reg(hw, E1000_M88E1545_PAGE_ADDR, 0);
if (ret_val)
goto out;
/* Turn on EEE advertisement. */
ret_val = igb_read_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
E1000_EEE_ADV_DEV_I354,
&phy_data);
if (ret_val)
goto out;
phy_data |= E1000_EEE_ADV_100_SUPPORTED |
E1000_EEE_ADV_1000_SUPPORTED;
ret_val = igb_write_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
E1000_EEE_ADV_DEV_I354,
phy_data);
} else {
/* Turn off EEE advertisement. */
ret_val = igb_read_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
E1000_EEE_ADV_DEV_I354,
&phy_data);
if (ret_val)
goto out;
phy_data &= ~(E1000_EEE_ADV_100_SUPPORTED |
E1000_EEE_ADV_1000_SUPPORTED);
ret_val = igb_write_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
E1000_EEE_ADV_DEV_I354,
phy_data);
}
out:
return ret_val;
}
/**
* igb_get_eee_status_i354 - Get EEE status
* @hw: pointer to the HW structure
* @status: EEE status
*
* Get EEE status by guessing based on whether Tx or Rx LPI indications have
* been received.
**/
s32 igb_get_eee_status_i354(struct e1000_hw *hw, bool *status)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val = 0;
u16 phy_data;
/* Check if EEE is supported on this device. */
if ((hw->phy.media_type != e1000_media_type_copper) ||
(phy->id != M88E1545_E_PHY_ID))
goto out;
ret_val = igb_read_xmdio_reg(hw, E1000_PCS_STATUS_ADDR_I354,
E1000_PCS_STATUS_DEV_I354,
&phy_data);
if (ret_val)
goto out;
*status = phy_data & (E1000_PCS_STATUS_TX_LPI_RCVD |
E1000_PCS_STATUS_RX_LPI_RCVD) ? true : false;
out:
return ret_val;
}
static const u8 e1000_emc_temp_data[4] = { static const u8 e1000_emc_temp_data[4] = {
E1000_EMC_INTERNAL_DATA, E1000_EMC_INTERNAL_DATA,
E1000_EMC_DIODE1_DATA, E1000_EMC_DIODE1_DATA,
...@@ -2368,11 +2494,12 @@ static const u8 e1000_emc_therm_limit[4] = { ...@@ -2368,11 +2494,12 @@ static const u8 e1000_emc_therm_limit[4] = {
E1000_EMC_DIODE3_THERM_LIMIT E1000_EMC_DIODE3_THERM_LIMIT
}; };
/* igb_get_thermal_sensor_data_generic - Gathers thermal sensor data /**
* igb_get_thermal_sensor_data_generic - Gathers thermal sensor data
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* *
* Updates the temperatures in mac.thermal_sensor_data * Updates the temperatures in mac.thermal_sensor_data
*/ **/
s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw) s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw)
{ {
s32 status = E1000_SUCCESS; s32 status = E1000_SUCCESS;
...@@ -2420,12 +2547,13 @@ s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw) ...@@ -2420,12 +2547,13 @@ s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw)
return status; return status;
} }
/* igb_init_thermal_sensor_thresh_generic - Sets thermal sensor thresholds /**
* igb_init_thermal_sensor_thresh_generic - Sets thermal sensor thresholds
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* *
* Sets the thermal sensor thresholds according to the NVM map * Sets the thermal sensor thresholds according to the NVM map
* and save off the threshold and location values into mac.thermal_sensor_data * and save off the threshold and location values into mac.thermal_sensor_data
*/ **/
s32 igb_init_thermal_sensor_thresh_generic(struct e1000_hw *hw) s32 igb_init_thermal_sensor_thresh_generic(struct e1000_hw *hw)
{ {
s32 status = E1000_SUCCESS; s32 status = E1000_SUCCESS;
......
...@@ -263,7 +263,9 @@ void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *, bool, int); ...@@ -263,7 +263,9 @@ void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *, bool, int);
void igb_vmdq_set_loopback_pf(struct e1000_hw *, bool); void igb_vmdq_set_loopback_pf(struct e1000_hw *, bool);
void igb_vmdq_set_replication_pf(struct e1000_hw *, bool); void igb_vmdq_set_replication_pf(struct e1000_hw *, bool);
u16 igb_rxpbs_adjust_82580(u32 data); u16 igb_rxpbs_adjust_82580(u32 data);
s32 igb_read_emi_reg(struct e1000_hw *, u16 addr, u16 *data);
s32 igb_set_eee_i350(struct e1000_hw *); s32 igb_set_eee_i350(struct e1000_hw *);
s32 igb_set_eee_i354(struct e1000_hw *);
s32 igb_init_thermal_sensor_thresh_generic(struct e1000_hw *); s32 igb_init_thermal_sensor_thresh_generic(struct e1000_hw *);
s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw); s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw);
......
...@@ -138,8 +138,7 @@ ...@@ -138,8 +138,7 @@
#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */ #define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */
#define E1000_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */ #define E1000_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */
/* /* Use byte values for the following shift parameters
* Use byte values for the following shift parameters
* Usage: * Usage:
* psrctl |= (((ROUNDUP(value0, 128) >> E1000_PSRCTL_BSIZE0_SHIFT) & * psrctl |= (((ROUNDUP(value0, 128) >> E1000_PSRCTL_BSIZE0_SHIFT) &
* E1000_PSRCTL_BSIZE0_MASK) | * E1000_PSRCTL_BSIZE0_MASK) |
...@@ -237,11 +236,14 @@ ...@@ -237,11 +236,14 @@
#define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000
/* BMC external code execution disabled */ /* BMC external code execution disabled */
#define E1000_STATUS_2P5_SKU 0x00001000 /* Val of 2.5GBE SKU strap */
#define E1000_STATUS_2P5_SKU_OVER 0x00002000 /* Val of 2.5GBE SKU Over */
/* Constants used to intrepret the masked PCI-X bus speed. */ /* Constants used to intrepret the masked PCI-X bus speed. */
#define SPEED_10 10 #define SPEED_10 10
#define SPEED_100 100 #define SPEED_100 100
#define SPEED_1000 1000 #define SPEED_1000 1000
#define SPEED_2500 2500
#define HALF_DUPLEX 1 #define HALF_DUPLEX 1
#define FULL_DUPLEX 2 #define FULL_DUPLEX 2
...@@ -382,8 +384,7 @@ ...@@ -382,8 +384,7 @@
#define E1000_EICR_OTHER 0x80000000 /* Interrupt Cause Active */ #define E1000_EICR_OTHER 0x80000000 /* Interrupt Cause Active */
/* TCP Timer */ /* TCP Timer */
/* /* This defines the bits that are set in the Interrupt Mask
* This defines the bits that are set in the Interrupt Mask
* Set/Read Register. Each bit is documented below: * Set/Read Register. Each bit is documented below:
* o RXT0 = Receiver Timer Interrupt (ring 0) * o RXT0 = Receiver Timer Interrupt (ring 0)
* o TXDW = Transmit Descriptor Written Back * o TXDW = Transmit Descriptor Written Back
...@@ -440,8 +441,7 @@ ...@@ -440,8 +441,7 @@
#define E1000_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */ #define E1000_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */
/* Receive Address */ /* Receive Address */
/* /* Number of high/low register pairs in the RAR. The RAR (Receive Address
* Number of high/low register pairs in the RAR. The RAR (Receive Address
* Registers) holds the directed and multicast addresses that we monitor. * Registers) holds the directed and multicast addresses that we monitor.
* Technically, we have 16 spots. However, we reserve one of these spots * Technically, we have 16 spots. However, we reserve one of these spots
* (RAR[15]) for our directed address used by controllers with * (RAR[15]) for our directed address used by controllers with
...@@ -760,8 +760,7 @@ ...@@ -760,8 +760,7 @@
#define MAX_PHY_MULTI_PAGE_REG 0xF #define MAX_PHY_MULTI_PAGE_REG 0xF
/* Bit definitions for valid PHY IDs. */ /* Bit definitions for valid PHY IDs. */
/* /* I = Integrated
* I = Integrated
* E = External * E = External
*/ */
#define M88E1111_I_PHY_ID 0x01410CC0 #define M88E1111_I_PHY_ID 0x01410CC0
...@@ -772,6 +771,7 @@ ...@@ -772,6 +771,7 @@
#define I350_I_PHY_ID 0x015403B0 #define I350_I_PHY_ID 0x015403B0
#define M88_VENDOR 0x0141 #define M88_VENDOR 0x0141
#define I210_I_PHY_ID 0x01410C00 #define I210_I_PHY_ID 0x01410C00
#define M88E1545_E_PHY_ID 0x01410EA0
/* M88E1000 Specific Registers */ /* M88E1000 Specific Registers */
#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */ #define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */
...@@ -791,8 +791,7 @@ ...@@ -791,8 +791,7 @@
#define M88E1000_PSCR_AUTO_X_1000T 0x0040 #define M88E1000_PSCR_AUTO_X_1000T 0x0040
/* Auto crossover enabled all speeds */ /* Auto crossover enabled all speeds */
#define M88E1000_PSCR_AUTO_X_MODE 0x0060 #define M88E1000_PSCR_AUTO_X_MODE 0x0060
/* /* 1=Enable Extended 10BASE-T distance (Lower 10BASE-T Rx Threshold
* 1=Enable Extended 10BASE-T distance (Lower 10BASE-T Rx Threshold
* 0=Normal 10BASE-T Rx Threshold * 0=Normal 10BASE-T Rx Threshold
*/ */
/* 1=5-bit interface in 100BASE-TX, 0=MII interface in 100BASE-TX */ /* 1=5-bit interface in 100BASE-TX, 0=MII interface in 100BASE-TX */
...@@ -802,8 +801,7 @@ ...@@ -802,8 +801,7 @@
#define M88E1000_PSSR_REV_POLARITY 0x0002 /* 1=Polarity reversed */ #define M88E1000_PSSR_REV_POLARITY 0x0002 /* 1=Polarity reversed */
#define M88E1000_PSSR_DOWNSHIFT 0x0020 /* 1=Downshifted */ #define M88E1000_PSSR_DOWNSHIFT 0x0020 /* 1=Downshifted */
#define M88E1000_PSSR_MDIX 0x0040 /* 1=MDIX; 0=MDI */ #define M88E1000_PSSR_MDIX 0x0040 /* 1=MDIX; 0=MDI */
/* /* 0 = <50M
* 0 = <50M
* 1 = 50-80M * 1 = 50-80M
* 2 = 80-110M * 2 = 80-110M
* 3 = 110-140M * 3 = 110-140M
...@@ -816,20 +814,17 @@ ...@@ -816,20 +814,17 @@
#define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7 #define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7
/* M88E1000 Extended PHY Specific Control Register */ /* M88E1000 Extended PHY Specific Control Register */
/* /* 1 = Lost lock detect enabled.
* 1 = Lost lock detect enabled.
* Will assert lost lock and bring * Will assert lost lock and bring
* link down if idle not seen * link down if idle not seen
* within 1ms in 1000BASE-T * within 1ms in 1000BASE-T
*/ */
/* /* Number of times we will attempt to autonegotiate before downshifting if we
* Number of times we will attempt to autonegotiate before downshifting if we
* are the master * are the master
*/ */
#define M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK 0x0C00 #define M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK 0x0C00
#define M88E1000_EPSCR_MASTER_DOWNSHIFT_1X 0x0000 #define M88E1000_EPSCR_MASTER_DOWNSHIFT_1X 0x0000
/* /* Number of times we will attempt to autonegotiate before downshifting if we
* Number of times we will attempt to autonegotiate before downshifting if we
* are the slave * are the slave
*/ */
#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK 0x0300 #define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK 0x0300
...@@ -844,8 +839,7 @@ ...@@ -844,8 +839,7 @@
/* i347-AT4 Extended PHY Specific Control Register */ /* i347-AT4 Extended PHY Specific Control Register */
/* /* Number of times we will attempt to autonegotiate before downshifting if we
* Number of times we will attempt to autonegotiate before downshifting if we
* are the master * are the master
*/ */
#define I347AT4_PSCR_DOWNSHIFT_ENABLE 0x0800 #define I347AT4_PSCR_DOWNSHIFT_ENABLE 0x0800
...@@ -895,6 +889,22 @@ ...@@ -895,6 +889,22 @@
#define E1000_EEER_LPI_FC 0x00040000 /* EEE Enable on FC */ #define E1000_EEER_LPI_FC 0x00040000 /* EEE Enable on FC */
#define E1000_EEE_SU_LPI_CLK_STP 0X00800000 /* EEE LPI Clock Stop */ #define E1000_EEE_SU_LPI_CLK_STP 0X00800000 /* EEE LPI Clock Stop */
#define E1000_EEER_EEE_NEG 0x20000000 /* EEE capability nego */ #define E1000_EEER_EEE_NEG 0x20000000 /* EEE capability nego */
#define E1000_EEE_LP_ADV_ADDR_I350 0x040F /* EEE LP Advertisement */
#define E1000_EEE_LP_ADV_DEV_I210 7 /* EEE LP Adv Device */
#define E1000_EEE_LP_ADV_ADDR_I210 61 /* EEE LP Adv Register */
#define E1000_MMDAC_FUNC_DATA 0x4000 /* Data, no post increment */
#define E1000_M88E1545_PAGE_ADDR 0x16 /* Page Offset Register */
#define E1000_M88E1545_EEE_CTRL_1 0x0
#define E1000_M88E1545_EEE_CTRL_1_MS 0x0001 /* EEE Master/Slave */
#define E1000_EEE_ADV_DEV_I354 7
#define E1000_EEE_ADV_ADDR_I354 60
#define E1000_EEE_ADV_100_SUPPORTED (1 << 1) /* 100BaseTx EEE Supported */
#define E1000_EEE_ADV_1000_SUPPORTED (1 << 2) /* 1000BaseT EEE Supported */
#define E1000_PCS_STATUS_DEV_I354 3
#define E1000_PCS_STATUS_ADDR_I354 1
#define E1000_PCS_STATUS_TX_LPI_IND 0x0200 /* Tx in LPI state */
#define E1000_PCS_STATUS_RX_LPI_RCVD 0x0400
#define E1000_PCS_STATUS_TX_LPI_RCVD 0x0800
/* SerDes Control */ /* SerDes Control */
#define E1000_GEN_CTL_READY 0x80000000 #define E1000_GEN_CTL_READY 0x80000000
......
...@@ -70,6 +70,9 @@ struct e1000_hw; ...@@ -70,6 +70,9 @@ struct e1000_hw;
#define E1000_DEV_ID_I210_SERDES 0x1537 #define E1000_DEV_ID_I210_SERDES 0x1537
#define E1000_DEV_ID_I210_SGMII 0x1538 #define E1000_DEV_ID_I210_SGMII 0x1538
#define E1000_DEV_ID_I211_COPPER 0x1539 #define E1000_DEV_ID_I211_COPPER 0x1539
#define E1000_DEV_ID_I354_BACKPLANE_1GBPS 0x1F40
#define E1000_DEV_ID_I354_SGMII 0x1F41
#define E1000_DEV_ID_I354_BACKPLANE_2_5GBPS 0x1F45
#define E1000_REVISION_2 2 #define E1000_REVISION_2 2
#define E1000_REVISION_4 4 #define E1000_REVISION_4 4
...@@ -90,6 +93,7 @@ enum e1000_mac_type { ...@@ -90,6 +93,7 @@ enum e1000_mac_type {
e1000_82576, e1000_82576,
e1000_82580, e1000_82580,
e1000_i350, e1000_i350,
e1000_i354,
e1000_i210, e1000_i210,
e1000_i211, e1000_i211,
e1000_num_macs /* List is 1-based, so subtract 1 for true count. */ e1000_num_macs /* List is 1-based, so subtract 1 for true count. */
...@@ -98,7 +102,8 @@ enum e1000_mac_type { ...@@ -98,7 +102,8 @@ enum e1000_mac_type {
enum e1000_media_type { enum e1000_media_type {
e1000_media_type_unknown = 0, e1000_media_type_unknown = 0,
e1000_media_type_copper = 1, e1000_media_type_copper = 1,
e1000_media_type_internal_serdes = 2, e1000_media_type_fiber = 2,
e1000_media_type_internal_serdes = 3,
e1000_num_media_types e1000_num_media_types
}; };
......
...@@ -103,7 +103,7 @@ void igb_release_nvm_i210(struct e1000_hw *hw) ...@@ -103,7 +103,7 @@ void igb_release_nvm_i210(struct e1000_hw *hw)
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* *
* Release hardware semaphore used to access the PHY or NVM * Release hardware semaphore used to access the PHY or NVM
*/ **/
static void igb_put_hw_semaphore_i210(struct e1000_hw *hw) static void igb_put_hw_semaphore_i210(struct e1000_hw *hw)
{ {
u32 swsm; u32 swsm;
...@@ -141,9 +141,7 @@ s32 igb_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask) ...@@ -141,9 +141,7 @@ s32 igb_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask)
if (!(swfw_sync & fwmask)) if (!(swfw_sync & fwmask))
break; break;
/* /* Firmware currently using resource (fwmask) */
* Firmware currently using resource (fwmask)
*/
igb_put_hw_semaphore_i210(hw); igb_put_hw_semaphore_i210(hw);
mdelay(5); mdelay(5);
i++; i++;
...@@ -203,7 +201,8 @@ s32 igb_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, ...@@ -203,7 +201,8 @@ s32 igb_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words,
/* We cannot hold synchronization semaphores for too long, /* We cannot hold synchronization semaphores for too long,
* because of forceful takeover procedure. However it is more efficient * because of forceful takeover procedure. However it is more efficient
* to read in bursts than synchronizing access for each word. */ * to read in bursts than synchronizing access for each word.
*/
for (i = 0; i < words; i += E1000_EERD_EEWR_MAX_COUNT) { for (i = 0; i < words; i += E1000_EERD_EEWR_MAX_COUNT) {
count = (words - i) / E1000_EERD_EEWR_MAX_COUNT > 0 ? count = (words - i) / E1000_EERD_EEWR_MAX_COUNT > 0 ?
E1000_EERD_EEWR_MAX_COUNT : (words - i); E1000_EERD_EEWR_MAX_COUNT : (words - i);
...@@ -242,8 +241,7 @@ static s32 igb_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, ...@@ -242,8 +241,7 @@ static s32 igb_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words,
u32 attempts = 100000; u32 attempts = 100000;
s32 ret_val = E1000_SUCCESS; s32 ret_val = E1000_SUCCESS;
/* /* A check for invalid values: offset too large, too many words,
* A check for invalid values: offset too large, too many words,
* too many words for the offset, and not enough words. * too many words for the offset, and not enough words.
*/ */
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
...@@ -294,7 +292,7 @@ static s32 igb_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, ...@@ -294,7 +292,7 @@ static s32 igb_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words,
* *
* If error code is returned, data and Shadow RAM may be inconsistent - buffer * If error code is returned, data and Shadow RAM may be inconsistent - buffer
* partially written. * partially written.
*/ **/
s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words, s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words,
u16 *data) u16 *data)
{ {
...@@ -326,7 +324,7 @@ s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words, ...@@ -326,7 +324,7 @@ s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words,
/** /**
* igb_read_nvm_i211 - Read NVM wrapper function for I211 * igb_read_nvm_i211 - Read NVM wrapper function for I211
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* @address: the word address (aka eeprom offset) to read * @words: number of words to read
* @data: pointer to the data read * @data: pointer to the data read
* *
* Wrapper function to return data formerly found in the NVM. * Wrapper function to return data formerly found in the NVM.
...@@ -549,8 +547,7 @@ s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw) ...@@ -549,8 +547,7 @@ s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw)
if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) { if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) {
/* /* Replace the read function with semaphore grabbing with
* Replace the read function with semaphore grabbing with
* the one that skips this for a while. * the one that skips this for a while.
* We have semaphore taken already here. * We have semaphore taken already here.
*/ */
...@@ -570,7 +567,6 @@ s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw) ...@@ -570,7 +567,6 @@ s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw)
return status; return status;
} }
/** /**
* igb_update_nvm_checksum_i210 - Update EEPROM checksum * igb_update_nvm_checksum_i210 - Update EEPROM checksum
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
...@@ -585,8 +581,7 @@ s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw) ...@@ -585,8 +581,7 @@ s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw)
u16 checksum = 0; u16 checksum = 0;
u16 i, nvm_data; u16 i, nvm_data;
/* /* Read the first word from the EEPROM. If this times out or fails, do
* Read the first word from the EEPROM. If this times out or fails, do
* not continue or we could be in for a very long wait while every * not continue or we could be in for a very long wait while every
* EEPROM read fails * EEPROM read fails
*/ */
...@@ -597,8 +592,7 @@ s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw) ...@@ -597,8 +592,7 @@ s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw)
} }
if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) { if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) {
/* /* Do not use hw->nvm.ops.write, hw->nvm.ops.read
* Do not use hw->nvm.ops.write, hw->nvm.ops.read
* because we do not want to take the synchronization * because we do not want to take the synchronization
* semaphores twice here. * semaphores twice here.
*/ */
...@@ -635,7 +629,7 @@ s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw) ...@@ -635,7 +629,7 @@ s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw)
* igb_pool_flash_update_done_i210 - Pool FLUDONE status. * igb_pool_flash_update_done_i210 - Pool FLUDONE status.
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* *
*/ **/
static s32 igb_pool_flash_update_done_i210(struct e1000_hw *hw) static s32 igb_pool_flash_update_done_i210(struct e1000_hw *hw)
{ {
s32 ret_val = -E1000_ERR_NVM; s32 ret_val = -E1000_ERR_NVM;
...@@ -714,3 +708,68 @@ s32 igb_valid_led_default_i210(struct e1000_hw *hw, u16 *data) ...@@ -714,3 +708,68 @@ s32 igb_valid_led_default_i210(struct e1000_hw *hw, u16 *data)
out: out:
return ret_val; return ret_val;
} }
/**
* __igb_access_xmdio_reg - Read/write XMDIO register
* @hw: pointer to the HW structure
* @address: XMDIO address to program
* @dev_addr: device address to program
* @data: pointer to value to read/write from/to the XMDIO address
* @read: boolean flag to indicate read or write
**/
static s32 __igb_access_xmdio_reg(struct e1000_hw *hw, u16 address,
u8 dev_addr, u16 *data, bool read)
{
s32 ret_val = E1000_SUCCESS;
ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, dev_addr);
if (ret_val)
return ret_val;
ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, address);
if (ret_val)
return ret_val;
ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, E1000_MMDAC_FUNC_DATA |
dev_addr);
if (ret_val)
return ret_val;
if (read)
ret_val = hw->phy.ops.read_reg(hw, E1000_MMDAAD, data);
else
ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, *data);
if (ret_val)
return ret_val;
/* Recalibrate the device back to 0 */
ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, 0);
if (ret_val)
return ret_val;
return ret_val;
}
/**
* igb_read_xmdio_reg - Read XMDIO register
* @hw: pointer to the HW structure
* @addr: XMDIO address to program
* @dev_addr: device address to program
* @data: value to be read from the EMI address
**/
s32 igb_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data)
{
return __igb_access_xmdio_reg(hw, addr, dev_addr, data, true);
}
/**
* igb_write_xmdio_reg - Write XMDIO register
* @hw: pointer to the HW structure
* @addr: XMDIO address to program
* @dev_addr: device address to program
* @data: value to be written to the XMDIO address
**/
s32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data)
{
return __igb_access_xmdio_reg(hw, addr, dev_addr, &data, false);
}
...@@ -45,6 +45,10 @@ extern s32 igb_read_nvm_i211(struct e1000_hw *hw, u16 offset, u16 words, ...@@ -45,6 +45,10 @@ extern s32 igb_read_nvm_i211(struct e1000_hw *hw, u16 offset, u16 words,
u16 *data); u16 *data);
extern s32 igb_read_invm_version(struct e1000_hw *hw, extern s32 igb_read_invm_version(struct e1000_hw *hw,
struct e1000_fw_version *invm_ver); struct e1000_fw_version *invm_ver);
extern s32 igb_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr,
u16 *data);
extern s32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr,
u16 data);
#define E1000_STM_OPCODE 0xDB00 #define E1000_STM_OPCODE 0xDB00
#define E1000_EEPROM_FLASH_SIZE_WORD 0x11 #define E1000_EEPROM_FLASH_SIZE_WORD 0x11
......
...@@ -214,7 +214,7 @@ s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add) ...@@ -214,7 +214,7 @@ s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add)
else else
vfta &= ~mask; vfta &= ~mask;
} }
if (hw->mac.type == e1000_i350) if ((hw->mac.type == e1000_i350) || (hw->mac.type == e1000_i354))
igb_write_vfta_i350(hw, index, vfta); igb_write_vfta_i350(hw, index, vfta);
else else
igb_write_vfta(hw, index, vfta); igb_write_vfta(hw, index, vfta);
...@@ -230,8 +230,8 @@ s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add) ...@@ -230,8 +230,8 @@ s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add)
* Checks the nvm for an alternate MAC address. An alternate MAC address * Checks the nvm for an alternate MAC address. An alternate MAC address
* can be setup by pre-boot software and must be treated like a permanent * can be setup by pre-boot software and must be treated like a permanent
* address and must override the actual permanent MAC address. If an * address and must override the actual permanent MAC address. If an
* alternate MAC address is fopund it is saved in the hw struct and * alternate MAC address is found it is saved in the hw struct and
* prgrammed into RAR0 and the cuntion returns success, otherwise the * programmed into RAR0 and the function returns success, otherwise the
* function returns an error. * function returns an error.
**/ **/
s32 igb_check_alt_mac_addr(struct e1000_hw *hw) s32 igb_check_alt_mac_addr(struct e1000_hw *hw)
...@@ -241,8 +241,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw) ...@@ -241,8 +241,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)
u16 offset, nvm_alt_mac_addr_offset, nvm_data; u16 offset, nvm_alt_mac_addr_offset, nvm_data;
u8 alt_mac_addr[ETH_ALEN]; u8 alt_mac_addr[ETH_ALEN];
/* /* Alternate MAC address is handled by the option ROM for 82580
* Alternate MAC address is handled by the option ROM for 82580
* and newer. SW support not required. * and newer. SW support not required.
*/ */
if (hw->mac.type >= e1000_82580) if (hw->mac.type >= e1000_82580)
...@@ -285,8 +284,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw) ...@@ -285,8 +284,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)
goto out; goto out;
} }
/* /* We have a valid alternate MAC address, and we want to treat it the
* We have a valid alternate MAC address, and we want to treat it the
* same as the normal permanent MAC address stored by the HW into the * same as the normal permanent MAC address stored by the HW into the
* RAR. Do this by mapping this address into RAR0. * RAR. Do this by mapping this address into RAR0.
*/ */
...@@ -309,8 +307,7 @@ void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) ...@@ -309,8 +307,7 @@ void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
{ {
u32 rar_low, rar_high; u32 rar_low, rar_high;
/* /* HW expects these in little endian so we reverse the byte order
* HW expects these in little endian so we reverse the byte order
* from network order (big endian) to little endian * from network order (big endian) to little endian
*/ */
rar_low = ((u32) addr[0] | rar_low = ((u32) addr[0] |
...@@ -323,8 +320,7 @@ void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) ...@@ -323,8 +320,7 @@ void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
if (rar_low || rar_high) if (rar_low || rar_high)
rar_high |= E1000_RAH_AV; rar_high |= E1000_RAH_AV;
/* /* Some bridges will combine consecutive 32-bit writes into
* Some bridges will combine consecutive 32-bit writes into
* a single burst write, which will malfunction on some parts. * a single burst write, which will malfunction on some parts.
* The flushes avoid this. * The flushes avoid this.
*/ */
...@@ -348,8 +344,7 @@ void igb_mta_set(struct e1000_hw *hw, u32 hash_value) ...@@ -348,8 +344,7 @@ void igb_mta_set(struct e1000_hw *hw, u32 hash_value)
{ {
u32 hash_bit, hash_reg, mta; u32 hash_bit, hash_reg, mta;
/* /* The MTA is a register array of 32-bit registers. It is
* The MTA is a register array of 32-bit registers. It is
* treated like an array of (32*mta_reg_count) bits. We want to * treated like an array of (32*mta_reg_count) bits. We want to
* set bit BitArray[hash_value]. So we figure out what register * set bit BitArray[hash_value]. So we figure out what register
* the bit is in, read it, OR in the new bit, then write * the bit is in, read it, OR in the new bit, then write
...@@ -386,15 +381,13 @@ static u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) ...@@ -386,15 +381,13 @@ static u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
/* Register count multiplied by bits per register */ /* Register count multiplied by bits per register */
hash_mask = (hw->mac.mta_reg_count * 32) - 1; hash_mask = (hw->mac.mta_reg_count * 32) - 1;
/* /* For a mc_filter_type of 0, bit_shift is the number of left-shifts
* For a mc_filter_type of 0, bit_shift is the number of left-shifts
* where 0xFF would still fall within the hash mask. * where 0xFF would still fall within the hash mask.
*/ */
while (hash_mask >> bit_shift != 0xFF) while (hash_mask >> bit_shift != 0xFF)
bit_shift++; bit_shift++;
/* /* The portion of the address that is used for the hash table
* The portion of the address that is used for the hash table
* is determined by the mc_filter_type setting. * is determined by the mc_filter_type setting.
* The algorithm is such that there is a total of 8 bits of shifting. * The algorithm is such that there is a total of 8 bits of shifting.
* The bit_shift for a mc_filter_type of 0 represents the number of * The bit_shift for a mc_filter_type of 0 represents the number of
...@@ -536,8 +529,7 @@ s32 igb_check_for_copper_link(struct e1000_hw *hw) ...@@ -536,8 +529,7 @@ s32 igb_check_for_copper_link(struct e1000_hw *hw)
s32 ret_val; s32 ret_val;
bool link; bool link;
/* /* We only want to go out to the PHY registers to see if Auto-Neg
* We only want to go out to the PHY registers to see if Auto-Neg
* has completed and/or if our link status has changed. The * has completed and/or if our link status has changed. The
* get_link_status flag is set upon receiving a Link Status * get_link_status flag is set upon receiving a Link Status
* Change or Rx Sequence Error interrupt. * Change or Rx Sequence Error interrupt.
...@@ -547,8 +539,7 @@ s32 igb_check_for_copper_link(struct e1000_hw *hw) ...@@ -547,8 +539,7 @@ s32 igb_check_for_copper_link(struct e1000_hw *hw)
goto out; goto out;
} }
/* /* First we want to see if the MII Status Register reports
* First we want to see if the MII Status Register reports
* link. If so, then we want to get the current speed/duplex * link. If so, then we want to get the current speed/duplex
* of the PHY. * of the PHY.
*/ */
...@@ -561,14 +552,12 @@ s32 igb_check_for_copper_link(struct e1000_hw *hw) ...@@ -561,14 +552,12 @@ s32 igb_check_for_copper_link(struct e1000_hw *hw)
mac->get_link_status = false; mac->get_link_status = false;
/* /* Check if there was DownShift, must be checked
* Check if there was DownShift, must be checked
* immediately after link-up * immediately after link-up
*/ */
igb_check_downshift(hw); igb_check_downshift(hw);
/* /* If we are forcing speed/duplex, then we simply return since
* If we are forcing speed/duplex, then we simply return since
* we have already determined whether we have link or not. * we have already determined whether we have link or not.
*/ */
if (!mac->autoneg) { if (!mac->autoneg) {
...@@ -576,15 +565,13 @@ s32 igb_check_for_copper_link(struct e1000_hw *hw) ...@@ -576,15 +565,13 @@ s32 igb_check_for_copper_link(struct e1000_hw *hw)
goto out; goto out;
} }
/* /* Auto-Neg is enabled. Auto Speed Detection takes care
* Auto-Neg is enabled. Auto Speed Detection takes care
* of MAC speed/duplex configuration. So we only need to * of MAC speed/duplex configuration. So we only need to
* configure Collision Distance in the MAC. * configure Collision Distance in the MAC.
*/ */
igb_config_collision_dist(hw); igb_config_collision_dist(hw);
/* /* Configure Flow Control now that Auto-Neg has completed.
* Configure Flow Control now that Auto-Neg has completed.
* First, we need to restore the desired flow control * First, we need to restore the desired flow control
* settings because we may have had to re-autoneg with a * settings because we may have had to re-autoneg with a
* different link partner. * different link partner.
...@@ -611,15 +598,13 @@ s32 igb_setup_link(struct e1000_hw *hw) ...@@ -611,15 +598,13 @@ s32 igb_setup_link(struct e1000_hw *hw)
{ {
s32 ret_val = 0; s32 ret_val = 0;
/* /* In the case of the phy reset being blocked, we already have a link.
* In the case of the phy reset being blocked, we already have a link.
* We do not need to set it up again. * We do not need to set it up again.
*/ */
if (igb_check_reset_block(hw)) if (igb_check_reset_block(hw))
goto out; goto out;
/* /* If requested flow control is set to default, set flow control
* If requested flow control is set to default, set flow control
* based on the EEPROM flow control settings. * based on the EEPROM flow control settings.
*/ */
if (hw->fc.requested_mode == e1000_fc_default) { if (hw->fc.requested_mode == e1000_fc_default) {
...@@ -628,8 +613,7 @@ s32 igb_setup_link(struct e1000_hw *hw) ...@@ -628,8 +613,7 @@ s32 igb_setup_link(struct e1000_hw *hw)
goto out; goto out;
} }
/* /* We want to save off the original Flow Control configuration just
* We want to save off the original Flow Control configuration just
* in case we get disconnected and then reconnected into a different * in case we get disconnected and then reconnected into a different
* hub or switch with different Flow Control capabilities. * hub or switch with different Flow Control capabilities.
*/ */
...@@ -642,8 +626,7 @@ s32 igb_setup_link(struct e1000_hw *hw) ...@@ -642,8 +626,7 @@ s32 igb_setup_link(struct e1000_hw *hw)
if (ret_val) if (ret_val)
goto out; goto out;
/* /* Initialize the flow control address, type, and PAUSE timer
* Initialize the flow control address, type, and PAUSE timer
* registers to their default values. This is done even if flow * registers to their default values. This is done even if flow
* control is disabled, because it does not hurt anything to * control is disabled, because it does not hurt anything to
* initialize these registers. * initialize these registers.
...@@ -696,16 +679,14 @@ static s32 igb_set_fc_watermarks(struct e1000_hw *hw) ...@@ -696,16 +679,14 @@ static s32 igb_set_fc_watermarks(struct e1000_hw *hw)
s32 ret_val = 0; s32 ret_val = 0;
u32 fcrtl = 0, fcrth = 0; u32 fcrtl = 0, fcrth = 0;
/* /* Set the flow control receive threshold registers. Normally,
* Set the flow control receive threshold registers. Normally,
* these registers will be set to a default threshold that may be * these registers will be set to a default threshold that may be
* adjusted later by the driver's runtime code. However, if the * adjusted later by the driver's runtime code. However, if the
* ability to transmit pause frames is not enabled, then these * ability to transmit pause frames is not enabled, then these
* registers will be set to 0. * registers will be set to 0.
*/ */
if (hw->fc.current_mode & e1000_fc_tx_pause) { if (hw->fc.current_mode & e1000_fc_tx_pause) {
/* /* We need to set up the Receive Threshold high and low water
* We need to set up the Receive Threshold high and low water
* marks as well as (optionally) enabling the transmission of * marks as well as (optionally) enabling the transmission of
* XON frames. * XON frames.
*/ */
...@@ -733,8 +714,7 @@ static s32 igb_set_default_fc(struct e1000_hw *hw) ...@@ -733,8 +714,7 @@ static s32 igb_set_default_fc(struct e1000_hw *hw)
s32 ret_val = 0; s32 ret_val = 0;
u16 nvm_data; u16 nvm_data;
/* /* Read and store word 0x0F of the EEPROM. This word contains bits
* Read and store word 0x0F of the EEPROM. This word contains bits
* that determine the hardware's default PAUSE (flow control) mode, * that determine the hardware's default PAUSE (flow control) mode,
* a bit that determines whether the HW defaults to enabling or * a bit that determines whether the HW defaults to enabling or
* disabling auto-negotiation, and the direction of the * disabling auto-negotiation, and the direction of the
...@@ -778,8 +758,7 @@ s32 igb_force_mac_fc(struct e1000_hw *hw) ...@@ -778,8 +758,7 @@ s32 igb_force_mac_fc(struct e1000_hw *hw)
ctrl = rd32(E1000_CTRL); ctrl = rd32(E1000_CTRL);
/* /* Because we didn't get link via the internal auto-negotiation
* Because we didn't get link via the internal auto-negotiation
* mechanism (we either forced link or we got link via PHY * mechanism (we either forced link or we got link via PHY
* auto-neg), we have to manually enable/disable transmit an * auto-neg), we have to manually enable/disable transmit an
* receive flow control. * receive flow control.
...@@ -843,8 +822,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -843,8 +822,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
u16 mii_status_reg, mii_nway_adv_reg, mii_nway_lp_ability_reg; u16 mii_status_reg, mii_nway_adv_reg, mii_nway_lp_ability_reg;
u16 speed, duplex; u16 speed, duplex;
/* /* Check for the case where we have fiber media and auto-neg failed
* Check for the case where we have fiber media and auto-neg failed
* so we had to force link. In this case, we need to force the * so we had to force link. In this case, we need to force the
* configuration of the MAC to match the "fc" parameter. * configuration of the MAC to match the "fc" parameter.
*/ */
...@@ -861,15 +839,13 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -861,15 +839,13 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
goto out; goto out;
} }
/* /* Check for the case where we have copper media and auto-neg is
* Check for the case where we have copper media and auto-neg is
* enabled. In this case, we need to check and see if Auto-Neg * enabled. In this case, we need to check and see if Auto-Neg
* has completed, and if so, how the PHY and link partner has * has completed, and if so, how the PHY and link partner has
* flow control configured. * flow control configured.
*/ */
if ((hw->phy.media_type == e1000_media_type_copper) && mac->autoneg) { if ((hw->phy.media_type == e1000_media_type_copper) && mac->autoneg) {
/* /* Read the MII Status Register and check to see if AutoNeg
* Read the MII Status Register and check to see if AutoNeg
* has completed. We read this twice because this reg has * has completed. We read this twice because this reg has
* some "sticky" (latched) bits. * some "sticky" (latched) bits.
*/ */
...@@ -888,8 +864,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -888,8 +864,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
goto out; goto out;
} }
/* /* The AutoNeg process has completed, so we now need to
* The AutoNeg process has completed, so we now need to
* read both the Auto Negotiation Advertisement * read both the Auto Negotiation Advertisement
* Register (Address 4) and the Auto_Negotiation Base * Register (Address 4) and the Auto_Negotiation Base
* Page Ability Register (Address 5) to determine how * Page Ability Register (Address 5) to determine how
...@@ -904,8 +879,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -904,8 +879,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
if (ret_val) if (ret_val)
goto out; goto out;
/* /* Two bits in the Auto Negotiation Advertisement Register
* Two bits in the Auto Negotiation Advertisement Register
* (Address 4) and two bits in the Auto Negotiation Base * (Address 4) and two bits in the Auto Negotiation Base
* Page Ability Register (Address 5) determine flow control * Page Ability Register (Address 5) determine flow control
* for both the PHY and the link partner. The following * for both the PHY and the link partner. The following
...@@ -940,8 +914,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -940,8 +914,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
*/ */
if ((mii_nway_adv_reg & NWAY_AR_PAUSE) && if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) { (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) {
/* /* Now we need to check if the user selected RX ONLY
* Now we need to check if the user selected RX ONLY
* of pause frames. In this case, we had to advertise * of pause frames. In this case, we had to advertise
* FULL flow control because we could not advertise RX * FULL flow control because we could not advertise RX
* ONLY. Hence, we must now check to see if we need to * ONLY. Hence, we must now check to see if we need to
...@@ -956,8 +929,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -956,8 +929,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
"RX PAUSE frames only.\r\n"); "RX PAUSE frames only.\r\n");
} }
} }
/* /* For receiving PAUSE frames ONLY.
* For receiving PAUSE frames ONLY.
* *
* LOCAL DEVICE | LINK PARTNER * LOCAL DEVICE | LINK PARTNER
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
...@@ -971,8 +943,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -971,8 +943,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
hw->fc.current_mode = e1000_fc_tx_pause; hw->fc.current_mode = e1000_fc_tx_pause;
hw_dbg("Flow Control = TX PAUSE frames only.\r\n"); hw_dbg("Flow Control = TX PAUSE frames only.\r\n");
} }
/* /* For transmitting PAUSE frames ONLY.
* For transmitting PAUSE frames ONLY.
* *
* LOCAL DEVICE | LINK PARTNER * LOCAL DEVICE | LINK PARTNER
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
...@@ -986,8 +957,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -986,8 +957,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
hw->fc.current_mode = e1000_fc_rx_pause; hw->fc.current_mode = e1000_fc_rx_pause;
hw_dbg("Flow Control = RX PAUSE frames only.\r\n"); hw_dbg("Flow Control = RX PAUSE frames only.\r\n");
} }
/* /* Per the IEEE spec, at this point flow control should be
* Per the IEEE spec, at this point flow control should be
* disabled. However, we want to consider that we could * disabled. However, we want to consider that we could
* be connected to a legacy switch that doesn't advertise * be connected to a legacy switch that doesn't advertise
* desired flow control, but can be forced on the link * desired flow control, but can be forced on the link
...@@ -1007,9 +977,9 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -1007,9 +977,9 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
* be asked to delay transmission of packets than asking * be asked to delay transmission of packets than asking
* our link partner to pause transmission of frames. * our link partner to pause transmission of frames.
*/ */
else if ((hw->fc.requested_mode == e1000_fc_none || else if ((hw->fc.requested_mode == e1000_fc_none) ||
hw->fc.requested_mode == e1000_fc_tx_pause) || (hw->fc.requested_mode == e1000_fc_tx_pause) ||
hw->fc.strict_ieee) { (hw->fc.strict_ieee)) {
hw->fc.current_mode = e1000_fc_none; hw->fc.current_mode = e1000_fc_none;
hw_dbg("Flow Control = NONE.\r\n"); hw_dbg("Flow Control = NONE.\r\n");
} else { } else {
...@@ -1017,8 +987,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -1017,8 +987,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
hw_dbg("Flow Control = RX PAUSE frames only.\r\n"); hw_dbg("Flow Control = RX PAUSE frames only.\r\n");
} }
/* /* Now we need to do one last check... If we auto-
* Now we need to do one last check... If we auto-
* negotiated to HALF DUPLEX, flow control should not be * negotiated to HALF DUPLEX, flow control should not be
* enabled per IEEE 802.3 spec. * enabled per IEEE 802.3 spec.
*/ */
...@@ -1031,8 +1000,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) ...@@ -1031,8 +1000,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
if (duplex == HALF_DUPLEX) if (duplex == HALF_DUPLEX)
hw->fc.current_mode = e1000_fc_none; hw->fc.current_mode = e1000_fc_none;
/* /* Now we call a subroutine to actually force the MAC
* Now we call a subroutine to actually force the MAC
* controller to use the correct flow control settings. * controller to use the correct flow control settings.
*/ */
ret_val = igb_force_mac_fc(hw); ret_val = igb_force_mac_fc(hw);
...@@ -1203,6 +1171,17 @@ s32 igb_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, ...@@ -1203,6 +1171,17 @@ s32 igb_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed,
hw_dbg("Half Duplex\n"); hw_dbg("Half Duplex\n");
} }
/* Check if it is an I354 2.5Gb backplane connection. */
if (hw->mac.type == e1000_i354) {
if ((status & E1000_STATUS_2P5_SKU) &&
!(status & E1000_STATUS_2P5_SKU_OVER)) {
*speed = SPEED_2500;
*duplex = FULL_DUPLEX;
hw_dbg("2500 Mbs, ");
hw_dbg("Full Duplex\n");
}
}
return 0; return 0;
} }
...@@ -1427,8 +1406,7 @@ s32 igb_blink_led(struct e1000_hw *hw) ...@@ -1427,8 +1406,7 @@ s32 igb_blink_led(struct e1000_hw *hw)
u32 ledctl_blink = 0; u32 ledctl_blink = 0;
u32 i; u32 i;
/* /* set the blink bit for each LED that's "on" (0x0E)
* set the blink bit for each LED that's "on" (0x0E)
* in ledctl_mode2 * in ledctl_mode2
*/ */
ledctl_blink = hw->mac.ledctl_mode2; ledctl_blink = hw->mac.ledctl_mode2;
...@@ -1467,7 +1445,7 @@ s32 igb_led_off(struct e1000_hw *hw) ...@@ -1467,7 +1445,7 @@ s32 igb_led_off(struct e1000_hw *hw)
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* *
* Returns 0 (0) if successful, else returns -10 * Returns 0 (0) if successful, else returns -10
* (-E1000_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not casued * (-E1000_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not caused
* the master requests to be disabled. * the master requests to be disabled.
* *
* Disables PCI-Express master access and verifies there are no pending * Disables PCI-Express master access and verifies there are no pending
......
...@@ -35,8 +35,7 @@ ...@@ -35,8 +35,7 @@
#include "e1000_defines.h" #include "e1000_defines.h"
#include "e1000_i210.h" #include "e1000_i210.h"
/* /* Functions that should not be called directly from drivers but can be used
* Functions that should not be called directly from drivers but can be used
* by other files in this 'shared code' * by other files in this 'shared code'
*/ */
s32 igb_blink_led(struct e1000_hw *hw); s32 igb_blink_led(struct e1000_hw *hw);
......
...@@ -196,7 +196,8 @@ static s32 igb_poll_for_ack(struct e1000_hw *hw, u16 mbx_id) ...@@ -196,7 +196,8 @@ static s32 igb_poll_for_ack(struct e1000_hw *hw, u16 mbx_id)
* returns SUCCESS if it successfully received a message notification and * returns SUCCESS if it successfully received a message notification and
* copied it into the receive buffer. * copied it into the receive buffer.
**/ **/
static s32 igb_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) static s32 igb_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size,
u16 mbx_id)
{ {
struct e1000_mbx_info *mbx = &hw->mbx; struct e1000_mbx_info *mbx = &hw->mbx;
s32 ret_val = -E1000_ERR_MBX; s32 ret_val = -E1000_ERR_MBX;
...@@ -222,7 +223,8 @@ static s32 igb_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_ ...@@ -222,7 +223,8 @@ static s32 igb_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_
* returns SUCCESS if it successfully copied message into the buffer and * returns SUCCESS if it successfully copied message into the buffer and
* received an ack to that message within delay * timeout period * received an ack to that message within delay * timeout period
**/ **/
static s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) static s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size,
u16 mbx_id)
{ {
struct e1000_mbx_info *mbx = &hw->mbx; struct e1000_mbx_info *mbx = &hw->mbx;
s32 ret_val = -E1000_ERR_MBX; s32 ret_val = -E1000_ERR_MBX;
...@@ -325,7 +327,6 @@ static s32 igb_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number) ...@@ -325,7 +327,6 @@ static s32 igb_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
s32 ret_val = -E1000_ERR_MBX; s32 ret_val = -E1000_ERR_MBX;
u32 p2v_mailbox; u32 p2v_mailbox;
/* Take ownership of the buffer */ /* Take ownership of the buffer */
wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU); wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU);
......
...@@ -47,12 +47,12 @@ ...@@ -47,12 +47,12 @@
* PF. The reverse is true if it is E1000_PF_*. * PF. The reverse is true if it is E1000_PF_*.
* Message ACK's are the value or'd with 0xF0000000 * Message ACK's are the value or'd with 0xF0000000
*/ */
#define E1000_VT_MSGTYPE_ACK 0x80000000 /* Messages below or'd with /* Messages below or'd with this are the ACK */
* this are the ACK */ #define E1000_VT_MSGTYPE_ACK 0x80000000
#define E1000_VT_MSGTYPE_NACK 0x40000000 /* Messages below or'd with /* Messages below or'd with this are the NACK */
* this are the NACK */ #define E1000_VT_MSGTYPE_NACK 0x40000000
#define E1000_VT_MSGTYPE_CTS 0x20000000 /* Indicates that VF is still /* Indicates that VF is still clear to send requests */
clear to send requests */ #define E1000_VT_MSGTYPE_CTS 0x20000000
#define E1000_VT_MSGINFO_SHIFT 16 #define E1000_VT_MSGINFO_SHIFT 16
/* bits 23:16 are used for exra info for certain messages */ /* bits 23:16 are used for exra info for certain messages */
#define E1000_VT_MSGINFO_MASK (0xFF << E1000_VT_MSGINFO_SHIFT) #define E1000_VT_MSGINFO_MASK (0xFF << E1000_VT_MSGINFO_SHIFT)
......
...@@ -289,8 +289,7 @@ static s32 igb_ready_nvm_eeprom(struct e1000_hw *hw) ...@@ -289,8 +289,7 @@ static s32 igb_ready_nvm_eeprom(struct e1000_hw *hw)
udelay(1); udelay(1);
timeout = NVM_MAX_RETRY_SPI; timeout = NVM_MAX_RETRY_SPI;
/* /* Read "Status Register" repeatedly until the LSB is cleared.
* Read "Status Register" repeatedly until the LSB is cleared.
* The EEPROM will signal that the command has been completed * The EEPROM will signal that the command has been completed
* by clearing bit 0 of the internal status register. If it's * by clearing bit 0 of the internal status register. If it's
* not cleared within 'timeout', then error out. * not cleared within 'timeout', then error out.
...@@ -335,8 +334,7 @@ s32 igb_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) ...@@ -335,8 +334,7 @@ s32 igb_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
u16 word_in; u16 word_in;
u8 read_opcode = NVM_READ_OPCODE_SPI; u8 read_opcode = NVM_READ_OPCODE_SPI;
/* /* A check for invalid values: offset too large, too many words,
* A check for invalid values: offset too large, too many words,
* and not enough words. * and not enough words.
*/ */
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
...@@ -363,8 +361,7 @@ s32 igb_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) ...@@ -363,8 +361,7 @@ s32 igb_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
igb_shift_out_eec_bits(hw, read_opcode, nvm->opcode_bits); igb_shift_out_eec_bits(hw, read_opcode, nvm->opcode_bits);
igb_shift_out_eec_bits(hw, (u16)(offset*2), nvm->address_bits); igb_shift_out_eec_bits(hw, (u16)(offset*2), nvm->address_bits);
/* /* Read the data. SPI NVMs increment the address with each byte
* Read the data. SPI NVMs increment the address with each byte
* read and will roll over if reading beyond the end. This allows * read and will roll over if reading beyond the end. This allows
* us to read the whole NVM from any offset * us to read the whole NVM from any offset
*/ */
...@@ -395,8 +392,7 @@ s32 igb_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) ...@@ -395,8 +392,7 @@ s32 igb_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
u32 i, eerd = 0; u32 i, eerd = 0;
s32 ret_val = 0; s32 ret_val = 0;
/* /* A check for invalid values: offset too large, too many words,
* A check for invalid values: offset too large, too many words,
* and not enough words. * and not enough words.
*/ */
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
...@@ -441,8 +437,7 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) ...@@ -441,8 +437,7 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
s32 ret_val = -E1000_ERR_NVM; s32 ret_val = -E1000_ERR_NVM;
u16 widx = 0; u16 widx = 0;
/* /* A check for invalid values: offset too large, too many words,
* A check for invalid values: offset too large, too many words,
* and not enough words. * and not enough words.
*/ */
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
...@@ -472,8 +467,7 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) ...@@ -472,8 +467,7 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
igb_standby_nvm(hw); igb_standby_nvm(hw);
/* /* Some SPI eeproms use the 8th address bit embedded in the
* Some SPI eeproms use the 8th address bit embedded in the
* opcode * opcode
*/ */
if ((nvm->address_bits == 8) && (offset >= 128)) if ((nvm->address_bits == 8) && (offset >= 128))
...@@ -538,8 +532,7 @@ s32 igb_read_part_string(struct e1000_hw *hw, u8 *part_num, u32 part_num_size) ...@@ -538,8 +532,7 @@ s32 igb_read_part_string(struct e1000_hw *hw, u8 *part_num, u32 part_num_size)
goto out; goto out;
} }
/* /* if nvm_data is not ptr guard the PBA must be in legacy format which
* if nvm_data is not ptr guard the PBA must be in legacy format which
* means pointer is actually our second data word for the PBA number * means pointer is actually our second data word for the PBA number
* and we can decode it into an ascii string * and we can decode it into an ascii string
*/ */
...@@ -728,6 +721,7 @@ void igb_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers) ...@@ -728,6 +721,7 @@ void igb_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers)
case e1000_82575: case e1000_82575:
case e1000_82576: case e1000_82576:
case e1000_82580: case e1000_82580:
case e1000_i354:
case e1000_i350: case e1000_i350:
case e1000_i210: case e1000_i210:
break; break;
...@@ -746,6 +740,7 @@ void igb_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers) ...@@ -746,6 +740,7 @@ void igb_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers)
switch (hw->mac.type) { switch (hw->mac.type) {
case e1000_i210: case e1000_i210:
case e1000_i354:
case e1000_i350: case e1000_i350:
/* find combo image version */ /* find combo image version */
hw->nvm.ops.read(hw, NVM_COMB_VER_PTR, 1, &comb_offset); hw->nvm.ops.read(hw, NVM_COMB_VER_PTR, 1, &comb_offset);
......
...@@ -38,14 +38,14 @@ static s32 igb_wait_autoneg(struct e1000_hw *hw); ...@@ -38,14 +38,14 @@ static s32 igb_wait_autoneg(struct e1000_hw *hw);
static s32 igb_set_master_slave_mode(struct e1000_hw *hw); static s32 igb_set_master_slave_mode(struct e1000_hw *hw);
/* Cable length tables */ /* Cable length tables */
static const u16 e1000_m88_cable_length_table[] = static const u16 e1000_m88_cable_length_table[] = {
{ 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED }; 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED };
#define M88E1000_CABLE_LENGTH_TABLE_SIZE \ #define M88E1000_CABLE_LENGTH_TABLE_SIZE \
(sizeof(e1000_m88_cable_length_table) / \ (sizeof(e1000_m88_cable_length_table) / \
sizeof(e1000_m88_cable_length_table[0])) sizeof(e1000_m88_cable_length_table[0]))
static const u16 e1000_igp_2_cable_length_table[] = static const u16 e1000_igp_2_cable_length_table[] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21,
0, 0, 0, 3, 6, 10, 13, 16, 19, 23, 26, 29, 32, 35, 38, 41, 0, 0, 0, 3, 6, 10, 13, 16, 19, 23, 26, 29, 32, 35, 38, 41,
6, 10, 14, 18, 22, 26, 30, 33, 37, 41, 44, 48, 51, 54, 58, 61, 6, 10, 14, 18, 22, 26, 30, 33, 37, 41, 44, 48, 51, 54, 58, 61,
21, 26, 31, 35, 40, 44, 49, 53, 57, 61, 65, 68, 72, 75, 79, 82, 21, 26, 31, 35, 40, 44, 49, 53, 57, 61, 65, 68, 72, 75, 79, 82,
...@@ -71,8 +71,7 @@ s32 igb_check_reset_block(struct e1000_hw *hw) ...@@ -71,8 +71,7 @@ s32 igb_check_reset_block(struct e1000_hw *hw)
manc = rd32(E1000_MANC); manc = rd32(E1000_MANC);
return (manc & E1000_MANC_BLK_PHY_RST_ON_IDE) ? return (manc & E1000_MANC_BLK_PHY_RST_ON_IDE) ? E1000_BLK_PHY_RESET : 0;
E1000_BLK_PHY_RESET : 0;
} }
/** /**
...@@ -149,8 +148,7 @@ s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) ...@@ -149,8 +148,7 @@ s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
goto out; goto out;
} }
/* /* Set up Op-code, Phy Address, and register offset in the MDI
* Set up Op-code, Phy Address, and register offset in the MDI
* Control register. The MAC will take care of interfacing with the * Control register. The MAC will take care of interfacing with the
* PHY to retrieve the desired data. * PHY to retrieve the desired data.
*/ */
...@@ -160,8 +158,7 @@ s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) ...@@ -160,8 +158,7 @@ s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
wr32(E1000_MDIC, mdic); wr32(E1000_MDIC, mdic);
/* /* Poll the ready bit to see if the MDI read completed
* Poll the ready bit to see if the MDI read completed
* Increasing the time out as testing showed failures with * Increasing the time out as testing showed failures with
* the lower time out * the lower time out
*/ */
...@@ -207,8 +204,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) ...@@ -207,8 +204,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
goto out; goto out;
} }
/* /* Set up Op-code, Phy Address, and register offset in the MDI
* Set up Op-code, Phy Address, and register offset in the MDI
* Control register. The MAC will take care of interfacing with the * Control register. The MAC will take care of interfacing with the
* PHY to retrieve the desired data. * PHY to retrieve the desired data.
*/ */
...@@ -219,8 +215,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) ...@@ -219,8 +215,7 @@ s32 igb_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
wr32(E1000_MDIC, mdic); wr32(E1000_MDIC, mdic);
/* /* Poll the ready bit to see if the MDI read completed
* Poll the ready bit to see if the MDI read completed
* Increasing the time out as testing showed failures with * Increasing the time out as testing showed failures with
* the lower time out * the lower time out
*/ */
...@@ -259,9 +254,7 @@ s32 igb_read_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 *data) ...@@ -259,9 +254,7 @@ s32 igb_read_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 *data)
struct e1000_phy_info *phy = &hw->phy; struct e1000_phy_info *phy = &hw->phy;
u32 i, i2ccmd = 0; u32 i, i2ccmd = 0;
/* Set up Op-code, Phy Address, and register address in the I2CCMD
/*
* Set up Op-code, Phy Address, and register address in the I2CCMD
* register. The MAC will take care of interfacing with the * register. The MAC will take care of interfacing with the
* PHY to retrieve the desired data. * PHY to retrieve the desired data.
*/ */
...@@ -317,8 +310,7 @@ s32 igb_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data) ...@@ -317,8 +310,7 @@ s32 igb_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data)
/* Swap the data bytes for the I2C interface */ /* Swap the data bytes for the I2C interface */
phy_data_swapped = ((data >> 8) & 0x00FF) | ((data << 8) & 0xFF00); phy_data_swapped = ((data >> 8) & 0x00FF) | ((data << 8) & 0xFF00);
/* /* Set up Op-code, Phy Address, and register address in the I2CCMD
* Set up Op-code, Phy Address, and register address in the I2CCMD
* register. The MAC will take care of interfacing with the * register. The MAC will take care of interfacing with the
* PHY to retrieve the desired data. * PHY to retrieve the desired data.
*/ */
...@@ -439,7 +431,6 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw) ...@@ -439,7 +431,6 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw)
s32 ret_val; s32 ret_val;
u16 phy_data; u16 phy_data;
if (phy->reset_disable) { if (phy->reset_disable) {
ret_val = 0; ret_val = 0;
goto out; goto out;
...@@ -472,8 +463,7 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw) ...@@ -472,8 +463,7 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw)
if (ret_val) if (ret_val)
goto out; goto out;
phy_data &= ~I82580_PHY_CTRL2_MDIX_CFG_MASK; phy_data &= ~I82580_PHY_CTRL2_MDIX_CFG_MASK;
/* /* Options:
* Options:
* 0 - Auto (default) * 0 - Auto (default)
* 1 - MDI mode * 1 - MDI mode
* 2 - MDI-X mode * 2 - MDI-X mode
...@@ -520,8 +510,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw) ...@@ -520,8 +510,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw)
phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX;
/* /* Options:
* Options:
* MDI/MDI-X = 0 (default) * MDI/MDI-X = 0 (default)
* 0 - Auto for all speeds * 0 - Auto for all speeds
* 1 - MDI mode * 1 - MDI mode
...@@ -546,8 +535,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw) ...@@ -546,8 +535,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw)
break; break;
} }
/* /* Options:
* Options:
* disable_polarity_correction = 0 (default) * disable_polarity_correction = 0 (default)
* Automatic Correction for Reversed Cable Polarity * Automatic Correction for Reversed Cable Polarity
* 0 - Disabled * 0 - Disabled
...@@ -562,8 +550,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw) ...@@ -562,8 +550,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw)
goto out; goto out;
if (phy->revision < E1000_REVISION_4) { if (phy->revision < E1000_REVISION_4) {
/* /* Force TX_CLK in the Extended PHY Specific Control Register
* Force TX_CLK in the Extended PHY Specific Control Register
* to 25MHz clock. * to 25MHz clock.
*/ */
ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL,
...@@ -630,8 +617,7 @@ s32 igb_copper_link_setup_m88_gen2(struct e1000_hw *hw) ...@@ -630,8 +617,7 @@ s32 igb_copper_link_setup_m88_gen2(struct e1000_hw *hw)
if (ret_val) if (ret_val)
goto out; goto out;
/* /* Options:
* Options:
* MDI/MDI-X = 0 (default) * MDI/MDI-X = 0 (default)
* 0 - Auto for all speeds * 0 - Auto for all speeds
* 1 - MDI mode * 1 - MDI mode
...@@ -659,8 +645,7 @@ s32 igb_copper_link_setup_m88_gen2(struct e1000_hw *hw) ...@@ -659,8 +645,7 @@ s32 igb_copper_link_setup_m88_gen2(struct e1000_hw *hw)
break; break;
} }
/* /* Options:
* Options:
* disable_polarity_correction = 0 (default) * disable_polarity_correction = 0 (default)
* Automatic Correction for Reversed Cable Polarity * Automatic Correction for Reversed Cable Polarity
* 0 - Disabled * 0 - Disabled
...@@ -714,14 +699,12 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw) ...@@ -714,14 +699,12 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
goto out; goto out;
} }
/* /* Wait 100ms for MAC to configure PHY from NVM settings, to avoid
* Wait 100ms for MAC to configure PHY from NVM settings, to avoid
* timeout issues when LFS is enabled. * timeout issues when LFS is enabled.
*/ */
msleep(100); msleep(100);
/* /* The NVM settings will configure LPLU in D3 for
* The NVM settings will configure LPLU in D3 for
* non-IGP1 PHYs. * non-IGP1 PHYs.
*/ */
if (phy->type == e1000_phy_igp) { if (phy->type == e1000_phy_igp) {
...@@ -765,8 +748,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw) ...@@ -765,8 +748,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
/* set auto-master slave resolution settings */ /* set auto-master slave resolution settings */
if (hw->mac.autoneg) { if (hw->mac.autoneg) {
/* /* when autonegotiation advertisement is only 1000Mbps then we
* when autonegotiation advertisement is only 1000Mbps then we
* should disable SmartSpeed and enable Auto MasterSlave * should disable SmartSpeed and enable Auto MasterSlave
* resolution as hardware default. * resolution as hardware default.
*/ */
...@@ -844,14 +826,12 @@ static s32 igb_copper_link_autoneg(struct e1000_hw *hw) ...@@ -844,14 +826,12 @@ static s32 igb_copper_link_autoneg(struct e1000_hw *hw)
s32 ret_val; s32 ret_val;
u16 phy_ctrl; u16 phy_ctrl;
/* /* Perform some bounds checking on the autoneg advertisement
* Perform some bounds checking on the autoneg advertisement
* parameter. * parameter.
*/ */
phy->autoneg_advertised &= phy->autoneg_mask; phy->autoneg_advertised &= phy->autoneg_mask;
/* /* If autoneg_advertised is zero, we assume it was not defaulted
* If autoneg_advertised is zero, we assume it was not defaulted
* by the calling code so we set to advertise full capability. * by the calling code so we set to advertise full capability.
*/ */
if (phy->autoneg_advertised == 0) if (phy->autoneg_advertised == 0)
...@@ -865,8 +845,7 @@ static s32 igb_copper_link_autoneg(struct e1000_hw *hw) ...@@ -865,8 +845,7 @@ static s32 igb_copper_link_autoneg(struct e1000_hw *hw)
} }
hw_dbg("Restarting Auto-Neg\n"); hw_dbg("Restarting Auto-Neg\n");
/* /* Restart auto-negotiation by setting the Auto Neg Enable bit and
* Restart auto-negotiation by setting the Auto Neg Enable bit and
* the Auto Neg Restart bit in the PHY control register. * the Auto Neg Restart bit in the PHY control register.
*/ */
ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl);
...@@ -878,8 +857,7 @@ static s32 igb_copper_link_autoneg(struct e1000_hw *hw) ...@@ -878,8 +857,7 @@ static s32 igb_copper_link_autoneg(struct e1000_hw *hw)
if (ret_val) if (ret_val)
goto out; goto out;
/* /* Does the user want to wait for Auto-Neg to complete here, or
* Does the user want to wait for Auto-Neg to complete here, or
* check at a later time (for example, callback routine). * check at a later time (for example, callback routine).
*/ */
if (phy->autoneg_wait_to_complete) { if (phy->autoneg_wait_to_complete) {
...@@ -928,16 +906,14 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -928,16 +906,14 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
goto out; goto out;
} }
/* /* Need to parse both autoneg_advertised and fc and set up
* Need to parse both autoneg_advertised and fc and set up
* the appropriate PHY registers. First we will parse for * the appropriate PHY registers. First we will parse for
* autoneg_advertised software override. Since we can advertise * autoneg_advertised software override. Since we can advertise
* a plethora of combinations, we need to check each bit * a plethora of combinations, we need to check each bit
* individually. * individually.
*/ */
/* /* First we clear all the 10/100 mb speed bits in the Auto-Neg
* First we clear all the 10/100 mb speed bits in the Auto-Neg
* Advertisement Register (Address 4) and the 1000 mb speed bits in * Advertisement Register (Address 4) and the 1000 mb speed bits in
* the 1000Base-T Control Register (Address 9). * the 1000Base-T Control Register (Address 9).
*/ */
...@@ -983,8 +959,7 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -983,8 +959,7 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS;
} }
/* /* Check for a software override of the flow control settings, and
* Check for a software override of the flow control settings, and
* setup the PHY advertisement registers accordingly. If * setup the PHY advertisement registers accordingly. If
* auto-negotiation is enabled, then software will have to set the * auto-negotiation is enabled, then software will have to set the
* "PAUSE" bits to the correct value in the Auto-Negotiation * "PAUSE" bits to the correct value in the Auto-Negotiation
...@@ -1003,15 +978,13 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -1003,15 +978,13 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
*/ */
switch (hw->fc.current_mode) { switch (hw->fc.current_mode) {
case e1000_fc_none: case e1000_fc_none:
/* /* Flow control (RX & TX) is completely disabled by a
* Flow control (RX & TX) is completely disabled by a
* software over-ride. * software over-ride.
*/ */
mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
break; break;
case e1000_fc_rx_pause: case e1000_fc_rx_pause:
/* /* RX Flow control is enabled, and TX Flow control is
* RX Flow control is enabled, and TX Flow control is
* disabled, by a software over-ride. * disabled, by a software over-ride.
* *
* Since there really isn't a way to advertise that we are * Since there really isn't a way to advertise that we are
...@@ -1023,16 +996,14 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -1023,16 +996,14 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
break; break;
case e1000_fc_tx_pause: case e1000_fc_tx_pause:
/* /* TX Flow control is enabled, and RX Flow control is
* TX Flow control is enabled, and RX Flow control is
* disabled, by a software over-ride. * disabled, by a software over-ride.
*/ */
mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR; mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR;
mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE; mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE;
break; break;
case e1000_fc_full: case e1000_fc_full:
/* /* Flow control (both RX and TX) is enabled by a software
* Flow control (both RX and TX) is enabled by a software
* over-ride. * over-ride.
*/ */
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
...@@ -1075,18 +1046,15 @@ s32 igb_setup_copper_link(struct e1000_hw *hw) ...@@ -1075,18 +1046,15 @@ s32 igb_setup_copper_link(struct e1000_hw *hw)
s32 ret_val; s32 ret_val;
bool link; bool link;
if (hw->mac.autoneg) { if (hw->mac.autoneg) {
/* /* Setup autoneg and flow control advertisement and perform
* Setup autoneg and flow control advertisement and perform
* autonegotiation. * autonegotiation.
*/ */
ret_val = igb_copper_link_autoneg(hw); ret_val = igb_copper_link_autoneg(hw);
if (ret_val) if (ret_val)
goto out; goto out;
} else { } else {
/* /* PHY will be set to 10H, 10F, 100H or 100F
* PHY will be set to 10H, 10F, 100H or 100F
* depending on user settings. * depending on user settings.
*/ */
hw_dbg("Forcing Speed and Duplex\n"); hw_dbg("Forcing Speed and Duplex\n");
...@@ -1097,14 +1065,10 @@ s32 igb_setup_copper_link(struct e1000_hw *hw) ...@@ -1097,14 +1065,10 @@ s32 igb_setup_copper_link(struct e1000_hw *hw)
} }
} }
/* /* Check link status. Wait up to 100 microseconds for link to become
* Check link status. Wait up to 100 microseconds for link to become
* valid. * valid.
*/ */
ret_val = igb_phy_has_link(hw, ret_val = igb_phy_has_link(hw, COPPER_LINK_UP_LIMIT, 10, &link);
COPPER_LINK_UP_LIMIT,
10,
&link);
if (ret_val) if (ret_val)
goto out; goto out;
...@@ -1145,8 +1109,7 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw) ...@@ -1145,8 +1109,7 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw)
if (ret_val) if (ret_val)
goto out; goto out;
/* /* Clear Auto-Crossover to force MDI manually. IGP requires MDI
* Clear Auto-Crossover to force MDI manually. IGP requires MDI
* forced whenever speed and duplex are forced. * forced whenever speed and duplex are forced.
*/ */
ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data);
...@@ -1167,10 +1130,7 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw) ...@@ -1167,10 +1130,7 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw)
if (phy->autoneg_wait_to_complete) { if (phy->autoneg_wait_to_complete) {
hw_dbg("Waiting for forced speed/duplex link on IGP phy.\n"); hw_dbg("Waiting for forced speed/duplex link on IGP phy.\n");
ret_val = igb_phy_has_link(hw, ret_val = igb_phy_has_link(hw, PHY_FORCE_LIMIT, 100000, &link);
PHY_FORCE_LIMIT,
100000,
&link);
if (ret_val) if (ret_val)
goto out; goto out;
...@@ -1178,10 +1138,7 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw) ...@@ -1178,10 +1138,7 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw)
hw_dbg("Link taking longer than expected.\n"); hw_dbg("Link taking longer than expected.\n");
/* Try once more */ /* Try once more */
ret_val = igb_phy_has_link(hw, ret_val = igb_phy_has_link(hw, PHY_FORCE_LIMIT, 100000, &link);
PHY_FORCE_LIMIT,
100000,
&link);
if (ret_val) if (ret_val)
goto out; goto out;
} }
...@@ -1209,8 +1166,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw) ...@@ -1209,8 +1166,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
/* I210 and I211 devices support Auto-Crossover in forced operation. */ /* I210 and I211 devices support Auto-Crossover in forced operation. */
if (phy->type != e1000_phy_i210) { if (phy->type != e1000_phy_i210) {
/* /* Clear Auto-Crossover to force MDI manually. M88E1000
* Clear Auto-Crossover to force MDI manually. M88E1000
* requires MDI forced whenever speed and duplex are forced. * requires MDI forced whenever speed and duplex are forced.
*/ */
ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL,
...@@ -1266,8 +1222,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw) ...@@ -1266,8 +1222,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
if (!reset_dsp) if (!reset_dsp)
hw_dbg("Link taking longer than expected.\n"); hw_dbg("Link taking longer than expected.\n");
else { else {
/* /* We didn't get link.
* We didn't get link.
* Reset the DSP and cross our fingers. * Reset the DSP and cross our fingers.
*/ */
ret_val = phy->ops.write_reg(hw, ret_val = phy->ops.write_reg(hw,
...@@ -1298,8 +1253,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw) ...@@ -1298,8 +1253,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
if (ret_val) if (ret_val)
goto out; goto out;
/* /* Resetting the phy means we need to re-force TX_CLK in the
* Resetting the phy means we need to re-force TX_CLK in the
* Extended PHY Specific Control Register to 25MHz clock from * Extended PHY Specific Control Register to 25MHz clock from
* the reset value of 2.5MHz. * the reset value of 2.5MHz.
*/ */
...@@ -1308,8 +1262,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw) ...@@ -1308,8 +1262,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
if (ret_val) if (ret_val)
goto out; goto out;
/* /* In addition, we must re-enable CRS on Tx for both half and full
* In addition, we must re-enable CRS on Tx for both half and full
* duplex. * duplex.
*/ */
ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
...@@ -1417,8 +1370,7 @@ s32 igb_set_d3_lplu_state(struct e1000_hw *hw, bool active) ...@@ -1417,8 +1370,7 @@ s32 igb_set_d3_lplu_state(struct e1000_hw *hw, bool active)
data); data);
if (ret_val) if (ret_val)
goto out; goto out;
/* /* LPLU and SmartSpeed are mutually exclusive. LPLU is used
* LPLU and SmartSpeed are mutually exclusive. LPLU is used
* during Dx states where the power conservation is most * during Dx states where the power conservation is most
* important. During driver activity we should enable * important. During driver activity we should enable
* SmartSpeed, so performance is maintained. * SmartSpeed, so performance is maintained.
...@@ -1556,8 +1508,7 @@ static s32 igb_check_polarity_igp(struct e1000_hw *hw) ...@@ -1556,8 +1508,7 @@ static s32 igb_check_polarity_igp(struct e1000_hw *hw)
s32 ret_val; s32 ret_val;
u16 data, offset, mask; u16 data, offset, mask;
/* /* Polarity is determined based on the speed of
* Polarity is determined based on the speed of
* our connection. * our connection.
*/ */
ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data); ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data);
...@@ -1569,8 +1520,7 @@ static s32 igb_check_polarity_igp(struct e1000_hw *hw) ...@@ -1569,8 +1520,7 @@ static s32 igb_check_polarity_igp(struct e1000_hw *hw)
offset = IGP01E1000_PHY_PCS_INIT_REG; offset = IGP01E1000_PHY_PCS_INIT_REG;
mask = IGP01E1000_PHY_POLARITY_MASK; mask = IGP01E1000_PHY_POLARITY_MASK;
} else { } else {
/* /* This really only applies to 10Mbps since
* This really only applies to 10Mbps since
* there is no polarity for 100Mbps (always 0). * there is no polarity for 100Mbps (always 0).
*/ */
offset = IGP01E1000_PHY_PORT_STATUS; offset = IGP01E1000_PHY_PORT_STATUS;
...@@ -1589,7 +1539,7 @@ static s32 igb_check_polarity_igp(struct e1000_hw *hw) ...@@ -1589,7 +1539,7 @@ static s32 igb_check_polarity_igp(struct e1000_hw *hw)
} }
/** /**
* igb_wait_autoneg - Wait for auto-neg compeletion * igb_wait_autoneg - Wait for auto-neg completion
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* *
* Waits for auto-negotiation to complete or for the auto-negotiation time * Waits for auto-negotiation to complete or for the auto-negotiation time
...@@ -1613,8 +1563,7 @@ static s32 igb_wait_autoneg(struct e1000_hw *hw) ...@@ -1613,8 +1563,7 @@ static s32 igb_wait_autoneg(struct e1000_hw *hw)
msleep(100); msleep(100);
} }
/* /* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation
* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation
* has completed. * has completed.
*/ */
return ret_val; return ret_val;
...@@ -1636,15 +1585,13 @@ s32 igb_phy_has_link(struct e1000_hw *hw, u32 iterations, ...@@ -1636,15 +1585,13 @@ s32 igb_phy_has_link(struct e1000_hw *hw, u32 iterations,
u16 i, phy_status; u16 i, phy_status;
for (i = 0; i < iterations; i++) { for (i = 0; i < iterations; i++) {
/* /* Some PHYs require the PHY_STATUS register to be read
* Some PHYs require the PHY_STATUS register to be read
* twice due to the link bit being sticky. No harm doing * twice due to the link bit being sticky. No harm doing
* it across the board. * it across the board.
*/ */
ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
if (ret_val) { if (ret_val) {
/* /* If the first read fails, another entity may have
* If the first read fails, another entity may have
* ownership of the resources, wait and try again to * ownership of the resources, wait and try again to
* see if they have relinquished the resources yet. * see if they have relinquished the resources yet.
*/ */
...@@ -1735,6 +1682,7 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw) ...@@ -1735,6 +1682,7 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw)
phy->max_cable_length = phy_data / (is_cm ? 100 : 1); phy->max_cable_length = phy_data / (is_cm ? 100 : 1);
phy->cable_length = phy_data / (is_cm ? 100 : 1); phy->cable_length = phy_data / (is_cm ? 100 : 1);
break; break;
case M88E1545_E_PHY_ID:
case I347AT4_E_PHY_ID: case I347AT4_E_PHY_ID:
/* Remember the original page select and set it to 7 */ /* Remember the original page select and set it to 7 */
ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT, ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT,
...@@ -1846,8 +1794,7 @@ s32 igb_get_cable_length_igp_2(struct e1000_hw *hw) ...@@ -1846,8 +1794,7 @@ s32 igb_get_cable_length_igp_2(struct e1000_hw *hw)
if (ret_val) if (ret_val)
goto out; goto out;
/* /* Getting bits 15:9, which represent the combination of
* Getting bits 15:9, which represent the combination of
* coarse and fine gain values. The result is a number * coarse and fine gain values. The result is a number
* that can be put into the lookup table to obtain the * that can be put into the lookup table to obtain the
* approximate cable length. * approximate cable length.
...@@ -2167,15 +2114,13 @@ s32 igb_phy_init_script_igp3(struct e1000_hw *hw) ...@@ -2167,15 +2114,13 @@ s32 igb_phy_init_script_igp3(struct e1000_hw *hw)
hw->phy.ops.write_reg(hw, 0x1796, 0x0008); hw->phy.ops.write_reg(hw, 0x1796, 0x0008);
/* Change cg_icount + enable integbp for channels BCD */ /* Change cg_icount + enable integbp for channels BCD */
hw->phy.ops.write_reg(hw, 0x1798, 0xD008); hw->phy.ops.write_reg(hw, 0x1798, 0xD008);
/* /* Change cg_icount + enable integbp + change prop_factor_master
* Change cg_icount + enable integbp + change prop_factor_master
* to 8 for channel A * to 8 for channel A
*/ */
hw->phy.ops.write_reg(hw, 0x1898, 0xD918); hw->phy.ops.write_reg(hw, 0x1898, 0xD918);
/* Disable AHT in Slave mode on channel A */ /* Disable AHT in Slave mode on channel A */
hw->phy.ops.write_reg(hw, 0x187A, 0x0800); hw->phy.ops.write_reg(hw, 0x187A, 0x0800);
/* /* Enable LPLU and disable AN to 1000 in non-D0a states,
* Enable LPLU and disable AN to 1000 in non-D0a states,
* Enable SPD+B2B * Enable SPD+B2B
*/ */
hw->phy.ops.write_reg(hw, 0x0019, 0x008D); hw->phy.ops.write_reg(hw, 0x0019, 0x008D);
...@@ -2278,7 +2223,6 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw) ...@@ -2278,7 +2223,6 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw)
u16 phy_data; u16 phy_data;
bool link; bool link;
ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data); ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data);
if (ret_val) if (ret_val)
goto out; goto out;
...@@ -2289,8 +2233,7 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw) ...@@ -2289,8 +2233,7 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw)
if (ret_val) if (ret_val)
goto out; goto out;
/* /* Clear Auto-Crossover to force MDI manually. 82580 requires MDI
* Clear Auto-Crossover to force MDI manually. 82580 requires MDI
* forced whenever speed and duplex are forced. * forced whenever speed and duplex are forced.
*/ */
ret_val = phy->ops.read_reg(hw, I82580_PHY_CTRL_2, &phy_data); ret_val = phy->ops.read_reg(hw, I82580_PHY_CTRL_2, &phy_data);
...@@ -2310,10 +2253,7 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw) ...@@ -2310,10 +2253,7 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw)
if (phy->autoneg_wait_to_complete) { if (phy->autoneg_wait_to_complete) {
hw_dbg("Waiting for forced speed/duplex link on 82580 phy\n"); hw_dbg("Waiting for forced speed/duplex link on 82580 phy\n");
ret_val = igb_phy_has_link(hw, ret_val = igb_phy_has_link(hw, PHY_FORCE_LIMIT, 100000, &link);
PHY_FORCE_LIMIT,
100000,
&link);
if (ret_val) if (ret_val)
goto out; goto out;
...@@ -2321,10 +2261,7 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw) ...@@ -2321,10 +2261,7 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw)
hw_dbg("Link taking longer than expected.\n"); hw_dbg("Link taking longer than expected.\n");
/* Try once more */ /* Try once more */
ret_val = igb_phy_has_link(hw, ret_val = igb_phy_has_link(hw, PHY_FORCE_LIMIT, 100000, &link);
PHY_FORCE_LIMIT,
100000,
&link);
if (ret_val) if (ret_val)
goto out; goto out;
} }
...@@ -2349,7 +2286,6 @@ s32 igb_get_phy_info_82580(struct e1000_hw *hw) ...@@ -2349,7 +2286,6 @@ s32 igb_get_phy_info_82580(struct e1000_hw *hw)
u16 data; u16 data;
bool link; bool link;
ret_val = igb_phy_has_link(hw, 1, 0, &link); ret_val = igb_phy_has_link(hw, 1, 0, &link);
if (ret_val) if (ret_val)
goto out; goto out;
...@@ -2412,7 +2348,6 @@ s32 igb_get_cable_length_82580(struct e1000_hw *hw) ...@@ -2412,7 +2348,6 @@ s32 igb_get_cable_length_82580(struct e1000_hw *hw)
s32 ret_val; s32 ret_val;
u16 phy_data, length; u16 phy_data, length;
ret_val = phy->ops.read_reg(hw, I82580_PHY_DIAG_STATUS, &phy_data); ret_val = phy->ops.read_reg(hw, I82580_PHY_DIAG_STATUS, &phy_data);
if (ret_val) if (ret_val)
goto out; goto out;
......
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#define E1000_TIPG 0x00410 /* TX Inter-packet gap -RW */ #define E1000_TIPG 0x00410 /* TX Inter-packet gap -RW */
#define E1000_AIT 0x00458 /* Adaptive Interframe Spacing Throttle - RW */ #define E1000_AIT 0x00458 /* Adaptive Interframe Spacing Throttle - RW */
#define E1000_LEDCTL 0x00E00 /* LED Control - RW */ #define E1000_LEDCTL 0x00E00 /* LED Control - RW */
#define E1000_LEDMUX 0x08130 /* LED MUX Control */
#define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */ #define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */
#define E1000_PBS 0x01008 /* Packet Buffer Size */ #define E1000_PBS 0x01008 /* Packet Buffer Size */
#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
...@@ -83,6 +84,9 @@ ...@@ -83,6 +84,9 @@
#define E1000_I2C_DATA_IN 0x00001000 /* I2C- Data In */ #define E1000_I2C_DATA_IN 0x00001000 /* I2C- Data In */
#define E1000_I2C_CLK_OE_N 0x00002000 /* I2C- Clock Output Enable */ #define E1000_I2C_CLK_OE_N 0x00002000 /* I2C- Clock Output Enable */
#define E1000_I2C_CLK_IN 0x00004000 /* I2C- Clock In */ #define E1000_I2C_CLK_IN 0x00004000 /* I2C- Clock In */
#define E1000_MPHY_ADDR_CTRL 0x0024 /* GbE MPHY Address Control */
#define E1000_MPHY_DATA 0x0E10 /* GBE MPHY Data */
#define E1000_MPHY_STAT 0x0E0C /* GBE MPHY Statistics */
/* IEEE 1588 TIMESYNCH */ /* IEEE 1588 TIMESYNCH */
#define E1000_TSYNCRXCTL 0x0B620 /* Rx Time Sync Control register - RW */ #define E1000_TSYNCRXCTL 0x0B620 /* Rx Time Sync Control register - RW */
...@@ -140,8 +144,7 @@ ...@@ -140,8 +144,7 @@
#define E1000_THHIGHTC 0x0810C /* High Threshold Control */ #define E1000_THHIGHTC 0x0810C /* High Threshold Control */
#define E1000_THSTAT 0x08110 /* Thermal Sensor Status */ #define E1000_THSTAT 0x08110 /* Thermal Sensor Status */
/* /* Convenience macros
* Convenience macros
* *
* Note: "_n" is the queue number of the register to be written to. * Note: "_n" is the queue number of the register to be written to.
* *
...@@ -287,7 +290,7 @@ ...@@ -287,7 +290,7 @@
#define E1000_RFCTL 0x05008 /* Receive Filter Control*/ #define E1000_RFCTL 0x05008 /* Receive Filter Control*/
#define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ #define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */
#define E1000_RA 0x05400 /* Receive Address - RW Array */ #define E1000_RA 0x05400 /* Receive Address - RW Array */
#define E1000_RA2 0x054E0 /* 2nd half of receive address array - RW Array */ #define E1000_RA2 0x054E0 /* 2nd half of Rx address array - RW Array */
#define E1000_PSRTYPE(_i) (0x05480 + ((_i) * 4)) #define E1000_PSRTYPE(_i) (0x05480 + ((_i) * 4))
#define E1000_RAL(_i) (((_i) <= 15) ? (0x05400 + ((_i) * 8)) : \ #define E1000_RAL(_i) (((_i) <= 15) ? (0x05400 + ((_i) * 8)) : \
(0x054E0 + ((_i - 16) * 8))) (0x054E0 + ((_i - 16) * 8)))
...@@ -366,6 +369,10 @@ ...@@ -366,6 +369,10 @@
#define E1000_IPCNFG 0x0E38 /* Internal PHY Configuration */ #define E1000_IPCNFG 0x0E38 /* Internal PHY Configuration */
#define E1000_EEER 0x0E30 /* Energy Efficient Ethernet */ #define E1000_EEER 0x0E30 /* Energy Efficient Ethernet */
#define E1000_EEE_SU 0X0E34 /* EEE Setup */ #define E1000_EEE_SU 0X0E34 /* EEE Setup */
#define E1000_EMIADD 0x10 /* Extended Memory Indirect Address */
#define E1000_EMIDATA 0x11 /* Extended Memory Indirect Data */
#define E1000_MMDAC 13 /* MMD Access Control */
#define E1000_MMDAAD 14 /* MMD Access Address/Data */
/* Thermal Sensor Register */ /* Thermal Sensor Register */
#define E1000_THSTAT 0x08110 /* Thermal Sensor Status */ #define E1000_THSTAT 0x08110 /* Thermal Sensor Status */
......
...@@ -103,6 +103,7 @@ struct vf_data_storage { ...@@ -103,6 +103,7 @@ struct vf_data_storage {
u16 pf_vlan; /* When set, guest VLAN config not allowed. */ u16 pf_vlan; /* When set, guest VLAN config not allowed. */
u16 pf_qos; u16 pf_qos;
u16 tx_rate; u16 tx_rate;
bool spoofchk_enabled;
}; };
#define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */ #define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */
...@@ -121,9 +122,9 @@ struct vf_data_storage { ...@@ -121,9 +122,9 @@ struct vf_data_storage {
* descriptors until either it has this many to write back, or the * descriptors until either it has this many to write back, or the
* ITR timer expires. * ITR timer expires.
*/ */
#define IGB_RX_PTHRESH 8 #define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : 8)
#define IGB_RX_HTHRESH 8 #define IGB_RX_HTHRESH 8
#define IGB_TX_PTHRESH 8 #define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8)
#define IGB_TX_HTHRESH 1 #define IGB_TX_HTHRESH 1
#define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \ #define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \
adapter->msix_entries) ? 1 : 4) adapter->msix_entries) ? 1 : 4)
...@@ -167,8 +168,7 @@ enum igb_tx_flags { ...@@ -167,8 +168,7 @@ enum igb_tx_flags {
#define IGB_TX_FLAGS_VLAN_MASK 0xffff0000 #define IGB_TX_FLAGS_VLAN_MASK 0xffff0000
#define IGB_TX_FLAGS_VLAN_SHIFT 16 #define IGB_TX_FLAGS_VLAN_SHIFT 16
/* /* The largest size we can write to the descriptor is 65535. In order to
* The largest size we can write to the descriptor is 65535. In order to
* maintain a power of two alignment we have to limit ourselves to 32K. * maintain a power of two alignment we have to limit ourselves to 32K.
*/ */
#define IGB_MAX_TXD_PWR 15 #define IGB_MAX_TXD_PWR 15
...@@ -178,8 +178,17 @@ enum igb_tx_flags { ...@@ -178,8 +178,17 @@ enum igb_tx_flags {
#define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IGB_MAX_DATA_PER_TXD) #define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IGB_MAX_DATA_PER_TXD)
#define DESC_NEEDED (MAX_SKB_FRAGS + 4) #define DESC_NEEDED (MAX_SKB_FRAGS + 4)
/* EEPROM byte offsets */
#define IGB_SFF_8472_SWAP 0x5C
#define IGB_SFF_8472_COMP 0x5E
/* Bitmasks */
#define IGB_SFF_ADDRESSING_MODE 0x4
#define IGB_SFF_8472_UNSUP 0x00
/* wrapper around a pointer to a socket buffer, /* wrapper around a pointer to a socket buffer,
* so a DMA handle can be stored along with the buffer */ * so a DMA handle can be stored along with the buffer
*/
struct igb_tx_buffer { struct igb_tx_buffer {
union e1000_adv_tx_desc *next_to_watch; union e1000_adv_tx_desc *next_to_watch;
unsigned long time_stamp; unsigned long time_stamp;
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/mdio.h>
#include "igb.h" #include "igb.h"
...@@ -178,44 +179,67 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -178,44 +179,67 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ecmd->port = PORT_TP; ecmd->port = PORT_TP;
ecmd->phy_address = hw->phy.addr; ecmd->phy_address = hw->phy.addr;
ecmd->transceiver = XCVR_INTERNAL;
} else { } else {
ecmd->supported = (SUPPORTED_1000baseT_Full | ecmd->supported = (SUPPORTED_1000baseT_Full |
SUPPORTED_100baseT_Full |
SUPPORTED_FIBRE | SUPPORTED_FIBRE |
SUPPORTED_Autoneg); SUPPORTED_Autoneg |
SUPPORTED_Pause);
if (hw->mac.type == e1000_i354)
ecmd->supported |= SUPPORTED_2500baseX_Full;
ecmd->advertising = (ADVERTISED_1000baseT_Full | ecmd->advertising = ADVERTISED_FIBRE;
ADVERTISED_FIBRE |
ADVERTISED_Autoneg |
ADVERTISED_Pause);
ecmd->port = PORT_FIBRE; switch (adapter->link_speed) {
case SPEED_2500:
ecmd->advertising = ADVERTISED_2500baseX_Full;
break;
case SPEED_1000:
ecmd->advertising = ADVERTISED_1000baseT_Full;
break;
case SPEED_100:
ecmd->advertising = ADVERTISED_100baseT_Full;
break;
default:
break;
} }
ecmd->transceiver = XCVR_INTERNAL; if (hw->mac.autoneg == 1)
ecmd->advertising |= ADVERTISED_Autoneg;
ecmd->port = PORT_FIBRE;
ecmd->transceiver = XCVR_EXTERNAL;
}
status = rd32(E1000_STATUS); status = rd32(E1000_STATUS);
if (status & E1000_STATUS_LU) { if (status & E1000_STATUS_LU) {
if ((hw->mac.type == e1000_i354) &&
if ((status & E1000_STATUS_SPEED_1000) || (status & E1000_STATUS_2P5_SKU) &&
hw->phy.media_type != e1000_media_type_copper) !(status & E1000_STATUS_2P5_SKU_OVER))
ethtool_cmd_speed_set(ecmd, SPEED_1000); ecmd->speed = SPEED_2500;
else if (status & E1000_STATUS_SPEED_1000)
ecmd->speed = SPEED_1000;
else if (status & E1000_STATUS_SPEED_100) else if (status & E1000_STATUS_SPEED_100)
ethtool_cmd_speed_set(ecmd, SPEED_100); ecmd->speed = SPEED_100;
else else
ethtool_cmd_speed_set(ecmd, SPEED_10); ecmd->speed = SPEED_10;
if ((status & E1000_STATUS_FD) || if ((status & E1000_STATUS_FD) ||
hw->phy.media_type != e1000_media_type_copper) hw->phy.media_type != e1000_media_type_copper)
ecmd->duplex = DUPLEX_FULL; ecmd->duplex = DUPLEX_FULL;
else else
ecmd->duplex = DUPLEX_HALF; ecmd->duplex = DUPLEX_HALF;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ecmd->speed = -1;
ecmd->duplex = -1; ecmd->duplex = -1;
} }
ecmd->autoneg = hw->mac.autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE; if ((hw->phy.media_type == e1000_media_type_fiber) ||
hw->mac.autoneg)
ecmd->autoneg = AUTONEG_ENABLE;
else
ecmd->autoneg = AUTONEG_DISABLE;
/* MDI-X => 2; MDI =>1; Invalid =>0 */ /* MDI-X => 2; MDI =>1; Invalid =>0 */
if (hw->phy.media_type == e1000_media_type_copper) if (hw->phy.media_type == e1000_media_type_copper)
...@@ -238,15 +262,15 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -238,15 +262,15 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
/* When SoL/IDER sessions are active, autoneg/speed/duplex /* When SoL/IDER sessions are active, autoneg/speed/duplex
* cannot be changed */ * cannot be changed
*/
if (igb_check_reset_block(hw)) { if (igb_check_reset_block(hw)) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"Cannot change link characteristics when SoL/IDER is active.\n"); "Cannot change link characteristics when SoL/IDER is active.\n");
return -EINVAL; return -EINVAL;
} }
/* /* MDI setting is only allowed when autoneg enabled because
* MDI setting is only allowed when autoneg enabled because
* some hardware doesn't allow MDI setting when speed or * some hardware doesn't allow MDI setting when speed or
* duplex is forced. * duplex is forced.
*/ */
...@@ -266,9 +290,31 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -266,9 +290,31 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
if (ecmd->autoneg == AUTONEG_ENABLE) { if (ecmd->autoneg == AUTONEG_ENABLE) {
hw->mac.autoneg = 1; hw->mac.autoneg = 1;
if (hw->phy.media_type == e1000_media_type_fiber) {
hw->phy.autoneg_advertised = ecmd->advertising |
ADVERTISED_FIBRE |
ADVERTISED_Autoneg;
switch (adapter->link_speed) {
case SPEED_2500:
hw->phy.autoneg_advertised =
ADVERTISED_2500baseX_Full;
break;
case SPEED_1000:
hw->phy.autoneg_advertised =
ADVERTISED_1000baseT_Full;
break;
case SPEED_100:
hw->phy.autoneg_advertised =
ADVERTISED_100baseT_Full;
break;
default:
break;
}
} else {
hw->phy.autoneg_advertised = ecmd->advertising | hw->phy.autoneg_advertised = ecmd->advertising |
ADVERTISED_TP | ADVERTISED_TP |
ADVERTISED_Autoneg; ADVERTISED_Autoneg;
}
ecmd->advertising = hw->phy.autoneg_advertised; ecmd->advertising = hw->phy.autoneg_advertised;
if (adapter->fc_autoneg) if (adapter->fc_autoneg)
hw->fc.requested_mode = e1000_fc_default; hw->fc.requested_mode = e1000_fc_default;
...@@ -283,8 +329,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -283,8 +329,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
/* MDI-X => 2; MDI => 1; Auto => 3 */ /* MDI-X => 2; MDI => 1; Auto => 3 */
if (ecmd->eth_tp_mdix_ctrl) { if (ecmd->eth_tp_mdix_ctrl) {
/* /* fix up the value for auto (3 => 0) as zero is mapped
* fix up the value for auto (3 => 0) as zero is mapped
* internally to auto * internally to auto
*/ */
if (ecmd->eth_tp_mdix_ctrl == ETH_TP_MDI_AUTO) if (ecmd->eth_tp_mdix_ctrl == ETH_TP_MDI_AUTO)
...@@ -309,8 +354,7 @@ static u32 igb_get_link(struct net_device *netdev) ...@@ -309,8 +354,7 @@ static u32 igb_get_link(struct net_device *netdev)
struct igb_adapter *adapter = netdev_priv(netdev); struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_mac_info *mac = &adapter->hw.mac; struct e1000_mac_info *mac = &adapter->hw.mac;
/* /* If the link is not reported up to netdev, interrupts are disabled,
* If the link is not reported up to netdev, interrupts are disabled,
* and so the physical link state may have changed since we last * and so the physical link state may have changed since we last
* looked. Set get_link_status to make sure that the true link * looked. Set get_link_status to make sure that the true link
* state is interrogated, rather than pulling a cached and possibly * state is interrogated, rather than pulling a cached and possibly
...@@ -430,7 +474,8 @@ static void igb_get_regs(struct net_device *netdev, ...@@ -430,7 +474,8 @@ static void igb_get_regs(struct net_device *netdev,
/* Interrupt */ /* Interrupt */
/* Reading EICS for EICR because they read the /* Reading EICS for EICR because they read the
* same but EICS does not clear on read */ * same but EICS does not clear on read
*/
regs_buff[13] = rd32(E1000_EICS); regs_buff[13] = rd32(E1000_EICS);
regs_buff[14] = rd32(E1000_EICS); regs_buff[14] = rd32(E1000_EICS);
regs_buff[15] = rd32(E1000_EIMS); regs_buff[15] = rd32(E1000_EIMS);
...@@ -438,7 +483,8 @@ static void igb_get_regs(struct net_device *netdev, ...@@ -438,7 +483,8 @@ static void igb_get_regs(struct net_device *netdev,
regs_buff[17] = rd32(E1000_EIAC); regs_buff[17] = rd32(E1000_EIAC);
regs_buff[18] = rd32(E1000_EIAM); regs_buff[18] = rd32(E1000_EIAM);
/* Reading ICS for ICR because they read the /* Reading ICS for ICR because they read the
* same but ICS does not clear on read */ * same but ICS does not clear on read
*/
regs_buff[19] = rd32(E1000_ICS); regs_buff[19] = rd32(E1000_ICS);
regs_buff[20] = rd32(E1000_ICS); regs_buff[20] = rd32(E1000_ICS);
regs_buff[21] = rd32(E1000_IMS); regs_buff[21] = rd32(E1000_IMS);
...@@ -740,15 +786,17 @@ static int igb_set_eeprom(struct net_device *netdev, ...@@ -740,15 +786,17 @@ static int igb_set_eeprom(struct net_device *netdev,
ptr = (void *)eeprom_buff; ptr = (void *)eeprom_buff;
if (eeprom->offset & 1) { if (eeprom->offset & 1) {
/* need read/modify/write of first changed EEPROM word */ /* need read/modify/write of first changed EEPROM word
/* only the second byte of the word is being modified */ * only the second byte of the word is being modified
*/
ret_val = hw->nvm.ops.read(hw, first_word, 1, ret_val = hw->nvm.ops.read(hw, first_word, 1,
&eeprom_buff[0]); &eeprom_buff[0]);
ptr++; ptr++;
} }
if (((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) { if (((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) {
/* need read/modify/write of last changed EEPROM word */ /* need read/modify/write of last changed EEPROM word
/* only the first byte of the word is being modified */ * only the first byte of the word is being modified
*/
ret_val = hw->nvm.ops.read(hw, last_word, 1, ret_val = hw->nvm.ops.read(hw, last_word, 1,
&eeprom_buff[last_word - first_word]); &eeprom_buff[last_word - first_word]);
} }
...@@ -766,7 +814,8 @@ static int igb_set_eeprom(struct net_device *netdev, ...@@ -766,7 +814,8 @@ static int igb_set_eeprom(struct net_device *netdev,
last_word - first_word + 1, eeprom_buff); last_word - first_word + 1, eeprom_buff);
/* Update the checksum over the first part of the EEPROM if needed /* Update the checksum over the first part of the EEPROM if needed
* and flush shadow RAM for 82573 controllers */ * and flush shadow RAM for 82573 controllers
*/
if ((ret_val == 0) && ((first_word <= NVM_CHECKSUM_REG))) if ((ret_val == 0) && ((first_word <= NVM_CHECKSUM_REG)))
hw->nvm.ops.update(hw); hw->nvm.ops.update(hw);
...@@ -783,8 +832,7 @@ static void igb_get_drvinfo(struct net_device *netdev, ...@@ -783,8 +832,7 @@ static void igb_get_drvinfo(struct net_device *netdev,
strlcpy(drvinfo->driver, igb_driver_name, sizeof(drvinfo->driver)); strlcpy(drvinfo->driver, igb_driver_name, sizeof(drvinfo->driver));
strlcpy(drvinfo->version, igb_driver_version, sizeof(drvinfo->version)); strlcpy(drvinfo->version, igb_driver_version, sizeof(drvinfo->version));
/* /* EEPROM image version # is reported as firmware version # for
* EEPROM image version # is reported as firmware version # for
* 82575 controllers * 82575 controllers
*/ */
strlcpy(drvinfo->fw_version, adapter->fw_version, strlcpy(drvinfo->fw_version, adapter->fw_version,
...@@ -847,9 +895,11 @@ static int igb_set_ringparam(struct net_device *netdev, ...@@ -847,9 +895,11 @@ static int igb_set_ringparam(struct net_device *netdev,
} }
if (adapter->num_tx_queues > adapter->num_rx_queues) if (adapter->num_tx_queues > adapter->num_rx_queues)
temp_ring = vmalloc(adapter->num_tx_queues * sizeof(struct igb_ring)); temp_ring = vmalloc(adapter->num_tx_queues *
sizeof(struct igb_ring));
else else
temp_ring = vmalloc(adapter->num_rx_queues * sizeof(struct igb_ring)); temp_ring = vmalloc(adapter->num_rx_queues *
sizeof(struct igb_ring));
if (!temp_ring) { if (!temp_ring) {
err = -ENOMEM; err = -ENOMEM;
...@@ -858,10 +908,9 @@ static int igb_set_ringparam(struct net_device *netdev, ...@@ -858,10 +908,9 @@ static int igb_set_ringparam(struct net_device *netdev,
igb_down(adapter); igb_down(adapter);
/* /* We can't just free everything and then setup again,
* We can't just free everything and then setup again,
* because the ISRs in MSI-X mode get passed pointers * because the ISRs in MSI-X mode get passed pointers
* to the tx and rx ring structs. * to the Tx and Rx ring structs.
*/ */
if (new_tx_count != adapter->tx_ring_count) { if (new_tx_count != adapter->tx_ring_count) {
for (i = 0; i < adapter->num_tx_queues; i++) { for (i = 0; i < adapter->num_tx_queues; i++) {
...@@ -1199,6 +1248,7 @@ static int igb_reg_test(struct igb_adapter *adapter, u64 *data) ...@@ -1199,6 +1248,7 @@ static int igb_reg_test(struct igb_adapter *adapter, u64 *data)
switch (adapter->hw.mac.type) { switch (adapter->hw.mac.type) {
case e1000_i350: case e1000_i350:
case e1000_i354:
test = reg_test_i350; test = reg_test_i350;
toggle = 0x7FEFF3FF; toggle = 0x7FEFF3FF;
break; break;
...@@ -1361,6 +1411,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data) ...@@ -1361,6 +1411,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
ics_mask = 0x77DCFED5; ics_mask = 0x77DCFED5;
break; break;
case e1000_i350: case e1000_i350:
case e1000_i354:
case e1000_i210: case e1000_i210:
case e1000_i211: case e1000_i211:
ics_mask = 0x77DCFED5; ics_mask = 0x77DCFED5;
...@@ -1737,7 +1788,7 @@ static int igb_clean_test_rings(struct igb_ring *rx_ring, ...@@ -1737,7 +1788,7 @@ static int igb_clean_test_rings(struct igb_ring *rx_ring,
rx_desc = IGB_RX_DESC(rx_ring, rx_ntc); rx_desc = IGB_RX_DESC(rx_ring, rx_ntc);
while (igb_test_staterr(rx_desc, E1000_RXD_STAT_DD)) { while (igb_test_staterr(rx_desc, E1000_RXD_STAT_DD)) {
/* check rx buffer */ /* check Rx buffer */
rx_buffer_info = &rx_ring->rx_buffer_info[rx_ntc]; rx_buffer_info = &rx_ring->rx_buffer_info[rx_ntc];
/* sync Rx buffer for CPU read */ /* sync Rx buffer for CPU read */
...@@ -1756,11 +1807,11 @@ static int igb_clean_test_rings(struct igb_ring *rx_ring, ...@@ -1756,11 +1807,11 @@ static int igb_clean_test_rings(struct igb_ring *rx_ring,
IGB_RX_BUFSZ, IGB_RX_BUFSZ,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
/* unmap buffer on tx side */ /* unmap buffer on Tx side */
tx_buffer_info = &tx_ring->tx_buffer_info[tx_ntc]; tx_buffer_info = &tx_ring->tx_buffer_info[tx_ntc];
igb_unmap_and_free_tx_resource(tx_ring, tx_buffer_info); igb_unmap_and_free_tx_resource(tx_ring, tx_buffer_info);
/* increment rx/tx next to clean counters */ /* increment Rx/Tx next to clean counters */
rx_ntc++; rx_ntc++;
if (rx_ntc == rx_ring->count) if (rx_ntc == rx_ring->count)
rx_ntc = 0; rx_ntc = 0;
...@@ -1801,8 +1852,7 @@ static int igb_run_loopback_test(struct igb_adapter *adapter) ...@@ -1801,8 +1852,7 @@ static int igb_run_loopback_test(struct igb_adapter *adapter)
igb_create_lbtest_frame(skb, size); igb_create_lbtest_frame(skb, size);
skb_put(skb, size); skb_put(skb, size);
/* /* Calculate the loop count based on the largest descriptor ring
* Calculate the loop count based on the largest descriptor ring
* The idea is to wrap the largest ring a number of times using 64 * The idea is to wrap the largest ring a number of times using 64
* send/receive pairs during each loop * send/receive pairs during each loop
*/ */
...@@ -1829,7 +1879,7 @@ static int igb_run_loopback_test(struct igb_adapter *adapter) ...@@ -1829,7 +1879,7 @@ static int igb_run_loopback_test(struct igb_adapter *adapter)
break; break;
} }
/* allow 200 milliseconds for packets to go from tx to rx */ /* allow 200 milliseconds for packets to go from Tx to Rx */
msleep(200); msleep(200);
good_cnt = igb_clean_test_rings(rx_ring, tx_ring, size); good_cnt = igb_clean_test_rings(rx_ring, tx_ring, size);
...@@ -1848,13 +1898,21 @@ static int igb_run_loopback_test(struct igb_adapter *adapter) ...@@ -1848,13 +1898,21 @@ static int igb_run_loopback_test(struct igb_adapter *adapter)
static int igb_loopback_test(struct igb_adapter *adapter, u64 *data) static int igb_loopback_test(struct igb_adapter *adapter, u64 *data)
{ {
/* PHY loopback cannot be performed if SoL/IDER /* PHY loopback cannot be performed if SoL/IDER
* sessions are active */ * sessions are active
*/
if (igb_check_reset_block(&adapter->hw)) { if (igb_check_reset_block(&adapter->hw)) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"Cannot do PHY loopback test when SoL/IDER is active.\n"); "Cannot do PHY loopback test when SoL/IDER is active.\n");
*data = 0; *data = 0;
goto out; goto out;
} }
if (adapter->hw.mac.type == e1000_i354) {
dev_info(&adapter->pdev->dev,
"Loopback test not supported on i354.\n");
*data = 0;
goto out;
}
*data = igb_setup_desc_rings(adapter); *data = igb_setup_desc_rings(adapter);
if (*data) if (*data)
goto out; goto out;
...@@ -1879,7 +1937,8 @@ static int igb_link_test(struct igb_adapter *adapter, u64 *data) ...@@ -1879,7 +1937,8 @@ static int igb_link_test(struct igb_adapter *adapter, u64 *data)
hw->mac.serdes_has_link = false; hw->mac.serdes_has_link = false;
/* On some blade server designs, link establishment /* On some blade server designs, link establishment
* could take as long as 2-3 minutes */ * could take as long as 2-3 minutes
*/
do { do {
hw->mac.ops.check_for_link(&adapter->hw); hw->mac.ops.check_for_link(&adapter->hw);
if (hw->mac.serdes_has_link) if (hw->mac.serdes_has_link)
...@@ -1922,7 +1981,8 @@ static void igb_diag_test(struct net_device *netdev, ...@@ -1922,7 +1981,8 @@ static void igb_diag_test(struct net_device *netdev,
igb_power_up_link(adapter); igb_power_up_link(adapter);
/* Link test performed before hardware reset so autoneg doesn't /* Link test performed before hardware reset so autoneg doesn't
* interfere with test result */ * interfere with test result
*/
if (igb_link_test(adapter, &data[4])) if (igb_link_test(adapter, &data[4]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
...@@ -2263,7 +2323,7 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) ...@@ -2263,7 +2323,7 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
sprintf(p, "rx_queue_%u_alloc_failed", i); sprintf(p, "rx_queue_%u_alloc_failed", i);
p += ETH_GSTRING_LEN; p += ETH_GSTRING_LEN;
} }
/* BUG_ON(p - data != IGB_STATS_LEN * ETH_GSTRING_LEN); */ /* BUG_ON(p - data != IGB_STATS_LEN * ETH_GSTRING_LEN); */
break; break;
} }
} }
...@@ -2283,6 +2343,7 @@ static int igb_get_ts_info(struct net_device *dev, ...@@ -2283,6 +2343,7 @@ static int igb_get_ts_info(struct net_device *dev,
case e1000_82576: case e1000_82576:
case e1000_82580: case e1000_82580:
case e1000_i350: case e1000_i350:
case e1000_i354:
case e1000_i210: case e1000_i210:
case e1000_i211: case e1000_i211:
info->so_timestamping = info->so_timestamping =
...@@ -2506,7 +2567,8 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_eee *edata) ...@@ -2506,7 +2567,8 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_eee *edata)
{ {
struct igb_adapter *adapter = netdev_priv(netdev); struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 ipcnfg, eeer; u32 ipcnfg, eeer, ret_val;
u16 phy_data;
if ((hw->mac.type < e1000_i350) || if ((hw->mac.type < e1000_i350) ||
(hw->phy.media_type != e1000_media_type_copper)) (hw->phy.media_type != e1000_media_type_copper))
...@@ -2525,6 +2587,32 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_eee *edata) ...@@ -2525,6 +2587,32 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_eee *edata)
if (ipcnfg & E1000_IPCNFG_EEE_100M_AN) if (ipcnfg & E1000_IPCNFG_EEE_100M_AN)
edata->advertised |= ADVERTISED_100baseT_Full; edata->advertised |= ADVERTISED_100baseT_Full;
/* EEE Link Partner Advertised */
switch (hw->mac.type) {
case e1000_i350:
ret_val = igb_read_emi_reg(hw, E1000_EEE_LP_ADV_ADDR_I350,
&phy_data);
if (ret_val)
return -ENODATA;
edata->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(phy_data);
break;
case e1000_i210:
case e1000_i211:
ret_val = igb_read_xmdio_reg(hw, E1000_EEE_LP_ADV_ADDR_I210,
E1000_EEE_LP_ADV_DEV_I210,
&phy_data);
if (ret_val)
return -ENODATA;
edata->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(phy_data);
break;
default:
break;
}
if (eeer & E1000_EEER_EEE_NEG) if (eeer & E1000_EEER_EEE_NEG)
edata->eee_active = true; edata->eee_active = true;
...@@ -2600,6 +2688,85 @@ static int igb_set_eee(struct net_device *netdev, ...@@ -2600,6 +2688,85 @@ static int igb_set_eee(struct net_device *netdev,
return 0; return 0;
} }
static int igb_get_module_info(struct net_device *netdev,
struct ethtool_modinfo *modinfo)
{
struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
u32 status = E1000_SUCCESS;
u16 sff8472_rev, addr_mode;
bool page_swap = false;
if ((hw->phy.media_type == e1000_media_type_copper) ||
(hw->phy.media_type == e1000_media_type_unknown))
return -EOPNOTSUPP;
/* Check whether we support SFF-8472 or not */
status = igb_read_phy_reg_i2c(hw, IGB_SFF_8472_COMP, &sff8472_rev);
if (status != E1000_SUCCESS)
return -EIO;
/* addressing mode is not supported */
status = igb_read_phy_reg_i2c(hw, IGB_SFF_8472_SWAP, &addr_mode);
if (status != E1000_SUCCESS)
return -EIO;
/* addressing mode is not supported */
if ((addr_mode & 0xFF) & IGB_SFF_ADDRESSING_MODE) {
hw_dbg("Address change required to access page 0xA2, but not supported. Please report the module type to the driver maintainers.\n");
page_swap = true;
}
if ((sff8472_rev & 0xFF) == IGB_SFF_8472_UNSUP || page_swap) {
/* We have an SFP, but it does not support SFF-8472 */
modinfo->type = ETH_MODULE_SFF_8079;
modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
} else {
/* We have an SFP which supports a revision of SFF-8472 */
modinfo->type = ETH_MODULE_SFF_8472;
modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
}
return 0;
}
static int igb_get_module_eeprom(struct net_device *netdev,
struct ethtool_eeprom *ee, u8 *data)
{
struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
u32 status = E1000_SUCCESS;
u16 *dataword;
u16 first_word, last_word;
int i = 0;
if (ee->len == 0)
return -EINVAL;
first_word = ee->offset >> 1;
last_word = (ee->offset + ee->len - 1) >> 1;
dataword = kmalloc(sizeof(u16) * (last_word - first_word + 1),
GFP_KERNEL);
if (!dataword)
return -ENOMEM;
/* Read EEPROM block, SFF-8079/SFF-8472, word at a time */
for (i = 0; i < last_word - first_word + 1; i++) {
status = igb_read_phy_reg_i2c(hw, first_word + i, &dataword[i]);
if (status != E1000_SUCCESS)
/* Error occurred while reading module */
return -EIO;
be16_to_cpus(&dataword[i]);
}
memcpy(data, (u8 *)dataword + (ee->offset & 1), ee->len);
kfree(dataword);
return 0;
}
static int igb_ethtool_begin(struct net_device *netdev) static int igb_ethtool_begin(struct net_device *netdev)
{ {
struct igb_adapter *adapter = netdev_priv(netdev); struct igb_adapter *adapter = netdev_priv(netdev);
...@@ -2644,6 +2811,8 @@ static const struct ethtool_ops igb_ethtool_ops = { ...@@ -2644,6 +2811,8 @@ static const struct ethtool_ops igb_ethtool_ops = {
.set_rxnfc = igb_set_rxnfc, .set_rxnfc = igb_set_rxnfc,
.get_eee = igb_get_eee, .get_eee = igb_get_eee,
.set_eee = igb_set_eee, .set_eee = igb_set_eee,
.get_module_info = igb_get_module_info,
.get_module_eeprom = igb_get_module_eeprom,
.begin = igb_ethtool_begin, .begin = igb_ethtool_begin,
.complete = igb_ethtool_complete, .complete = igb_ethtool_complete,
}; };
......
...@@ -111,7 +111,8 @@ static ssize_t igb_hwmon_show_maxopthresh(struct device *dev, ...@@ -111,7 +111,8 @@ static ssize_t igb_hwmon_show_maxopthresh(struct device *dev,
* the data structures we need to get the data to display. * the data structures we need to get the data to display.
*/ */
static int igb_add_hwmon_attr(struct igb_adapter *adapter, static int igb_add_hwmon_attr(struct igb_adapter *adapter,
unsigned int offset, int type) { unsigned int offset, int type)
{
int rc; int rc;
unsigned int n_attr; unsigned int n_attr;
struct hwmon_attr *igb_attr; struct hwmon_attr *igb_attr;
......
...@@ -77,6 +77,9 @@ static const struct e1000_info *igb_info_tbl[] = { ...@@ -77,6 +77,9 @@ static const struct e1000_info *igb_info_tbl[] = {
}; };
static DEFINE_PCI_DEVICE_TABLE(igb_pci_tbl) = { static DEFINE_PCI_DEVICE_TABLE(igb_pci_tbl) = {
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I354_BACKPLANE_1GBPS) },
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I354_SGMII) },
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I354_BACKPLANE_2_5GBPS) },
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I211_COPPER), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_I211_COPPER), board_82575 },
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_COPPER), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_COPPER), board_82575 },
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_FIBER), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_FIBER), board_82575 },
...@@ -169,6 +172,8 @@ static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac); ...@@ -169,6 +172,8 @@ static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac);
static int igb_ndo_set_vf_vlan(struct net_device *netdev, static int igb_ndo_set_vf_vlan(struct net_device *netdev,
int vf, u16 vlan, u8 qos); int vf, u16 vlan, u8 qos);
static int igb_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate); static int igb_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate);
static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
bool setting);
static int igb_ndo_get_vf_config(struct net_device *netdev, int vf, static int igb_ndo_get_vf_config(struct net_device *netdev, int vf,
struct ifla_vf_info *ivi); struct ifla_vf_info *ivi);
static void igb_check_vf_rate_limit(struct igb_adapter *); static void igb_check_vf_rate_limit(struct igb_adapter *);
...@@ -292,9 +297,7 @@ static const struct igb_reg_info igb_reg_info_tbl[] = { ...@@ -292,9 +297,7 @@ static const struct igb_reg_info igb_reg_info_tbl[] = {
{} {}
}; };
/* /* igb_regdump - register printout routine */
* igb_regdump - register printout routine
*/
static void igb_regdump(struct e1000_hw *hw, struct igb_reg_info *reginfo) static void igb_regdump(struct e1000_hw *hw, struct igb_reg_info *reginfo)
{ {
int n = 0; int n = 0;
...@@ -360,9 +363,7 @@ static void igb_regdump(struct e1000_hw *hw, struct igb_reg_info *reginfo) ...@@ -360,9 +363,7 @@ static void igb_regdump(struct e1000_hw *hw, struct igb_reg_info *reginfo)
regs[2], regs[3]); regs[2], regs[3]);
} }
/* /* igb_dump - Print registers, Tx-rings and Rx-rings */
* igb_dump - Print registers, tx-rings and rx-rings
*/
static void igb_dump(struct igb_adapter *adapter) static void igb_dump(struct igb_adapter *adapter)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
...@@ -569,12 +570,13 @@ static void igb_dump(struct igb_adapter *adapter) ...@@ -569,12 +570,13 @@ static void igb_dump(struct igb_adapter *adapter)
return; return;
} }
/* igb_get_i2c_data - Reads the I2C SDA data bit /**
* igb_get_i2c_data - Reads the I2C SDA data bit
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* @i2cctl: Current value of I2CCTL register * @i2cctl: Current value of I2CCTL register
* *
* Returns the I2C data bit value * Returns the I2C data bit value
*/ **/
static int igb_get_i2c_data(void *data) static int igb_get_i2c_data(void *data)
{ {
struct igb_adapter *adapter = (struct igb_adapter *)data; struct igb_adapter *adapter = (struct igb_adapter *)data;
...@@ -584,12 +586,13 @@ static int igb_get_i2c_data(void *data) ...@@ -584,12 +586,13 @@ static int igb_get_i2c_data(void *data)
return ((i2cctl & E1000_I2C_DATA_IN) != 0); return ((i2cctl & E1000_I2C_DATA_IN) != 0);
} }
/* igb_set_i2c_data - Sets the I2C data bit /**
* igb_set_i2c_data - Sets the I2C data bit
* @data: pointer to hardware structure * @data: pointer to hardware structure
* @state: I2C data value (0 or 1) to set * @state: I2C data value (0 or 1) to set
* *
* Sets the I2C data bit * Sets the I2C data bit
*/ **/
static void igb_set_i2c_data(void *data, int state) static void igb_set_i2c_data(void *data, int state)
{ {
struct igb_adapter *adapter = (struct igb_adapter *)data; struct igb_adapter *adapter = (struct igb_adapter *)data;
...@@ -608,12 +611,13 @@ static void igb_set_i2c_data(void *data, int state) ...@@ -608,12 +611,13 @@ static void igb_set_i2c_data(void *data, int state)
} }
/* igb_set_i2c_clk - Sets the I2C SCL clock /**
* igb_set_i2c_clk - Sets the I2C SCL clock
* @data: pointer to hardware structure * @data: pointer to hardware structure
* @state: state to set clock * @state: state to set clock
* *
* Sets the I2C clock line to state * Sets the I2C clock line to state
*/ **/
static void igb_set_i2c_clk(void *data, int state) static void igb_set_i2c_clk(void *data, int state)
{ {
struct igb_adapter *adapter = (struct igb_adapter *)data; struct igb_adapter *adapter = (struct igb_adapter *)data;
...@@ -631,11 +635,12 @@ static void igb_set_i2c_clk(void *data, int state) ...@@ -631,11 +635,12 @@ static void igb_set_i2c_clk(void *data, int state)
wrfl(); wrfl();
} }
/* igb_get_i2c_clk - Gets the I2C SCL clock state /**
* igb_get_i2c_clk - Gets the I2C SCL clock state
* @data: pointer to hardware structure * @data: pointer to hardware structure
* *
* Gets the I2C clock state * Gets the I2C clock state
*/ **/
static int igb_get_i2c_clk(void *data) static int igb_get_i2c_clk(void *data)
{ {
struct igb_adapter *adapter = (struct igb_adapter *)data; struct igb_adapter *adapter = (struct igb_adapter *)data;
...@@ -656,6 +661,8 @@ static const struct i2c_algo_bit_data igb_i2c_algo = { ...@@ -656,6 +661,8 @@ static const struct i2c_algo_bit_data igb_i2c_algo = {
/** /**
* igb_get_hw_dev - return device * igb_get_hw_dev - return device
* @hw: pointer to hardware structure
*
* used by hardware layer to print debugging information * used by hardware layer to print debugging information
**/ **/
struct net_device *igb_get_hw_dev(struct e1000_hw *hw) struct net_device *igb_get_hw_dev(struct e1000_hw *hw)
...@@ -731,6 +738,7 @@ static void igb_cache_ring_register(struct igb_adapter *adapter) ...@@ -731,6 +738,7 @@ static void igb_cache_ring_register(struct igb_adapter *adapter)
case e1000_82575: case e1000_82575:
case e1000_82580: case e1000_82580:
case e1000_i350: case e1000_i350:
case e1000_i354:
case e1000_i210: case e1000_i210:
case e1000_i211: case e1000_i211:
default: default:
...@@ -785,9 +793,10 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector) ...@@ -785,9 +793,10 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
switch (hw->mac.type) { switch (hw->mac.type) {
case e1000_82575: case e1000_82575:
/* The 82575 assigns vectors using a bitmask, which matches the /* The 82575 assigns vectors using a bitmask, which matches the
bitmask for the EICR/EIMS/EIMC registers. To assign one * bitmask for the EICR/EIMS/EIMC registers. To assign one
or more queues to a vector, we write the appropriate bits * or more queues to a vector, we write the appropriate bits
into the MSIXBM register for that vector. */ * into the MSIXBM register for that vector.
*/
if (rx_queue > IGB_N0_QUEUE) if (rx_queue > IGB_N0_QUEUE)
msixbm = E1000_EICR_RX_QUEUE0 << rx_queue; msixbm = E1000_EICR_RX_QUEUE0 << rx_queue;
if (tx_queue > IGB_N0_QUEUE) if (tx_queue > IGB_N0_QUEUE)
...@@ -798,8 +807,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector) ...@@ -798,8 +807,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
q_vector->eims_value = msixbm; q_vector->eims_value = msixbm;
break; break;
case e1000_82576: case e1000_82576:
/* /* 82576 uses a table that essentially consists of 2 columns
* 82576 uses a table that essentially consists of 2 columns
* with 8 rows. The ordering is column-major so we use the * with 8 rows. The ordering is column-major so we use the
* lower 3 bits as the row index, and the 4th bit as the * lower 3 bits as the row index, and the 4th bit as the
* column offset. * column offset.
...@@ -816,10 +824,10 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector) ...@@ -816,10 +824,10 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
break; break;
case e1000_82580: case e1000_82580:
case e1000_i350: case e1000_i350:
case e1000_i354:
case e1000_i210: case e1000_i210:
case e1000_i211: case e1000_i211:
/* /* On 82580 and newer adapters the scheme is similar to 82576
* On 82580 and newer adapters the scheme is similar to 82576
* however instead of ordering column-major we have things * however instead of ordering column-major we have things
* ordered row-major. So we traverse the table by using * ordered row-major. So we traverse the table by using
* bit 0 as the column offset, and the remaining bits as the * bit 0 as the column offset, and the remaining bits as the
...@@ -849,6 +857,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector) ...@@ -849,6 +857,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
/** /**
* igb_configure_msix - Configure MSI-X hardware * igb_configure_msix - Configure MSI-X hardware
* @adapter: board private structure to initialize
* *
* igb_configure_msix sets up the hardware to properly * igb_configure_msix sets up the hardware to properly
* generate MSI-X interrupts. * generate MSI-X interrupts.
...@@ -875,8 +884,7 @@ static void igb_configure_msix(struct igb_adapter *adapter) ...@@ -875,8 +884,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
wr32(E1000_CTRL_EXT, tmp); wr32(E1000_CTRL_EXT, tmp);
/* enable msix_other interrupt */ /* enable msix_other interrupt */
array_wr32(E1000_MSIXBM(0), vector++, array_wr32(E1000_MSIXBM(0), vector++, E1000_EIMS_OTHER);
E1000_EIMS_OTHER);
adapter->eims_other = E1000_EIMS_OTHER; adapter->eims_other = E1000_EIMS_OTHER;
break; break;
...@@ -884,10 +892,12 @@ static void igb_configure_msix(struct igb_adapter *adapter) ...@@ -884,10 +892,12 @@ static void igb_configure_msix(struct igb_adapter *adapter)
case e1000_82576: case e1000_82576:
case e1000_82580: case e1000_82580:
case e1000_i350: case e1000_i350:
case e1000_i354:
case e1000_i210: case e1000_i210:
case e1000_i211: case e1000_i211:
/* Turn on MSI-X capability first, or our settings /* Turn on MSI-X capability first, or our settings
* won't stick. And it will take days to debug. */ * won't stick. And it will take days to debug.
*/
wr32(E1000_GPIE, E1000_GPIE_MSIX_MODE | wr32(E1000_GPIE, E1000_GPIE_MSIX_MODE |
E1000_GPIE_PBA | E1000_GPIE_EIAME | E1000_GPIE_PBA | E1000_GPIE_EIAME |
E1000_GPIE_NSICR); E1000_GPIE_NSICR);
...@@ -913,6 +923,7 @@ static void igb_configure_msix(struct igb_adapter *adapter) ...@@ -913,6 +923,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
/** /**
* igb_request_msix - Initialize MSI-X interrupts * igb_request_msix - Initialize MSI-X interrupts
* @adapter: board private structure to initialize
* *
* igb_request_msix allocates MSI-X vectors and requests interrupts from the * igb_request_msix allocates MSI-X vectors and requests interrupts from the
* kernel. * kernel.
...@@ -1003,8 +1014,7 @@ static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx) ...@@ -1003,8 +1014,7 @@ static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx)
adapter->q_vector[v_idx] = NULL; adapter->q_vector[v_idx] = NULL;
netif_napi_del(&q_vector->napi); netif_napi_del(&q_vector->napi);
/* /* ixgbe_get_stats64() might access the rings on this vector,
* ixgbe_get_stats64() might access the rings on this vector,
* we must wait a grace period before freeing it. * we must wait a grace period before freeing it.
*/ */
kfree_rcu(q_vector, rcu); kfree_rcu(q_vector, rcu);
...@@ -1032,8 +1042,9 @@ static void igb_free_q_vectors(struct igb_adapter *adapter) ...@@ -1032,8 +1042,9 @@ static void igb_free_q_vectors(struct igb_adapter *adapter)
/** /**
* igb_clear_interrupt_scheme - reset the device to a state of no interrupts * igb_clear_interrupt_scheme - reset the device to a state of no interrupts
* @adapter: board private structure to initialize
* *
* This function resets the device so that it has 0 rx queues, tx queues, and * This function resets the device so that it has 0 Rx queues, Tx queues, and
* MSI-X interrupts allocated. * MSI-X interrupts allocated.
*/ */
static void igb_clear_interrupt_scheme(struct igb_adapter *adapter) static void igb_clear_interrupt_scheme(struct igb_adapter *adapter)
...@@ -1044,6 +1055,8 @@ static void igb_clear_interrupt_scheme(struct igb_adapter *adapter) ...@@ -1044,6 +1055,8 @@ static void igb_clear_interrupt_scheme(struct igb_adapter *adapter)
/** /**
* igb_set_interrupt_capability - set MSI or MSI-X if supported * igb_set_interrupt_capability - set MSI or MSI-X if supported
* @adapter: board private structure to initialize
* @msix: boolean value of MSIX capability
* *
* Attempt to configure interrupts using the best available * Attempt to configure interrupts using the best available
* capabilities of the hardware and kernel. * capabilities of the hardware and kernel.
...@@ -1063,10 +1076,10 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix) ...@@ -1063,10 +1076,10 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
else else
adapter->num_tx_queues = adapter->rss_queues; adapter->num_tx_queues = adapter->rss_queues;
/* start with one vector for every rx queue */ /* start with one vector for every Rx queue */
numvecs = adapter->num_rx_queues; numvecs = adapter->num_rx_queues;
/* if tx handler is separate add 1 for every tx queue */ /* if Tx handler is separate add 1 for every Tx queue */
if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS)) if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS))
numvecs += adapter->num_tx_queues; numvecs += adapter->num_tx_queues;
...@@ -1179,6 +1192,17 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter, ...@@ -1179,6 +1192,17 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter,
/* initialize pointer to rings */ /* initialize pointer to rings */
ring = q_vector->ring; ring = q_vector->ring;
/* intialize ITR */
if (rxr_count) {
/* rx or rx/tx vector */
if (!adapter->rx_itr_setting || adapter->rx_itr_setting > 3)
q_vector->itr_val = adapter->rx_itr_setting;
} else {
/* tx only vector */
if (!adapter->tx_itr_setting || adapter->tx_itr_setting > 3)
q_vector->itr_val = adapter->tx_itr_setting;
}
if (txr_count) { if (txr_count) {
/* assign generic ring traits */ /* assign generic ring traits */
ring->dev = &adapter->pdev->dev; ring->dev = &adapter->pdev->dev;
...@@ -1221,9 +1245,9 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter, ...@@ -1221,9 +1245,9 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter,
set_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags); set_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags);
/* /*
* On i350, i210, and i211, loopback VLAN packets * On i350, i354, i210, and i211, loopback VLAN packets
* have the tag byte-swapped. * have the tag byte-swapped.
* */ */
if (adapter->hw.mac.type >= e1000_i350) if (adapter->hw.mac.type >= e1000_i350)
set_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &ring->flags); set_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &ring->flags);
...@@ -1299,6 +1323,8 @@ static int igb_alloc_q_vectors(struct igb_adapter *adapter) ...@@ -1299,6 +1323,8 @@ static int igb_alloc_q_vectors(struct igb_adapter *adapter)
/** /**
* igb_init_interrupt_scheme - initialize interrupts, allocate queues/vectors * igb_init_interrupt_scheme - initialize interrupts, allocate queues/vectors
* @adapter: board private structure to initialize
* @msix: boolean value of MSIX capability
* *
* This function initializes the interrupts and allocates all of the queues. * This function initializes the interrupts and allocates all of the queues.
**/ **/
...@@ -1326,6 +1352,7 @@ static int igb_init_interrupt_scheme(struct igb_adapter *adapter, bool msix) ...@@ -1326,6 +1352,7 @@ static int igb_init_interrupt_scheme(struct igb_adapter *adapter, bool msix)
/** /**
* igb_request_irq - initialize interrupts * igb_request_irq - initialize interrupts
* @adapter: board private structure to initialize
* *
* Attempts to configure interrupts using the best available * Attempts to configure interrupts using the best available
* capabilities of the hardware and kernel. * capabilities of the hardware and kernel.
...@@ -1401,8 +1428,7 @@ static void igb_irq_disable(struct igb_adapter *adapter) ...@@ -1401,8 +1428,7 @@ static void igb_irq_disable(struct igb_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
/* /* we need to be careful when disabling interrupts. The VFs are also
* we need to be careful when disabling interrupts. The VFs are also
* mapped into these registers and so clearing the bits can cause * mapped into these registers and so clearing the bits can cause
* issues on the VF drivers so we only need to clear what we set * issues on the VF drivers so we only need to clear what we set
*/ */
...@@ -1483,7 +1509,6 @@ static void igb_update_mng_vlan(struct igb_adapter *adapter) ...@@ -1483,7 +1509,6 @@ static void igb_update_mng_vlan(struct igb_adapter *adapter)
* igb_release_hw_control resets CTRL_EXT:DRV_LOAD bit. * igb_release_hw_control resets CTRL_EXT:DRV_LOAD bit.
* For ASF and Pass Through versions of f/w this means that the * For ASF and Pass Through versions of f/w this means that the
* driver is no longer loaded. * driver is no longer loaded.
*
**/ **/
static void igb_release_hw_control(struct igb_adapter *adapter) static void igb_release_hw_control(struct igb_adapter *adapter)
{ {
...@@ -1503,7 +1528,6 @@ static void igb_release_hw_control(struct igb_adapter *adapter) ...@@ -1503,7 +1528,6 @@ static void igb_release_hw_control(struct igb_adapter *adapter)
* igb_get_hw_control sets CTRL_EXT:DRV_LOAD bit. * igb_get_hw_control sets CTRL_EXT:DRV_LOAD bit.
* For ASF and Pass Through versions of f/w this means that * For ASF and Pass Through versions of f/w this means that
* the driver is loaded. * the driver is loaded.
*
**/ **/
static void igb_get_hw_control(struct igb_adapter *adapter) static void igb_get_hw_control(struct igb_adapter *adapter)
{ {
...@@ -1541,7 +1565,8 @@ static void igb_configure(struct igb_adapter *adapter) ...@@ -1541,7 +1565,8 @@ static void igb_configure(struct igb_adapter *adapter)
/* call igb_desc_unused which always leaves /* call igb_desc_unused which always leaves
* at least 1 descriptor unused to make sure * at least 1 descriptor unused to make sure
* next_to_use != next_to_clean */ * next_to_use != next_to_clean
*/
for (i = 0; i < adapter->num_rx_queues; i++) { for (i = 0; i < adapter->num_rx_queues; i++) {
struct igb_ring *ring = adapter->rx_ring[i]; struct igb_ring *ring = adapter->rx_ring[i];
igb_alloc_rx_buffers(ring, igb_desc_unused(ring)); igb_alloc_rx_buffers(ring, igb_desc_unused(ring));
...@@ -1624,7 +1649,8 @@ void igb_down(struct igb_adapter *adapter) ...@@ -1624,7 +1649,8 @@ void igb_down(struct igb_adapter *adapter)
int i; int i;
/* signal that we're down so the interrupt handler does not /* signal that we're down so the interrupt handler does not
* reschedule our watchdog timer */ * reschedule our watchdog timer
*/
set_bit(__IGB_DOWN, &adapter->state); set_bit(__IGB_DOWN, &adapter->state);
/* disable receives in the hardware */ /* disable receives in the hardware */
...@@ -1694,6 +1720,7 @@ void igb_reset(struct igb_adapter *adapter) ...@@ -1694,6 +1720,7 @@ void igb_reset(struct igb_adapter *adapter)
*/ */
switch (mac->type) { switch (mac->type) {
case e1000_i350: case e1000_i350:
case e1000_i354:
case e1000_82580: case e1000_82580:
pba = rd32(E1000_RXPBS); pba = rd32(E1000_RXPBS);
pba = igb_rxpbs_adjust_82580(pba); pba = igb_rxpbs_adjust_82580(pba);
...@@ -1720,14 +1747,16 @@ void igb_reset(struct igb_adapter *adapter) ...@@ -1720,14 +1747,16 @@ void igb_reset(struct igb_adapter *adapter)
* rounded up to the next 1KB and expressed in KB. Likewise, * rounded up to the next 1KB and expressed in KB. Likewise,
* the Rx FIFO should be large enough to accommodate at least * the Rx FIFO should be large enough to accommodate at least
* one full receive packet and is similarly rounded up and * one full receive packet and is similarly rounded up and
* expressed in KB. */ * expressed in KB.
*/
pba = rd32(E1000_PBA); pba = rd32(E1000_PBA);
/* upper 16 bits has Tx packet buffer allocation size in KB */ /* upper 16 bits has Tx packet buffer allocation size in KB */
tx_space = pba >> 16; tx_space = pba >> 16;
/* lower 16 bits has Rx packet buffer allocation size in KB */ /* lower 16 bits has Rx packet buffer allocation size in KB */
pba &= 0xffff; pba &= 0xffff;
/* the tx fifo also stores 16 bytes of information about the tx /* the Tx fifo also stores 16 bytes of information about the Tx
* but don't include ethernet FCS because hardware appends it */ * but don't include ethernet FCS because hardware appends it
*/
min_tx_space = (adapter->max_frame_size + min_tx_space = (adapter->max_frame_size +
sizeof(union e1000_adv_tx_desc) - sizeof(union e1000_adv_tx_desc) -
ETH_FCS_LEN) * 2; ETH_FCS_LEN) * 2;
...@@ -1740,13 +1769,15 @@ void igb_reset(struct igb_adapter *adapter) ...@@ -1740,13 +1769,15 @@ void igb_reset(struct igb_adapter *adapter)
/* If current Tx allocation is less than the min Tx FIFO size, /* If current Tx allocation is less than the min Tx FIFO size,
* and the min Tx FIFO size is less than the current Rx FIFO * and the min Tx FIFO size is less than the current Rx FIFO
* allocation, take space away from current Rx allocation */ * allocation, take space away from current Rx allocation
*/
if (tx_space < min_tx_space && if (tx_space < min_tx_space &&
((min_tx_space - tx_space) < pba)) { ((min_tx_space - tx_space) < pba)) {
pba = pba - (min_tx_space - tx_space); pba = pba - (min_tx_space - tx_space);
/* if short on rx space, rx wins and must trump tx /* if short on Rx space, Rx wins and must trump Tx
* adjustment */ * adjustment
*/
if (pba < min_rx_space) if (pba < min_rx_space)
pba = min_rx_space; pba = min_rx_space;
} }
...@@ -1758,7 +1789,8 @@ void igb_reset(struct igb_adapter *adapter) ...@@ -1758,7 +1789,8 @@ void igb_reset(struct igb_adapter *adapter)
* (or the size used for early receive) above it in the Rx FIFO. * (or the size used for early receive) above it in the Rx FIFO.
* Set it to the lower of: * Set it to the lower of:
* - 90% of the Rx FIFO size, or * - 90% of the Rx FIFO size, or
* - the full Rx FIFO size minus one full frame */ * - the full Rx FIFO size minus one full frame
*/
hwm = min(((pba << 10) * 9 / 10), hwm = min(((pba << 10) * 9 / 10),
((pba << 10) - 2 * adapter->max_frame_size)); ((pba << 10) - 2 * adapter->max_frame_size));
...@@ -1789,8 +1821,7 @@ void igb_reset(struct igb_adapter *adapter) ...@@ -1789,8 +1821,7 @@ void igb_reset(struct igb_adapter *adapter)
if (hw->mac.ops.init_hw(hw)) if (hw->mac.ops.init_hw(hw))
dev_err(&pdev->dev, "Hardware Error\n"); dev_err(&pdev->dev, "Hardware Error\n");
/* /* Flow control settings reset on hardware reset, so guarantee flow
* Flow control settings reset on hardware reset, so guarantee flow
* control is off when forcing speed. * control is off when forcing speed.
*/ */
if (!hw->mac.autoneg) if (!hw->mac.autoneg)
...@@ -1826,9 +1857,8 @@ void igb_reset(struct igb_adapter *adapter) ...@@ -1826,9 +1857,8 @@ void igb_reset(struct igb_adapter *adapter)
static netdev_features_t igb_fix_features(struct net_device *netdev, static netdev_features_t igb_fix_features(struct net_device *netdev,
netdev_features_t features) netdev_features_t features)
{ {
/* /* Since there is no support for separate Rx/Tx vlan accel
* Since there is no support for separate rx/tx vlan accel * enable/disable make sure Tx flag is always in same state as Rx.
* enable/disable make sure tx flag is always in same state as rx.
*/ */
if (features & NETIF_F_HW_VLAN_RX) if (features & NETIF_F_HW_VLAN_RX)
features |= NETIF_F_HW_VLAN_TX; features |= NETIF_F_HW_VLAN_TX;
...@@ -1876,6 +1906,7 @@ static const struct net_device_ops igb_netdev_ops = { ...@@ -1876,6 +1906,7 @@ static const struct net_device_ops igb_netdev_ops = {
.ndo_set_vf_mac = igb_ndo_set_vf_mac, .ndo_set_vf_mac = igb_ndo_set_vf_mac,
.ndo_set_vf_vlan = igb_ndo_set_vf_vlan, .ndo_set_vf_vlan = igb_ndo_set_vf_vlan,
.ndo_set_vf_tx_rate = igb_ndo_set_vf_bw, .ndo_set_vf_tx_rate = igb_ndo_set_vf_bw,
.ndo_set_vf_spoofchk = igb_ndo_set_vf_spoofchk,
.ndo_get_vf_config = igb_ndo_get_vf_config, .ndo_get_vf_config = igb_ndo_get_vf_config,
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = igb_netpoll, .ndo_poll_controller = igb_netpoll,
...@@ -1887,7 +1918,6 @@ static const struct net_device_ops igb_netdev_ops = { ...@@ -1887,7 +1918,6 @@ static const struct net_device_ops igb_netdev_ops = {
/** /**
* igb_set_fw_version - Configure version string for ethtool * igb_set_fw_version - Configure version string for ethtool
* @adapter: adapter struct * @adapter: adapter struct
*
**/ **/
void igb_set_fw_version(struct igb_adapter *adapter) void igb_set_fw_version(struct igb_adapter *adapter)
{ {
...@@ -1923,10 +1953,10 @@ void igb_set_fw_version(struct igb_adapter *adapter) ...@@ -1923,10 +1953,10 @@ void igb_set_fw_version(struct igb_adapter *adapter)
return; return;
} }
/* igb_init_i2c - Init I2C interface /**
* igb_init_i2c - Init I2C interface
* @adapter: pointer to adapter structure * @adapter: pointer to adapter structure
* **/
*/
static s32 igb_init_i2c(struct igb_adapter *adapter) static s32 igb_init_i2c(struct igb_adapter *adapter)
{ {
s32 status = E1000_SUCCESS; s32 status = E1000_SUCCESS;
...@@ -1996,10 +2026,11 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1996,10 +2026,11 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} else { } else {
err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
if (err) { if (err) {
err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); err = dma_set_coherent_mask(&pdev->dev,
DMA_BIT_MASK(32));
if (err) { if (err) {
dev_err(&pdev->dev, "No usable DMA " dev_err(&pdev->dev,
"configuration, aborting\n"); "No usable DMA configuration, aborting\n");
goto err_dma; goto err_dma;
} }
} }
...@@ -2085,8 +2116,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2085,8 +2116,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dev_info(&pdev->dev, dev_info(&pdev->dev,
"PHY reset is blocked due to SOL/IDER session.\n"); "PHY reset is blocked due to SOL/IDER session.\n");
/* /* features is initialized to 0 in allocation, it might have bits
* features is initialized to 0 in allocation, it might have bits
* set by igb_sw_init so we should use an or instead of an * set by igb_sw_init so we should use an or instead of an
* assignment. * assignment.
*/ */
...@@ -2130,11 +2160,11 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2130,11 +2160,11 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
adapter->en_mng_pt = igb_enable_mng_pass_thru(hw); adapter->en_mng_pt = igb_enable_mng_pass_thru(hw);
/* before reading the NVM, reset the controller to put the device in a /* before reading the NVM, reset the controller to put the device in a
* known good starting state */ * known good starting state
*/
hw->mac.ops.reset_hw(hw); hw->mac.ops.reset_hw(hw);
/* /* make sure the NVM is good , i211 parts have special NVM that
* make sure the NVM is good , i211 parts have special NVM that
* doesn't contain a checksum * doesn't contain a checksum
*/ */
if (hw->mac.type != e1000_i211) { if (hw->mac.type != e1000_i211) {
...@@ -2195,7 +2225,8 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2195,7 +2225,8 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* now that we have the eeprom settings, apply the special cases where /* now that we have the eeprom settings, apply the special cases where
* the eeprom may be wrong or the board simply won't support wake on * the eeprom may be wrong or the board simply won't support wake on
* lan on a particular port */ * lan on a particular port
*/
switch (pdev->device) { switch (pdev->device) {
case E1000_DEV_ID_82575GB_QUAD_COPPER: case E1000_DEV_ID_82575GB_QUAD_COPPER:
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED; adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
...@@ -2204,7 +2235,8 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2204,7 +2235,8 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
case E1000_DEV_ID_82576_FIBER: case E1000_DEV_ID_82576_FIBER:
case E1000_DEV_ID_82576_SERDES: case E1000_DEV_ID_82576_SERDES:
/* Wake events only supported on port A for dual fiber /* Wake events only supported on port A for dual fiber
* regardless of eeprom setting */ * regardless of eeprom setting
*/
if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1) if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1)
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED; adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
break; break;
...@@ -2274,8 +2306,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2274,8 +2306,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (hw->mac.type == e1000_i350 && hw->bus.func == 0) { if (hw->mac.type == e1000_i350 && hw->bus.func == 0) {
u16 ets_word; u16 ets_word;
/* /* Read the NVM to determine if this i350 device supports an
* Read the NVM to determine if this i350 device supports an
* external thermal sensor. * external thermal sensor.
*/ */
hw->nvm.ops.read(hw, NVM_ETS_CFG, 1, &ets_word); hw->nvm.ops.read(hw, NVM_ETS_CFG, 1, &ets_word);
...@@ -2294,17 +2325,20 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2294,17 +2325,20 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
igb_ptp_init(adapter); igb_ptp_init(adapter);
dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n"); dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n");
/* print bus type/speed/width info */ /* print bus type/speed/width info, not applicable to i354 */
if (hw->mac.type != e1000_i354) {
dev_info(&pdev->dev, "%s: (PCIe:%s:%s) %pM\n", dev_info(&pdev->dev, "%s: (PCIe:%s:%s) %pM\n",
netdev->name, netdev->name,
((hw->bus.speed == e1000_bus_speed_2500) ? "2.5Gb/s" : ((hw->bus.speed == e1000_bus_speed_2500) ? "2.5Gb/s" :
(hw->bus.speed == e1000_bus_speed_5000) ? "5.0Gb/s" : (hw->bus.speed == e1000_bus_speed_5000) ? "5.0Gb/s" :
"unknown"), "unknown"),
((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" : ((hw->bus.width == e1000_bus_width_pcie_x4) ?
(hw->bus.width == e1000_bus_width_pcie_x2) ? "Width x2" : "Width x4" :
(hw->bus.width == e1000_bus_width_pcie_x1) ? "Width x1" : (hw->bus.width == e1000_bus_width_pcie_x2) ?
"unknown"), "Width x2" :
netdev->dev_addr); (hw->bus.width == e1000_bus_width_pcie_x1) ?
"Width x1" : "unknown"), netdev->dev_addr);
}
ret_val = igb_read_part_string(hw, part_str, E1000_PBANUM_LENGTH); ret_val = igb_read_part_string(hw, part_str, E1000_PBANUM_LENGTH);
if (ret_val) if (ret_val)
...@@ -2321,6 +2355,13 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2321,6 +2355,13 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
case e1000_i211: case e1000_i211:
igb_set_eee_i350(hw); igb_set_eee_i350(hw);
break; break;
case e1000_i354:
if (hw->phy.media_type == e1000_media_type_copper) {
if ((rd32(E1000_CTRL_EXT) &
E1000_CTRL_EXT_LINK_MODE_SGMII))
igb_set_eee_i354(hw);
}
break;
default: default:
break; break;
} }
...@@ -2444,14 +2485,12 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs) ...@@ -2444,14 +2485,12 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs)
} }
#endif #endif
/* /**
* igb_remove_i2c - Cleanup I2C interface * igb_remove_i2c - Cleanup I2C interface
* @adapter: pointer to adapter structure * @adapter: pointer to adapter structure
* **/
*/
static void igb_remove_i2c(struct igb_adapter *adapter) static void igb_remove_i2c(struct igb_adapter *adapter)
{ {
/* free the adapter bus structure */ /* free the adapter bus structure */
i2c_del_adapter(&adapter->i2c_adap); i2c_del_adapter(&adapter->i2c_adap);
} }
...@@ -2477,8 +2516,7 @@ static void igb_remove(struct pci_dev *pdev) ...@@ -2477,8 +2516,7 @@ static void igb_remove(struct pci_dev *pdev)
#endif #endif
igb_remove_i2c(adapter); igb_remove_i2c(adapter);
igb_ptp_stop(adapter); igb_ptp_stop(adapter);
/* /* The watchdog timer may be rescheduled, so explicitly
* The watchdog timer may be rescheduled, so explicitly
* disable watchdog from being rescheduled. * disable watchdog from being rescheduled.
*/ */
set_bit(__IGB_DOWN, &adapter->state); set_bit(__IGB_DOWN, &adapter->state);
...@@ -2498,7 +2536,8 @@ static void igb_remove(struct pci_dev *pdev) ...@@ -2498,7 +2536,8 @@ static void igb_remove(struct pci_dev *pdev)
#endif #endif
/* Release control of h/w to f/w. If f/w is AMT enabled, this /* Release control of h/w to f/w. If f/w is AMT enabled, this
* would have already happened in close and is redundant. */ * would have already happened in close and is redundant.
*/
igb_release_hw_control(adapter); igb_release_hw_control(adapter);
unregister_netdev(netdev); unregister_netdev(netdev);
...@@ -2576,6 +2615,7 @@ static void igb_init_queue_configuration(struct igb_adapter *adapter) ...@@ -2576,6 +2615,7 @@ static void igb_init_queue_configuration(struct igb_adapter *adapter)
} }
/* fall through */ /* fall through */
case e1000_82580: case e1000_82580:
case e1000_i354:
default: default:
max_rss_queues = IGB_MAX_RX_QUEUES; max_rss_queues = IGB_MAX_RX_QUEUES;
break; break;
...@@ -2590,8 +2630,7 @@ static void igb_init_queue_configuration(struct igb_adapter *adapter) ...@@ -2590,8 +2630,7 @@ static void igb_init_queue_configuration(struct igb_adapter *adapter)
/* Device supports enough interrupts without queue pairing. */ /* Device supports enough interrupts without queue pairing. */
break; break;
case e1000_82576: case e1000_82576:
/* /* If VFs are going to be allocated with RSS queues then we
* If VFs are going to be allocated with RSS queues then we
* should pair the queues in order to conserve interrupts due * should pair the queues in order to conserve interrupts due
* to limited supply. * to limited supply.
*/ */
...@@ -2601,10 +2640,10 @@ static void igb_init_queue_configuration(struct igb_adapter *adapter) ...@@ -2601,10 +2640,10 @@ static void igb_init_queue_configuration(struct igb_adapter *adapter)
/* fall through */ /* fall through */
case e1000_82580: case e1000_82580:
case e1000_i350: case e1000_i350:
case e1000_i354:
case e1000_i210: case e1000_i210:
default: default:
/* /* If rss_queues > half of max_rss_queues, pair the queues in
* If rss_queues > half of max_rss_queues, pair the queues in
* order to conserve interrupts due to limited supply. * order to conserve interrupts due to limited supply.
*/ */
if (adapter->rss_queues > (max_rss_queues / 2)) if (adapter->rss_queues > (max_rss_queues / 2))
...@@ -2734,7 +2773,8 @@ static int __igb_open(struct net_device *netdev, bool resuming) ...@@ -2734,7 +2773,8 @@ static int __igb_open(struct net_device *netdev, bool resuming)
/* before we allocate an interrupt, we must be ready to handle it. /* before we allocate an interrupt, we must be ready to handle it.
* Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
* as soon as we call pci_request_irq, so we have to setup our * as soon as we call pci_request_irq, so we have to setup our
* clean_rx handler before we do so. */ * clean_rx handler before we do so.
*/
igb_configure(adapter); igb_configure(adapter);
err = igb_request_irq(adapter); err = igb_request_irq(adapter);
...@@ -2983,7 +3023,7 @@ static void igb_configure_tx(struct igb_adapter *adapter) ...@@ -2983,7 +3023,7 @@ static void igb_configure_tx(struct igb_adapter *adapter)
/** /**
* igb_setup_rx_resources - allocate Rx resources (Descriptors) * igb_setup_rx_resources - allocate Rx resources (Descriptors)
* @rx_ring: rx descriptor ring (for a specific queue) to setup * @rx_ring: Rx descriptor ring (for a specific queue) to setup
* *
* Returns 0 on success, negative on failure * Returns 0 on success, negative on failure
**/ **/
...@@ -3081,8 +3121,7 @@ static void igb_setup_mrqc(struct igb_adapter *adapter) ...@@ -3081,8 +3121,7 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
break; break;
} }
/* /* Populate the indirection table 4 entries at a time. To do this
* Populate the indirection table 4 entries at a time. To do this
* we are generating the results for n and n+2 and then interleaving * we are generating the results for n and n+2 and then interleaving
* those with the results with n+1 and n+3. * those with the results with n+1 and n+3.
*/ */
...@@ -3098,8 +3137,7 @@ static void igb_setup_mrqc(struct igb_adapter *adapter) ...@@ -3098,8 +3137,7 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
wr32(E1000_RETA(j), reta); wr32(E1000_RETA(j), reta);
} }
/* /* Disable raw packet checksumming so that RSS hash is placed in
* Disable raw packet checksumming so that RSS hash is placed in
* descriptor on writeback. No need to enable TCP/UDP/IP checksum * descriptor on writeback. No need to enable TCP/UDP/IP checksum
* offloads as they are enabled by default * offloads as they are enabled by default
*/ */
...@@ -3129,7 +3167,8 @@ static void igb_setup_mrqc(struct igb_adapter *adapter) ...@@ -3129,7 +3167,8 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
/* If VMDq is enabled then we set the appropriate mode for that, else /* If VMDq is enabled then we set the appropriate mode for that, else
* we default to RSS so that an RSS hash is calculated per packet even * we default to RSS so that an RSS hash is calculated per packet even
* if we are only using one queue */ * if we are only using one queue
*/
if (adapter->vfs_allocated_count) { if (adapter->vfs_allocated_count) {
if (hw->mac.type > e1000_82575) { if (hw->mac.type > e1000_82575) {
/* Set the default pool for the PF's first queue */ /* Set the default pool for the PF's first queue */
...@@ -3170,8 +3209,7 @@ void igb_setup_rctl(struct igb_adapter *adapter) ...@@ -3170,8 +3209,7 @@ void igb_setup_rctl(struct igb_adapter *adapter)
rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_RDMTS_HALF | rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_RDMTS_HALF |
(hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT); (hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT);
/* /* enable stripping of CRC. It's unlikely this will break BMC
* enable stripping of CRC. It's unlikely this will break BMC
* redirection as it did with e1000. Newer features require * redirection as it did with e1000. Newer features require
* that the HW strips the CRC. * that the HW strips the CRC.
*/ */
...@@ -3198,7 +3236,8 @@ void igb_setup_rctl(struct igb_adapter *adapter) ...@@ -3198,7 +3236,8 @@ void igb_setup_rctl(struct igb_adapter *adapter)
/* This is useful for sniffing bad packets. */ /* This is useful for sniffing bad packets. */
if (adapter->netdev->features & NETIF_F_RXALL) { if (adapter->netdev->features & NETIF_F_RXALL) {
/* UPE and MPE will be handled by normal PROMISC logic /* UPE and MPE will be handled by normal PROMISC logic
* in e1000e_set_rx_mode */ * in e1000e_set_rx_mode
*/
rctl |= (E1000_RCTL_SBP | /* Receive bad packets */ rctl |= (E1000_RCTL_SBP | /* Receive bad packets */
E1000_RCTL_BAM | /* RX All Bcast Pkts */ E1000_RCTL_BAM | /* RX All Bcast Pkts */
E1000_RCTL_PMCF); /* RX All MAC Ctrl Pkts */ E1000_RCTL_PMCF); /* RX All MAC Ctrl Pkts */
...@@ -3221,7 +3260,8 @@ static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size, ...@@ -3221,7 +3260,8 @@ static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size,
u32 vmolr; u32 vmolr;
/* if it isn't the PF check to see if VFs are enabled and /* if it isn't the PF check to see if VFs are enabled and
* increase the size to support vlan tags */ * increase the size to support vlan tags
*/
if (vfn < adapter->vfs_allocated_count && if (vfn < adapter->vfs_allocated_count &&
adapter->vf_data[vfn].vlans_enabled) adapter->vf_data[vfn].vlans_enabled)
size += VLAN_TAG_SIZE; size += VLAN_TAG_SIZE;
...@@ -3248,8 +3288,7 @@ static void igb_rlpml_set(struct igb_adapter *adapter) ...@@ -3248,8 +3288,7 @@ static void igb_rlpml_set(struct igb_adapter *adapter)
if (pf_id) { if (pf_id) {
igb_set_vf_rlpml(adapter, max_frame_size, pf_id); igb_set_vf_rlpml(adapter, max_frame_size, pf_id);
/* /* If we're in VMDQ or SR-IOV mode, then set global RLPML
* If we're in VMDQ or SR-IOV mode, then set global RLPML
* to our max jumbo frame size, in case we need to enable * to our max jumbo frame size, in case we need to enable
* jumbo frames on one of the rings later. * jumbo frames on one of the rings later.
* This will not pass over-length frames into the default * This will not pass over-length frames into the default
...@@ -3267,8 +3306,7 @@ static inline void igb_set_vmolr(struct igb_adapter *adapter, ...@@ -3267,8 +3306,7 @@ static inline void igb_set_vmolr(struct igb_adapter *adapter,
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 vmolr; u32 vmolr;
/* /* This register exists only on 82576 and newer so if we are older then
* This register exists only on 82576 and newer so if we are older then
* we should exit and do nothing * we should exit and do nothing
*/ */
if (hw->mac.type < e1000_82576) if (hw->mac.type < e1000_82576)
...@@ -3286,8 +3324,7 @@ static inline void igb_set_vmolr(struct igb_adapter *adapter, ...@@ -3286,8 +3324,7 @@ static inline void igb_set_vmolr(struct igb_adapter *adapter,
if (adapter->rss_queues > 1 && vfn == adapter->vfs_allocated_count) if (adapter->rss_queues > 1 && vfn == adapter->vfs_allocated_count)
vmolr |= E1000_VMOLR_RSSE; /* enable RSS */ vmolr |= E1000_VMOLR_RSSE; /* enable RSS */
/* /* for VMDq only allow the VFs and pool 0 to accept broadcast and
* for VMDq only allow the VFs and pool 0 to accept broadcast and
* multicast packets * multicast packets
*/ */
if (vfn <= adapter->vfs_allocated_count) if (vfn <= adapter->vfs_allocated_count)
...@@ -3382,7 +3419,8 @@ static void igb_configure_rx(struct igb_adapter *adapter) ...@@ -3382,7 +3419,8 @@ static void igb_configure_rx(struct igb_adapter *adapter)
adapter->vfs_allocated_count); adapter->vfs_allocated_count);
/* Setup the HW Rx Head and Tail Descriptor Pointers and /* Setup the HW Rx Head and Tail Descriptor Pointers and
* the Base and Length of the Rx Descriptor Ring */ * the Base and Length of the Rx Descriptor Ring
*/
for (i = 0; i < adapter->num_rx_queues; i++) { for (i = 0; i < adapter->num_rx_queues; i++) {
struct igb_ring *rx_ring = adapter->rx_ring[i]; struct igb_ring *rx_ring = adapter->rx_ring[i];
igb_set_rx_buffer_len(adapter, rx_ring); igb_set_rx_buffer_len(adapter, rx_ring);
...@@ -3723,8 +3761,7 @@ static void igb_set_rx_mode(struct net_device *netdev) ...@@ -3723,8 +3761,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
rctl |= E1000_RCTL_MPE; rctl |= E1000_RCTL_MPE;
vmolr |= E1000_VMOLR_MPME; vmolr |= E1000_VMOLR_MPME;
} else { } else {
/* /* Write addresses to the MTA, if the attempt fails
* Write addresses to the MTA, if the attempt fails
* then we should just turn on promiscuous mode so * then we should just turn on promiscuous mode so
* that we can at least receive multicast traffic * that we can at least receive multicast traffic
*/ */
...@@ -3736,8 +3773,7 @@ static void igb_set_rx_mode(struct net_device *netdev) ...@@ -3736,8 +3773,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
vmolr |= E1000_VMOLR_ROMPE; vmolr |= E1000_VMOLR_ROMPE;
} }
} }
/* /* Write addresses to available RAR registers, if there is not
* Write addresses to available RAR registers, if there is not
* sufficient space to store all the addresses then enable * sufficient space to store all the addresses then enable
* unicast promiscuous mode * unicast promiscuous mode
*/ */
...@@ -3750,8 +3786,7 @@ static void igb_set_rx_mode(struct net_device *netdev) ...@@ -3750,8 +3786,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
} }
wr32(E1000_RCTL, rctl); wr32(E1000_RCTL, rctl);
/* /* In order to support SR-IOV and eventually VMDq it is necessary to set
* In order to support SR-IOV and eventually VMDq it is necessary to set
* the VMOLR to enable the appropriate modes. Without this workaround * the VMOLR to enable the appropriate modes. Without this workaround
* we will have issues with VLAN tag stripping not being done for frames * we will have issues with VLAN tag stripping not being done for frames
* that are only arriving because we are the default pool * that are only arriving because we are the default pool
...@@ -3805,7 +3840,8 @@ static void igb_spoof_check(struct igb_adapter *adapter) ...@@ -3805,7 +3840,8 @@ static void igb_spoof_check(struct igb_adapter *adapter)
} }
/* Need to wait a few seconds after link up to get diagnostic information from /* Need to wait a few seconds after link up to get diagnostic information from
* the phy */ * the phy
*/
static void igb_update_phy_info(unsigned long data) static void igb_update_phy_info(unsigned long data)
{ {
struct igb_adapter *adapter = (struct igb_adapter *) data; struct igb_adapter *adapter = (struct igb_adapter *) data;
...@@ -3859,10 +3895,9 @@ static bool igb_thermal_sensor_event(struct e1000_hw *hw, u32 event) ...@@ -3859,10 +3895,9 @@ static bool igb_thermal_sensor_event(struct e1000_hw *hw, u32 event)
ctrl_ext = rd32(E1000_CTRL_EXT); ctrl_ext = rd32(E1000_CTRL_EXT);
if ((hw->phy.media_type == e1000_media_type_copper) && if ((hw->phy.media_type == e1000_media_type_copper) &&
!(ctrl_ext & E1000_CTRL_EXT_LINK_MODE_SGMII)) { !(ctrl_ext & E1000_CTRL_EXT_LINK_MODE_SGMII))
ret = !!(thstat & event); ret = !!(thstat & event);
} }
}
return ret; return ret;
} }
...@@ -3980,7 +4015,8 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -3980,7 +4015,8 @@ static void igb_watchdog_task(struct work_struct *work)
/* We've lost link, so the controller stops DMA, /* We've lost link, so the controller stops DMA,
* but we've got queued Tx work that's never going * but we've got queued Tx work that's never going
* to get done, so reset controller to flush Tx. * to get done, so reset controller to flush Tx.
* (Do the reset outside of interrupt context). */ * (Do the reset outside of interrupt context).
*/
if (igb_desc_unused(tx_ring) + 1 < tx_ring->count) { if (igb_desc_unused(tx_ring) + 1 < tx_ring->count) {
adapter->tx_timeout_count++; adapter->tx_timeout_count++;
schedule_work(&adapter->reset_task); schedule_work(&adapter->reset_task);
...@@ -3993,7 +4029,7 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -3993,7 +4029,7 @@ static void igb_watchdog_task(struct work_struct *work)
set_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags); set_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags);
} }
/* Cause software interrupt to ensure rx ring is cleaned */ /* Cause software interrupt to ensure Rx ring is cleaned */
if (adapter->msix_entries) { if (adapter->msix_entries) {
u32 eics = 0; u32 eics = 0;
for (i = 0; i < adapter->num_q_vectors; i++) for (i = 0; i < adapter->num_q_vectors; i++)
...@@ -4021,6 +4057,7 @@ enum latency_range { ...@@ -4021,6 +4057,7 @@ enum latency_range {
/** /**
* igb_update_ring_itr - update the dynamic ITR value based on packet size * igb_update_ring_itr - update the dynamic ITR value based on packet size
* @q_vector: pointer to q_vector
* *
* Stores a new ITR value based on strictly on packet size. This * Stores a new ITR value based on strictly on packet size. This
* algorithm is less sophisticated than that used in igb_update_itr, * algorithm is less sophisticated than that used in igb_update_itr,
...@@ -4033,7 +4070,6 @@ enum latency_range { ...@@ -4033,7 +4070,6 @@ enum latency_range {
* parameter (see igb_param.c) * parameter (see igb_param.c)
* NOTE: This function is called only when operating in a multiqueue * NOTE: This function is called only when operating in a multiqueue
* receive environment. * receive environment.
* @q_vector: pointer to q_vector
**/ **/
static void igb_update_ring_itr(struct igb_q_vector *q_vector) static void igb_update_ring_itr(struct igb_q_vector *q_vector)
{ {
...@@ -4095,6 +4131,9 @@ static void igb_update_ring_itr(struct igb_q_vector *q_vector) ...@@ -4095,6 +4131,9 @@ static void igb_update_ring_itr(struct igb_q_vector *q_vector)
/** /**
* igb_update_itr - update the dynamic ITR value based on statistics * igb_update_itr - update the dynamic ITR value based on statistics
* @q_vector: pointer to q_vector
* @ring_container: ring info to update the itr for
*
* Stores a new ITR value based on packets and byte * Stores a new ITR value based on packets and byte
* counts during the last interrupt. The advantage of per interrupt * counts during the last interrupt. The advantage of per interrupt
* computation is faster updates and more accurate ITR for the current * computation is faster updates and more accurate ITR for the current
...@@ -4106,8 +4145,6 @@ static void igb_update_ring_itr(struct igb_q_vector *q_vector) ...@@ -4106,8 +4145,6 @@ static void igb_update_ring_itr(struct igb_q_vector *q_vector)
* parameter (see igb_param.c) * parameter (see igb_param.c)
* NOTE: These calculations are only valid when operating in a single- * NOTE: These calculations are only valid when operating in a single-
* queue environment. * queue environment.
* @q_vector: pointer to q_vector
* @ring_container: ring info to update the itr for
**/ **/
static void igb_update_itr(struct igb_q_vector *q_vector, static void igb_update_itr(struct igb_q_vector *q_vector,
struct igb_ring_container *ring_container) struct igb_ring_container *ring_container)
...@@ -4205,12 +4242,12 @@ static void igb_set_itr(struct igb_q_vector *q_vector) ...@@ -4205,12 +4242,12 @@ static void igb_set_itr(struct igb_q_vector *q_vector)
if (new_itr != q_vector->itr_val) { if (new_itr != q_vector->itr_val) {
/* this attempts to bias the interrupt rate towards Bulk /* this attempts to bias the interrupt rate towards Bulk
* by adding intermediate steps when interrupt rate is * by adding intermediate steps when interrupt rate is
* increasing */ * increasing
*/
new_itr = new_itr > q_vector->itr_val ? new_itr = new_itr > q_vector->itr_val ?
max((new_itr * q_vector->itr_val) / max((new_itr * q_vector->itr_val) /
(new_itr + (q_vector->itr_val >> 2)), (new_itr + (q_vector->itr_val >> 2)),
new_itr) : new_itr) : new_itr;
new_itr;
/* Don't write the value here; it resets the adapter's /* Don't write the value here; it resets the adapter's
* internal timer, and causes us to delay far longer than * internal timer, and causes us to delay far longer than
* we should between interrupts. Instead, we write the ITR * we should between interrupts. Instead, we write the ITR
...@@ -4514,8 +4551,7 @@ static void igb_tx_map(struct igb_ring *tx_ring, ...@@ -4514,8 +4551,7 @@ static void igb_tx_map(struct igb_ring *tx_ring,
/* set the timestamp */ /* set the timestamp */
first->time_stamp = jiffies; first->time_stamp = jiffies;
/* /* Force memory writes to complete before letting h/w know there
* Force memory writes to complete before letting h/w know there
* are new descriptors to fetch. (Only applicable for weak-ordered * are new descriptors to fetch. (Only applicable for weak-ordered
* memory model archs, such as IA-64). * memory model archs, such as IA-64).
* *
...@@ -4536,7 +4572,8 @@ static void igb_tx_map(struct igb_ring *tx_ring, ...@@ -4536,7 +4572,8 @@ static void igb_tx_map(struct igb_ring *tx_ring,
writel(i, tx_ring->tail); writel(i, tx_ring->tail);
/* we need this if more than one processor can write to our tail /* we need this if more than one processor can write to our tail
* at a time, it syncronizes IO on IA64/Altix systems */ * at a time, it synchronizes IO on IA64/Altix systems
*/
mmiowb(); mmiowb();
return; return;
...@@ -4566,11 +4603,13 @@ static int __igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size) ...@@ -4566,11 +4603,13 @@ static int __igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size)
/* Herbert's original patch had: /* Herbert's original patch had:
* smp_mb__after_netif_stop_queue(); * smp_mb__after_netif_stop_queue();
* but since that doesn't exist yet, just open code it. */ * but since that doesn't exist yet, just open code it.
*/
smp_mb(); smp_mb();
/* We need to check again in a case another CPU has just /* We need to check again in a case another CPU has just
* made room available. */ * made room available.
*/
if (igb_desc_unused(tx_ring) < size) if (igb_desc_unused(tx_ring) < size)
return -EBUSY; return -EBUSY;
...@@ -4594,7 +4633,6 @@ static inline int igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size) ...@@ -4594,7 +4633,6 @@ static inline int igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size)
netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
struct igb_ring *tx_ring) struct igb_ring *tx_ring)
{ {
struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
struct igb_tx_buffer *first; struct igb_tx_buffer *first;
int tso; int tso;
u32 tx_flags = 0; u32 tx_flags = 0;
...@@ -4629,8 +4667,10 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, ...@@ -4629,8 +4667,10 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
skb_tx_timestamp(skb); skb_tx_timestamp(skb);
if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
!(adapter->ptp_tx_skb))) { struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
if (!(adapter->ptp_tx_skb)) {
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
tx_flags |= IGB_TX_FLAGS_TSTAMP; tx_flags |= IGB_TX_FLAGS_TSTAMP;
...@@ -4639,6 +4679,7 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, ...@@ -4639,6 +4679,7 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
if (adapter->hw.mac.type == e1000_82576) if (adapter->hw.mac.type == e1000_82576)
schedule_work(&adapter->ptp_tx_work); schedule_work(&adapter->ptp_tx_work);
} }
}
if (vlan_tx_tag_present(skb)) { if (vlan_tx_tag_present(skb)) {
tx_flags |= IGB_TX_FLAGS_VLAN; tx_flags |= IGB_TX_FLAGS_VLAN;
...@@ -4694,8 +4735,7 @@ static netdev_tx_t igb_xmit_frame(struct sk_buff *skb, ...@@ -4694,8 +4735,7 @@ static netdev_tx_t igb_xmit_frame(struct sk_buff *skb,
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
/* /* The minimum packet size with TCTL.PSP set is 17 so pad the skb
* The minimum packet size with TCTL.PSP set is 17 so pad the skb
* in order to meet this minimum size requirement. * in order to meet this minimum size requirement.
*/ */
if (unlikely(skb->len < 17)) { if (unlikely(skb->len < 17)) {
...@@ -4742,7 +4782,6 @@ static void igb_reset_task(struct work_struct *work) ...@@ -4742,7 +4782,6 @@ static void igb_reset_task(struct work_struct *work)
* igb_get_stats64 - Get System Network Statistics * igb_get_stats64 - Get System Network Statistics
* @netdev: network interface device structure * @netdev: network interface device structure
* @stats: rtnl_link_stats64 pointer * @stats: rtnl_link_stats64 pointer
*
**/ **/
static struct rtnl_link_stats64 *igb_get_stats64(struct net_device *netdev, static struct rtnl_link_stats64 *igb_get_stats64(struct net_device *netdev,
struct rtnl_link_stats64 *stats) struct rtnl_link_stats64 *stats)
...@@ -4808,7 +4847,6 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -4808,7 +4847,6 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
* igb_update_stats - Update the board statistics counters * igb_update_stats - Update the board statistics counters
* @adapter: board private structure * @adapter: board private structure
**/ **/
void igb_update_stats(struct igb_adapter *adapter, void igb_update_stats(struct igb_adapter *adapter,
struct rtnl_link_stats64 *net_stats) struct rtnl_link_stats64 *net_stats)
{ {
...@@ -4823,8 +4861,7 @@ void igb_update_stats(struct igb_adapter *adapter, ...@@ -4823,8 +4861,7 @@ void igb_update_stats(struct igb_adapter *adapter,
#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
/* /* Prevent stats update while adapter is being reset, or if the pci
* Prevent stats update while adapter is being reset, or if the pci
* connection is down. * connection is down.
*/ */
if (adapter->link_speed == 0) if (adapter->link_speed == 0)
...@@ -4958,7 +4995,8 @@ void igb_update_stats(struct igb_adapter *adapter, ...@@ -4958,7 +4995,8 @@ void igb_update_stats(struct igb_adapter *adapter,
/* Rx Errors */ /* Rx Errors */
/* RLEC on some newer hardware can be incorrect so build /* RLEC on some newer hardware can be incorrect so build
* our own version based on RUC and ROC */ * our own version based on RUC and ROC
*/
net_stats->rx_errors = adapter->stats.rxerrc + net_stats->rx_errors = adapter->stats.rxerrc +
adapter->stats.crcerrs + adapter->stats.algnerrc + adapter->stats.crcerrs + adapter->stats.algnerrc +
adapter->stats.ruc + adapter->stats.roc + adapter->stats.ruc + adapter->stats.roc +
...@@ -5017,7 +5055,8 @@ static irqreturn_t igb_msix_other(int irq, void *data) ...@@ -5017,7 +5055,8 @@ static irqreturn_t igb_msix_other(int irq, void *data)
adapter->stats.doosync++; adapter->stats.doosync++;
/* The DMA Out of Sync is also indication of a spoof event /* The DMA Out of Sync is also indication of a spoof event
* in IOV mode. Check the Wrong VM Behavior register to * in IOV mode. Check the Wrong VM Behavior register to
* see if it is really a spoof event. */ * see if it is really a spoof event.
*/
igb_check_wvbr(adapter); igb_check_wvbr(adapter);
} }
...@@ -5091,8 +5130,7 @@ static void igb_update_tx_dca(struct igb_adapter *adapter, ...@@ -5091,8 +5130,7 @@ static void igb_update_tx_dca(struct igb_adapter *adapter,
if (hw->mac.type != e1000_82575) if (hw->mac.type != e1000_82575)
txctrl <<= E1000_DCA_TXCTRL_CPUID_SHIFT; txctrl <<= E1000_DCA_TXCTRL_CPUID_SHIFT;
/* /* We can enable relaxed ordering for reads, but not writes when
* We can enable relaxed ordering for reads, but not writes when
* DCA is enabled. This is due to a known issue in some chipsets * DCA is enabled. This is due to a known issue in some chipsets
* which will cause the DCA tag to be cleared. * which will cause the DCA tag to be cleared.
*/ */
...@@ -5113,8 +5151,7 @@ static void igb_update_rx_dca(struct igb_adapter *adapter, ...@@ -5113,8 +5151,7 @@ static void igb_update_rx_dca(struct igb_adapter *adapter,
if (hw->mac.type != e1000_82575) if (hw->mac.type != e1000_82575)
rxctrl <<= E1000_DCA_RXCTRL_CPUID_SHIFT; rxctrl <<= E1000_DCA_RXCTRL_CPUID_SHIFT;
/* /* We can enable relaxed ordering for reads, but not writes when
* We can enable relaxed ordering for reads, but not writes when
* DCA is enabled. This is due to a known issue in some chipsets * DCA is enabled. This is due to a known issue in some chipsets
* which will cause the DCA tag to be cleared. * which will cause the DCA tag to be cleared.
*/ */
...@@ -5183,7 +5220,8 @@ static int __igb_notify_dca(struct device *dev, void *data) ...@@ -5183,7 +5220,8 @@ static int __igb_notify_dca(struct device *dev, void *data)
case DCA_PROVIDER_REMOVE: case DCA_PROVIDER_REMOVE:
if (adapter->flags & IGB_FLAG_DCA_ENABLED) { if (adapter->flags & IGB_FLAG_DCA_ENABLED) {
/* without this a class_device is left /* without this a class_device is left
* hanging around in the sysfs model */ * hanging around in the sysfs model
*/
dca_remove_requester(dev); dca_remove_requester(dev);
dev_info(&pdev->dev, "DCA disabled\n"); dev_info(&pdev->dev, "DCA disabled\n");
adapter->flags &= ~IGB_FLAG_DCA_ENABLED; adapter->flags &= ~IGB_FLAG_DCA_ENABLED;
...@@ -5215,6 +5253,9 @@ static int igb_vf_configure(struct igb_adapter *adapter, int vf) ...@@ -5215,6 +5253,9 @@ static int igb_vf_configure(struct igb_adapter *adapter, int vf)
eth_zero_addr(mac_addr); eth_zero_addr(mac_addr);
igb_set_vf_mac(adapter, vf, mac_addr); igb_set_vf_mac(adapter, vf, mac_addr);
/* By default spoof check is enabled for all VFs */
adapter->vf_data[vf].spoofchk_enabled = true;
return 0; return 0;
} }
...@@ -5281,8 +5322,7 @@ static int igb_set_vf_promisc(struct igb_adapter *adapter, u32 *msgbuf, u32 vf) ...@@ -5281,8 +5322,7 @@ static int igb_set_vf_promisc(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)
vf_data->flags |= IGB_VF_FLAG_MULTI_PROMISC; vf_data->flags |= IGB_VF_FLAG_MULTI_PROMISC;
*msgbuf &= ~E1000_VF_SET_PROMISC_MULTICAST; *msgbuf &= ~E1000_VF_SET_PROMISC_MULTICAST;
} else { } else {
/* /* if we have hashes and we are clearing a multicast promisc
* if we have hashes and we are clearing a multicast promisc
* flag we need to write the hashes to the MTA as this step * flag we need to write the hashes to the MTA as this step
* was previously skipped * was previously skipped
*/ */
...@@ -5303,7 +5343,6 @@ static int igb_set_vf_promisc(struct igb_adapter *adapter, u32 *msgbuf, u32 vf) ...@@ -5303,7 +5343,6 @@ static int igb_set_vf_promisc(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)
return -EINVAL; return -EINVAL;
return 0; return 0;
} }
static int igb_set_vf_multicasts(struct igb_adapter *adapter, static int igb_set_vf_multicasts(struct igb_adapter *adapter,
...@@ -5510,11 +5549,9 @@ static int igb_ndo_set_vf_vlan(struct net_device *netdev, ...@@ -5510,11 +5549,9 @@ static int igb_ndo_set_vf_vlan(struct net_device *netdev,
"Setting VLAN %d, QOS 0x%x on VF %d\n", vlan, qos, vf); "Setting VLAN %d, QOS 0x%x on VF %d\n", vlan, qos, vf);
if (test_bit(__IGB_DOWN, &adapter->state)) { if (test_bit(__IGB_DOWN, &adapter->state)) {
dev_warn(&adapter->pdev->dev, dev_warn(&adapter->pdev->dev,
"The VF VLAN has been set," "The VF VLAN has been set, but the PF device is not up.\n");
" but the PF device is not up.\n");
dev_warn(&adapter->pdev->dev, dev_warn(&adapter->pdev->dev,
"Bring the PF device up before" "Bring the PF device up before attempting to use the VF device.\n");
" attempting to use the VF device.\n");
} }
} else { } else {
igb_vlvf_set(adapter, adapter->vf_data[vf].pf_vlan, igb_vlvf_set(adapter, adapter->vf_data[vf].pf_vlan,
...@@ -5603,8 +5640,7 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf) ...@@ -5603,8 +5640,7 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf)
static int igb_set_vf_mac_addr(struct igb_adapter *adapter, u32 *msg, int vf) static int igb_set_vf_mac_addr(struct igb_adapter *adapter, u32 *msg, int vf)
{ {
/* /* The VF MAC Address is stored in a packed array of bytes
* The VF MAC Address is stored in a packed array of bytes
* starting at the second 32 bit word of the msg array * starting at the second 32 bit word of the msg array
*/ */
unsigned char *addr = (char *)&msg[1]; unsigned char *addr = (char *)&msg[1];
...@@ -5653,11 +5689,9 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf) ...@@ -5653,11 +5689,9 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
if (msgbuf[0] & (E1000_VT_MSGTYPE_ACK | E1000_VT_MSGTYPE_NACK)) if (msgbuf[0] & (E1000_VT_MSGTYPE_ACK | E1000_VT_MSGTYPE_NACK))
return; return;
/* /* until the vf completes a reset it should not be
* until the vf completes a reset it should not be
* allowed to start any configuration. * allowed to start any configuration.
*/ */
if (msgbuf[0] == E1000_VF_RESET) { if (msgbuf[0] == E1000_VF_RESET) {
igb_vf_reset_msg(adapter, vf); igb_vf_reset_msg(adapter, vf);
return; return;
...@@ -5677,9 +5711,8 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf) ...@@ -5677,9 +5711,8 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
retval = igb_set_vf_mac_addr(adapter, msgbuf, vf); retval = igb_set_vf_mac_addr(adapter, msgbuf, vf);
else else
dev_warn(&pdev->dev, dev_warn(&pdev->dev,
"VF %d attempted to override administratively " "VF %d attempted to override administratively set MAC address\nReload the VF driver to resume operations\n",
"set MAC address\nReload the VF driver to " vf);
"resume operations\n", vf);
break; break;
case E1000_VF_SET_PROMISC: case E1000_VF_SET_PROMISC:
retval = igb_set_vf_promisc(adapter, msgbuf, vf); retval = igb_set_vf_promisc(adapter, msgbuf, vf);
...@@ -5694,9 +5727,8 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf) ...@@ -5694,9 +5727,8 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
retval = -1; retval = -1;
if (vf_data->pf_vlan) if (vf_data->pf_vlan)
dev_warn(&pdev->dev, dev_warn(&pdev->dev,
"VF %d attempted to override administratively " "VF %d attempted to override administratively set VLAN tag\nReload the VF driver to resume operations\n",
"set VLAN tag\nReload the VF driver to " vf);
"resume operations\n", vf);
else else
retval = igb_set_vf_vlan(adapter, msgbuf, vf); retval = igb_set_vf_vlan(adapter, msgbuf, vf);
break; break;
...@@ -5820,11 +5852,13 @@ static irqreturn_t igb_intr(int irq, void *data) ...@@ -5820,11 +5852,13 @@ static irqreturn_t igb_intr(int irq, void *data)
struct igb_q_vector *q_vector = adapter->q_vector[0]; struct igb_q_vector *q_vector = adapter->q_vector[0];
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
/* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No
* need for the IMC write */ * need for the IMC write
*/
u32 icr = rd32(E1000_ICR); u32 icr = rd32(E1000_ICR);
/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
* not set, then the adapter didn't send an interrupt */ * not set, then the adapter didn't send an interrupt
*/
if (!(icr & E1000_ICR_INT_ASSERTED)) if (!(icr & E1000_ICR_INT_ASSERTED))
return IRQ_NONE; return IRQ_NONE;
...@@ -6025,7 +6059,8 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) ...@@ -6025,7 +6059,8 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
/* Detect a transmit hang in hardware, this serializes the /* Detect a transmit hang in hardware, this serializes the
* check with the clearing of time_stamp and movement of i */ * check with the clearing of time_stamp and movement of i
*/
clear_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags); clear_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags);
if (tx_buffer->next_to_watch && if (tx_buffer->next_to_watch &&
time_after(jiffies, tx_buffer->time_stamp + time_after(jiffies, tx_buffer->time_stamp +
...@@ -6305,8 +6340,7 @@ static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring, ...@@ -6305,8 +6340,7 @@ static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring,
return NULL; return NULL;
} }
/* /* we will be copying header into skb->data in
* we will be copying header into skb->data in
* pskb_may_pull so it is in our interest to prefetch * pskb_may_pull so it is in our interest to prefetch
* it now to avoid a possible cache miss * it now to avoid a possible cache miss
*/ */
...@@ -6354,8 +6388,7 @@ static inline void igb_rx_checksum(struct igb_ring *ring, ...@@ -6354,8 +6388,7 @@ static inline void igb_rx_checksum(struct igb_ring *ring,
if (igb_test_staterr(rx_desc, if (igb_test_staterr(rx_desc,
E1000_RXDEXT_STATERR_TCPE | E1000_RXDEXT_STATERR_TCPE |
E1000_RXDEXT_STATERR_IPE)) { E1000_RXDEXT_STATERR_IPE)) {
/* /* work around errata with sctp packets where the TCPE aka
* work around errata with sctp packets where the TCPE aka
* L4E bit is set incorrectly on 64 byte (60 byte w/o crc) * L4E bit is set incorrectly on 64 byte (60 byte w/o crc)
* packets, (aka let the stack check the crc32c) * packets, (aka let the stack check the crc32c)
*/ */
...@@ -6473,7 +6506,7 @@ static unsigned int igb_get_headlen(unsigned char *data, ...@@ -6473,7 +6506,7 @@ static unsigned int igb_get_headlen(unsigned char *data,
return hdr.network - data; return hdr.network - data;
/* record next protocol if header is present */ /* record next protocol if header is present */
if (!hdr.ipv4->frag_off) if (!(hdr.ipv4->frag_off & htons(IP_OFFSET)))
nexthdr = hdr.ipv4->protocol; nexthdr = hdr.ipv4->protocol;
} else if (protocol == __constant_htons(ETH_P_IPV6)) { } else if (protocol == __constant_htons(ETH_P_IPV6)) {
if ((hdr.network - data) > (max_len - sizeof(struct ipv6hdr))) if ((hdr.network - data) > (max_len - sizeof(struct ipv6hdr)))
...@@ -6509,8 +6542,7 @@ static unsigned int igb_get_headlen(unsigned char *data, ...@@ -6509,8 +6542,7 @@ static unsigned int igb_get_headlen(unsigned char *data,
hdr.network += sizeof(struct udphdr); hdr.network += sizeof(struct udphdr);
} }
/* /* If everything has gone correctly hdr.network should be the
* If everything has gone correctly hdr.network should be the
* data section of the packet and will be the end of the header. * data section of the packet and will be the end of the header.
* If not then it probably represents the end of the last recognized * If not then it probably represents the end of the last recognized
* header. * header.
...@@ -6542,8 +6574,7 @@ static void igb_pull_tail(struct igb_ring *rx_ring, ...@@ -6542,8 +6574,7 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
unsigned char *va; unsigned char *va;
unsigned int pull_len; unsigned int pull_len;
/* /* it is valid to use page_address instead of kmap since we are
* it is valid to use page_address instead of kmap since we are
* working with pages allocated out of the lomem pool per * working with pages allocated out of the lomem pool per
* alloc_page(GFP_ATOMIC) * alloc_page(GFP_ATOMIC)
*/ */
...@@ -6563,8 +6594,7 @@ static void igb_pull_tail(struct igb_ring *rx_ring, ...@@ -6563,8 +6594,7 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
va += IGB_TS_HDR_LEN; va += IGB_TS_HDR_LEN;
} }
/* /* we need the header to contain the greater of either ETH_HLEN or
* we need the header to contain the greater of either ETH_HLEN or
* 60 bytes if the skb->len is less than 60 for skb_pad. * 60 bytes if the skb->len is less than 60 for skb_pad.
*/ */
pull_len = igb_get_headlen(va, IGB_RX_HDR_LEN); pull_len = igb_get_headlen(va, IGB_RX_HDR_LEN);
...@@ -6597,7 +6627,6 @@ static bool igb_cleanup_headers(struct igb_ring *rx_ring, ...@@ -6597,7 +6627,6 @@ static bool igb_cleanup_headers(struct igb_ring *rx_ring,
union e1000_adv_rx_desc *rx_desc, union e1000_adv_rx_desc *rx_desc,
struct sk_buff *skb) struct sk_buff *skb)
{ {
if (unlikely((igb_test_staterr(rx_desc, if (unlikely((igb_test_staterr(rx_desc,
E1000_RXDEXT_ERR_FRAME_ERR_MASK)))) { E1000_RXDEXT_ERR_FRAME_ERR_MASK)))) {
struct net_device *netdev = rx_ring->netdev; struct net_device *netdev = rx_ring->netdev;
...@@ -6762,8 +6791,7 @@ static bool igb_alloc_mapped_page(struct igb_ring *rx_ring, ...@@ -6762,8 +6791,7 @@ static bool igb_alloc_mapped_page(struct igb_ring *rx_ring,
/* map page for use */ /* map page for use */
dma = dma_map_page(rx_ring->dev, page, 0, PAGE_SIZE, DMA_FROM_DEVICE); dma = dma_map_page(rx_ring->dev, page, 0, PAGE_SIZE, DMA_FROM_DEVICE);
/* /* if mapping failed free memory back to system since
* if mapping failed free memory back to system since
* there isn't much point in holding memory we can't use * there isn't much point in holding memory we can't use
*/ */
if (dma_mapping_error(rx_ring->dev, dma)) { if (dma_mapping_error(rx_ring->dev, dma)) {
...@@ -6810,8 +6838,7 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count) ...@@ -6810,8 +6838,7 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count)
if (!igb_alloc_mapped_page(rx_ring, bi)) if (!igb_alloc_mapped_page(rx_ring, bi))
break; break;
/* /* Refresh the desc even if buffer_addrs didn't change
* Refresh the desc even if buffer_addrs didn't change
* because each write-back erases this info. * because each write-back erases this info.
*/ */
rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + rx_desc->read.pkt_addr = cpu_to_le64(bi->dma +
...@@ -6842,8 +6869,7 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count) ...@@ -6842,8 +6869,7 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count)
/* update next to alloc since we have filled the ring */ /* update next to alloc since we have filled the ring */
rx_ring->next_to_alloc = i; rx_ring->next_to_alloc = i;
/* /* Force memory writes to complete before letting h/w
* Force memory writes to complete before letting h/w
* know there are new descriptors to fetch. (Only * know there are new descriptors to fetch. (Only
* applicable for weak-ordered memory model archs, * applicable for weak-ordered memory model archs,
* such as IA-64). * such as IA-64).
...@@ -7004,15 +7030,24 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx) ...@@ -7004,15 +7030,24 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx)
mac->autoneg = 0; mac->autoneg = 0;
/* Make sure dplx is at most 1 bit and lsb of speed is not set /* Make sure dplx is at most 1 bit and lsb of speed is not set
* for the switch() below to work */ * for the switch() below to work
*/
if ((spd & 1) || (dplx & ~1)) if ((spd & 1) || (dplx & ~1))
goto err_inval; goto err_inval;
/* Fiber NIC's only allow 1000 Gbps Full duplex */ /* Fiber NIC's only allow 1000 gbps Full duplex
if ((adapter->hw.phy.media_type == e1000_media_type_internal_serdes) && * and 100Mbps Full duplex for 100baseFx sfp
spd != SPEED_1000 && */
dplx != DUPLEX_FULL) if (adapter->hw.phy.media_type == e1000_media_type_internal_serdes) {
switch (spd + dplx) {
case SPEED_10 + DUPLEX_HALF:
case SPEED_10 + DUPLEX_FULL:
case SPEED_100 + DUPLEX_HALF:
goto err_inval; goto err_inval;
default:
break;
}
}
switch (spd + dplx) { switch (spd + dplx) {
case SPEED_10 + DUPLEX_HALF: case SPEED_10 + DUPLEX_HALF:
...@@ -7111,7 +7146,8 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, ...@@ -7111,7 +7146,8 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake,
igb_power_up_link(adapter); igb_power_up_link(adapter);
/* Release control of h/w to f/w. If f/w is AMT enabled, this /* Release control of h/w to f/w. If f/w is AMT enabled, this
* would have already happened in close and is redundant. */ * would have already happened in close and is redundant.
*/
igb_release_hw_control(adapter); igb_release_hw_control(adapter);
pci_disable_device(pdev); pci_disable_device(pdev);
...@@ -7173,7 +7209,8 @@ static int igb_resume(struct device *dev) ...@@ -7173,7 +7209,8 @@ static int igb_resume(struct device *dev)
igb_reset(adapter); igb_reset(adapter);
/* let the f/w know that the h/w is now under the control of the /* let the f/w know that the h/w is now under the control of the
* driver. */ * driver.
*/
igb_get_hw_control(adapter); igb_get_hw_control(adapter);
wr32(E1000_WUS, ~0); wr32(E1000_WUS, ~0);
...@@ -7309,8 +7346,7 @@ static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs) ...@@ -7309,8 +7346,7 @@ static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs)
} }
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
/* /* Polling 'interrupt' - used by things like netconsole to send skbs
* Polling 'interrupt' - used by things like netconsole to send skbs
* without having to re-enable interrupts. It's not called while * without having to re-enable interrupts. It's not called while
* the interrupt routine is executing. * the interrupt routine is executing.
*/ */
...@@ -7339,7 +7375,7 @@ static void igb_netpoll(struct net_device *netdev) ...@@ -7339,7 +7375,7 @@ static void igb_netpoll(struct net_device *netdev)
* *
* This function is called after a PCI bus error affecting * This function is called after a PCI bus error affecting
* this device has been detected. * this device has been detected.
*/ **/
static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev, static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev,
pci_channel_state_t state) pci_channel_state_t state)
{ {
...@@ -7365,7 +7401,7 @@ static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev, ...@@ -7365,7 +7401,7 @@ static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev,
* *
* Restart the card from scratch, as if from a cold-boot. Implementation * Restart the card from scratch, as if from a cold-boot. Implementation
* resembles the first-half of the igb_resume routine. * resembles the first-half of the igb_resume routine.
*/ **/
static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev) static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
...@@ -7393,8 +7429,9 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev) ...@@ -7393,8 +7429,9 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
err = pci_cleanup_aer_uncorrect_error_status(pdev); err = pci_cleanup_aer_uncorrect_error_status(pdev);
if (err) { if (err) {
dev_err(&pdev->dev, "pci_cleanup_aer_uncorrect_error_status " dev_err(&pdev->dev,
"failed 0x%0x\n", err); "pci_cleanup_aer_uncorrect_error_status failed 0x%0x\n",
err);
/* non-fatal, continue */ /* non-fatal, continue */
} }
...@@ -7424,7 +7461,8 @@ static void igb_io_resume(struct pci_dev *pdev) ...@@ -7424,7 +7461,8 @@ static void igb_io_resume(struct pci_dev *pdev)
netif_device_attach(netdev); netif_device_attach(netdev);
/* let the f/w know that the h/w is now under the control of the /* let the f/w know that the h/w is now under the control of the
* driver. */ * driver.
*/
igb_get_hw_control(adapter); igb_get_hw_control(adapter);
} }
...@@ -7460,7 +7498,8 @@ static int igb_set_vf_mac(struct igb_adapter *adapter, ...@@ -7460,7 +7498,8 @@ static int igb_set_vf_mac(struct igb_adapter *adapter,
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
/* VF MAC addresses start at end of receive addresses and moves /* VF MAC addresses start at end of receive addresses and moves
* torwards the first, as a result a collision should not be possible */ * towards the first, as a result a collision should not be possible
*/
int rar_entry = hw->mac.rar_entry_count - (vf + 1); int rar_entry = hw->mac.rar_entry_count - (vf + 1);
memcpy(adapter->vf_data[vf].vf_mac_addresses, mac_addr, ETH_ALEN); memcpy(adapter->vf_data[vf].vf_mac_addresses, mac_addr, ETH_ALEN);
...@@ -7477,13 +7516,13 @@ static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) ...@@ -7477,13 +7516,13 @@ static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
return -EINVAL; return -EINVAL;
adapter->vf_data[vf].flags |= IGB_VF_FLAG_PF_SET_MAC; adapter->vf_data[vf].flags |= IGB_VF_FLAG_PF_SET_MAC;
dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf); dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf);
dev_info(&adapter->pdev->dev, "Reload the VF driver to make this" dev_info(&adapter->pdev->dev,
" change effective."); "Reload the VF driver to make this change effective.");
if (test_bit(__IGB_DOWN, &adapter->state)) { if (test_bit(__IGB_DOWN, &adapter->state)) {
dev_warn(&adapter->pdev->dev, "The VF MAC address has been set," dev_warn(&adapter->pdev->dev,
" but the PF device is not up.\n"); "The VF MAC address has been set, but the PF device is not up.\n");
dev_warn(&adapter->pdev->dev, "Bring the PF device up before" dev_warn(&adapter->pdev->dev,
" attempting to use the VF device.\n"); "Bring the PF device up before attempting to use the VF device.\n");
} }
return igb_set_vf_mac(adapter, vf, mac); return igb_set_vf_mac(adapter, vf, mac);
} }
...@@ -7510,10 +7549,11 @@ static void igb_set_vf_rate_limit(struct e1000_hw *hw, int vf, int tx_rate, ...@@ -7510,10 +7549,11 @@ static void igb_set_vf_rate_limit(struct e1000_hw *hw, int vf, int tx_rate,
/* Calculate the rate factor values to set */ /* Calculate the rate factor values to set */
rf_int = link_speed / tx_rate; rf_int = link_speed / tx_rate;
rf_dec = (link_speed - (rf_int * tx_rate)); rf_dec = (link_speed - (rf_int * tx_rate));
rf_dec = (rf_dec * (1<<E1000_RTTBCNRC_RF_INT_SHIFT)) / tx_rate; rf_dec = (rf_dec * (1 << E1000_RTTBCNRC_RF_INT_SHIFT)) /
tx_rate;
bcnrc_val = E1000_RTTBCNRC_RS_ENA; bcnrc_val = E1000_RTTBCNRC_RS_ENA;
bcnrc_val |= ((rf_int<<E1000_RTTBCNRC_RF_INT_SHIFT) & bcnrc_val |= ((rf_int << E1000_RTTBCNRC_RF_INT_SHIFT) &
E1000_RTTBCNRC_RF_INT_MASK); E1000_RTTBCNRC_RF_INT_MASK);
bcnrc_val |= (rf_dec & E1000_RTTBCNRC_RF_DEC_MASK); bcnrc_val |= (rf_dec & E1000_RTTBCNRC_RF_DEC_MASK);
} else { } else {
...@@ -7521,8 +7561,7 @@ static void igb_set_vf_rate_limit(struct e1000_hw *hw, int vf, int tx_rate, ...@@ -7521,8 +7561,7 @@ static void igb_set_vf_rate_limit(struct e1000_hw *hw, int vf, int tx_rate,
} }
wr32(E1000_RTTDQSEL, vf); /* vf X uses queue X */ wr32(E1000_RTTDQSEL, vf); /* vf X uses queue X */
/* /* Set global transmit compensation time to the MMW_SIZE in RTTBCNRM
* Set global transmit compensation time to the MMW_SIZE in RTTBCNRM
* register. MMW_SIZE=0x014 if 9728-byte jumbo is supported. * register. MMW_SIZE=0x014 if 9728-byte jumbo is supported.
*/ */
wr32(E1000_RTTBCNRM, 0x14); wr32(E1000_RTTBCNRM, 0x14);
...@@ -7544,8 +7583,7 @@ static void igb_check_vf_rate_limit(struct igb_adapter *adapter) ...@@ -7544,8 +7583,7 @@ static void igb_check_vf_rate_limit(struct igb_adapter *adapter)
reset_rate = true; reset_rate = true;
adapter->vf_rate_link_speed = 0; adapter->vf_rate_link_speed = 0;
dev_info(&adapter->pdev->dev, dev_info(&adapter->pdev->dev,
"Link speed has been changed. VF Transmit " "Link speed has been changed. VF Transmit rate is disabled\n");
"rate is disabled\n");
} }
for (i = 0; i < adapter->vfs_allocated_count; i++) { for (i = 0; i < adapter->vfs_allocated_count; i++) {
...@@ -7580,6 +7618,33 @@ static int igb_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate) ...@@ -7580,6 +7618,33 @@ static int igb_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate)
return 0; return 0;
} }
static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
bool setting)
{
struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
u32 reg_val, reg_offset;
if (!adapter->vfs_allocated_count)
return -EOPNOTSUPP;
if (vf >= adapter->vfs_allocated_count)
return -EINVAL;
reg_offset = (hw->mac.type == e1000_82576) ? E1000_DTXSWC : E1000_TXSWC;
reg_val = rd32(reg_offset);
if (setting)
reg_val |= ((1 << vf) |
(1 << (vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT)));
else
reg_val &= ~((1 << vf) |
(1 << (vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT)));
wr32(reg_offset, reg_val);
adapter->vf_data[vf].spoofchk_enabled = setting;
return E1000_SUCCESS;
}
static int igb_ndo_get_vf_config(struct net_device *netdev, static int igb_ndo_get_vf_config(struct net_device *netdev,
int vf, struct ifla_vf_info *ivi) int vf, struct ifla_vf_info *ivi)
{ {
...@@ -7591,6 +7656,7 @@ static int igb_ndo_get_vf_config(struct net_device *netdev, ...@@ -7591,6 +7656,7 @@ static int igb_ndo_get_vf_config(struct net_device *netdev,
ivi->tx_rate = adapter->vf_data[vf].tx_rate; ivi->tx_rate = adapter->vf_data[vf].tx_rate;
ivi->vlan = adapter->vf_data[vf].pf_vlan; ivi->vlan = adapter->vf_data[vf].pf_vlan;
ivi->qos = adapter->vf_data[vf].pf_qos; ivi->qos = adapter->vf_data[vf].pf_qos;
ivi->spoofchk = adapter->vf_data[vf].spoofchk_enabled;
return 0; return 0;
} }
...@@ -7603,6 +7669,7 @@ static void igb_vmm_control(struct igb_adapter *adapter) ...@@ -7603,6 +7669,7 @@ static void igb_vmm_control(struct igb_adapter *adapter)
case e1000_82575: case e1000_82575:
case e1000_i210: case e1000_i210:
case e1000_i211: case e1000_i211:
case e1000_i354:
default: default:
/* replication is not supported for 82575 */ /* replication is not supported for 82575 */
return; return;
...@@ -7645,8 +7712,7 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) ...@@ -7645,8 +7712,7 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
/* force threshold to 0. */ /* force threshold to 0. */
wr32(E1000_DMCTXTH, 0); wr32(E1000_DMCTXTH, 0);
/* /* DMA Coalescing high water mark needs to be greater
* DMA Coalescing high water mark needs to be greater
* than the Rx threshold. Set hwm to PBA - max frame * than the Rx threshold. Set hwm to PBA - max frame
* size in 16B units, capping it at PBA - 6KB. * size in 16B units, capping it at PBA - 6KB.
*/ */
...@@ -7659,8 +7725,7 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) ...@@ -7659,8 +7725,7 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
& E1000_FCRTC_RTH_COAL_MASK); & E1000_FCRTC_RTH_COAL_MASK);
wr32(E1000_FCRTC, reg); wr32(E1000_FCRTC, reg);
/* /* Set the DMA Coalescing Rx threshold to PBA - 2 * max
* Set the DMA Coalescing Rx threshold to PBA - 2 * max
* frame size, capping it at PBA - 10KB. * frame size, capping it at PBA - 10KB.
*/ */
dmac_thr = pba - adapter->max_frame_size / 512; dmac_thr = pba - adapter->max_frame_size / 512;
...@@ -7678,11 +7743,12 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) ...@@ -7678,11 +7743,12 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
reg |= (1000 >> 5); reg |= (1000 >> 5);
/* Disable BMC-to-OS Watchdog Enable */ /* Disable BMC-to-OS Watchdog Enable */
if (hw->mac.type != e1000_i354)
reg &= ~E1000_DMACR_DC_BMC2OSW_EN; reg &= ~E1000_DMACR_DC_BMC2OSW_EN;
wr32(E1000_DMACR, reg); wr32(E1000_DMACR, reg);
/* /* no lower threshold to disable
* no lower threshold to disable
* coalescing(smart fifb)-UTRESH=0 * coalescing(smart fifb)-UTRESH=0
*/ */
wr32(E1000_DMCRTRH, 0); wr32(E1000_DMCRTRH, 0);
...@@ -7691,15 +7757,13 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) ...@@ -7691,15 +7757,13 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
wr32(E1000_DMCTLX, reg); wr32(E1000_DMCTLX, reg);
/* /* free space in tx packet buffer to wake from
* free space in tx packet buffer to wake from
* DMA coal * DMA coal
*/ */
wr32(E1000_DMCTXTH, (IGB_MIN_TXPBSIZE - wr32(E1000_DMCTXTH, (IGB_MIN_TXPBSIZE -
(IGB_TX_BUF_4096 + adapter->max_frame_size)) >> 6); (IGB_TX_BUF_4096 + adapter->max_frame_size)) >> 6);
/* /* make low power state decision controlled
* make low power state decision controlled
* by DMA coal * by DMA coal
*/ */
reg = rd32(E1000_PCIEMISC); reg = rd32(E1000_PCIEMISC);
...@@ -7713,7 +7777,8 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) ...@@ -7713,7 +7777,8 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
} }
} }
/* igb_read_i2c_byte - Reads 8 bit word over I2C /**
* igb_read_i2c_byte - Reads 8 bit word over I2C
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* @byte_offset: byte offset to read * @byte_offset: byte offset to read
* @dev_addr: device address * @dev_addr: device address
...@@ -7721,7 +7786,7 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) ...@@ -7721,7 +7786,7 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
* *
* Performs byte read operation over I2C interface at * Performs byte read operation over I2C interface at
* a specified device address. * a specified device address.
*/ **/
s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset, s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
u8 dev_addr, u8 *data) u8 dev_addr, u8 *data)
{ {
...@@ -7750,7 +7815,8 @@ s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset, ...@@ -7750,7 +7815,8 @@ s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
} }
} }
/* igb_write_i2c_byte - Writes 8 bit word over I2C /**
* igb_write_i2c_byte - Writes 8 bit word over I2C
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* @byte_offset: byte offset to write * @byte_offset: byte offset to write
* @dev_addr: device address * @dev_addr: device address
...@@ -7758,7 +7824,7 @@ s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset, ...@@ -7758,7 +7824,7 @@ s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
* *
* Performs byte write operation over I2C interface at * Performs byte write operation over I2C interface at
* a specified device address. * a specified device address.
*/ **/
s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset, s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
u8 dev_addr, u8 data) u8 dev_addr, u8 data)
{ {
......
/* /* PTP Hardware Clock (PHC) driver for the Intel 82576 and 82580
* PTP Hardware Clock (PHC) driver for the Intel 82576 and 82580
* *
* Copyright (C) 2011 Richard Cochran <richardcochran@gmail.com> * Copyright (C) 2011 Richard Cochran <richardcochran@gmail.com>
* *
...@@ -27,8 +26,7 @@ ...@@ -27,8 +26,7 @@
#define INCVALUE_MASK 0x7fffffff #define INCVALUE_MASK 0x7fffffff
#define ISGN 0x80000000 #define ISGN 0x80000000
/* /* The 82580 timesync updates the system timer every 8ns by 8ns,
* The 82580 timesync updates the system timer every 8ns by 8ns,
* and this update value cannot be reprogrammed. * and this update value cannot be reprogrammed.
* *
* Neither the 82576 nor the 82580 offer registers wide enough to hold * Neither the 82576 nor the 82580 offer registers wide enough to hold
...@@ -77,10 +75,7 @@ ...@@ -77,10 +75,7 @@
#define INCVALUE_82576 (16 << IGB_82576_TSYNC_SHIFT) #define INCVALUE_82576 (16 << IGB_82576_TSYNC_SHIFT)
#define IGB_NBITS_82580 40 #define IGB_NBITS_82580 40
/* /* SYSTIM read access for the 82576 */
* SYSTIM read access for the 82576
*/
static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc) static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc)
{ {
struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc); struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
...@@ -97,10 +92,7 @@ static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc) ...@@ -97,10 +92,7 @@ static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc)
return val; return val;
} }
/* /* SYSTIM read access for the 82580 */
* SYSTIM read access for the 82580
*/
static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc) static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc)
{ {
struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc); struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
...@@ -108,8 +100,7 @@ static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc) ...@@ -108,8 +100,7 @@ static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc)
u64 val; u64 val;
u32 lo, hi, jk; u32 lo, hi, jk;
/* /* The timestamp latches on lowest register read. For the 82580
* The timestamp latches on lowest register read. For the 82580
* the lowest register is SYSTIMR instead of SYSTIML. However we only * the lowest register is SYSTIMR instead of SYSTIML. However we only
* need to provide nanosecond resolution, so we just ignore it. * need to provide nanosecond resolution, so we just ignore it.
*/ */
...@@ -123,17 +114,13 @@ static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc) ...@@ -123,17 +114,13 @@ static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc)
return val; return val;
} }
/* /* SYSTIM read access for I210/I211 */
* SYSTIM read access for I210/I211
*/
static void igb_ptp_read_i210(struct igb_adapter *adapter, struct timespec *ts) static void igb_ptp_read_i210(struct igb_adapter *adapter, struct timespec *ts)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 sec, nsec, jk; u32 sec, nsec, jk;
/* /* The timestamp latches on lowest register read. For I210/I211, the
* The timestamp latches on lowest register read. For I210/I211, the
* lowest register is SYSTIMR. Since we only need to provide nanosecond * lowest register is SYSTIMR. Since we only need to provide nanosecond
* resolution, we can ignore it. * resolution, we can ignore it.
*/ */
...@@ -150,8 +137,7 @@ static void igb_ptp_write_i210(struct igb_adapter *adapter, ...@@ -150,8 +137,7 @@ static void igb_ptp_write_i210(struct igb_adapter *adapter,
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
/* /* Writing the SYSTIMR register is not necessary as it only provides
* Writing the SYSTIMR register is not necessary as it only provides
* sub-nanosecond resolution. * sub-nanosecond resolution.
*/ */
wr32(E1000_SYSTIML, ts->tv_nsec); wr32(E1000_SYSTIML, ts->tv_nsec);
...@@ -185,6 +171,7 @@ static void igb_ptp_systim_to_hwtstamp(struct igb_adapter *adapter, ...@@ -185,6 +171,7 @@ static void igb_ptp_systim_to_hwtstamp(struct igb_adapter *adapter,
switch (adapter->hw.mac.type) { switch (adapter->hw.mac.type) {
case e1000_82576: case e1000_82576:
case e1000_82580: case e1000_82580:
case e1000_i354:
case e1000_i350: case e1000_i350:
spin_lock_irqsave(&adapter->tmreg_lock, flags); spin_lock_irqsave(&adapter->tmreg_lock, flags);
...@@ -207,10 +194,7 @@ static void igb_ptp_systim_to_hwtstamp(struct igb_adapter *adapter, ...@@ -207,10 +194,7 @@ static void igb_ptp_systim_to_hwtstamp(struct igb_adapter *adapter,
} }
} }
/* /* PTP clock operations */
* PTP clock operations
*/
static int igb_ptp_adjfreq_82576(struct ptp_clock_info *ptp, s32 ppb) static int igb_ptp_adjfreq_82576(struct ptp_clock_info *ptp, s32 ppb)
{ {
struct igb_adapter *igb = container_of(ptp, struct igb_adapter, struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
...@@ -387,7 +371,7 @@ static int igb_ptp_enable(struct ptp_clock_info *ptp, ...@@ -387,7 +371,7 @@ static int igb_ptp_enable(struct ptp_clock_info *ptp,
* *
* This work function polls the TSYNCTXCTL valid bit to determine when a * This work function polls the TSYNCTXCTL valid bit to determine when a
* timestamp has been taken for the current stored skb. * timestamp has been taken for the current stored skb.
*/ **/
void igb_ptp_tx_work(struct work_struct *work) void igb_ptp_tx_work(struct work_struct *work)
{ {
struct igb_adapter *adapter = container_of(work, struct igb_adapter, struct igb_adapter *adapter = container_of(work, struct igb_adapter,
...@@ -437,7 +421,7 @@ static void igb_ptp_overflow_check(struct work_struct *work) ...@@ -437,7 +421,7 @@ static void igb_ptp_overflow_check(struct work_struct *work)
* dropped an Rx packet that was timestamped when the ring is full. The * dropped an Rx packet that was timestamped when the ring is full. The
* particular error is rare but leaves the device in a state unable to timestamp * particular error is rare but leaves the device in a state unable to timestamp
* any future packets. * any future packets.
*/ **/
void igb_ptp_rx_hang(struct igb_adapter *adapter) void igb_ptp_rx_hang(struct igb_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
...@@ -481,7 +465,7 @@ void igb_ptp_rx_hang(struct igb_adapter *adapter) ...@@ -481,7 +465,7 @@ void igb_ptp_rx_hang(struct igb_adapter *adapter)
* If we were asked to do hardware stamping and such a time stamp is * If we were asked to do hardware stamping and such a time stamp is
* available, then it must have been for this skb here because we only * available, then it must have been for this skb here because we only
* allow only one such packet into the queue. * allow only one such packet into the queue.
*/ **/
void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter) void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
...@@ -506,15 +490,14 @@ void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter) ...@@ -506,15 +490,14 @@ void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter)
* This function is meant to retrieve a timestamp from the first buffer of an * This function is meant to retrieve a timestamp from the first buffer of an
* incoming frame. The value is stored in little endian format starting on * incoming frame. The value is stored in little endian format starting on
* byte 8. * byte 8.
*/ **/
void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector,
unsigned char *va, unsigned char *va,
struct sk_buff *skb) struct sk_buff *skb)
{ {
__le64 *regval = (__le64 *)va; __le64 *regval = (__le64 *)va;
/* /* The timestamp is recorded in little endian format.
* The timestamp is recorded in little endian format.
* DWORD: 0 1 2 3 * DWORD: 0 1 2 3
* Field: Reserved Reserved SYSTIML SYSTIMH * Field: Reserved Reserved SYSTIML SYSTIMH
*/ */
...@@ -529,7 +512,7 @@ void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, ...@@ -529,7 +512,7 @@ void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector,
* *
* This function is meant to retrieve a timestamp from the internal registers * This function is meant to retrieve a timestamp from the internal registers
* of the adapter and store it in the skb. * of the adapter and store it in the skb.
*/ **/
void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector,
struct sk_buff *skb) struct sk_buff *skb)
{ {
...@@ -537,8 +520,7 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, ...@@ -537,8 +520,7 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector,
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u64 regval; u64 regval;
/* /* If this bit is set, then the RX registers contain the time stamp. No
* If this bit is set, then the RX registers contain the time stamp. No
* other packet will be time stamped until we read these registers, so * other packet will be time stamped until we read these registers, so
* read the registers to make them available again. Because only one * read the registers to make them available again. Because only one
* packet can be time stamped at a time, we know that the register * packet can be time stamped at a time, we know that the register
...@@ -574,7 +556,6 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, ...@@ -574,7 +556,6 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector,
* type has to be specified. Matching the kind of event packet is * type has to be specified. Matching the kind of event packet is
* not supported, with the exception of "all V2 events regardless of * not supported, with the exception of "all V2 events regardless of
* level 2 or 4". * level 2 or 4".
*
**/ **/
int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
struct ifreq *ifr, int cmd) struct ifreq *ifr, int cmd)
...@@ -655,10 +636,9 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, ...@@ -655,10 +636,9 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
return 0; return 0;
} }
/* /* Per-packet timestamping only works if all packets are
* Per-packet timestamping only works if all packets are
* timestamped, so enable timestamping in all packets as * timestamped, so enable timestamping in all packets as
* long as one rx filter was configured. * long as one Rx filter was configured.
*/ */
if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) { if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) {
tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
...@@ -756,6 +736,7 @@ void igb_ptp_init(struct igb_adapter *adapter) ...@@ -756,6 +736,7 @@ void igb_ptp_init(struct igb_adapter *adapter)
wr32(E1000_TIMINCA, INCPERIOD_82576 | INCVALUE_82576); wr32(E1000_TIMINCA, INCPERIOD_82576 | INCVALUE_82576);
break; break;
case e1000_82580: case e1000_82580:
case e1000_i354:
case e1000_i350: case e1000_i350:
snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr);
adapter->ptp_caps.owner = THIS_MODULE; adapter->ptp_caps.owner = THIS_MODULE;
...@@ -844,6 +825,7 @@ void igb_ptp_stop(struct igb_adapter *adapter) ...@@ -844,6 +825,7 @@ void igb_ptp_stop(struct igb_adapter *adapter)
switch (adapter->hw.mac.type) { switch (adapter->hw.mac.type) {
case e1000_82576: case e1000_82576:
case e1000_82580: case e1000_82580:
case e1000_i354:
case e1000_i350: case e1000_i350:
cancel_delayed_work_sync(&adapter->ptp_overflow_work); cancel_delayed_work_sync(&adapter->ptp_overflow_work);
break; break;
...@@ -888,6 +870,7 @@ void igb_ptp_reset(struct igb_adapter *adapter) ...@@ -888,6 +870,7 @@ void igb_ptp_reset(struct igb_adapter *adapter)
wr32(E1000_TIMINCA, INCPERIOD_82576 | INCVALUE_82576); wr32(E1000_TIMINCA, INCPERIOD_82576 | INCVALUE_82576);
break; break;
case e1000_82580: case e1000_82580:
case e1000_i354:
case e1000_i350: case e1000_i350:
case e1000_i210: case e1000_i210:
case e1000_i211: case e1000_i211:
......
...@@ -740,6 +740,11 @@ extern void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter); ...@@ -740,6 +740,11 @@ extern void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter);
extern void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter); extern void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter);
extern void ixgbe_dbg_init(void); extern void ixgbe_dbg_init(void);
extern void ixgbe_dbg_exit(void); extern void ixgbe_dbg_exit(void);
#else
static inline void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter) {}
static inline void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter) {}
static inline void ixgbe_dbg_init(void) {}
static inline void ixgbe_dbg_exit(void) {}
#endif /* CONFIG_DEBUG_FS */ #endif /* CONFIG_DEBUG_FS */
static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring) static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring)
{ {
......
...@@ -5123,14 +5123,14 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) ...@@ -5123,14 +5123,14 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
netif_device_detach(netdev); netif_device_detach(netdev);
if (netif_running(netdev)) {
rtnl_lock(); rtnl_lock();
if (netif_running(netdev)) {
ixgbe_down(adapter); ixgbe_down(adapter);
ixgbe_free_irq(adapter); ixgbe_free_irq(adapter);
ixgbe_free_all_tx_resources(adapter); ixgbe_free_all_tx_resources(adapter);
ixgbe_free_all_rx_resources(adapter); ixgbe_free_all_rx_resources(adapter);
rtnl_unlock();
} }
rtnl_unlock();
ixgbe_clear_interrupt_scheme(adapter); ixgbe_clear_interrupt_scheme(adapter);
...@@ -7206,6 +7206,7 @@ int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id, ...@@ -7206,6 +7206,7 @@ int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id,
case IXGBE_SUBDEV_ID_82599_SFP: case IXGBE_SUBDEV_ID_82599_SFP:
case IXGBE_SUBDEV_ID_82599_RNDC: case IXGBE_SUBDEV_ID_82599_RNDC:
case IXGBE_SUBDEV_ID_82599_ECNA_DP: case IXGBE_SUBDEV_ID_82599_ECNA_DP:
case IXGBE_SUBDEV_ID_82599_LOM_SFP:
is_wol_supported = 1; is_wol_supported = 1;
break; break;
} }
...@@ -7625,9 +7626,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -7625,9 +7626,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
e_err(probe, "failed to allocate sysfs resources\n"); e_err(probe, "failed to allocate sysfs resources\n");
#endif /* CONFIG_IXGBE_HWMON */ #endif /* CONFIG_IXGBE_HWMON */
#ifdef CONFIG_DEBUG_FS
ixgbe_dbg_adapter_init(adapter); ixgbe_dbg_adapter_init(adapter);
#endif /* CONFIG_DEBUG_FS */
/* Need link setup for MNG FW, else wait for IXGBE_UP */ /* Need link setup for MNG FW, else wait for IXGBE_UP */
if (hw->mng_fw_enabled && hw->mac.ops.setup_link) if (hw->mng_fw_enabled && hw->mac.ops.setup_link)
...@@ -7669,9 +7668,7 @@ static void ixgbe_remove(struct pci_dev *pdev) ...@@ -7669,9 +7668,7 @@ static void ixgbe_remove(struct pci_dev *pdev)
struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
#ifdef CONFIG_DEBUG_FS
ixgbe_dbg_adapter_exit(adapter); ixgbe_dbg_adapter_exit(adapter);
#endif /*CONFIG_DEBUG_FS */
set_bit(__IXGBE_DOWN, &adapter->state); set_bit(__IXGBE_DOWN, &adapter->state);
cancel_work_sync(&adapter->service_task); cancel_work_sync(&adapter->service_task);
...@@ -7934,15 +7931,11 @@ static int __init ixgbe_init_module(void) ...@@ -7934,15 +7931,11 @@ static int __init ixgbe_init_module(void)
pr_info("%s - version %s\n", ixgbe_driver_string, ixgbe_driver_version); pr_info("%s - version %s\n", ixgbe_driver_string, ixgbe_driver_version);
pr_info("%s\n", ixgbe_copyright); pr_info("%s\n", ixgbe_copyright);
#ifdef CONFIG_DEBUG_FS
ixgbe_dbg_init(); ixgbe_dbg_init();
#endif /* CONFIG_DEBUG_FS */
ret = pci_register_driver(&ixgbe_driver); ret = pci_register_driver(&ixgbe_driver);
if (ret) { if (ret) {
#ifdef CONFIG_DEBUG_FS
ixgbe_dbg_exit(); ixgbe_dbg_exit();
#endif /* CONFIG_DEBUG_FS */
return ret; return ret;
} }
...@@ -7968,9 +7961,7 @@ static void __exit ixgbe_exit_module(void) ...@@ -7968,9 +7961,7 @@ static void __exit ixgbe_exit_module(void)
#endif #endif
pci_unregister_driver(&ixgbe_driver); pci_unregister_driver(&ixgbe_driver);
#ifdef CONFIG_DEBUG_FS
ixgbe_dbg_exit(); ixgbe_dbg_exit();
#endif /* CONFIG_DEBUG_FS */
rcu_barrier(); /* Wait for completion of call_rcu()'s */ rcu_barrier(); /* Wait for completion of call_rcu()'s */
} }
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#define IXGBE_SUBDEV_ID_82599_RNDC 0x1F72 #define IXGBE_SUBDEV_ID_82599_RNDC 0x1F72
#define IXGBE_SUBDEV_ID_82599_560FLR 0x17D0 #define IXGBE_SUBDEV_ID_82599_560FLR 0x17D0
#define IXGBE_SUBDEV_ID_82599_ECNA_DP 0x0470 #define IXGBE_SUBDEV_ID_82599_ECNA_DP 0x0470
#define IXGBE_SUBDEV_ID_82599_LOM_SFP 0x8976
#define IXGBE_DEV_ID_82599_SFP_EM 0x1507 #define IXGBE_DEV_ID_82599_SFP_EM 0x1507
#define IXGBE_DEV_ID_82599_SFP_SF2 0x154D #define IXGBE_DEV_ID_82599_SFP_SF2 0x154D
#define IXGBE_DEV_ID_82599EN_SFP 0x1557 #define IXGBE_DEV_ID_82599EN_SFP 0x1557
......
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