提交 17eed249 编写于 作者: D David S. Miller

Merge branch 'upstream-net26' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6

此差异已折叠。
...@@ -940,7 +940,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id) ...@@ -940,7 +940,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
/* is the RECON info empty or old? */ /* is the RECON info empty or old? */
if (!lp->first_recon || !lp->last_recon || if (!lp->first_recon || !lp->last_recon ||
jiffies - lp->last_recon > HZ * 10) { time_after(jiffies, lp->last_recon + HZ * 10)) {
if (lp->network_down) if (lp->network_down)
BUGMSG(D_NORMAL, "reconfiguration detected: cabling restored?\n"); BUGMSG(D_NORMAL, "reconfiguration detected: cabling restored?\n");
lp->first_recon = lp->last_recon = jiffies; lp->first_recon = lp->last_recon = jiffies;
...@@ -974,7 +974,8 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id) ...@@ -974,7 +974,8 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
lp->num_recons = 1; lp->num_recons = 1;
} }
} }
} else if (lp->network_down && jiffies - lp->last_recon > HZ * 10) { } else if (lp->network_down &&
time_after(jiffies, lp->last_recon + HZ * 10)) {
if (lp->network_down) if (lp->network_down)
BUGMSG(D_NORMAL, "cabling restored?\n"); BUGMSG(D_NORMAL, "cabling restored?\n");
lp->first_recon = lp->last_recon = 0; lp->first_recon = lp->last_recon = 0;
......
/******************************************************************************* /*******************************************************************************
Intel PRO/1000 Linux driver Intel PRO/1000 Linux driver
Copyright(c) 1999 - 2007 Intel Corporation. Copyright(c) 1999 - 2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
/* /*
* 82571EB Gigabit Ethernet Controller * 82571EB Gigabit Ethernet Controller
* 82571EB Gigabit Ethernet Controller (Fiber) * 82571EB Gigabit Ethernet Controller (Fiber)
* 82571EB Dual Port Gigabit Mezzanine Adapter
* 82571EB Quad Port Gigabit Mezzanine Adapter
* 82571PT Gigabit PT Quad Port Server ExpressModule
* 82572EI Gigabit Ethernet Controller (Copper) * 82572EI Gigabit Ethernet Controller (Copper)
* 82572EI Gigabit Ethernet Controller (Fiber) * 82572EI Gigabit Ethernet Controller (Fiber)
* 82572EI Gigabit Ethernet Controller * 82572EI Gigabit Ethernet Controller
...@@ -72,7 +75,7 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) ...@@ -72,7 +75,7 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
struct e1000_phy_info *phy = &hw->phy; struct e1000_phy_info *phy = &hw->phy;
s32 ret_val; s32 ret_val;
if (hw->media_type != e1000_media_type_copper) { if (hw->phy.media_type != e1000_media_type_copper) {
phy->type = e1000_phy_none; phy->type = e1000_phy_none;
return 0; return 0;
} }
...@@ -150,7 +153,8 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) ...@@ -150,7 +153,8 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
if (((eecd >> 15) & 0x3) == 0x3) { if (((eecd >> 15) & 0x3) == 0x3) {
nvm->type = e1000_nvm_flash_hw; nvm->type = e1000_nvm_flash_hw;
nvm->word_size = 2048; nvm->word_size = 2048;
/* Autonomous Flash update bit must be cleared due /*
* Autonomous Flash update bit must be cleared due
* to Flash update issue. * to Flash update issue.
*/ */
eecd &= ~E1000_EECD_AUPDEN; eecd &= ~E1000_EECD_AUPDEN;
...@@ -162,7 +166,8 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) ...@@ -162,7 +166,8 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
nvm->type = e1000_nvm_eeprom_spi; nvm->type = e1000_nvm_eeprom_spi;
size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
E1000_EECD_SIZE_EX_SHIFT); E1000_EECD_SIZE_EX_SHIFT);
/* Added to a constant, "size" becomes the left-shift value /*
* Added to a constant, "size" becomes the left-shift value
* for setting word_size. * for setting word_size.
*/ */
size += NVM_WORD_SIZE_BASE_SHIFT; size += NVM_WORD_SIZE_BASE_SHIFT;
...@@ -190,16 +195,16 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) ...@@ -190,16 +195,16 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
case E1000_DEV_ID_82571EB_FIBER: case E1000_DEV_ID_82571EB_FIBER:
case E1000_DEV_ID_82572EI_FIBER: case E1000_DEV_ID_82572EI_FIBER:
case E1000_DEV_ID_82571EB_QUAD_FIBER: case E1000_DEV_ID_82571EB_QUAD_FIBER:
hw->media_type = e1000_media_type_fiber; hw->phy.media_type = e1000_media_type_fiber;
break; break;
case E1000_DEV_ID_82571EB_SERDES: case E1000_DEV_ID_82571EB_SERDES:
case E1000_DEV_ID_82572EI_SERDES: case E1000_DEV_ID_82572EI_SERDES:
case E1000_DEV_ID_82571EB_SERDES_DUAL: case E1000_DEV_ID_82571EB_SERDES_DUAL:
case E1000_DEV_ID_82571EB_SERDES_QUAD: case E1000_DEV_ID_82571EB_SERDES_QUAD:
hw->media_type = e1000_media_type_internal_serdes; hw->phy.media_type = e1000_media_type_internal_serdes;
break; break;
default: default:
hw->media_type = e1000_media_type_copper; hw->phy.media_type = e1000_media_type_copper;
break; break;
} }
...@@ -208,25 +213,28 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) ...@@ -208,25 +213,28 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
/* Set rar entry count */ /* Set rar entry count */
mac->rar_entry_count = E1000_RAR_ENTRIES; mac->rar_entry_count = E1000_RAR_ENTRIES;
/* Set if manageability features are enabled. */ /* Set if manageability features are enabled. */
mac->arc_subsystem_valid = mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) ? 1 : 0;
(er32(FWSM) & E1000_FWSM_MODE_MASK) ? 1 : 0;
/* check for link */ /* check for link */
switch (hw->media_type) { switch (hw->phy.media_type) {
case e1000_media_type_copper: case e1000_media_type_copper:
func->setup_physical_interface = e1000_setup_copper_link_82571; func->setup_physical_interface = e1000_setup_copper_link_82571;
func->check_for_link = e1000e_check_for_copper_link; func->check_for_link = e1000e_check_for_copper_link;
func->get_link_up_info = e1000e_get_speed_and_duplex_copper; func->get_link_up_info = e1000e_get_speed_and_duplex_copper;
break; break;
case e1000_media_type_fiber: case e1000_media_type_fiber:
func->setup_physical_interface = e1000_setup_fiber_serdes_link_82571; func->setup_physical_interface =
e1000_setup_fiber_serdes_link_82571;
func->check_for_link = e1000e_check_for_fiber_link; func->check_for_link = e1000e_check_for_fiber_link;
func->get_link_up_info = e1000e_get_speed_and_duplex_fiber_serdes; func->get_link_up_info =
e1000e_get_speed_and_duplex_fiber_serdes;
break; break;
case e1000_media_type_internal_serdes: case e1000_media_type_internal_serdes:
func->setup_physical_interface = e1000_setup_fiber_serdes_link_82571; func->setup_physical_interface =
e1000_setup_fiber_serdes_link_82571;
func->check_for_link = e1000e_check_for_serdes_link; func->check_for_link = e1000e_check_for_serdes_link;
func->get_link_up_info = e1000e_get_speed_and_duplex_fiber_serdes; func->get_link_up_info =
e1000e_get_speed_and_duplex_fiber_serdes;
break; break;
default: default:
return -E1000_ERR_CONFIG; return -E1000_ERR_CONFIG;
...@@ -322,10 +330,12 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw) ...@@ -322,10 +330,12 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)
switch (hw->mac.type) { switch (hw->mac.type) {
case e1000_82571: case e1000_82571:
case e1000_82572: case e1000_82572:
/* The 82571 firmware may still be configuring the PHY. /*
* The 82571 firmware may still be configuring the PHY.
* In this case, we cannot access the PHY until the * In this case, we cannot access the PHY until the
* configuration is done. So we explicitly set the * configuration is done. So we explicitly set the
* PHY ID. */ * PHY ID.
*/
phy->id = IGP01E1000_I_PHY_ID; phy->id = IGP01E1000_I_PHY_ID;
break; break;
case e1000_82573: case e1000_82573:
...@@ -479,8 +489,10 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw) ...@@ -479,8 +489,10 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)
if (ret_val) if (ret_val)
return ret_val; return ret_val;
/* If our nvm is an EEPROM, then we're done /*
* otherwise, commit the checksum to the flash NVM. */ * If our nvm is an EEPROM, then we're done
* otherwise, commit the checksum to the flash NVM.
*/
if (hw->nvm.type != e1000_nvm_flash_hw) if (hw->nvm.type != e1000_nvm_flash_hw)
return ret_val; return ret_val;
...@@ -496,7 +508,8 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw) ...@@ -496,7 +508,8 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)
/* Reset the firmware if using STM opcode. */ /* Reset the firmware if using STM opcode. */
if ((er32(FLOP) & 0xFF00) == E1000_STM_OPCODE) { if ((er32(FLOP) & 0xFF00) == E1000_STM_OPCODE) {
/* The enabling of and the actual reset must be done /*
* The enabling of and the actual reset must be done
* in two write cycles. * in two write cycles.
*/ */
ew32(HICR, E1000_HICR_FW_RESET_ENABLE); ew32(HICR, E1000_HICR_FW_RESET_ENABLE);
...@@ -557,8 +570,10 @@ static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, ...@@ -557,8 +570,10 @@ static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
u32 eewr = 0; u32 eewr = 0;
s32 ret_val = 0; s32 ret_val = 0;
/* A check for invalid values: offset too large, too many words, /*
* and not enough words. */ * A check for invalid values: offset too large, too many 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)) ||
(words == 0)) { (words == 0)) {
hw_dbg(hw, "nvm parameter(s) out of bounds\n"); hw_dbg(hw, "nvm parameter(s) out of bounds\n");
...@@ -645,10 +660,12 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) ...@@ -645,10 +660,12 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active)
} else { } else {
data &= ~IGP02E1000_PM_D0_LPLU; data &= ~IGP02E1000_PM_D0_LPLU;
ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, 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.
*/
if (phy->smart_speed == e1000_smart_speed_on) { if (phy->smart_speed == e1000_smart_speed_on) {
ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
&data); &data);
...@@ -693,7 +710,8 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) ...@@ -693,7 +710,8 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
s32 ret_val; s32 ret_val;
u16 i = 0; u16 i = 0;
/* 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 = e1000e_disable_pcie_master(hw); ret_val = e1000e_disable_pcie_master(hw);
...@@ -709,8 +727,10 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) ...@@ -709,8 +727,10 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
msleep(10); msleep(10);
/* Must acquire the MDIO ownership before MAC reset. /*
* Ownership defaults to firmware after a reset. */ * Must acquire the MDIO ownership before MAC reset.
* Ownership defaults to firmware after a reset.
*/
if (hw->mac.type == e1000_82573) { if (hw->mac.type == e1000_82573) {
extcnf_ctrl = er32(EXTCNF_CTRL); extcnf_ctrl = er32(EXTCNF_CTRL);
extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
...@@ -747,7 +767,8 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) ...@@ -747,7 +767,8 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
/* We don't want to continue accessing MAC registers. */ /* We don't want to continue accessing MAC registers. */
return ret_val; return ret_val;
/* Phy configuration from NVM just starts after EECD_AUTO_RD is set. /*
* Phy configuration from NVM just starts after EECD_AUTO_RD is set.
* Need to wait for Phy configuration completion before accessing * Need to wait for Phy configuration completion before accessing
* NVM and Phy. * NVM and Phy.
*/ */
...@@ -793,7 +814,8 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) ...@@ -793,7 +814,8 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
e1000e_clear_vfta(hw); e1000e_clear_vfta(hw);
/* Setup the receive address. */ /* Setup the receive address. */
/* If, however, a locally administered address was assigned to the /*
* If, however, a locally administered address was assigned to the
* 82571, we must reserve a RAR for it to work around an issue where * 82571, we must reserve a RAR for it to work around an issue where
* resetting one port will reload the MAC on the other port. * resetting one port will reload the MAC on the other port.
*/ */
...@@ -830,7 +852,8 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) ...@@ -830,7 +852,8 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
ew32(GCR, reg_data); ew32(GCR, reg_data);
} }
/* 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.
...@@ -922,7 +945,8 @@ void e1000e_clear_vfta(struct e1000_hw *hw) ...@@ -922,7 +945,8 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
if (hw->mac.type == e1000_82573) { if (hw->mac.type == e1000_82573) {
if (hw->mng_cookie.vlan_id != 0) { if (hw->mng_cookie.vlan_id != 0) {
/* The VFTA is a 4096b bit-field, each identifying /*
* The VFTA is a 4096b bit-field, each identifying
* a single VLAN ID. The following operations * a single VLAN ID. The following operations
* determine which 32b entry (i.e. offset) into the * determine which 32b entry (i.e. offset) into the
* array we want to set the VLAN ID (i.e. bit) of * array we want to set the VLAN ID (i.e. bit) of
...@@ -936,7 +960,8 @@ void e1000e_clear_vfta(struct e1000_hw *hw) ...@@ -936,7 +960,8 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
} }
} }
for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
/* If the offset we want to clear is the same offset of the /*
* If the offset we want to clear is the same offset of the
* manageability VLAN ID, then clear all bits except that of * manageability VLAN ID, then clear all bits except that of
* the manageability unit. * the manageability unit.
*/ */
...@@ -947,7 +972,7 @@ void e1000e_clear_vfta(struct e1000_hw *hw) ...@@ -947,7 +972,7 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
} }
/** /**
* e1000_mc_addr_list_update_82571 - Update Multicast addresses * e1000_update_mc_addr_list_82571 - Update Multicast addresses
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* @mc_addr_list: array of multicast addresses to program * @mc_addr_list: array of multicast addresses to program
* @mc_addr_count: number of multicast addresses to program * @mc_addr_count: number of multicast addresses to program
...@@ -959,7 +984,7 @@ void e1000e_clear_vfta(struct e1000_hw *hw) ...@@ -959,7 +984,7 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
* The parameter rar_count will usually be hw->mac.rar_entry_count * The parameter rar_count will usually be hw->mac.rar_entry_count
* unless there are workarounds that change this. * unless there are workarounds that change this.
**/ **/
static void e1000_mc_addr_list_update_82571(struct e1000_hw *hw, static void e1000_update_mc_addr_list_82571(struct e1000_hw *hw,
u8 *mc_addr_list, u8 *mc_addr_list,
u32 mc_addr_count, u32 mc_addr_count,
u32 rar_used_count, u32 rar_used_count,
...@@ -968,7 +993,7 @@ static void e1000_mc_addr_list_update_82571(struct e1000_hw *hw, ...@@ -968,7 +993,7 @@ static void e1000_mc_addr_list_update_82571(struct e1000_hw *hw,
if (e1000e_get_laa_state_82571(hw)) if (e1000e_get_laa_state_82571(hw))
rar_count--; rar_count--;
e1000e_mc_addr_list_update_generic(hw, mc_addr_list, mc_addr_count, e1000e_update_mc_addr_list_generic(hw, mc_addr_list, mc_addr_count,
rar_used_count, rar_count); rar_used_count, rar_count);
} }
...@@ -984,12 +1009,13 @@ static void e1000_mc_addr_list_update_82571(struct e1000_hw *hw, ...@@ -984,12 +1009,13 @@ static void e1000_mc_addr_list_update_82571(struct e1000_hw *hw,
**/ **/
static s32 e1000_setup_link_82571(struct e1000_hw *hw) static s32 e1000_setup_link_82571(struct e1000_hw *hw)
{ {
/* 82573 does not have a word in the NVM to determine /*
* 82573 does not have a word in the NVM to determine
* the default flow control setting, so we explicitly * the default flow control setting, so we explicitly
* set it to full. * set it to full.
*/ */
if (hw->mac.type == e1000_82573) if (hw->mac.type == e1000_82573)
hw->mac.fc = e1000_fc_full; hw->fc.type = e1000_fc_full;
return e1000e_setup_link(hw); return e1000e_setup_link(hw);
} }
...@@ -1050,14 +1076,14 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) ...@@ -1050,14 +1076,14 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw)
switch (hw->mac.type) { switch (hw->mac.type) {
case e1000_82571: case e1000_82571:
case e1000_82572: case e1000_82572:
/* If SerDes loopback mode is entered, there is no form /*
* If SerDes loopback mode is entered, there is no form
* of reset to take the adapter out of that mode. So we * of reset to take the adapter out of that mode. So we
* have to explicitly take the adapter out of loopback * have to explicitly take the adapter out of loopback
* mode. This prevents drivers from twiddling their thumbs * mode. This prevents drivers from twiddling their thumbs
* if another tool failed to take it out of loopback mode. * if another tool failed to take it out of loopback mode.
*/ */
ew32(SCTL, ew32(SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK);
E1000_SCTL_DISABLE_SERDES_LOOPBACK);
break; break;
default: default:
break; break;
...@@ -1124,7 +1150,8 @@ void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state) ...@@ -1124,7 +1150,8 @@ void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state)
/* If workaround is activated... */ /* If workaround is activated... */
if (state) if (state)
/* Hold a copy of the LAA in RAR[14] This is done so that /*
* Hold a copy of the LAA in RAR[14] This is done so that
* between the time RAR[0] gets clobbered and the time it * between the time RAR[0] gets clobbered and the time it
* gets fixed, the actual LAA is in one of the RARs and no * gets fixed, the actual LAA is in one of the RARs and no
* incoming packets directed to this port are dropped. * incoming packets directed to this port are dropped.
...@@ -1152,7 +1179,8 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw) ...@@ -1152,7 +1179,8 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw)
if (nvm->type != e1000_nvm_flash_hw) if (nvm->type != e1000_nvm_flash_hw)
return 0; return 0;
/* Check bit 4 of word 10h. If it is 0, firmware is done updating /*
* Check bit 4 of word 10h. If it is 0, firmware is done updating
* 10h-12h. Checksum may need to be fixed. * 10h-12h. Checksum may need to be fixed.
*/ */
ret_val = e1000_read_nvm(hw, 0x10, 1, &data); ret_val = e1000_read_nvm(hw, 0x10, 1, &data);
...@@ -1160,7 +1188,8 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw) ...@@ -1160,7 +1188,8 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw)
return ret_val; return ret_val;
if (!(data & 0x10)) { if (!(data & 0x10)) {
/* Read 0x23 and check bit 15. This bit is a 1 /*
* Read 0x23 and check bit 15. This bit is a 1
* when the checksum has already been fixed. If * when the checksum has already been fixed. If
* the checksum is still wrong and this bit is a * the checksum is still wrong and this bit is a
* 1, we need to return bad checksum. Otherwise, * 1, we need to return bad checksum. Otherwise,
...@@ -1240,7 +1269,7 @@ static struct e1000_mac_operations e82571_mac_ops = { ...@@ -1240,7 +1269,7 @@ static struct e1000_mac_operations e82571_mac_ops = {
/* .get_link_up_info: media type dependent */ /* .get_link_up_info: media type dependent */
.led_on = e1000e_led_on_generic, .led_on = e1000e_led_on_generic,
.led_off = e1000e_led_off_generic, .led_off = e1000e_led_off_generic,
.mc_addr_list_update = e1000_mc_addr_list_update_82571, .update_mc_addr_list = e1000_update_mc_addr_list_82571,
.reset_hw = e1000_reset_hw_82571, .reset_hw = e1000_reset_hw_82571,
.init_hw = e1000_init_hw_82571, .init_hw = e1000_init_hw_82571,
.setup_link = e1000_setup_link_82571, .setup_link = e1000_setup_link_82571,
......
################################################################################ ################################################################################
# #
# Intel PRO/1000 Linux driver # Intel PRO/1000 Linux driver
# Copyright(c) 1999 - 2007 Intel Corporation. # Copyright(c) 1999 - 2008 Intel Corporation.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License, # under the terms and conditions of the GNU General Public License,
......
/******************************************************************************* /*******************************************************************************
Intel PRO/1000 Linux driver Intel PRO/1000 Linux driver
Copyright(c) 1999 - 2007 Intel Corporation. Copyright(c) 1999 - 2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -120,10 +120,10 @@ ...@@ -120,10 +120,10 @@
#define E1000_MANC_ARP_EN 0x00002000 /* Enable ARP Request Filtering */ #define E1000_MANC_ARP_EN 0x00002000 /* Enable ARP Request Filtering */
#define E1000_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */ #define E1000_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */
#define E1000_MANC_BLK_PHY_RST_ON_IDE 0x00040000 /* Block phy resets */ #define E1000_MANC_BLK_PHY_RST_ON_IDE 0x00040000 /* Block phy resets */
#define E1000_MANC_EN_MAC_ADDR_FILTER 0x00100000 /* Enable MAC address /* Enable MAC address filtering */
* filtering */ #define E1000_MANC_EN_MAC_ADDR_FILTER 0x00100000
#define E1000_MANC_EN_MNG2HOST 0x00200000 /* Enable MNG packets to host /* Enable MNG packets to host memory */
* memory */ #define E1000_MANC_EN_MNG2HOST 0x00200000
/* Receive Control */ /* Receive Control */
#define E1000_RCTL_EN 0x00000002 /* enable */ #define E1000_RCTL_EN 0x00000002 /* enable */
...@@ -135,25 +135,26 @@ ...@@ -135,25 +135,26 @@
#define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */ #define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */
#define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */ #define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */
#define E1000_RCTL_DTYP_PS 0x00000400 /* Packet Split descriptor */ #define E1000_RCTL_DTYP_PS 0x00000400 /* Packet Split descriptor */
#define E1000_RCTL_RDMTS_HALF 0x00000000 /* rx desc min threshold size */ #define E1000_RCTL_RDMTS_HALF 0x00000000 /* Rx desc min threshold size */
#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */ #define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */
#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */ #define E1000_RCTL_BAM 0x00008000 /* broadcast enable */
/* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */ /* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */
#define E1000_RCTL_SZ_2048 0x00000000 /* rx buffer size 2048 */ #define E1000_RCTL_SZ_2048 0x00000000 /* Rx buffer size 2048 */
#define E1000_RCTL_SZ_1024 0x00010000 /* rx buffer size 1024 */ #define E1000_RCTL_SZ_1024 0x00010000 /* Rx buffer size 1024 */
#define E1000_RCTL_SZ_512 0x00020000 /* rx buffer size 512 */ #define E1000_RCTL_SZ_512 0x00020000 /* Rx buffer size 512 */
#define E1000_RCTL_SZ_256 0x00030000 /* rx buffer size 256 */ #define E1000_RCTL_SZ_256 0x00030000 /* Rx buffer size 256 */
/* these buffer sizes are valid if E1000_RCTL_BSEX is 1 */ /* these buffer sizes are valid if E1000_RCTL_BSEX is 1 */
#define E1000_RCTL_SZ_16384 0x00010000 /* rx buffer size 16384 */ #define E1000_RCTL_SZ_16384 0x00010000 /* Rx buffer size 16384 */
#define E1000_RCTL_SZ_8192 0x00020000 /* rx buffer size 8192 */ #define E1000_RCTL_SZ_8192 0x00020000 /* Rx buffer size 8192 */
#define E1000_RCTL_SZ_4096 0x00030000 /* rx buffer size 4096 */ #define E1000_RCTL_SZ_4096 0x00030000 /* Rx buffer size 4096 */
#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */ #define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */
#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */ #define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */
#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */ #define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */
#define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */ #define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */
#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) |
...@@ -206,7 +207,8 @@ ...@@ -206,7 +207,8 @@
#define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */ #define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */
#define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */ #define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */
/* Bit definitions for the Management Data IO (MDIO) and Management Data /*
* Bit definitions for the Management Data IO (MDIO) and Management Data
* Clock (MDC) pins in the Device Control Register. * Clock (MDC) pins in the Device Control Register.
*/ */
...@@ -279,7 +281,7 @@ ...@@ -279,7 +281,7 @@
#define E1000_TXD_STAT_TC 0x00000004 /* Tx Underrun */ #define E1000_TXD_STAT_TC 0x00000004 /* Tx Underrun */
/* Transmit Control */ /* Transmit Control */
#define E1000_TCTL_EN 0x00000002 /* enable tx */ #define E1000_TCTL_EN 0x00000002 /* enable Tx */
#define E1000_TCTL_PSP 0x00000008 /* pad short packets */ #define E1000_TCTL_PSP 0x00000008 /* pad short packets */
#define E1000_TCTL_CT 0x00000ff0 /* collision threshold */ #define E1000_TCTL_CT 0x00000ff0 /* collision threshold */
#define E1000_TCTL_COLD 0x003ff000 /* collision distance */ #define E1000_TCTL_COLD 0x003ff000 /* collision distance */
...@@ -337,8 +339,8 @@ ...@@ -337,8 +339,8 @@
#define E1000_KABGTXD_BGSQLBIAS 0x00050000 #define E1000_KABGTXD_BGSQLBIAS 0x00050000
/* PBA constants */ /* PBA constants */
#define E1000_PBA_8K 0x0008 /* 8KB, default Rx allocation */ #define E1000_PBA_8K 0x0008 /* 8KB */
#define E1000_PBA_16K 0x0010 /* 16KB, default TX allocation */ #define E1000_PBA_16K 0x0010 /* 16KB */
#define E1000_PBS_16K E1000_PBA_16K #define E1000_PBS_16K E1000_PBA_16K
...@@ -356,12 +358,13 @@ ...@@ -356,12 +358,13 @@
/* Interrupt Cause Read */ /* Interrupt Cause Read */
#define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */ #define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */
#define E1000_ICR_LSC 0x00000004 /* Link Status Change */ #define E1000_ICR_LSC 0x00000004 /* Link Status Change */
#define E1000_ICR_RXSEQ 0x00000008 /* rx sequence error */ #define E1000_ICR_RXSEQ 0x00000008 /* Rx sequence error */
#define E1000_ICR_RXDMT0 0x00000010 /* rx desc min. threshold (0) */ #define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */
#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */ #define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */
#define E1000_ICR_INT_ASSERTED 0x80000000 /* If this bit asserted, the driver should claim the interrupt */ #define E1000_ICR_INT_ASSERTED 0x80000000 /* If this bit asserted, the driver should claim the interrupt */
/* 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
...@@ -379,21 +382,22 @@ ...@@ -379,21 +382,22 @@
/* Interrupt Mask Set */ /* Interrupt Mask Set */
#define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ #define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */
#define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */ #define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */
#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ #define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */
#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ #define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */
#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */ #define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */
/* Interrupt Cause Set */ /* Interrupt Cause Set */
#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ #define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */
#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ #define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */
#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */
/* Transmit Descriptor Control */ /* Transmit Descriptor Control */
#define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */ #define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */
#define E1000_TXDCTL_WTHRESH 0x003F0000 /* TXDCTL Writeback Threshold */ #define E1000_TXDCTL_WTHRESH 0x003F0000 /* TXDCTL Writeback Threshold */
#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ #define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */
#define E1000_TXDCTL_MAX_TX_DESC_PREFETCH 0x0100001F /* GRAN=1, PTHRESH=31 */ #define E1000_TXDCTL_MAX_TX_DESC_PREFETCH 0x0100001F /* GRAN=1, PTHRESH=31 */
#define E1000_TXDCTL_COUNT_DESC 0x00400000 /* Enable the counting of desc. /* Enable the counting of desc. still to be processed. */
still to be processed. */ #define E1000_TXDCTL_COUNT_DESC 0x00400000
/* Flow Control Constants */ /* Flow Control Constants */
#define FLOW_CONTROL_ADDRESS_LOW 0x00C28001 #define FLOW_CONTROL_ADDRESS_LOW 0x00C28001
...@@ -404,7 +408,8 @@ ...@@ -404,7 +408,8 @@
#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
...@@ -533,8 +538,8 @@ ...@@ -533,8 +538,8 @@
#define E1000_EECD_REQ 0x00000040 /* NVM Access Request */ #define E1000_EECD_REQ 0x00000040 /* NVM Access Request */
#define E1000_EECD_GNT 0x00000080 /* NVM Access Grant */ #define E1000_EECD_GNT 0x00000080 /* NVM Access Grant */
#define E1000_EECD_SIZE 0x00000200 /* NVM Size (0=64 word 1=256 word) */ #define E1000_EECD_SIZE 0x00000200 /* NVM Size (0=64 word 1=256 word) */
#define E1000_EECD_ADDR_BITS 0x00000400 /* NVM Addressing bits based on type /* NVM Addressing bits based on type (0-small, 1-large) */
* (0-small, 1-large) */ #define E1000_EECD_ADDR_BITS 0x00000400
#define E1000_NVM_GRANT_ATTEMPTS 1000 /* NVM # attempts to gain grant */ #define E1000_NVM_GRANT_ATTEMPTS 1000 /* NVM # attempts to gain grant */
#define E1000_EECD_AUTO_RD 0x00000200 /* NVM Auto Read done */ #define E1000_EECD_AUTO_RD 0x00000200 /* NVM Auto Read done */
#define E1000_EECD_SIZE_EX_MASK 0x00007800 /* NVM Size */ #define E1000_EECD_SIZE_EX_MASK 0x00007800 /* NVM Size */
...@@ -626,7 +631,8 @@ ...@@ -626,7 +631,8 @@
#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 M88E1000_E_PHY_ID 0x01410C50 #define M88E1000_E_PHY_ID 0x01410C50
...@@ -653,37 +659,37 @@ ...@@ -653,37 +659,37 @@
#define M88E1000_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5 */ #define M88E1000_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5 */
/* Manual MDI configuration */ /* Manual MDI configuration */
#define M88E1000_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */ #define M88E1000_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */
#define M88E1000_PSCR_AUTO_X_1000T 0x0040 /* 1000BASE-T: Auto crossover, /* 1000BASE-T: Auto crossover, 100BASE-TX/10BASE-T: MDI Mode */
* 100BASE-TX/10BASE-T: #define M88E1000_PSCR_AUTO_X_1000T 0x0040
* MDI Mode /* Auto crossover enabled all speeds */
#define M88E1000_PSCR_AUTO_X_MODE 0x0060
/*
* 1=Enable Extended 10BASE-T distance (Lower 10BASE-T Rx Threshold)
* 0=Normal 10BASE-T Rx Threshold
*/ */
#define M88E1000_PSCR_AUTO_X_MODE 0x0060 /* Auto crossover enabled
* all speeds.
*/
/* 1=Enable Extended 10BASE-T distance
* (Lower 10BASE-T RX Threshold)
* 0=Normal 10BASE-T RX Threshold */
/* 1=5-Bit interface in 100BASE-TX
* 0=MII interface in 100BASE-TX */
#define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */ #define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */
/* M88E1000 PHY Specific Status Register */ /* M88E1000 PHY Specific Status Register */
#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 */
#define M88E1000_PSSR_CABLE_LENGTH 0x0380 /* 0=<50M;1=50-80M;2=80-110M; /* 0=<50M; 1=50-80M; 2=80-110M; 3=110-140M; 4=>140M */
* 3=110-140M;4=>140M */ #define M88E1000_PSSR_CABLE_LENGTH 0x0380
#define M88E1000_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */ #define M88E1000_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */
#define M88E1000_PSSR_1000MBS 0x8000 /* 10=1000Mbs */ #define M88E1000_PSSR_1000MBS 0x8000 /* 10=1000Mbs */
#define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7 #define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7
/* Number of times we will attempt to autonegotiate before downshifting if we /*
* are the master */ * Number of times we will attempt to autonegotiate before downshifting if we
* 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 /*
* are the slave */ * Number of times we will attempt to autonegotiate before downshifting if we
* are the slave
*/
#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK 0x0300 #define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK 0x0300
#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X 0x0100 #define M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X 0x0100
#define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */ #define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */
...@@ -692,7 +698,8 @@ ...@@ -692,7 +698,8 @@
#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK 0x0E00 #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK 0x0E00
#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X 0x0800 #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X 0x0800
/* Bits... /*
* Bits...
* 15-5: page * 15-5: page
* 4-0: register offset * 4-0: register offset
*/ */
......
/******************************************************************************* /*******************************************************************************
Intel PRO/1000 Linux driver Intel PRO/1000 Linux driver
Copyright(c) 1999 - 2007 Intel Corporation. Copyright(c) 1999 - 2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -61,7 +61,7 @@ struct e1000_info; ...@@ -61,7 +61,7 @@ struct e1000_info;
ndev_printk(KERN_NOTICE , netdev, format, ## arg) ndev_printk(KERN_NOTICE , netdev, format, ## arg)
/* TX/RX descriptor defines */ /* Tx/Rx descriptor defines */
#define E1000_DEFAULT_TXD 256 #define E1000_DEFAULT_TXD 256
#define E1000_MAX_TXD 4096 #define E1000_MAX_TXD 4096
#define E1000_MIN_TXD 80 #define E1000_MIN_TXD 80
...@@ -114,13 +114,13 @@ struct e1000_buffer { ...@@ -114,13 +114,13 @@ struct e1000_buffer {
dma_addr_t dma; dma_addr_t dma;
struct sk_buff *skb; struct sk_buff *skb;
union { union {
/* TX */ /* Tx */
struct { struct {
unsigned long time_stamp; unsigned long time_stamp;
u16 length; u16 length;
u16 next_to_watch; u16 next_to_watch;
}; };
/* RX */ /* Rx */
/* arrays of page information for packet split */ /* arrays of page information for packet split */
struct e1000_ps_page *ps_pages; struct e1000_ps_page *ps_pages;
}; };
...@@ -177,7 +177,7 @@ struct e1000_adapter { ...@@ -177,7 +177,7 @@ struct e1000_adapter {
u16 rx_itr; u16 rx_itr;
/* /*
* TX * Tx
*/ */
struct e1000_ring *tx_ring /* One per active queue */ struct e1000_ring *tx_ring /* One per active queue */
____cacheline_aligned_in_smp; ____cacheline_aligned_in_smp;
...@@ -199,7 +199,7 @@ struct e1000_adapter { ...@@ -199,7 +199,7 @@ struct e1000_adapter {
unsigned int total_rx_bytes; unsigned int total_rx_bytes;
unsigned int total_rx_packets; unsigned int total_rx_packets;
/* TX stats */ /* Tx stats */
u64 tpt_old; u64 tpt_old;
u64 colc_old; u64 colc_old;
u64 gotcl_old; u64 gotcl_old;
...@@ -211,7 +211,7 @@ struct e1000_adapter { ...@@ -211,7 +211,7 @@ struct e1000_adapter {
u32 tx_dma_failed; u32 tx_dma_failed;
/* /*
* RX * Rx
*/ */
bool (*clean_rx) (struct e1000_adapter *adapter, bool (*clean_rx) (struct e1000_adapter *adapter,
int *work_done, int work_to_do) int *work_done, int work_to_do)
...@@ -223,7 +223,7 @@ struct e1000_adapter { ...@@ -223,7 +223,7 @@ struct e1000_adapter {
u32 rx_int_delay; u32 rx_int_delay;
u32 rx_abs_int_delay; u32 rx_abs_int_delay;
/* RX stats */ /* Rx stats */
u64 hw_csum_err; u64 hw_csum_err;
u64 hw_csum_good; u64 hw_csum_good;
u64 rx_hdr_split; u64 rx_hdr_split;
...@@ -234,6 +234,8 @@ struct e1000_adapter { ...@@ -234,6 +234,8 @@ struct e1000_adapter {
unsigned int rx_ps_pages; unsigned int rx_ps_pages;
u16 rx_ps_bsize0; u16 rx_ps_bsize0;
u32 max_frame_size;
u32 min_frame_size;
/* OS defined structs */ /* OS defined structs */
struct net_device *netdev; struct net_device *netdev;
...@@ -258,7 +260,7 @@ struct e1000_adapter { ...@@ -258,7 +260,7 @@ struct e1000_adapter {
u32 wol; u32 wol;
u32 pba; u32 pba;
u8 fc_autoneg; bool fc_autoneg;
unsigned long led_status; unsigned long led_status;
...@@ -305,6 +307,7 @@ struct e1000_info { ...@@ -305,6 +307,7 @@ struct e1000_info {
#define FLAG_MSI_ENABLED (1 << 27) #define FLAG_MSI_ENABLED (1 << 27)
#define FLAG_RX_CSUM_ENABLED (1 << 28) #define FLAG_RX_CSUM_ENABLED (1 << 28)
#define FLAG_TSO_FORCE (1 << 29) #define FLAG_TSO_FORCE (1 << 29)
#define FLAG_RX_RESTART_NOW (1 << 30)
#define E1000_RX_DESC_PS(R, i) \ #define E1000_RX_DESC_PS(R, i) \
(&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
...@@ -387,9 +390,11 @@ extern s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw); ...@@ -387,9 +390,11 @@ extern s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw);
extern s32 e1000e_setup_link(struct e1000_hw *hw); extern s32 e1000e_setup_link(struct e1000_hw *hw);
extern void e1000e_clear_vfta(struct e1000_hw *hw); extern void e1000e_clear_vfta(struct e1000_hw *hw);
extern void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count); extern void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count);
extern void e1000e_mc_addr_list_update_generic(struct e1000_hw *hw, extern void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw,
u8 *mc_addr_list, u32 mc_addr_count, u8 *mc_addr_list,
u32 rar_used_count, u32 rar_count); u32 mc_addr_count,
u32 rar_used_count,
u32 rar_count);
extern void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index); extern void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
extern s32 e1000e_set_fc_watermarks(struct e1000_hw *hw); extern s32 e1000e_set_fc_watermarks(struct e1000_hw *hw);
extern void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop); extern void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop);
......
/******************************************************************************* /*******************************************************************************
Intel PRO/1000 Linux driver Intel PRO/1000 Linux driver
Copyright(c) 1999 - 2007 Intel Corporation. Copyright(c) 1999 - 2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -92,7 +92,8 @@ ...@@ -92,7 +92,8 @@
/* In-Band Control Register (Page 194, Register 18) */ /* In-Band Control Register (Page 194, Register 18) */
#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */ #define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */
/* A table for the GG82563 cable length where the range is defined /*
* A table for the GG82563 cable length where the range is defined
* with a lower bound at "index" and the upper bound at * with a lower bound at "index" and the upper bound at
* "index + 5". * "index + 5".
*/ */
...@@ -118,7 +119,7 @@ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw) ...@@ -118,7 +119,7 @@ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw)
struct e1000_phy_info *phy = &hw->phy; struct e1000_phy_info *phy = &hw->phy;
s32 ret_val; s32 ret_val;
if (hw->media_type != e1000_media_type_copper) { if (hw->phy.media_type != e1000_media_type_copper) {
phy->type = e1000_phy_none; phy->type = e1000_phy_none;
return 0; return 0;
} }
...@@ -172,7 +173,8 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) ...@@ -172,7 +173,8 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw)
size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
E1000_EECD_SIZE_EX_SHIFT); E1000_EECD_SIZE_EX_SHIFT);
/* Added to a constant, "size" becomes the left-shift value /*
* Added to a constant, "size" becomes the left-shift value
* for setting word_size. * for setting word_size.
*/ */
size += NVM_WORD_SIZE_BASE_SHIFT; size += NVM_WORD_SIZE_BASE_SHIFT;
...@@ -196,10 +198,10 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) ...@@ -196,10 +198,10 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)
/* Set media type */ /* Set media type */
switch (adapter->pdev->device) { switch (adapter->pdev->device) {
case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
hw->media_type = e1000_media_type_internal_serdes; hw->phy.media_type = e1000_media_type_internal_serdes;
break; break;
default: default:
hw->media_type = e1000_media_type_copper; hw->phy.media_type = e1000_media_type_copper;
break; break;
} }
...@@ -208,11 +210,10 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) ...@@ -208,11 +210,10 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)
/* Set rar entry count */ /* Set rar entry count */
mac->rar_entry_count = E1000_RAR_ENTRIES; mac->rar_entry_count = E1000_RAR_ENTRIES;
/* Set if manageability features are enabled. */ /* Set if manageability features are enabled. */
mac->arc_subsystem_valid = mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) ? 1 : 0;
(er32(FWSM) & E1000_FWSM_MODE_MASK) ? 1 : 0;
/* check for link */ /* check for link */
switch (hw->media_type) { switch (hw->phy.media_type) {
case e1000_media_type_copper: case e1000_media_type_copper:
func->setup_physical_interface = e1000_setup_copper_link_80003es2lan; func->setup_physical_interface = e1000_setup_copper_link_80003es2lan;
func->check_for_link = e1000e_check_for_copper_link; func->check_for_link = e1000e_check_for_copper_link;
...@@ -344,8 +345,10 @@ static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) ...@@ -344,8 +345,10 @@ static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
if (!(swfw_sync & (fwmask | swmask))) if (!(swfw_sync & (fwmask | swmask)))
break; break;
/* Firmware currently using resource (fwmask) /*
* or other software thread using resource (swmask) */ * Firmware currently using resource (fwmask)
* or other software thread using resource (swmask)
*/
e1000e_put_hw_semaphore(hw); e1000e_put_hw_semaphore(hw);
mdelay(5); mdelay(5);
i++; i++;
...@@ -407,7 +410,8 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, ...@@ -407,7 +410,8 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
if ((offset & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) if ((offset & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG)
page_select = GG82563_PHY_PAGE_SELECT; page_select = GG82563_PHY_PAGE_SELECT;
else else
/* Use Alternative Page Select register to access /*
* Use Alternative Page Select register to access
* registers 30 and 31 * registers 30 and 31
*/ */
page_select = GG82563_PHY_PAGE_SELECT_ALT; page_select = GG82563_PHY_PAGE_SELECT_ALT;
...@@ -417,7 +421,8 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, ...@@ -417,7 +421,8 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
if (ret_val) if (ret_val)
return ret_val; return ret_val;
/* The "ready" bit in the MDIC register may be incorrectly set /*
* The "ready" bit in the MDIC register may be incorrectly set
* before the device has completed the "Page Select" MDI * before the device has completed the "Page Select" MDI
* transaction. So we wait 200us after each MDI command... * transaction. So we wait 200us after each MDI command...
*/ */
...@@ -462,7 +467,8 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, ...@@ -462,7 +467,8 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
if ((offset & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) if ((offset & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG)
page_select = GG82563_PHY_PAGE_SELECT; page_select = GG82563_PHY_PAGE_SELECT;
else else
/* Use Alternative Page Select register to access /*
* Use Alternative Page Select register to access
* registers 30 and 31 * registers 30 and 31
*/ */
page_select = GG82563_PHY_PAGE_SELECT_ALT; page_select = GG82563_PHY_PAGE_SELECT_ALT;
...@@ -473,7 +479,8 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, ...@@ -473,7 +479,8 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
return ret_val; return ret_val;
/* The "ready" bit in the MDIC register may be incorrectly set /*
* The "ready" bit in the MDIC register may be incorrectly set
* before the device has completed the "Page Select" MDI * before the device has completed the "Page Select" MDI
* transaction. So we wait 200us after each MDI command... * transaction. So we wait 200us after each MDI command...
*/ */
...@@ -554,7 +561,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) ...@@ -554,7 +561,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
u16 phy_data; u16 phy_data;
bool link; bool link;
/* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI /*
* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI
* forced whenever speed and duplex are forced. * forced whenever speed and duplex are forced.
*/ */
ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
...@@ -583,7 +591,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) ...@@ -583,7 +591,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
udelay(1); udelay(1);
if (hw->phy.wait_for_link) { if (hw->phy.autoneg_wait_to_complete) {
hw_dbg(hw, "Waiting for forced speed/duplex link " hw_dbg(hw, "Waiting for forced speed/duplex link "
"on GG82563 phy.\n"); "on GG82563 phy.\n");
...@@ -593,7 +601,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) ...@@ -593,7 +601,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
return ret_val; return ret_val;
if (!link) { if (!link) {
/* 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 = e1000e_phy_reset_dsp(hw); ret_val = e1000e_phy_reset_dsp(hw);
...@@ -612,7 +621,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) ...@@ -612,7 +621,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
if (ret_val) if (ret_val)
return ret_val; return ret_val;
/* Resetting the phy means we need to verify the TX_CLK corresponds /*
* Resetting the phy means we need to verify the TX_CLK corresponds
* to the link speed. 10Mbps -> 2.5MHz, else 25MHz. * to the link speed. 10Mbps -> 2.5MHz, else 25MHz.
*/ */
phy_data &= ~GG82563_MSCR_TX_CLK_MASK; phy_data &= ~GG82563_MSCR_TX_CLK_MASK;
...@@ -621,7 +631,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) ...@@ -621,7 +631,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
else else
phy_data |= GG82563_MSCR_TX_CLK_100MBPS_25; phy_data |= GG82563_MSCR_TX_CLK_100MBPS_25;
/* 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.
*/ */
phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX; phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX;
...@@ -671,7 +682,7 @@ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, ...@@ -671,7 +682,7 @@ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
{ {
s32 ret_val; s32 ret_val;
if (hw->media_type == e1000_media_type_copper) { if (hw->phy.media_type == e1000_media_type_copper) {
ret_val = e1000e_get_speed_and_duplex_copper(hw, ret_val = e1000e_get_speed_and_duplex_copper(hw,
speed, speed,
duplex); duplex);
...@@ -704,7 +715,8 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw) ...@@ -704,7 +715,8 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
u32 icr; u32 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 = e1000e_disable_pcie_master(hw); ret_val = e1000e_disable_pcie_master(hw);
...@@ -808,7 +820,8 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) ...@@ -808,7 +820,8 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
reg_data &= ~0x00100000; reg_data &= ~0x00100000;
E1000_WRITE_REG_ARRAY(hw, E1000_FFLT, 0x0001, reg_data); E1000_WRITE_REG_ARRAY(hw, E1000_FFLT, 0x0001, reg_data);
/* 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.
...@@ -841,7 +854,7 @@ static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw) ...@@ -841,7 +854,7 @@ static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw)
/* Transmit Arbitration Control 0 */ /* Transmit Arbitration Control 0 */
reg = er32(TARC0); reg = er32(TARC0);
reg &= ~(0xF << 27); /* 30:27 */ reg &= ~(0xF << 27); /* 30:27 */
if (hw->media_type != e1000_media_type_copper) if (hw->phy.media_type != e1000_media_type_copper)
reg &= ~(1 << 20); reg &= ~(1 << 20);
ew32(TARC0, reg); ew32(TARC0, reg);
...@@ -881,7 +894,8 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) ...@@ -881,7 +894,8 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
if (ret_val) if (ret_val)
return ret_val; return ret_val;
/* 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
...@@ -907,7 +921,8 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) ...@@ -907,7 +921,8 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(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
...@@ -928,9 +943,8 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) ...@@ -928,9 +943,8 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
return ret_val; return ret_val;
} }
/* Bypass RX and TX FIFO's */ /* Bypass Rx and Tx FIFO's */
ret_val = e1000e_write_kmrn_reg(hw, ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL,
E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL,
E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS | E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS |
E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS); E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS);
if (ret_val) if (ret_val)
...@@ -953,7 +967,8 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) ...@@ -953,7 +967,8 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
if (ret_val) if (ret_val)
return ret_val; return ret_val;
/* Do not init these registers when the HW is in IAMT mode, since the /*
* Do not init these registers when the HW is in IAMT mode, since the
* firmware will have already initialized them. We only initialize * firmware will have already initialized them. We only initialize
* them if the HW is not in IAMT mode. * them if the HW is not in IAMT mode.
*/ */
...@@ -974,7 +989,8 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) ...@@ -974,7 +989,8 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
return ret_val; return ret_val;
} }
/* Workaround: Disable padding in Kumeran interface in the MAC /*
* Workaround: Disable padding in Kumeran interface in the MAC
* and in the PHY to avoid CRC errors. * and in the PHY to avoid CRC errors.
*/ */
ret_val = e1e_rphy(hw, GG82563_PHY_INBAND_CTRL, &data); ret_val = e1e_rphy(hw, GG82563_PHY_INBAND_CTRL, &data);
...@@ -1007,9 +1023,11 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw) ...@@ -1007,9 +1023,11 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw)
ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
ew32(CTRL, ctrl); ew32(CTRL, ctrl);
/* Set the mac to wait the maximum time between each /*
* Set the mac to wait the maximum time between each
* iteration and increase the max iterations when * iteration and increase the max iterations when
* polling the phy; this fixes erroneous timeouts at 10Mbps. */ * polling the phy; this fixes erroneous timeouts at 10Mbps.
*/
ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF); ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF);
if (ret_val) if (ret_val)
return ret_val; return ret_val;
...@@ -1026,8 +1044,7 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw) ...@@ -1026,8 +1044,7 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw)
if (ret_val) if (ret_val)
return ret_val; return ret_val;
reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING; reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING;
ret_val = e1000e_write_kmrn_reg(hw, ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_OFFSET_INB_CTRL,
E1000_KMRNCTRLSTA_OFFSET_INB_CTRL,
reg_data); reg_data);
if (ret_val) if (ret_val)
return ret_val; return ret_val;
...@@ -1056,8 +1073,7 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex) ...@@ -1056,8 +1073,7 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex)
u16 reg_data; u16 reg_data;
reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT; reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT;
ret_val = e1000e_write_kmrn_reg(hw, ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
reg_data); reg_data);
if (ret_val) if (ret_val)
return ret_val; return ret_val;
...@@ -1096,8 +1112,7 @@ static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw) ...@@ -1096,8 +1112,7 @@ static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw)
u32 tipg; u32 tipg;
reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT; reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT;
ret_val = e1000e_write_kmrn_reg(hw, ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
reg_data); reg_data);
if (ret_val) if (ret_val)
return ret_val; return ret_val;
...@@ -1175,7 +1190,7 @@ static struct e1000_mac_operations es2_mac_ops = { ...@@ -1175,7 +1190,7 @@ static struct e1000_mac_operations es2_mac_ops = {
.get_link_up_info = e1000_get_link_up_info_80003es2lan, .get_link_up_info = e1000_get_link_up_info_80003es2lan,
.led_on = e1000e_led_on_generic, .led_on = e1000e_led_on_generic,
.led_off = e1000e_led_off_generic, .led_off = e1000e_led_off_generic,
.mc_addr_list_update = e1000e_mc_addr_list_update_generic, .update_mc_addr_list = e1000e_update_mc_addr_list_generic,
.reset_hw = e1000_reset_hw_80003es2lan, .reset_hw = e1000_reset_hw_80003es2lan,
.init_hw = e1000_init_hw_80003es2lan, .init_hw = e1000_init_hw_80003es2lan,
.setup_link = e1000e_setup_link, .setup_link = e1000e_setup_link,
......
/******************************************************************************* /*******************************************************************************
Intel PRO/1000 Linux driver Intel PRO/1000 Linux driver
Copyright(c) 1999 - 2007 Intel Corporation. Copyright(c) 1999 - 2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -111,7 +111,7 @@ static int e1000_get_settings(struct net_device *netdev, ...@@ -111,7 +111,7 @@ static int e1000_get_settings(struct net_device *netdev,
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 status; u32 status;
if (hw->media_type == e1000_media_type_copper) { if (hw->phy.media_type == e1000_media_type_copper) {
ecmd->supported = (SUPPORTED_10baseT_Half | ecmd->supported = (SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Full |
...@@ -165,7 +165,7 @@ static int e1000_get_settings(struct net_device *netdev, ...@@ -165,7 +165,7 @@ static int e1000_get_settings(struct net_device *netdev,
ecmd->duplex = -1; ecmd->duplex = -1;
} }
ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) || ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) ||
hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE; hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
return 0; return 0;
} }
...@@ -187,7 +187,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) ...@@ -187,7 +187,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
mac->autoneg = 0; mac->autoneg = 0;
/* Fiber NICs only allow 1000 gbps Full duplex */ /* Fiber NICs only allow 1000 gbps Full duplex */
if ((adapter->hw.media_type == e1000_media_type_fiber) && if ((adapter->hw.phy.media_type == e1000_media_type_fiber) &&
spddplx != (SPEED_1000 + DUPLEX_FULL)) { spddplx != (SPEED_1000 + DUPLEX_FULL)) {
ndev_err(adapter->netdev, "Unsupported Speed/Duplex " ndev_err(adapter->netdev, "Unsupported Speed/Duplex "
"configuration\n"); "configuration\n");
...@@ -226,8 +226,10 @@ static int e1000_set_settings(struct net_device *netdev, ...@@ -226,8 +226,10 @@ static int e1000_set_settings(struct net_device *netdev,
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
/* When SoL/IDER sessions are active, autoneg/speed/duplex /*
* cannot be changed */ * When SoL/IDER sessions are active, autoneg/speed/duplex
* cannot be changed
*/
if (e1000_check_reset_block(hw)) { if (e1000_check_reset_block(hw)) {
ndev_err(netdev, "Cannot change link " ndev_err(netdev, "Cannot change link "
"characteristics when SoL/IDER is active.\n"); "characteristics when SoL/IDER is active.\n");
...@@ -239,7 +241,7 @@ static int e1000_set_settings(struct net_device *netdev, ...@@ -239,7 +241,7 @@ static int e1000_set_settings(struct net_device *netdev,
if (ecmd->autoneg == AUTONEG_ENABLE) { if (ecmd->autoneg == AUTONEG_ENABLE) {
hw->mac.autoneg = 1; hw->mac.autoneg = 1;
if (hw->media_type == e1000_media_type_fiber) if (hw->phy.media_type == e1000_media_type_fiber)
hw->phy.autoneg_advertised = ADVERTISED_1000baseT_Full | hw->phy.autoneg_advertised = ADVERTISED_1000baseT_Full |
ADVERTISED_FIBRE | ADVERTISED_FIBRE |
ADVERTISED_Autoneg; ADVERTISED_Autoneg;
...@@ -248,6 +250,8 @@ static int e1000_set_settings(struct net_device *netdev, ...@@ -248,6 +250,8 @@ static int e1000_set_settings(struct net_device *netdev,
ADVERTISED_TP | ADVERTISED_TP |
ADVERTISED_Autoneg; ADVERTISED_Autoneg;
ecmd->advertising = hw->phy.autoneg_advertised; ecmd->advertising = hw->phy.autoneg_advertised;
if (adapter->fc_autoneg)
hw->fc.original_type = e1000_fc_default;
} else { } else {
if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) { if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) {
clear_bit(__E1000_RESETTING, &adapter->state); clear_bit(__E1000_RESETTING, &adapter->state);
...@@ -277,11 +281,11 @@ static void e1000_get_pauseparam(struct net_device *netdev, ...@@ -277,11 +281,11 @@ static void e1000_get_pauseparam(struct net_device *netdev,
pause->autoneg = pause->autoneg =
(adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE);
if (hw->mac.fc == e1000_fc_rx_pause) { if (hw->fc.type == e1000_fc_rx_pause) {
pause->rx_pause = 1; pause->rx_pause = 1;
} else if (hw->mac.fc == e1000_fc_tx_pause) { } else if (hw->fc.type == e1000_fc_tx_pause) {
pause->tx_pause = 1; pause->tx_pause = 1;
} else if (hw->mac.fc == e1000_fc_full) { } else if (hw->fc.type == e1000_fc_full) {
pause->rx_pause = 1; pause->rx_pause = 1;
pause->tx_pause = 1; pause->tx_pause = 1;
} }
...@@ -300,18 +304,18 @@ static int e1000_set_pauseparam(struct net_device *netdev, ...@@ -300,18 +304,18 @@ static int e1000_set_pauseparam(struct net_device *netdev,
msleep(1); msleep(1);
if (pause->rx_pause && pause->tx_pause) if (pause->rx_pause && pause->tx_pause)
hw->mac.fc = e1000_fc_full; hw->fc.type = e1000_fc_full;
else if (pause->rx_pause && !pause->tx_pause) else if (pause->rx_pause && !pause->tx_pause)
hw->mac.fc = e1000_fc_rx_pause; hw->fc.type = e1000_fc_rx_pause;
else if (!pause->rx_pause && pause->tx_pause) else if (!pause->rx_pause && pause->tx_pause)
hw->mac.fc = e1000_fc_tx_pause; hw->fc.type = e1000_fc_tx_pause;
else if (!pause->rx_pause && !pause->tx_pause) else if (!pause->rx_pause && !pause->tx_pause)
hw->mac.fc = e1000_fc_none; hw->fc.type = e1000_fc_none;
hw->mac.original_fc = hw->mac.fc; hw->fc.original_type = hw->fc.type;
if (adapter->fc_autoneg == AUTONEG_ENABLE) { if (adapter->fc_autoneg == AUTONEG_ENABLE) {
hw->mac.fc = e1000_fc_default; hw->fc.type = e1000_fc_default;
if (netif_running(adapter->netdev)) { if (netif_running(adapter->netdev)) {
e1000e_down(adapter); e1000e_down(adapter);
e1000e_up(adapter); e1000e_up(adapter);
...@@ -319,7 +323,7 @@ static int e1000_set_pauseparam(struct net_device *netdev, ...@@ -319,7 +323,7 @@ static int e1000_set_pauseparam(struct net_device *netdev,
e1000e_reset(adapter); e1000e_reset(adapter);
} }
} else { } else {
retval = ((hw->media_type == e1000_media_type_fiber) ? retval = ((hw->phy.media_type == e1000_media_type_fiber) ?
hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw)); hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw));
} }
...@@ -558,8 +562,10 @@ static int e1000_set_eeprom(struct net_device *netdev, ...@@ -558,8 +562,10 @@ static int e1000_set_eeprom(struct net_device *netdev,
ret_val = e1000_write_nvm(hw, first_word, ret_val = e1000_write_nvm(hw, first_word,
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 /*
* and flush shadow RAM for 82573 controllers */ * Update the checksum over the first part of the EEPROM if needed
* 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->mac.type == e1000_82573))) (hw->mac.type == e1000_82573)))
e1000e_update_nvm_checksum(hw); e1000e_update_nvm_checksum(hw);
...@@ -578,8 +584,10 @@ static void e1000_get_drvinfo(struct net_device *netdev, ...@@ -578,8 +584,10 @@ static void e1000_get_drvinfo(struct net_device *netdev,
strncpy(drvinfo->driver, e1000e_driver_name, 32); strncpy(drvinfo->driver, e1000e_driver_name, 32);
strncpy(drvinfo->version, e1000e_driver_version, 32); strncpy(drvinfo->version, e1000e_driver_version, 32);
/* EEPROM image version # is reported as firmware version # for /*
* PCI-E controllers */ * EEPROM image version # is reported as firmware version # for
* PCI-E controllers
*/
e1000_read_nvm(&adapter->hw, 5, 1, &eeprom_data); e1000_read_nvm(&adapter->hw, 5, 1, &eeprom_data);
sprintf(firmware_version, "%d.%d-%d", sprintf(firmware_version, "%d.%d-%d",
(eeprom_data & 0xF000) >> 12, (eeprom_data & 0xF000) >> 12,
...@@ -658,8 +666,10 @@ static int e1000_set_ringparam(struct net_device *netdev, ...@@ -658,8 +666,10 @@ static int e1000_set_ringparam(struct net_device *netdev,
if (err) if (err)
goto err_setup_tx; goto err_setup_tx;
/* save the new, restore the old in order to free it, /*
* then restore the new back again */ * restore the old in order to free it,
* then add in the new
*/
adapter->rx_ring = rx_old; adapter->rx_ring = rx_old;
adapter->tx_ring = tx_old; adapter->tx_ring = tx_old;
e1000e_free_rx_resources(adapter); e1000e_free_rx_resources(adapter);
...@@ -758,7 +768,8 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data) ...@@ -758,7 +768,8 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
u32 i; u32 i;
u32 toggle; u32 toggle;
/* The status register is Read Only, so a write should fail. /*
* The status register is Read Only, so a write should fail.
* Some bits that get toggled are ignored. * Some bits that get toggled are ignored.
*/ */
switch (mac->type) { switch (mac->type) {
...@@ -908,7 +919,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data) ...@@ -908,7 +919,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
mask = 1 << i; mask = 1 << i;
if (!shared_int) { if (!shared_int) {
/* Disable the interrupt to be reported in /*
* Disable the interrupt to be reported in
* the cause register and then force the same * the cause register and then force the same
* interrupt and see if one gets posted. If * interrupt and see if one gets posted. If
* an interrupt was posted to the bus, the * an interrupt was posted to the bus, the
...@@ -925,7 +937,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data) ...@@ -925,7 +937,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
} }
} }
/* Enable the interrupt to be reported in /*
* Enable the interrupt to be reported in
* the cause register and then force the same * the cause register and then force the same
* interrupt and see if one gets posted. If * interrupt and see if one gets posted. If
* an interrupt was not posted to the bus, the * an interrupt was not posted to the bus, the
...@@ -942,7 +955,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data) ...@@ -942,7 +955,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
} }
if (!shared_int) { if (!shared_int) {
/* Disable the other interrupts to be reported in /*
* Disable the other interrupts to be reported in
* the cause register and then force the other * the cause register and then force the other
* interrupts and see if any get posted. If * interrupts and see if any get posted. If
* an interrupt was posted to the bus, the * an interrupt was posted to the bus, the
...@@ -1175,21 +1189,21 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) ...@@ -1175,21 +1189,21 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
u32 ctrl_reg = 0; u32 ctrl_reg = 0;
u32 stat_reg = 0; u32 stat_reg = 0;
adapter->hw.mac.autoneg = 0; hw->mac.autoneg = 0;
if (adapter->hw.phy.type == e1000_phy_m88) { if (hw->phy.type == e1000_phy_m88) {
/* Auto-MDI/MDIX Off */ /* Auto-MDI/MDIX Off */
e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, 0x0808); e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);
/* reset to update Auto-MDI/MDIX */ /* reset to update Auto-MDI/MDIX */
e1e_wphy(hw, PHY_CONTROL, 0x9140); e1e_wphy(hw, PHY_CONTROL, 0x9140);
/* autoneg off */ /* autoneg off */
e1e_wphy(hw, PHY_CONTROL, 0x8140); e1e_wphy(hw, PHY_CONTROL, 0x8140);
} else if (adapter->hw.phy.type == e1000_phy_gg82563) } else if (hw->phy.type == e1000_phy_gg82563)
e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x1CC); e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x1CC);
ctrl_reg = er32(CTRL); ctrl_reg = er32(CTRL);
if (adapter->hw.phy.type == e1000_phy_ife) { if (hw->phy.type == e1000_phy_ife) {
/* force 100, set loopback */ /* force 100, set loopback */
e1e_wphy(hw, PHY_CONTROL, 0x6100); e1e_wphy(hw, PHY_CONTROL, 0x6100);
...@@ -1212,12 +1226,14 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) ...@@ -1212,12 +1226,14 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
E1000_CTRL_FD); /* Force Duplex to FULL */ E1000_CTRL_FD); /* Force Duplex to FULL */
} }
if (adapter->hw.media_type == e1000_media_type_copper && if (hw->phy.media_type == e1000_media_type_copper &&
adapter->hw.phy.type == e1000_phy_m88) { hw->phy.type == e1000_phy_m88) {
ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */
} else { } else {
/* Set the ILOS bit on the fiber Nic if half duplex link is /*
* detected. */ * Set the ILOS bit on the fiber Nic if half duplex link is
* detected.
*/
stat_reg = er32(STATUS); stat_reg = er32(STATUS);
if ((stat_reg & E1000_STATUS_FD) == 0) if ((stat_reg & E1000_STATUS_FD) == 0)
ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU);
...@@ -1225,10 +1241,11 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) ...@@ -1225,10 +1241,11 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
ew32(CTRL, ctrl_reg); ew32(CTRL, ctrl_reg);
/* Disable the receiver on the PHY so when a cable is plugged in, the /*
* Disable the receiver on the PHY so when a cable is plugged in, the
* PHY does not begin to autoneg when a cable is reconnected to the NIC. * PHY does not begin to autoneg when a cable is reconnected to the NIC.
*/ */
if (adapter->hw.phy.type == e1000_phy_m88) if (hw->phy.type == e1000_phy_m88)
e1000_phy_disable_receiver(adapter); e1000_phy_disable_receiver(adapter);
udelay(500); udelay(500);
...@@ -1244,8 +1261,10 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter) ...@@ -1244,8 +1261,10 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter)
/* special requirements for 82571/82572 fiber adapters */ /* special requirements for 82571/82572 fiber adapters */
/* jump through hoops to make sure link is up because serdes /*
* link is hardwired up */ * jump through hoops to make sure link is up because serdes
* link is hardwired up
*/
ctrl |= E1000_CTRL_SLU; ctrl |= E1000_CTRL_SLU;
ew32(CTRL, ctrl); ew32(CTRL, ctrl);
...@@ -1263,8 +1282,10 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter) ...@@ -1263,8 +1282,10 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter)
ew32(CTRL, ctrl); ew32(CTRL, ctrl);
} }
/* special write to serdes control register to enable SerDes analog /*
* loopback */ * special write to serdes control register to enable SerDes analog
* loopback
*/
#define E1000_SERDES_LB_ON 0x410 #define E1000_SERDES_LB_ON 0x410
ew32(SCTL, E1000_SERDES_LB_ON); ew32(SCTL, E1000_SERDES_LB_ON);
msleep(10); msleep(10);
...@@ -1279,8 +1300,10 @@ static int e1000_set_es2lan_mac_loopback(struct e1000_adapter *adapter) ...@@ -1279,8 +1300,10 @@ static int e1000_set_es2lan_mac_loopback(struct e1000_adapter *adapter)
u32 ctrlext = er32(CTRL_EXT); u32 ctrlext = er32(CTRL_EXT);
u32 ctrl = er32(CTRL); u32 ctrl = er32(CTRL);
/* save CTRL_EXT to restore later, reuse an empty variable (unused /*
on mac_type 80003es2lan) */ * save CTRL_EXT to restore later, reuse an empty variable (unused
* on mac_type 80003es2lan)
*/
adapter->tx_fifo_head = ctrlext; adapter->tx_fifo_head = ctrlext;
/* clear the serdes mode bits, putting the device into mac loopback */ /* clear the serdes mode bits, putting the device into mac loopback */
...@@ -1312,8 +1335,8 @@ static int e1000_setup_loopback_test(struct e1000_adapter *adapter) ...@@ -1312,8 +1335,8 @@ static int e1000_setup_loopback_test(struct e1000_adapter *adapter)
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 rctl; u32 rctl;
if (hw->media_type == e1000_media_type_fiber || if (hw->phy.media_type == e1000_media_type_fiber ||
hw->media_type == e1000_media_type_internal_serdes) { hw->phy.media_type == e1000_media_type_internal_serdes) {
switch (hw->mac.type) { switch (hw->mac.type) {
case e1000_80003es2lan: case e1000_80003es2lan:
return e1000_set_es2lan_mac_loopback(adapter); return e1000_set_es2lan_mac_loopback(adapter);
...@@ -1328,7 +1351,7 @@ static int e1000_setup_loopback_test(struct e1000_adapter *adapter) ...@@ -1328,7 +1351,7 @@ static int e1000_setup_loopback_test(struct e1000_adapter *adapter)
ew32(RCTL, rctl); ew32(RCTL, rctl);
return 0; return 0;
} }
} else if (hw->media_type == e1000_media_type_copper) { } else if (hw->phy.media_type == e1000_media_type_copper) {
return e1000_integrated_phy_loopback(adapter); return e1000_integrated_phy_loopback(adapter);
} }
...@@ -1347,18 +1370,17 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter) ...@@ -1347,18 +1370,17 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
switch (hw->mac.type) { switch (hw->mac.type) {
case e1000_80003es2lan: case e1000_80003es2lan:
if (hw->media_type == e1000_media_type_fiber || if (hw->phy.media_type == e1000_media_type_fiber ||
hw->media_type == e1000_media_type_internal_serdes) { hw->phy.media_type == e1000_media_type_internal_serdes) {
/* restore CTRL_EXT, stealing space from tx_fifo_head */ /* restore CTRL_EXT, stealing space from tx_fifo_head */
ew32(CTRL_EXT, ew32(CTRL_EXT, adapter->tx_fifo_head);
adapter->tx_fifo_head);
adapter->tx_fifo_head = 0; adapter->tx_fifo_head = 0;
} }
/* fall through */ /* fall through */
case e1000_82571: case e1000_82571:
case e1000_82572: case e1000_82572:
if (hw->media_type == e1000_media_type_fiber || if (hw->phy.media_type == e1000_media_type_fiber ||
hw->media_type == e1000_media_type_internal_serdes) { hw->phy.media_type == e1000_media_type_internal_serdes) {
#define E1000_SERDES_LB_OFF 0x400 #define E1000_SERDES_LB_OFF 0x400
ew32(SCTL, E1000_SERDES_LB_OFF); ew32(SCTL, E1000_SERDES_LB_OFF);
msleep(10); msleep(10);
...@@ -1414,7 +1436,8 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter) ...@@ -1414,7 +1436,8 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
ew32(RDT, rx_ring->count - 1); ew32(RDT, rx_ring->count - 1);
/* 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
*/ */
...@@ -1454,7 +1477,8 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter) ...@@ -1454,7 +1477,8 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
l++; l++;
if (l == rx_ring->count) if (l == rx_ring->count)
l = 0; l = 0;
/* time + 20 msecs (200 msecs on 2.4) is more than /*
* time + 20 msecs (200 msecs on 2.4) is more than
* enough time to complete the receives, if it's * enough time to complete the receives, if it's
* exceeded, break and error off * exceeded, break and error off
*/ */
...@@ -1473,8 +1497,10 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter) ...@@ -1473,8 +1497,10 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data) static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data)
{ {
/* PHY loopback cannot be performed if SoL/IDER /*
* sessions are active */ * PHY loopback cannot be performed if SoL/IDER
* sessions are active
*/
if (e1000_check_reset_block(&adapter->hw)) { if (e1000_check_reset_block(&adapter->hw)) {
ndev_err(adapter->netdev, "Cannot do PHY loopback test " ndev_err(adapter->netdev, "Cannot do PHY loopback test "
"when SoL/IDER is active.\n"); "when SoL/IDER is active.\n");
...@@ -1504,12 +1530,14 @@ static int e1000_link_test(struct e1000_adapter *adapter, u64 *data) ...@@ -1504,12 +1530,14 @@ static int e1000_link_test(struct e1000_adapter *adapter, u64 *data)
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
*data = 0; *data = 0;
if (hw->media_type == e1000_media_type_internal_serdes) { if (hw->phy.media_type == e1000_media_type_internal_serdes) {
int i = 0; int i = 0;
hw->mac.serdes_has_link = 0; hw->mac.serdes_has_link = 0;
/* On some blade server designs, link establishment /*
* could take as long as 2-3 minutes */ * On some blade server designs, link establishment
* could take as long as 2-3 minutes
*/
do { do {
hw->mac.ops.check_for_link(hw); hw->mac.ops.check_for_link(hw);
if (hw->mac.serdes_has_link) if (hw->mac.serdes_has_link)
...@@ -1562,8 +1590,10 @@ static void e1000_diag_test(struct net_device *netdev, ...@@ -1562,8 +1590,10 @@ static void e1000_diag_test(struct net_device *netdev,
ndev_info(netdev, "offline testing starting\n"); ndev_info(netdev, "offline testing starting\n");
/* Link test performed before hardware reset so autoneg doesn't /*
* interfere with test result */ * Link test performed before hardware reset so autoneg doesn't
* interfere with test result
*/
if (e1000_link_test(adapter, &data[4])) if (e1000_link_test(adapter, &data[4]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
...@@ -1596,9 +1626,9 @@ static void e1000_diag_test(struct net_device *netdev, ...@@ -1596,9 +1626,9 @@ static void e1000_diag_test(struct net_device *netdev,
adapter->hw.mac.autoneg = autoneg; adapter->hw.mac.autoneg = autoneg;
/* force this routine to wait until autoneg complete/timeout */ /* force this routine to wait until autoneg complete/timeout */
adapter->hw.phy.wait_for_link = 1; adapter->hw.phy.autoneg_wait_to_complete = 1;
e1000e_reset(adapter); e1000e_reset(adapter);
adapter->hw.phy.wait_for_link = 0; adapter->hw.phy.autoneg_wait_to_complete = 0;
clear_bit(__E1000_TESTING, &adapter->state); clear_bit(__E1000_TESTING, &adapter->state);
if (if_running) if (if_running)
...@@ -1768,8 +1798,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset, ...@@ -1768,8 +1798,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset,
switch (stringset) { switch (stringset) {
case ETH_SS_TEST: case ETH_SS_TEST:
memcpy(data, *e1000_gstrings_test, memcpy(data, *e1000_gstrings_test, sizeof(e1000_gstrings_test));
sizeof(e1000_gstrings_test));
break; break;
case ETH_SS_STATS: case ETH_SS_STATS:
for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
......
/******************************************************************************* /*******************************************************************************
Intel PRO/1000 Linux driver Intel PRO/1000 Linux driver
Copyright(c) 1999 - 2007 Intel Corporation. Copyright(c) 1999 - 2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -66,14 +66,14 @@ enum e1e_registers { ...@@ -66,14 +66,14 @@ enum e1e_registers {
E1000_IMS = 0x000D0, /* Interrupt Mask Set - RW */ E1000_IMS = 0x000D0, /* Interrupt Mask Set - RW */
E1000_IMC = 0x000D8, /* Interrupt Mask Clear - WO */ E1000_IMC = 0x000D8, /* Interrupt Mask Clear - WO */
E1000_IAM = 0x000E0, /* Interrupt Acknowledge Auto Mask */ E1000_IAM = 0x000E0, /* Interrupt Acknowledge Auto Mask */
E1000_RCTL = 0x00100, /* RX Control - RW */ E1000_RCTL = 0x00100, /* Rx Control - RW */
E1000_FCTTV = 0x00170, /* Flow Control Transmit Timer Value - RW */ E1000_FCTTV = 0x00170, /* Flow Control Transmit Timer Value - RW */
E1000_TXCW = 0x00178, /* TX Configuration Word - RW */ E1000_TXCW = 0x00178, /* Tx Configuration Word - RW */
E1000_RXCW = 0x00180, /* RX Configuration Word - RO */ E1000_RXCW = 0x00180, /* Rx Configuration Word - RO */
E1000_TCTL = 0x00400, /* TX Control - RW */ E1000_TCTL = 0x00400, /* Tx Control - RW */
E1000_TCTL_EXT = 0x00404, /* Extended TX Control - RW */ E1000_TCTL_EXT = 0x00404, /* Extended Tx Control - RW */
E1000_TIPG = 0x00410, /* TX Inter-packet gap -RW */ E1000_TIPG = 0x00410, /* Tx Inter-packet gap -RW */
E1000_AIT = 0x00458, /* Adaptive Interframe Spacing Throttle - RW */ E1000_AIT = 0x00458, /* Adaptive Interframe Spacing Throttle -RW */
E1000_LEDCTL = 0x00E00, /* LED Control - RW */ E1000_LEDCTL = 0x00E00, /* LED Control - RW */
E1000_EXTCNF_CTRL = 0x00F00, /* Extended Configuration Control */ E1000_EXTCNF_CTRL = 0x00F00, /* Extended Configuration Control */
E1000_EXTCNF_SIZE = 0x00F08, /* Extended Configuration Size */ E1000_EXTCNF_SIZE = 0x00F08, /* Extended Configuration Size */
...@@ -87,12 +87,12 @@ enum e1e_registers { ...@@ -87,12 +87,12 @@ enum e1e_registers {
E1000_FCRTL = 0x02160, /* Flow Control Receive Threshold Low - RW */ E1000_FCRTL = 0x02160, /* Flow Control Receive Threshold Low - RW */
E1000_FCRTH = 0x02168, /* Flow Control Receive Threshold High - RW */ E1000_FCRTH = 0x02168, /* Flow Control Receive Threshold High - RW */
E1000_PSRCTL = 0x02170, /* Packet Split Receive Control - RW */ E1000_PSRCTL = 0x02170, /* Packet Split Receive Control - RW */
E1000_RDBAL = 0x02800, /* RX Descriptor Base Address Low - RW */ E1000_RDBAL = 0x02800, /* Rx Descriptor Base Address Low - RW */
E1000_RDBAH = 0x02804, /* RX Descriptor Base Address High - RW */ E1000_RDBAH = 0x02804, /* Rx Descriptor Base Address High - RW */
E1000_RDLEN = 0x02808, /* RX Descriptor Length - RW */ E1000_RDLEN = 0x02808, /* Rx Descriptor Length - RW */
E1000_RDH = 0x02810, /* RX Descriptor Head - RW */ E1000_RDH = 0x02810, /* Rx Descriptor Head - RW */
E1000_RDT = 0x02818, /* RX Descriptor Tail - RW */ E1000_RDT = 0x02818, /* Rx Descriptor Tail - RW */
E1000_RDTR = 0x02820, /* RX Delay Timer - RW */ E1000_RDTR = 0x02820, /* Rx Delay Timer - RW */
E1000_RADV = 0x0282C, /* RX Interrupt Absolute Delay Timer - RW */ E1000_RADV = 0x0282C, /* RX Interrupt Absolute Delay Timer - RW */
/* Convenience macros /* Convenience macros
...@@ -105,17 +105,17 @@ enum e1e_registers { ...@@ -105,17 +105,17 @@ enum e1e_registers {
*/ */
#define E1000_RDBAL_REG(_n) (E1000_RDBAL + (_n << 8)) #define E1000_RDBAL_REG(_n) (E1000_RDBAL + (_n << 8))
E1000_KABGTXD = 0x03004, /* AFE Band Gap Transmit Ref Data */ E1000_KABGTXD = 0x03004, /* AFE Band Gap Transmit Ref Data */
E1000_TDBAL = 0x03800, /* TX Descriptor Base Address Low - RW */ E1000_TDBAL = 0x03800, /* Tx Descriptor Base Address Low - RW */
E1000_TDBAH = 0x03804, /* TX Descriptor Base Address High - RW */ E1000_TDBAH = 0x03804, /* Tx Descriptor Base Address High - RW */
E1000_TDLEN = 0x03808, /* TX Descriptor Length - RW */ E1000_TDLEN = 0x03808, /* Tx Descriptor Length - RW */
E1000_TDH = 0x03810, /* TX Descriptor Head - RW */ E1000_TDH = 0x03810, /* Tx Descriptor Head - RW */
E1000_TDT = 0x03818, /* TX Descriptor Tail - RW */ E1000_TDT = 0x03818, /* Tx Descriptor Tail - RW */
E1000_TIDV = 0x03820, /* TX Interrupt Delay Value - RW */ E1000_TIDV = 0x03820, /* Tx Interrupt Delay Value - RW */
E1000_TXDCTL = 0x03828, /* TX Descriptor Control - RW */ E1000_TXDCTL = 0x03828, /* Tx Descriptor Control - RW */
E1000_TADV = 0x0382C, /* TX Interrupt Absolute Delay Val - RW */ E1000_TADV = 0x0382C, /* Tx Interrupt Absolute Delay Val - RW */
E1000_TARC0 = 0x03840, /* TX Arbitration Count (0) */ E1000_TARC0 = 0x03840, /* Tx Arbitration Count (0) */
E1000_TXDCTL1 = 0x03928, /* TX Descriptor Control (1) - RW */ E1000_TXDCTL1 = 0x03928, /* Tx Descriptor Control (1) - RW */
E1000_TARC1 = 0x03940, /* TX Arbitration Count (1) */ E1000_TARC1 = 0x03940, /* Tx Arbitration Count (1) */
E1000_CRCERRS = 0x04000, /* CRC Error Count - R/clr */ E1000_CRCERRS = 0x04000, /* CRC Error Count - R/clr */
E1000_ALGNERRC = 0x04004, /* Alignment Error Count - R/clr */ E1000_ALGNERRC = 0x04004, /* Alignment Error Count - R/clr */
E1000_SYMERRS = 0x04008, /* Symbol Error Count - R/clr */ E1000_SYMERRS = 0x04008, /* Symbol Error Count - R/clr */
...@@ -127,53 +127,53 @@ enum e1e_registers { ...@@ -127,53 +127,53 @@ enum e1e_registers {
E1000_LATECOL = 0x04020, /* Late Collision Count - R/clr */ E1000_LATECOL = 0x04020, /* Late Collision Count - R/clr */
E1000_COLC = 0x04028, /* Collision Count - R/clr */ E1000_COLC = 0x04028, /* Collision Count - R/clr */
E1000_DC = 0x04030, /* Defer Count - R/clr */ E1000_DC = 0x04030, /* Defer Count - R/clr */
E1000_TNCRS = 0x04034, /* TX-No CRS - R/clr */ E1000_TNCRS = 0x04034, /* Tx-No CRS - R/clr */
E1000_SEC = 0x04038, /* Sequence Error Count - R/clr */ E1000_SEC = 0x04038, /* Sequence Error Count - R/clr */
E1000_CEXTERR = 0x0403C, /* Carrier Extension Error Count - R/clr */ E1000_CEXTERR = 0x0403C, /* Carrier Extension Error Count - R/clr */
E1000_RLEC = 0x04040, /* Receive Length Error Count - R/clr */ E1000_RLEC = 0x04040, /* Receive Length Error Count - R/clr */
E1000_XONRXC = 0x04048, /* XON RX Count - R/clr */ E1000_XONRXC = 0x04048, /* XON Rx Count - R/clr */
E1000_XONTXC = 0x0404C, /* XON TX Count - R/clr */ E1000_XONTXC = 0x0404C, /* XON Tx Count - R/clr */
E1000_XOFFRXC = 0x04050, /* XOFF RX Count - R/clr */ E1000_XOFFRXC = 0x04050, /* XOFF Rx Count - R/clr */
E1000_XOFFTXC = 0x04054, /* XOFF TX Count - R/clr */ E1000_XOFFTXC = 0x04054, /* XOFF Tx Count - R/clr */
E1000_FCRUC = 0x04058, /* Flow Control RX Unsupported Count- R/clr */ E1000_FCRUC = 0x04058, /* Flow Control Rx Unsupported Count- R/clr */
E1000_PRC64 = 0x0405C, /* Packets RX (64 bytes) - R/clr */ E1000_PRC64 = 0x0405C, /* Packets Rx (64 bytes) - R/clr */
E1000_PRC127 = 0x04060, /* Packets RX (65-127 bytes) - R/clr */ E1000_PRC127 = 0x04060, /* Packets Rx (65-127 bytes) - R/clr */
E1000_PRC255 = 0x04064, /* Packets RX (128-255 bytes) - R/clr */ E1000_PRC255 = 0x04064, /* Packets Rx (128-255 bytes) - R/clr */
E1000_PRC511 = 0x04068, /* Packets RX (255-511 bytes) - R/clr */ E1000_PRC511 = 0x04068, /* Packets Rx (255-511 bytes) - R/clr */
E1000_PRC1023 = 0x0406C, /* Packets RX (512-1023 bytes) - R/clr */ E1000_PRC1023 = 0x0406C, /* Packets Rx (512-1023 bytes) - R/clr */
E1000_PRC1522 = 0x04070, /* Packets RX (1024-1522 bytes) - R/clr */ E1000_PRC1522 = 0x04070, /* Packets Rx (1024-1522 bytes) - R/clr */
E1000_GPRC = 0x04074, /* Good Packets RX Count - R/clr */ E1000_GPRC = 0x04074, /* Good Packets Rx Count - R/clr */
E1000_BPRC = 0x04078, /* Broadcast Packets RX Count - R/clr */ E1000_BPRC = 0x04078, /* Broadcast Packets Rx Count - R/clr */
E1000_MPRC = 0x0407C, /* Multicast Packets RX Count - R/clr */ E1000_MPRC = 0x0407C, /* Multicast Packets Rx Count - R/clr */
E1000_GPTC = 0x04080, /* Good Packets TX Count - R/clr */ E1000_GPTC = 0x04080, /* Good Packets Tx Count - R/clr */
E1000_GORCL = 0x04088, /* Good Octets RX Count Low - R/clr */ E1000_GORCL = 0x04088, /* Good Octets Rx Count Low - R/clr */
E1000_GORCH = 0x0408C, /* Good Octets RX Count High - R/clr */ E1000_GORCH = 0x0408C, /* Good Octets Rx Count High - R/clr */
E1000_GOTCL = 0x04090, /* Good Octets TX Count Low - R/clr */ E1000_GOTCL = 0x04090, /* Good Octets Tx Count Low - R/clr */
E1000_GOTCH = 0x04094, /* Good Octets TX Count High - R/clr */ E1000_GOTCH = 0x04094, /* Good Octets Tx Count High - R/clr */
E1000_RNBC = 0x040A0, /* RX No Buffers Count - R/clr */ E1000_RNBC = 0x040A0, /* Rx No Buffers Count - R/clr */
E1000_RUC = 0x040A4, /* RX Undersize Count - R/clr */ E1000_RUC = 0x040A4, /* Rx Undersize Count - R/clr */
E1000_RFC = 0x040A8, /* RX Fragment Count - R/clr */ E1000_RFC = 0x040A8, /* Rx Fragment Count - R/clr */
E1000_ROC = 0x040AC, /* RX Oversize Count - R/clr */ E1000_ROC = 0x040AC, /* Rx Oversize Count - R/clr */
E1000_RJC = 0x040B0, /* RX Jabber Count - R/clr */ E1000_RJC = 0x040B0, /* Rx Jabber Count - R/clr */
E1000_MGTPRC = 0x040B4, /* Management Packets RX Count - R/clr */ E1000_MGTPRC = 0x040B4, /* Management Packets Rx Count - R/clr */
E1000_MGTPDC = 0x040B8, /* Management Packets Dropped Count - R/clr */ E1000_MGTPDC = 0x040B8, /* Management Packets Dropped Count - R/clr */
E1000_MGTPTC = 0x040BC, /* Management Packets TX Count - R/clr */ E1000_MGTPTC = 0x040BC, /* Management Packets Tx Count - R/clr */
E1000_TORL = 0x040C0, /* Total Octets RX Low - R/clr */ E1000_TORL = 0x040C0, /* Total Octets Rx Low - R/clr */
E1000_TORH = 0x040C4, /* Total Octets RX High - R/clr */ E1000_TORH = 0x040C4, /* Total Octets Rx High - R/clr */
E1000_TOTL = 0x040C8, /* Total Octets TX Low - R/clr */ E1000_TOTL = 0x040C8, /* Total Octets Tx Low - R/clr */
E1000_TOTH = 0x040CC, /* Total Octets TX High - R/clr */ E1000_TOTH = 0x040CC, /* Total Octets Tx High - R/clr */
E1000_TPR = 0x040D0, /* Total Packets RX - R/clr */ E1000_TPR = 0x040D0, /* Total Packets Rx - R/clr */
E1000_TPT = 0x040D4, /* Total Packets TX - R/clr */ E1000_TPT = 0x040D4, /* Total Packets Tx - R/clr */
E1000_PTC64 = 0x040D8, /* Packets TX (64 bytes) - R/clr */ E1000_PTC64 = 0x040D8, /* Packets Tx (64 bytes) - R/clr */
E1000_PTC127 = 0x040DC, /* Packets TX (65-127 bytes) - R/clr */ E1000_PTC127 = 0x040DC, /* Packets Tx (65-127 bytes) - R/clr */
E1000_PTC255 = 0x040E0, /* Packets TX (128-255 bytes) - R/clr */ E1000_PTC255 = 0x040E0, /* Packets Tx (128-255 bytes) - R/clr */
E1000_PTC511 = 0x040E4, /* Packets TX (256-511 bytes) - R/clr */ E1000_PTC511 = 0x040E4, /* Packets Tx (256-511 bytes) - R/clr */
E1000_PTC1023 = 0x040E8, /* Packets TX (512-1023 bytes) - R/clr */ E1000_PTC1023 = 0x040E8, /* Packets Tx (512-1023 bytes) - R/clr */
E1000_PTC1522 = 0x040EC, /* Packets TX (1024-1522 Bytes) - R/clr */ E1000_PTC1522 = 0x040EC, /* Packets Tx (1024-1522 Bytes) - R/clr */
E1000_MPTC = 0x040F0, /* Multicast Packets TX Count - R/clr */ E1000_MPTC = 0x040F0, /* Multicast Packets Tx Count - R/clr */
E1000_BPTC = 0x040F4, /* Broadcast Packets TX Count - R/clr */ E1000_BPTC = 0x040F4, /* Broadcast Packets Tx Count - R/clr */
E1000_TSCTC = 0x040F8, /* TCP Segmentation Context TX - R/clr */ E1000_TSCTC = 0x040F8, /* TCP Segmentation Context Tx - R/clr */
E1000_TSCTFC = 0x040FC, /* TCP Segmentation Context TX Fail - R/clr */ E1000_TSCTFC = 0x040FC, /* TCP Segmentation Context Tx Fail - R/clr */
E1000_IAC = 0x04100, /* Interrupt Assertion Count */ E1000_IAC = 0x04100, /* Interrupt Assertion Count */
E1000_ICRXPTC = 0x04104, /* Irq Cause Rx Packet Timer Expire Count */ E1000_ICRXPTC = 0x04104, /* Irq Cause Rx Packet Timer Expire Count */
E1000_ICRXATC = 0x04108, /* Irq Cause Rx Abs Timer Expire Count */ E1000_ICRXATC = 0x04108, /* Irq Cause Rx Abs Timer Expire Count */
...@@ -183,7 +183,7 @@ enum e1e_registers { ...@@ -183,7 +183,7 @@ enum e1e_registers {
E1000_ICTXQMTC = 0x0411C, /* Irq Cause Tx Queue MinThreshold Count */ E1000_ICTXQMTC = 0x0411C, /* Irq Cause Tx Queue MinThreshold Count */
E1000_ICRXDMTC = 0x04120, /* Irq Cause Rx Desc MinThreshold Count */ E1000_ICRXDMTC = 0x04120, /* Irq Cause Rx Desc MinThreshold Count */
E1000_ICRXOC = 0x04124, /* Irq Cause Receiver Overrun Count */ E1000_ICRXOC = 0x04124, /* Irq Cause Receiver Overrun Count */
E1000_RXCSUM = 0x05000, /* RX Checksum Control - RW */ E1000_RXCSUM = 0x05000, /* Rx Checksum Control - RW */
E1000_RFCTL = 0x05008, /* Receive Filter Control */ E1000_RFCTL = 0x05008, /* Receive Filter Control */
E1000_MTA = 0x05200, /* Multicast Table Array - RW Array */ E1000_MTA = 0x05200, /* Multicast Table Array - RW Array */
E1000_RA = 0x05400, /* Receive Address - RW Array */ E1000_RA = 0x05400, /* Receive Address - RW Array */
...@@ -250,8 +250,8 @@ enum e1e_registers { ...@@ -250,8 +250,8 @@ enum e1e_registers {
#define E1000_VFTA_ENTRY_BIT_SHIFT_MASK 0x1F #define E1000_VFTA_ENTRY_BIT_SHIFT_MASK 0x1F
#define E1000_HICR_EN 0x01 /* Enable bit - RO */ #define E1000_HICR_EN 0x01 /* Enable bit - RO */
#define E1000_HICR_C 0x02 /* Driver sets this bit when done /* Driver sets this bit when done to put command in RAM */
* to put command in RAM */ #define E1000_HICR_C 0x02
#define E1000_HICR_FW_RESET_ENABLE 0x40 #define E1000_HICR_FW_RESET_ENABLE 0x40
#define E1000_HICR_FW_RESET 0x80 #define E1000_HICR_FW_RESET 0x80
...@@ -400,7 +400,7 @@ enum e1000_rev_polarity{ ...@@ -400,7 +400,7 @@ enum e1000_rev_polarity{
e1000_rev_polarity_undefined = 0xFF e1000_rev_polarity_undefined = 0xFF
}; };
enum e1000_fc_mode { enum e1000_fc_type {
e1000_fc_none = 0, e1000_fc_none = 0,
e1000_fc_rx_pause, e1000_fc_rx_pause,
e1000_fc_tx_pause, e1000_fc_tx_pause,
...@@ -685,8 +685,7 @@ struct e1000_mac_operations { ...@@ -685,8 +685,7 @@ struct e1000_mac_operations {
s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *);
s32 (*led_on)(struct e1000_hw *); s32 (*led_on)(struct e1000_hw *);
s32 (*led_off)(struct e1000_hw *); s32 (*led_off)(struct e1000_hw *);
void (*mc_addr_list_update)(struct e1000_hw *, u8 *, u32, u32, void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32, u32, u32);
u32);
s32 (*reset_hw)(struct e1000_hw *); s32 (*reset_hw)(struct e1000_hw *);
s32 (*init_hw)(struct e1000_hw *); s32 (*init_hw)(struct e1000_hw *);
s32 (*setup_link)(struct e1000_hw *); s32 (*setup_link)(struct e1000_hw *);
...@@ -728,16 +727,12 @@ struct e1000_mac_info { ...@@ -728,16 +727,12 @@ struct e1000_mac_info {
u8 perm_addr[6]; u8 perm_addr[6];
enum e1000_mac_type type; enum e1000_mac_type type;
enum e1000_fc_mode fc;
enum e1000_fc_mode original_fc;
u32 collision_delta; u32 collision_delta;
u32 ledctl_default; u32 ledctl_default;
u32 ledctl_mode1; u32 ledctl_mode1;
u32 ledctl_mode2; u32 ledctl_mode2;
u32 max_frame_size;
u32 mc_filter_type; u32 mc_filter_type;
u32 min_frame_size;
u32 tx_packet_delta; u32 tx_packet_delta;
u32 txcw; u32 txcw;
...@@ -748,9 +743,6 @@ struct e1000_mac_info { ...@@ -748,9 +743,6 @@ struct e1000_mac_info {
u16 ifs_step_size; u16 ifs_step_size;
u16 mta_reg_count; u16 mta_reg_count;
u16 rar_entry_count; u16 rar_entry_count;
u16 fc_high_water;
u16 fc_low_water;
u16 fc_pause_time;
u8 forced_speed_duplex; u8 forced_speed_duplex;
...@@ -780,6 +772,8 @@ struct e1000_phy_info { ...@@ -780,6 +772,8 @@ struct e1000_phy_info {
u32 reset_delay_us; /* in usec */ u32 reset_delay_us; /* in usec */
u32 revision; u32 revision;
enum e1000_media_type media_type;
u16 autoneg_advertised; u16 autoneg_advertised;
u16 autoneg_mask; u16 autoneg_mask;
u16 cable_length; u16 cable_length;
...@@ -792,7 +786,7 @@ struct e1000_phy_info { ...@@ -792,7 +786,7 @@ struct e1000_phy_info {
bool is_mdix; bool is_mdix;
bool polarity_correction; bool polarity_correction;
bool speed_downgraded; bool speed_downgraded;
bool wait_for_link; bool autoneg_wait_to_complete;
}; };
struct e1000_nvm_info { struct e1000_nvm_info {
...@@ -817,6 +811,16 @@ struct e1000_bus_info { ...@@ -817,6 +811,16 @@ struct e1000_bus_info {
u16 func; u16 func;
}; };
struct e1000_fc_info {
u32 high_water; /* Flow control high-water mark */
u32 low_water; /* Flow control low-water mark */
u16 pause_time; /* Flow control pause timer */
bool send_xon; /* Flow control send XON */
bool strict_ieee; /* Strict IEEE mode */
enum e1000_fc_type type; /* Type of flow control */
enum e1000_fc_type original_type;
};
struct e1000_dev_spec_82571 { struct e1000_dev_spec_82571 {
bool laa_is_present; bool laa_is_present;
bool alt_mac_addr_is_present; bool alt_mac_addr_is_present;
...@@ -841,6 +845,7 @@ struct e1000_hw { ...@@ -841,6 +845,7 @@ struct e1000_hw {
u8 __iomem *flash_address; u8 __iomem *flash_address;
struct e1000_mac_info mac; struct e1000_mac_info mac;
struct e1000_fc_info fc;
struct e1000_phy_info phy; struct e1000_phy_info phy;
struct e1000_nvm_info nvm; struct e1000_nvm_info nvm;
struct e1000_bus_info bus; struct e1000_bus_info bus;
...@@ -850,8 +855,6 @@ struct e1000_hw { ...@@ -850,8 +855,6 @@ struct e1000_hw {
struct e1000_dev_spec_82571 e82571; struct e1000_dev_spec_82571 e82571;
struct e1000_dev_spec_ich8lan ich8lan; struct e1000_dev_spec_ich8lan ich8lan;
} dev_spec; } dev_spec;
enum e1000_media_type media_type;
}; };
#ifdef DEBUG #ifdef DEBUG
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
/******************************************************************************* /*******************************************************************************
Intel PRO/1000 Linux driver Intel PRO/1000 Linux driver
Copyright(c) 1999 - 2007 Intel Corporation. Copyright(c) 1999 - 2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
#include "e1000.h" #include "e1000.h"
/* This is the only thing that needs to be changed to adjust the /*
* This is the only thing that needs to be changed to adjust the
* maximum number of ports that the driver can manage. * maximum number of ports that the driver can manage.
*/ */
...@@ -46,7 +47,8 @@ module_param(copybreak, uint, 0644); ...@@ -46,7 +47,8 @@ module_param(copybreak, uint, 0644);
MODULE_PARM_DESC(copybreak, MODULE_PARM_DESC(copybreak,
"Maximum size of packet that is copied to a new buffer on receive"); "Maximum size of packet that is copied to a new buffer on receive");
/* All parameters are treated the same, as an integer array of values. /*
* All parameters are treated the same, as an integer array of values.
* This macro just reduces the need to repeat the same declaration code * This macro just reduces the need to repeat the same declaration code
* over and over (plus this helps to avoid typo bugs). * over and over (plus this helps to avoid typo bugs).
*/ */
...@@ -60,7 +62,8 @@ MODULE_PARM_DESC(copybreak, ...@@ -60,7 +62,8 @@ MODULE_PARM_DESC(copybreak,
MODULE_PARM_DESC(X, desc); MODULE_PARM_DESC(X, desc);
/* Transmit Interrupt Delay in units of 1.024 microseconds /*
* Transmit Interrupt Delay in units of 1.024 microseconds
* Tx interrupt delay needs to typically be set to something non zero * Tx interrupt delay needs to typically be set to something non zero
* *
* Valid Range: 0-65535 * Valid Range: 0-65535
...@@ -70,7 +73,8 @@ E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay"); ...@@ -70,7 +73,8 @@ E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay");
#define MAX_TXDELAY 0xFFFF #define MAX_TXDELAY 0xFFFF
#define MIN_TXDELAY 0 #define MIN_TXDELAY 0
/* Transmit Absolute Interrupt Delay in units of 1.024 microseconds /*
* Transmit Absolute Interrupt Delay in units of 1.024 microseconds
* *
* Valid Range: 0-65535 * Valid Range: 0-65535
*/ */
...@@ -79,7 +83,8 @@ E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay"); ...@@ -79,7 +83,8 @@ E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay");
#define MAX_TXABSDELAY 0xFFFF #define MAX_TXABSDELAY 0xFFFF
#define MIN_TXABSDELAY 0 #define MIN_TXABSDELAY 0
/* Receive Interrupt Delay in units of 1.024 microseconds /*
* Receive Interrupt Delay in units of 1.024 microseconds
* hardware will likely hang if you set this to anything but zero. * hardware will likely hang if you set this to anything but zero.
* *
* Valid Range: 0-65535 * Valid Range: 0-65535
...@@ -89,7 +94,8 @@ E1000_PARAM(RxIntDelay, "Receive Interrupt Delay"); ...@@ -89,7 +94,8 @@ E1000_PARAM(RxIntDelay, "Receive Interrupt Delay");
#define MAX_RXDELAY 0xFFFF #define MAX_RXDELAY 0xFFFF
#define MIN_RXDELAY 0 #define MIN_RXDELAY 0
/* Receive Absolute Interrupt Delay in units of 1.024 microseconds /*
* Receive Absolute Interrupt Delay in units of 1.024 microseconds
* *
* Valid Range: 0-65535 * Valid Range: 0-65535
*/ */
...@@ -98,7 +104,8 @@ E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); ...@@ -98,7 +104,8 @@ E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay");
#define MAX_RXABSDELAY 0xFFFF #define MAX_RXABSDELAY 0xFFFF
#define MIN_RXABSDELAY 0 #define MIN_RXABSDELAY 0
/* Interrupt Throttle Rate (interrupts/sec) /*
* Interrupt Throttle Rate (interrupts/sec)
* *
* Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative) * Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative)
*/ */
...@@ -107,7 +114,8 @@ E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); ...@@ -107,7 +114,8 @@ E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
#define MAX_ITR 100000 #define MAX_ITR 100000
#define MIN_ITR 100 #define MIN_ITR 100
/* Enable Smart Power Down of the PHY /*
* Enable Smart Power Down of the PHY
* *
* Valid Range: 0, 1 * Valid Range: 0, 1
* *
...@@ -115,7 +123,8 @@ E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); ...@@ -115,7 +123,8 @@ E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
*/ */
E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down"); E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
/* Enable Kumeran Lock Loss workaround /*
* Enable Kumeran Lock Loss workaround
* *
* Valid Range: 0, 1 * Valid Range: 0, 1
* *
......
/******************************************************************************* /*******************************************************************************
Intel PRO/1000 Linux driver Intel PRO/1000 Linux driver
Copyright(c) 1999 - 2007 Intel Corporation. Copyright(c) 1999 - 2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -134,7 +134,8 @@ static s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) ...@@ -134,7 +134,8 @@ static s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
return -E1000_ERR_PARAM; return -E1000_ERR_PARAM;
} }
/* 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.
*/ */
...@@ -144,7 +145,11 @@ static s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) ...@@ -144,7 +145,11 @@ static s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
ew32(MDIC, mdic); ew32(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
* the lower time out
*/
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
udelay(50); udelay(50);
mdic = er32(MDIC); mdic = er32(MDIC);
...@@ -182,7 +187,8 @@ static s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) ...@@ -182,7 +187,8 @@ static s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
return -E1000_ERR_PARAM; return -E1000_ERR_PARAM;
} }
/* 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.
*/ */
...@@ -409,14 +415,15 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw) ...@@ -409,14 +415,15 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
s32 ret_val; s32 ret_val;
u16 phy_data; u16 phy_data;
/* Enable CRS on TX. This must be set for half-duplex operation. */ /* Enable CRS on Tx. This must be set for half-duplex operation. */
ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
if (ret_val) if (ret_val)
return ret_val; return ret_val;
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
...@@ -441,7 +448,8 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw) ...@@ -441,7 +448,8 @@ s32 e1000e_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
...@@ -456,7 +464,8 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw) ...@@ -456,7 +464,8 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
return ret_val; return ret_val;
if (phy->revision < 4) { if (phy->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 = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data);
...@@ -543,9 +552,11 @@ s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw) ...@@ -543,9 +552,11 @@ s32 e1000e_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.
*/
if (phy->autoneg_advertised == ADVERTISE_1000_FULL) { if (phy->autoneg_advertised == ADVERTISE_1000_FULL) {
/* Disable SmartSpeed */ /* Disable SmartSpeed */
ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
...@@ -630,14 +641,16 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -630,14 +641,16 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
return ret_val; return ret_val;
} }
/* 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).
*/ */
...@@ -683,7 +696,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -683,7 +696,8 @@ static s32 e1000_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
...@@ -696,38 +710,42 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -696,38 +710,42 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
* but not send pause frames). * but not send pause frames).
* 2: Tx flow control is enabled (we can send pause frames * 2: Tx flow control is enabled (we can send pause frames
* but we do not support receiving pause frames). * but we do not support receiving pause frames).
* 3: Both Rx and TX flow control (symmetric) are enabled. * 3: Both Rx and Tx flow control (symmetric) are enabled.
* other: No software override. The flow control configuration * other: No software override. The flow control configuration
* in the EEPROM is used. * in the EEPROM is used.
*/ */
switch (hw->mac.fc) { switch (hw->fc.type) {
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
* capable of RX Pause ONLY, we will advertise that we * capable of Rx Pause ONLY, we will advertise that we
* support both symmetric and asymmetric RX PAUSE. Later * support both symmetric and asymmetric Rx PAUSE. Later
* (in e1000e_config_fc_after_link_up) we will disable the * (in e1000e_config_fc_after_link_up) we will disable the
* hw's ability to send PAUSE frames. * hw's ability to send PAUSE frames.
*/ */
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);
...@@ -758,7 +776,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -758,7 +776,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
* Performs initial bounds checking on autoneg advertisement parameter, then * Performs initial bounds checking on autoneg advertisement parameter, then
* configure to advertise the full capability. Setup the PHY to autoneg * configure to advertise the full capability. Setup the PHY to autoneg
* and restart the negotiation process between the link partner. If * and restart the negotiation process between the link partner. If
* wait_for_link, then wait for autoneg to complete before exiting. * autoneg_wait_to_complete, then wait for autoneg to complete before exiting.
**/ **/
static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
{ {
...@@ -766,12 +784,14 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) ...@@ -766,12 +784,14 @@ static s32 e1000_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)
...@@ -785,7 +805,8 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) ...@@ -785,7 +805,8 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
} }
hw_dbg(hw, "Restarting Auto-Neg\n"); hw_dbg(hw, "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 = e1e_rphy(hw, PHY_CONTROL, &phy_ctrl); ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_ctrl);
...@@ -797,10 +818,11 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) ...@@ -797,10 +818,11 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
if (ret_val) if (ret_val)
return ret_val; return ret_val;
/* 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->wait_for_link) { if (phy->autoneg_wait_to_complete) {
ret_val = e1000_wait_autoneg(hw); ret_val = e1000_wait_autoneg(hw);
if (ret_val) { if (ret_val) {
hw_dbg(hw, "Error while waiting for " hw_dbg(hw, "Error while waiting for "
...@@ -829,14 +851,18 @@ s32 e1000e_setup_copper_link(struct e1000_hw *hw) ...@@ -829,14 +851,18 @@ s32 e1000e_setup_copper_link(struct e1000_hw *hw)
bool link; bool link;
if (hw->mac.autoneg) { if (hw->mac.autoneg) {
/* Setup autoneg and flow control advertisement and perform /*
* autonegotiation. */ * Setup autoneg and flow control advertisement and perform
* autonegotiation.
*/
ret_val = e1000_copper_link_autoneg(hw); ret_val = e1000_copper_link_autoneg(hw);
if (ret_val) if (ret_val)
return ret_val; return ret_val;
} else { } else {
/* PHY will be set to 10H, 10F, 100H or 100F /*
* depending on user settings. */ * PHY will be set to 10H, 10F, 100H or 100F
* depending on user settings.
*/
hw_dbg(hw, "Forcing Speed and Duplex\n"); hw_dbg(hw, "Forcing Speed and Duplex\n");
ret_val = e1000_phy_force_speed_duplex(hw); ret_val = e1000_phy_force_speed_duplex(hw);
if (ret_val) { if (ret_val) {
...@@ -845,7 +871,8 @@ s32 e1000e_setup_copper_link(struct e1000_hw *hw) ...@@ -845,7 +871,8 @@ s32 e1000e_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 = e1000e_phy_has_link_generic(hw, ret_val = e1000e_phy_has_link_generic(hw,
...@@ -891,7 +918,8 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw) ...@@ -891,7 +918,8 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw)
if (ret_val) if (ret_val)
return ret_val; return ret_val;
/* 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 = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data);
...@@ -909,7 +937,7 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw) ...@@ -909,7 +937,7 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw)
udelay(1); udelay(1);
if (phy->wait_for_link) { if (phy->autoneg_wait_to_complete) {
hw_dbg(hw, "Waiting for forced speed/duplex link on IGP phy.\n"); hw_dbg(hw, "Waiting for forced speed/duplex link on IGP phy.\n");
ret_val = e1000e_phy_has_link_generic(hw, ret_val = e1000e_phy_has_link_generic(hw,
...@@ -941,7 +969,7 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw) ...@@ -941,7 +969,7 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw)
* Calls the PHY setup function to force speed and duplex. Clears the * Calls the PHY setup function to force speed and duplex. Clears the
* auto-crossover to force MDI manually. Resets the PHY to commit the * auto-crossover to force MDI manually. Resets the PHY to commit the
* changes. If time expires while waiting for link up, we reset the DSP. * changes. If time expires while waiting for link up, we reset the DSP.
* After reset, TX_CLK and CRS on TX must be set. Return successful upon * After reset, TX_CLK and CRS on Tx must be set. Return successful upon
* successful completion, else return corresponding error code. * successful completion, else return corresponding error code.
**/ **/
s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
...@@ -951,7 +979,8 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) ...@@ -951,7 +979,8 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
u16 phy_data; u16 phy_data;
bool link; bool link;
/* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI /*
* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI
* forced whenever speed and duplex are forced. * forced whenever speed and duplex are forced.
*/ */
ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
...@@ -980,7 +1009,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) ...@@ -980,7 +1009,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
udelay(1); udelay(1);
if (phy->wait_for_link) { if (phy->autoneg_wait_to_complete) {
hw_dbg(hw, "Waiting for forced speed/duplex link on M88 phy.\n"); hw_dbg(hw, "Waiting for forced speed/duplex link on M88 phy.\n");
ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
...@@ -989,10 +1018,12 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) ...@@ -989,10 +1018,12 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
return ret_val; return ret_val;
if (!link) { if (!link) {
/* 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 = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT, 0x001d); ret_val = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT,
0x001d);
if (ret_val) if (ret_val)
return ret_val; return ret_val;
ret_val = e1000e_phy_reset_dsp(hw); ret_val = e1000e_phy_reset_dsp(hw);
...@@ -1011,7 +1042,8 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) ...@@ -1011,7 +1042,8 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
if (ret_val) if (ret_val)
return ret_val; return ret_val;
/* 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.
*/ */
...@@ -1020,7 +1052,8 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) ...@@ -1020,7 +1052,8 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
if (ret_val) if (ret_val)
return ret_val; return ret_val;
/* 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 = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
...@@ -1051,7 +1084,7 @@ void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl) ...@@ -1051,7 +1084,7 @@ void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)
u32 ctrl; u32 ctrl;
/* Turn off flow control when forcing speed/duplex */ /* Turn off flow control when forcing speed/duplex */
mac->fc = e1000_fc_none; hw->fc.type = e1000_fc_none;
/* Force speed/duplex on the mac */ /* Force speed/duplex on the mac */
ctrl = er32(CTRL); ctrl = er32(CTRL);
...@@ -1124,10 +1157,12 @@ s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active) ...@@ -1124,10 +1157,12 @@ s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active)
data); data);
if (ret_val) if (ret_val)
return ret_val; return ret_val;
/* 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.
*/
if (phy->smart_speed == e1000_smart_speed_on) { if (phy->smart_speed == e1000_smart_speed_on) {
ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
&data); &data);
...@@ -1249,8 +1284,10 @@ static s32 e1000_check_polarity_igp(struct e1000_hw *hw) ...@@ -1249,8 +1284,10 @@ static s32 e1000_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 /*
* our connection. */ * Polarity is determined based on the speed of
* our connection.
*/
ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data); ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data);
if (ret_val) if (ret_val)
return ret_val; return ret_val;
...@@ -1260,7 +1297,8 @@ static s32 e1000_check_polarity_igp(struct e1000_hw *hw) ...@@ -1260,7 +1297,8 @@ static s32 e1000_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;
...@@ -1278,7 +1316,7 @@ static s32 e1000_check_polarity_igp(struct e1000_hw *hw) ...@@ -1278,7 +1316,7 @@ static s32 e1000_check_polarity_igp(struct e1000_hw *hw)
} }
/** /**
* e1000_wait_autoneg - Wait for auto-neg compeletion * e1000_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
...@@ -1302,7 +1340,8 @@ static s32 e1000_wait_autoneg(struct e1000_hw *hw) ...@@ -1302,7 +1340,8 @@ static s32 e1000_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;
...@@ -1324,7 +1363,8 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, ...@@ -1324,7 +1363,8 @@ s32 e1000e_phy_has_link_generic(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.
*/ */
...@@ -1412,10 +1452,12 @@ s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw) ...@@ -1412,10 +1452,12 @@ s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw)
if (ret_val) if (ret_val)
return ret_val; return ret_val;
/* Getting bits 15:9, which represent the combination of /*
* Getting bits 15:9, which represent the combination of
* course and fine gain values. The result is a number * course 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.
*/
cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) & cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) &
IGP02E1000_AGC_LENGTH_MASK; IGP02E1000_AGC_LENGTH_MASK;
...@@ -1466,7 +1508,7 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw) ...@@ -1466,7 +1508,7 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw)
u16 phy_data; u16 phy_data;
bool link; bool link;
if (hw->media_type != e1000_media_type_copper) { if (hw->phy.media_type != e1000_media_type_copper) {
hw_dbg(hw, "Phy info is only valid for copper media\n"); hw_dbg(hw, "Phy info is only valid for copper media\n");
return -E1000_ERR_CONFIG; return -E1000_ERR_CONFIG;
} }
......
...@@ -421,7 +421,7 @@ struct ehea_fw_handle_entry { ...@@ -421,7 +421,7 @@ struct ehea_fw_handle_entry {
struct ehea_fw_handle_array { struct ehea_fw_handle_array {
struct ehea_fw_handle_entry *arr; struct ehea_fw_handle_entry *arr;
int num_entries; int num_entries;
struct semaphore lock; struct mutex lock;
}; };
struct ehea_bcmc_reg_entry { struct ehea_bcmc_reg_entry {
...@@ -434,7 +434,7 @@ struct ehea_bcmc_reg_entry { ...@@ -434,7 +434,7 @@ struct ehea_bcmc_reg_entry {
struct ehea_bcmc_reg_array { struct ehea_bcmc_reg_array {
struct ehea_bcmc_reg_entry *arr; struct ehea_bcmc_reg_entry *arr;
int num_entries; int num_entries;
struct semaphore lock; struct mutex lock;
}; };
#define EHEA_PORT_UP 1 #define EHEA_PORT_UP 1
...@@ -452,7 +452,7 @@ struct ehea_port { ...@@ -452,7 +452,7 @@ struct ehea_port {
struct vlan_group *vgrp; struct vlan_group *vgrp;
struct ehea_eq *qp_eq; struct ehea_eq *qp_eq;
struct work_struct reset_task; struct work_struct reset_task;
struct semaphore port_lock; struct mutex port_lock;
char int_aff_name[EHEA_IRQ_NAME_SIZE]; char int_aff_name[EHEA_IRQ_NAME_SIZE];
int allmulti; /* Indicates IFF_ALLMULTI state */ int allmulti; /* Indicates IFF_ALLMULTI state */
int promisc; /* Indicates IFF_PROMISC state */ int promisc; /* Indicates IFF_PROMISC state */
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <asm/kexec.h> #include <asm/kexec.h>
#include <linux/mutex.h>
#include <net/ip.h> #include <net/ip.h>
...@@ -99,7 +100,7 @@ static int port_name_cnt; ...@@ -99,7 +100,7 @@ static int port_name_cnt;
static LIST_HEAD(adapter_list); static LIST_HEAD(adapter_list);
u64 ehea_driver_flags; u64 ehea_driver_flags;
struct work_struct ehea_rereg_mr_task; struct work_struct ehea_rereg_mr_task;
struct semaphore dlpar_mem_lock; static DEFINE_MUTEX(dlpar_mem_lock);
struct ehea_fw_handle_array ehea_fw_handles; struct ehea_fw_handle_array ehea_fw_handles;
struct ehea_bcmc_reg_array ehea_bcmc_regs; struct ehea_bcmc_reg_array ehea_bcmc_regs;
...@@ -1758,7 +1759,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa) ...@@ -1758,7 +1759,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa)
memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len); memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len);
down(&ehea_bcmc_regs.lock); mutex_lock(&ehea_bcmc_regs.lock);
/* Deregister old MAC in pHYP */ /* Deregister old MAC in pHYP */
ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC); ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
...@@ -1776,7 +1777,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa) ...@@ -1776,7 +1777,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa)
out_upregs: out_upregs:
ehea_update_bcmc_registrations(); ehea_update_bcmc_registrations();
up(&ehea_bcmc_regs.lock); mutex_unlock(&ehea_bcmc_regs.lock);
out_free: out_free:
kfree(cb0); kfree(cb0);
out: out:
...@@ -1938,7 +1939,7 @@ static void ehea_set_multicast_list(struct net_device *dev) ...@@ -1938,7 +1939,7 @@ static void ehea_set_multicast_list(struct net_device *dev)
} }
ehea_promiscuous(dev, 0); ehea_promiscuous(dev, 0);
down(&ehea_bcmc_regs.lock); mutex_lock(&ehea_bcmc_regs.lock);
if (dev->flags & IFF_ALLMULTI) { if (dev->flags & IFF_ALLMULTI) {
ehea_allmulti(dev, 1); ehea_allmulti(dev, 1);
...@@ -1969,7 +1970,7 @@ static void ehea_set_multicast_list(struct net_device *dev) ...@@ -1969,7 +1970,7 @@ static void ehea_set_multicast_list(struct net_device *dev)
} }
out: out:
ehea_update_bcmc_registrations(); ehea_update_bcmc_registrations();
up(&ehea_bcmc_regs.lock); mutex_unlock(&ehea_bcmc_regs.lock);
return; return;
} }
...@@ -2452,7 +2453,7 @@ static int ehea_up(struct net_device *dev) ...@@ -2452,7 +2453,7 @@ static int ehea_up(struct net_device *dev)
if (port->state == EHEA_PORT_UP) if (port->state == EHEA_PORT_UP)
return 0; return 0;
down(&ehea_fw_handles.lock); mutex_lock(&ehea_fw_handles.lock);
ret = ehea_port_res_setup(port, port->num_def_qps, ret = ehea_port_res_setup(port, port->num_def_qps,
port->num_add_tx_qps); port->num_add_tx_qps);
...@@ -2490,7 +2491,7 @@ static int ehea_up(struct net_device *dev) ...@@ -2490,7 +2491,7 @@ static int ehea_up(struct net_device *dev)
} }
} }
down(&ehea_bcmc_regs.lock); mutex_lock(&ehea_bcmc_regs.lock);
ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); ret = ehea_broadcast_reg_helper(port, H_REG_BCMC);
if (ret) { if (ret) {
...@@ -2513,10 +2514,10 @@ static int ehea_up(struct net_device *dev) ...@@ -2513,10 +2514,10 @@ static int ehea_up(struct net_device *dev)
ehea_info("Failed starting %s. ret=%i", dev->name, ret); ehea_info("Failed starting %s. ret=%i", dev->name, ret);
ehea_update_bcmc_registrations(); ehea_update_bcmc_registrations();
up(&ehea_bcmc_regs.lock); mutex_unlock(&ehea_bcmc_regs.lock);
ehea_update_firmware_handles(); ehea_update_firmware_handles();
up(&ehea_fw_handles.lock); mutex_unlock(&ehea_fw_handles.lock);
return ret; return ret;
} }
...@@ -2542,7 +2543,7 @@ static int ehea_open(struct net_device *dev) ...@@ -2542,7 +2543,7 @@ static int ehea_open(struct net_device *dev)
int ret; int ret;
struct ehea_port *port = netdev_priv(dev); struct ehea_port *port = netdev_priv(dev);
down(&port->port_lock); mutex_lock(&port->port_lock);
if (netif_msg_ifup(port)) if (netif_msg_ifup(port))
ehea_info("enabling port %s", dev->name); ehea_info("enabling port %s", dev->name);
...@@ -2553,7 +2554,7 @@ static int ehea_open(struct net_device *dev) ...@@ -2553,7 +2554,7 @@ static int ehea_open(struct net_device *dev)
netif_start_queue(dev); netif_start_queue(dev);
} }
up(&port->port_lock); mutex_unlock(&port->port_lock);
return ret; return ret;
} }
...@@ -2566,18 +2567,18 @@ static int ehea_down(struct net_device *dev) ...@@ -2566,18 +2567,18 @@ static int ehea_down(struct net_device *dev)
if (port->state == EHEA_PORT_DOWN) if (port->state == EHEA_PORT_DOWN)
return 0; return 0;
down(&ehea_bcmc_regs.lock); mutex_lock(&ehea_fw_handles.lock);
mutex_lock(&ehea_bcmc_regs.lock);
ehea_drop_multicast_list(dev); ehea_drop_multicast_list(dev);
ehea_broadcast_reg_helper(port, H_DEREG_BCMC); ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
ehea_free_interrupts(dev); ehea_free_interrupts(dev);
down(&ehea_fw_handles.lock);
port->state = EHEA_PORT_DOWN; port->state = EHEA_PORT_DOWN;
ehea_update_bcmc_registrations(); ehea_update_bcmc_registrations();
up(&ehea_bcmc_regs.lock); mutex_unlock(&ehea_bcmc_regs.lock);
ret = ehea_clean_all_portres(port); ret = ehea_clean_all_portres(port);
if (ret) if (ret)
...@@ -2585,7 +2586,7 @@ static int ehea_down(struct net_device *dev) ...@@ -2585,7 +2586,7 @@ static int ehea_down(struct net_device *dev)
dev->name, ret); dev->name, ret);
ehea_update_firmware_handles(); ehea_update_firmware_handles();
up(&ehea_fw_handles.lock); mutex_unlock(&ehea_fw_handles.lock);
return ret; return ret;
} }
...@@ -2599,11 +2600,11 @@ static int ehea_stop(struct net_device *dev) ...@@ -2599,11 +2600,11 @@ static int ehea_stop(struct net_device *dev)
ehea_info("disabling port %s", dev->name); ehea_info("disabling port %s", dev->name);
flush_scheduled_work(); flush_scheduled_work();
down(&port->port_lock); mutex_lock(&port->port_lock);
netif_stop_queue(dev); netif_stop_queue(dev);
port_napi_disable(port); port_napi_disable(port);
ret = ehea_down(dev); ret = ehea_down(dev);
up(&port->port_lock); mutex_unlock(&port->port_lock);
return ret; return ret;
} }
...@@ -2801,7 +2802,7 @@ static void ehea_reset_port(struct work_struct *work) ...@@ -2801,7 +2802,7 @@ static void ehea_reset_port(struct work_struct *work)
struct net_device *dev = port->netdev; struct net_device *dev = port->netdev;
port->resets++; port->resets++;
down(&port->port_lock); mutex_lock(&port->port_lock);
netif_stop_queue(dev); netif_stop_queue(dev);
port_napi_disable(port); port_napi_disable(port);
...@@ -2821,7 +2822,7 @@ static void ehea_reset_port(struct work_struct *work) ...@@ -2821,7 +2822,7 @@ static void ehea_reset_port(struct work_struct *work)
netif_wake_queue(dev); netif_wake_queue(dev);
out: out:
up(&port->port_lock); mutex_unlock(&port->port_lock);
return; return;
} }
...@@ -2830,7 +2831,7 @@ static void ehea_rereg_mrs(struct work_struct *work) ...@@ -2830,7 +2831,7 @@ static void ehea_rereg_mrs(struct work_struct *work)
int ret, i; int ret, i;
struct ehea_adapter *adapter; struct ehea_adapter *adapter;
down(&dlpar_mem_lock); mutex_lock(&dlpar_mem_lock);
ehea_info("LPAR memory enlarged - re-initializing driver"); ehea_info("LPAR memory enlarged - re-initializing driver");
list_for_each_entry(adapter, &adapter_list, list) list_for_each_entry(adapter, &adapter_list, list)
...@@ -2838,21 +2839,23 @@ static void ehea_rereg_mrs(struct work_struct *work) ...@@ -2838,21 +2839,23 @@ static void ehea_rereg_mrs(struct work_struct *work)
/* Shutdown all ports */ /* Shutdown all ports */
for (i = 0; i < EHEA_MAX_PORTS; i++) { for (i = 0; i < EHEA_MAX_PORTS; i++) {
struct ehea_port *port = adapter->port[i]; struct ehea_port *port = adapter->port[i];
struct net_device *dev;
if (port) { if (!port)
struct net_device *dev = port->netdev; continue;
dev = port->netdev;
if (dev->flags & IFF_UP) { if (dev->flags & IFF_UP) {
down(&port->port_lock); mutex_lock(&port->port_lock);
netif_stop_queue(dev); netif_stop_queue(dev);
ret = ehea_stop_qps(dev); ret = ehea_stop_qps(dev);
if (ret) { if (ret) {
up(&port->port_lock); mutex_unlock(&port->port_lock);
goto out; goto out;
} }
port_napi_disable(port); port_napi_disable(port);
up(&port->port_lock); mutex_unlock(&port->port_lock);
}
} }
} }
...@@ -2892,17 +2895,17 @@ static void ehea_rereg_mrs(struct work_struct *work) ...@@ -2892,17 +2895,17 @@ static void ehea_rereg_mrs(struct work_struct *work)
struct net_device *dev = port->netdev; struct net_device *dev = port->netdev;
if (dev->flags & IFF_UP) { if (dev->flags & IFF_UP) {
down(&port->port_lock); mutex_lock(&port->port_lock);
port_napi_enable(port); port_napi_enable(port);
ret = ehea_restart_qps(dev); ret = ehea_restart_qps(dev);
if (!ret) if (!ret)
netif_wake_queue(dev); netif_wake_queue(dev);
up(&port->port_lock); mutex_unlock(&port->port_lock);
} }
} }
} }
} }
up(&dlpar_mem_lock); mutex_unlock(&dlpar_mem_lock);
ehea_info("re-initializing driver complete"); ehea_info("re-initializing driver complete");
out: out:
return; return;
...@@ -3063,7 +3066,7 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, ...@@ -3063,7 +3066,7 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
port = netdev_priv(dev); port = netdev_priv(dev);
sema_init(&port->port_lock, 1); mutex_init(&port->port_lock);
port->state = EHEA_PORT_DOWN; port->state = EHEA_PORT_DOWN;
port->sig_comp_iv = sq_entries / 10; port->sig_comp_iv = sq_entries / 10;
...@@ -3342,7 +3345,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev, ...@@ -3342,7 +3345,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
ehea_error("Invalid ibmebus device probed"); ehea_error("Invalid ibmebus device probed");
return -EINVAL; return -EINVAL;
} }
down(&ehea_fw_handles.lock); mutex_lock(&ehea_fw_handles.lock);
adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
if (!adapter) { if (!adapter) {
...@@ -3426,7 +3429,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev, ...@@ -3426,7 +3429,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
out: out:
ehea_update_firmware_handles(); ehea_update_firmware_handles();
up(&ehea_fw_handles.lock); mutex_unlock(&ehea_fw_handles.lock);
return ret; return ret;
} }
...@@ -3445,7 +3448,7 @@ static int __devexit ehea_remove(struct of_device *dev) ...@@ -3445,7 +3448,7 @@ static int __devexit ehea_remove(struct of_device *dev)
flush_scheduled_work(); flush_scheduled_work();
down(&ehea_fw_handles.lock); mutex_lock(&ehea_fw_handles.lock);
ibmebus_free_irq(adapter->neq->attr.ist1, adapter); ibmebus_free_irq(adapter->neq->attr.ist1, adapter);
tasklet_kill(&adapter->neq_tasklet); tasklet_kill(&adapter->neq_tasklet);
...@@ -3456,7 +3459,7 @@ static int __devexit ehea_remove(struct of_device *dev) ...@@ -3456,7 +3459,7 @@ static int __devexit ehea_remove(struct of_device *dev)
kfree(adapter); kfree(adapter);
ehea_update_firmware_handles(); ehea_update_firmware_handles();
up(&ehea_fw_handles.lock); mutex_unlock(&ehea_fw_handles.lock);
return 0; return 0;
} }
...@@ -3543,9 +3546,8 @@ int __init ehea_module_init(void) ...@@ -3543,9 +3546,8 @@ int __init ehea_module_init(void)
memset(&ehea_fw_handles, 0, sizeof(ehea_fw_handles)); memset(&ehea_fw_handles, 0, sizeof(ehea_fw_handles));
memset(&ehea_bcmc_regs, 0, sizeof(ehea_bcmc_regs)); memset(&ehea_bcmc_regs, 0, sizeof(ehea_bcmc_regs));
sema_init(&dlpar_mem_lock, 1); mutex_init(&ehea_fw_handles.lock);
sema_init(&ehea_fw_handles.lock, 1); mutex_init(&ehea_bcmc_regs.lock);
sema_init(&ehea_bcmc_regs.lock, 1);
ret = check_module_parm(); ret = check_module_parm();
if (ret) if (ret)
......
...@@ -367,7 +367,7 @@ static int __ixgbe_notify_dca(struct device *dev, void *data) ...@@ -367,7 +367,7 @@ static int __ixgbe_notify_dca(struct device *dev, void *data)
/* Always use CB2 mode, difference is masked /* Always use CB2 mode, difference is masked
* in the CB driver. */ * in the CB driver. */
IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_CTRL, 2); IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_CTRL, 2);
if (dca_add_requester(dev) == IXGBE_SUCCESS) { if (dca_add_requester(dev) == 0) {
ixgbe_setup_dca(adapter); ixgbe_setup_dca(adapter);
break; break;
} }
...@@ -381,7 +381,7 @@ static int __ixgbe_notify_dca(struct device *dev, void *data) ...@@ -381,7 +381,7 @@ static int __ixgbe_notify_dca(struct device *dev, void *data)
break; break;
} }
return IXGBE_SUCCESS; return 0;
} }
#endif /* CONFIG_DCA */ #endif /* CONFIG_DCA */
...@@ -3605,7 +3605,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, ...@@ -3605,7 +3605,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
goto err_register; goto err_register;
#ifdef CONFIG_DCA #ifdef CONFIG_DCA
if (dca_add_requester(&pdev->dev) == IXGBE_SUCCESS) { if (dca_add_requester(&pdev->dev) == 0) {
adapter->flags |= IXGBE_FLAG_DCA_ENABLED; adapter->flags |= IXGBE_FLAG_DCA_ENABLED;
/* always use CB2 mode, difference is masked /* always use CB2 mode, difference is masked
* in the CB driver */ * in the CB driver */
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#define XL_DEBUG 0 #define XL_DEBUG 0
#include <linux/jiffies.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -408,7 +409,7 @@ static int xl_hw_reset(struct net_device *dev) ...@@ -408,7 +409,7 @@ static int xl_hw_reset(struct net_device *dev)
t=jiffies; t=jiffies;
while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) {
schedule(); schedule();
if(jiffies-t > 40*HZ) { if (time_after(jiffies, t + 40 * HZ)) {
printk(KERN_ERR "%s: 3COM 3C359 Velocity XL card not responding to global reset.\n", dev->name); printk(KERN_ERR "%s: 3COM 3C359 Velocity XL card not responding to global reset.\n", dev->name);
return -ENODEV; return -ENODEV;
} }
...@@ -519,7 +520,7 @@ static int xl_hw_reset(struct net_device *dev) ...@@ -519,7 +520,7 @@ static int xl_hw_reset(struct net_device *dev)
t=jiffies; t=jiffies;
while ( !(readw(xl_mmio + MMIO_INTSTATUS_AUTO) & INTSTAT_SRB) ) { while ( !(readw(xl_mmio + MMIO_INTSTATUS_AUTO) & INTSTAT_SRB) ) {
schedule(); schedule();
if(jiffies-t > 15*HZ) { if (time_after(jiffies, t + 15 * HZ)) {
printk(KERN_ERR "3COM 3C359 Velocity XL card not responding.\n"); printk(KERN_ERR "3COM 3C359 Velocity XL card not responding.\n");
return -ENODEV; return -ENODEV;
} }
...@@ -790,7 +791,7 @@ static int xl_open_hw(struct net_device *dev) ...@@ -790,7 +791,7 @@ static int xl_open_hw(struct net_device *dev)
t=jiffies; t=jiffies;
while (! (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_SRB)) { while (! (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_SRB)) {
schedule(); schedule();
if(jiffies-t > 40*HZ) { if (time_after(jiffies, t + 40 * HZ)) {
printk(KERN_ERR "3COM 3C359 Velocity XL card not responding.\n"); printk(KERN_ERR "3COM 3C359 Velocity XL card not responding.\n");
break ; break ;
} }
...@@ -1003,7 +1004,7 @@ static void xl_reset(struct net_device *dev) ...@@ -1003,7 +1004,7 @@ static void xl_reset(struct net_device *dev)
t=jiffies; t=jiffies;
while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) {
if(jiffies-t > 40*HZ) { if (time_after(jiffies, t + 40 * HZ)) {
printk(KERN_ERR "3COM 3C359 Velocity XL card not responding.\n"); printk(KERN_ERR "3COM 3C359 Velocity XL card not responding.\n");
break ; break ;
} }
...@@ -1270,7 +1271,7 @@ static int xl_close(struct net_device *dev) ...@@ -1270,7 +1271,7 @@ static int xl_close(struct net_device *dev)
t=jiffies; t=jiffies;
while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) {
schedule(); schedule();
if(jiffies-t > 10*HZ) { if (time_after(jiffies, t + 10 * HZ)) {
printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-DNSTALL not responding.\n", dev->name); printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-DNSTALL not responding.\n", dev->name);
break ; break ;
} }
...@@ -1279,7 +1280,7 @@ static int xl_close(struct net_device *dev) ...@@ -1279,7 +1280,7 @@ static int xl_close(struct net_device *dev)
t=jiffies; t=jiffies;
while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) {
schedule(); schedule();
if(jiffies-t > 10*HZ) { if (time_after(jiffies, t + 10 * HZ)) {
printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-DNDISABLE not responding.\n", dev->name); printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-DNDISABLE not responding.\n", dev->name);
break ; break ;
} }
...@@ -1288,7 +1289,7 @@ static int xl_close(struct net_device *dev) ...@@ -1288,7 +1289,7 @@ static int xl_close(struct net_device *dev)
t=jiffies; t=jiffies;
while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) {
schedule(); schedule();
if(jiffies-t > 10*HZ) { if (time_after(jiffies, t + 10 * HZ)) {
printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-UPSTALL not responding.\n", dev->name); printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-UPSTALL not responding.\n", dev->name);
break ; break ;
} }
...@@ -1305,7 +1306,7 @@ static int xl_close(struct net_device *dev) ...@@ -1305,7 +1306,7 @@ static int xl_close(struct net_device *dev)
t=jiffies; t=jiffies;
while (!(readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_SRB)) { while (!(readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_SRB)) {
schedule(); schedule();
if(jiffies-t > 10*HZ) { if (time_after(jiffies, t + 10 * HZ)) {
printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-CLOSENIC not responding.\n", dev->name); printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-CLOSENIC not responding.\n", dev->name);
break ; break ;
} }
...@@ -1334,7 +1335,7 @@ static int xl_close(struct net_device *dev) ...@@ -1334,7 +1335,7 @@ static int xl_close(struct net_device *dev)
t=jiffies; t=jiffies;
while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) {
schedule(); schedule();
if(jiffies-t > 10*HZ) { if (time_after(jiffies, t + 10 * HZ)) {
printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-UPRESET not responding.\n", dev->name); printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-UPRESET not responding.\n", dev->name);
break ; break ;
} }
...@@ -1343,7 +1344,7 @@ static int xl_close(struct net_device *dev) ...@@ -1343,7 +1344,7 @@ static int xl_close(struct net_device *dev)
t=jiffies; t=jiffies;
while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) {
schedule(); schedule();
if(jiffies-t > 10*HZ) { if (time_after(jiffies, t + 10 * HZ)) {
printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-DNRESET not responding.\n", dev->name); printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-DNRESET not responding.\n", dev->name);
break ; break ;
} }
......
...@@ -770,14 +770,14 @@ static void yellowfin_init_ring(struct net_device *dev) ...@@ -770,14 +770,14 @@ static void yellowfin_init_ring(struct net_device *dev)
/* Branch on Tx error. */ /* Branch on Tx error. */
yp->tx_ring[j].dbdma_cmd = cpu_to_le32(CMD_STOP); yp->tx_ring[j].dbdma_cmd = cpu_to_le32(CMD_STOP);
yp->tx_ring[j].branch_addr = cpu_to_le32(yp->tx_ring_dma + yp->tx_ring[j].branch_addr = cpu_to_le32(yp->tx_ring_dma +
(j+1)*sizeof(struct yellowfin_desc); (j+1)*sizeof(struct yellowfin_desc));
j++; j++;
if (yp->flags & FullTxStatus) { if (yp->flags & FullTxStatus) {
yp->tx_ring[j].dbdma_cmd = yp->tx_ring[j].dbdma_cmd =
cpu_to_le32(CMD_TXSTATUS | sizeof(*yp->tx_status)); cpu_to_le32(CMD_TXSTATUS | sizeof(*yp->tx_status));
yp->tx_ring[j].request_cnt = sizeof(*yp->tx_status); yp->tx_ring[j].request_cnt = sizeof(*yp->tx_status);
yp->tx_ring[j].addr = cpu_to_le32(yp->tx_status_dma + yp->tx_ring[j].addr = cpu_to_le32(yp->tx_status_dma +
i*sizeof(struct tx_status_words); i*sizeof(struct tx_status_words));
} else { } else {
/* Symbios chips write only tx_errs word. */ /* Symbios chips write only tx_errs word. */
yp->tx_ring[j].dbdma_cmd = yp->tx_ring[j].dbdma_cmd =
......
...@@ -283,8 +283,8 @@ struct arcnet_local { ...@@ -283,8 +283,8 @@ struct arcnet_local {
int next_buf, first_free_buf; int next_buf, first_free_buf;
/* network "reconfiguration" handling */ /* network "reconfiguration" handling */
time_t first_recon, /* time of "first" RECON message to count */ unsigned long first_recon; /* time of "first" RECON message to count */
last_recon; /* time of most recent RECON */ unsigned long last_recon; /* time of most recent RECON */
int num_recons; /* number of RECONs between first and last. */ int num_recons; /* number of RECONs between first and last. */
bool network_down; /* do we think the network is down? */ bool network_down; /* do we think the network is down? */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册