* [PATCH 2/6] e1000e: remove namespace collisions with e1000
From: Auke Kok @ 2007-08-10 20:00 UTC (permalink / raw)
To: jeff; +Cc: netdev, akpm, andi
In-Reply-To: <20070810200038.21509.77815.stgit@localhost.localdomain>
To prevent future collisions we rename all extern's from e1000_
to e1000e_*. The list of changed symbols was taken from e1000.h
Compile tested with CONFIG_E1000=y and CONFIG_E1000E=y.
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e1000e/82571.c | 129 +++++++++++++-------------
drivers/net/e1000e/e1000.h | 194 +++++++++++++++++++--------------------
drivers/net/e1000e/es2lan.c | 118 ++++++++++++------------
drivers/net/e1000e/ethtool.c | 62 ++++++------
drivers/net/e1000e/ich8lan.c | 92 +++++++++---------
drivers/net/e1000e/lib.c | 210 +++++++++++++++++++++---------------------
drivers/net/e1000e/netdev.c | 168 +++++++++++++++++-----------------
drivers/net/e1000e/param.c | 8 +-
drivers/net/e1000e/phy.c | 138 ++++++++++++++--------------
9 files changed, 559 insertions(+), 560 deletions(-)
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index 0f8f0ac..cf70522 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -54,7 +54,6 @@
static s32 e1000_get_phy_id_82571(struct e1000_hw *hw);
static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw);
static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw);
-static s32 e1000_get_phy_id_82571(struct e1000_hw *hw);
static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
u16 words, u16 *data);
static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw);
@@ -214,18 +213,18 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
switch (hw->media_type) {
case e1000_media_type_copper:
func->setup_physical_interface = e1000_setup_copper_link_82571;
- func->check_for_link = e1000_check_for_copper_link;
- func->get_link_up_info = e1000_get_speed_and_duplex_copper;
+ func->check_for_link = e1000e_check_for_copper_link;
+ func->get_link_up_info = e1000e_get_speed_and_duplex_copper;
break;
case e1000_media_type_fiber:
func->setup_physical_interface = e1000_setup_fiber_serdes_link_82571;
- func->check_for_link = e1000_check_for_fiber_link;
- func->get_link_up_info = e1000_get_speed_and_duplex_fiber_serdes;
+ func->check_for_link = e1000e_check_for_fiber_link;
+ func->get_link_up_info = e1000e_get_speed_and_duplex_fiber_serdes;
break;
case e1000_media_type_internal_serdes:
func->setup_physical_interface = e1000_setup_fiber_serdes_link_82571;
- func->check_for_link = e1000_check_for_serdes_link;
- func->get_link_up_info = e1000_get_speed_and_duplex_fiber_serdes;
+ func->check_for_link = e1000e_check_for_serdes_link;
+ func->get_link_up_info = e1000e_get_speed_and_duplex_fiber_serdes;
break;
default:
return -E1000_ERR_CONFIG;
@@ -324,7 +323,7 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)
phy->id = IGP01E1000_I_PHY_ID;
break;
case e1000_82573:
- return e1000_get_phy_id(hw);
+ return e1000e_get_phy_id(hw);
break;
default:
return -E1000_ERR_PHY;
@@ -360,7 +359,7 @@ static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw)
if (i == timeout) {
/* Release semaphores */
- e1000_put_hw_semaphore(hw);
+ e1000e_put_hw_semaphore(hw);
hw_dbg(hw, "Driver can't access the NVM\n");
return -E1000_ERR_NVM;
}
@@ -403,7 +402,7 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw)
return ret_val;
if (hw->mac.type != e1000_82573)
- ret_val = e1000_acquire_nvm(hw);
+ ret_val = e1000e_acquire_nvm(hw);
if (ret_val)
e1000_put_hw_semaphore_82571(hw);
@@ -419,7 +418,7 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw)
**/
static void e1000_release_nvm_82571(struct e1000_hw *hw)
{
- e1000_release_nvm(hw);
+ e1000e_release_nvm(hw);
e1000_put_hw_semaphore_82571(hw);
}
@@ -432,7 +431,7 @@ static void e1000_release_nvm_82571(struct e1000_hw *hw)
*
* For non-82573 silicon, write data to EEPROM at offset using SPI interface.
*
- * If e1000_update_nvm_checksum is not called after this function, the
+ * If e1000e_update_nvm_checksum is not called after this function, the
* EEPROM will most likley contain an invalid checksum.
**/
static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words,
@@ -446,7 +445,7 @@ static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words,
break;
case e1000_82571:
case e1000_82572:
- ret_val = e1000_write_nvm_spi(hw, offset, words, data);
+ ret_val = e1000e_write_nvm_spi(hw, offset, words, data);
break;
default:
ret_val = -E1000_ERR_NVM;
@@ -470,7 +469,7 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)
s32 ret_val;
u16 i;
- ret_val = e1000_update_nvm_checksum_generic(hw);
+ ret_val = e1000e_update_nvm_checksum_generic(hw);
if (ret_val)
return ret_val;
@@ -527,7 +526,7 @@ static s32 e1000_validate_nvm_checksum_82571(struct e1000_hw *hw)
if (hw->nvm.type == e1000_nvm_flash_hw)
e1000_fix_nvm_checksum_82571(hw);
- return e1000_validate_nvm_checksum_generic(hw);
+ return e1000e_validate_nvm_checksum_generic(hw);
}
/**
@@ -541,7 +540,7 @@ static s32 e1000_validate_nvm_checksum_82571(struct e1000_hw *hw)
* command has completed before trying to write the next word. After write
* poll for completion.
*
- * If e1000_update_nvm_checksum is not called after this function, the
+ * If e1000e_update_nvm_checksum is not called after this function, the
* EEPROM will most likley contain an invalid checksum.
**/
static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
@@ -565,13 +564,13 @@ static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
((offset+i) << E1000_NVM_RW_ADDR_SHIFT) |
E1000_NVM_RW_REG_START;
- ret_val = e1000_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE);
+ ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE);
if (ret_val)
break;
ew32(EEWR, eewr);
- ret_val = e1000_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE);
+ ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE);
if (ret_val)
break;
}
@@ -691,7 +690,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
/* Prevent the PCI-E bus from sticking if there is no TLP connection
* on the last TLP read/write transaction when MAC is reset.
*/
- ret_val = e1000_disable_pcie_master(hw);
+ ret_val = e1000e_disable_pcie_master(hw);
if (ret_val)
hw_dbg(hw, "PCI-E Master disable polling has failed.\n");
@@ -737,7 +736,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
e1e_flush();
}
- ret_val = e1000_get_auto_rd_done(hw);
+ ret_val = e1000e_get_auto_rd_done(hw);
if (ret_val)
/* We don't want to continue accessing MAC registers. */
return ret_val;
@@ -773,7 +772,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
e1000_initialize_hw_bits_82571(hw);
/* Initialize identification LED */
- ret_val = e1000_id_led_init(hw);
+ ret_val = e1000e_id_led_init(hw);
if (ret_val) {
hw_dbg(hw, "Error initializing identification LED\n");
return ret_val;
@@ -781,16 +780,16 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
/* Disabling VLAN filtering */
hw_dbg(hw, "Initializing the IEEE VLAN\n");
- e1000_clear_vfta(hw);
+ e1000e_clear_vfta(hw);
/* Setup the receive address. */
/* If, however, a locally administered address was assigned to the
* 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.
*/
- if (e1000_get_laa_state_82571(hw))
+ if (e1000e_get_laa_state_82571(hw))
rar_count--;
- e1000_init_rx_addrs(hw, rar_count);
+ e1000e_init_rx_addrs(hw, rar_count);
/* Zero out the Multicast HASH table */
hw_dbg(hw, "Zeroing the MTA\n");
@@ -815,7 +814,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
E1000_TXDCTL_COUNT_DESC;
ew32(TXDCTL1, reg_data);
} else {
- e1000_enable_tx_pkt_filtering(hw);
+ e1000e_enable_tx_pkt_filtering(hw);
reg_data = er32(GCR);
reg_data |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX;
ew32(GCR, reg_data);
@@ -898,13 +897,13 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
}
/**
- * e1000_clear_vfta - Clear VLAN filter table
+ * e1000e_clear_vfta - Clear VLAN filter table
* @hw: pointer to the HW structure
*
* Clears the register array which contains the VLAN filter table by
* setting all the values to 0.
**/
-void e1000_clear_vfta(struct e1000_hw *hw)
+void e1000e_clear_vfta(struct e1000_hw *hw)
{
u32 offset;
u32 vfta_value = 0;
@@ -956,10 +955,10 @@ static void e1000_mc_addr_list_update_82571(struct e1000_hw *hw,
u32 rar_used_count,
u32 rar_count)
{
- if (e1000_get_laa_state_82571(hw))
+ if (e1000e_get_laa_state_82571(hw))
rar_count--;
- e1000_mc_addr_list_update_generic(hw, mc_addr_list, mc_addr_count,
+ e1000e_mc_addr_list_update_generic(hw, mc_addr_list, mc_addr_count,
rar_used_count, rar_count);
}
@@ -982,7 +981,7 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw)
if (hw->mac.type == e1000_82573)
hw->mac.fc = e1000_fc_full;
- return e1000_setup_link(hw);
+ return e1000e_setup_link(hw);
}
/**
@@ -1006,10 +1005,10 @@ static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw)
switch (hw->phy.type) {
case e1000_phy_m88:
- ret_val = e1000_copper_link_setup_m88(hw);
+ ret_val = e1000e_copper_link_setup_m88(hw);
break;
case e1000_phy_igp_2:
- ret_val = e1000_copper_link_setup_igp(hw);
+ ret_val = e1000e_copper_link_setup_igp(hw);
/* Setup activity LED */
led_ctrl = er32(LEDCTL);
led_ctrl &= IGP_ACTIVITY_LED_MASK;
@@ -1024,7 +1023,7 @@ static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw)
if (ret_val)
return ret_val;
- ret_val = e1000_setup_copper_link(hw);
+ ret_val = e1000e_setup_copper_link(hw);
return ret_val;
}
@@ -1054,7 +1053,7 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw)
break;
}
- return e1000_setup_fiber_serdes_link(hw);
+ return e1000e_setup_fiber_serdes_link(hw);
}
/**
@@ -1086,12 +1085,12 @@ static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data)
}
/**
- * e1000_get_laa_state_82571 - Get locally administered address state
+ * e1000e_get_laa_state_82571 - Get locally administered address state
* @hw: pointer to the HW structure
*
* Retrieve and return the current locally administed address state.
**/
-bool e1000_get_laa_state_82571(struct e1000_hw *hw)
+bool e1000e_get_laa_state_82571(struct e1000_hw *hw)
{
if (hw->mac.type != e1000_82571)
return 0;
@@ -1100,13 +1099,13 @@ bool e1000_get_laa_state_82571(struct e1000_hw *hw)
}
/**
- * e1000_set_laa_state_82571 - Set locally administered address state
+ * e1000e_set_laa_state_82571 - Set locally administered address state
* @hw: pointer to the HW structure
* @state: enable/disable locally administered address
*
* Enable/Disable the current locally administed address state.
**/
-void e1000_set_laa_state_82571(struct e1000_hw *hw, bool state)
+void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state)
{
if (hw->mac.type != e1000_82571)
return;
@@ -1121,7 +1120,7 @@ void e1000_set_laa_state_82571(struct e1000_hw *hw, bool state)
* incoming packets directed to this port are dropped.
* Eventually the LAA will be in RAR[0] and RAR[14].
*/
- e1000_rar_set(hw, hw->mac.addr, hw->mac.rar_entry_count - 1);
+ e1000e_rar_set(hw, hw->mac.addr, hw->mac.rar_entry_count - 1);
}
/**
@@ -1167,7 +1166,7 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw)
ret_val = e1000_write_nvm(hw, 0x23, 1, &data);
if (ret_val)
return ret_val;
- ret_val = e1000_update_nvm_checksum(hw);
+ ret_val = e1000e_update_nvm_checksum(hw);
}
}
@@ -1184,7 +1183,7 @@ static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw)
{
u32 temp;
- e1000_clear_hw_cntrs_base(hw);
+ e1000e_clear_hw_cntrs_base(hw);
temp = er32(PRC64);
temp = er32(PRC127);
@@ -1225,12 +1224,12 @@ static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw)
static struct e1000_mac_operations e82571_mac_ops = {
.mng_mode_enab = E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT,
/* .check_for_link: media type dependent */
- .cleanup_led = e1000_cleanup_led_generic,
+ .cleanup_led = e1000e_cleanup_led_generic,
.clear_hw_cntrs = e1000_clear_hw_cntrs_82571,
- .get_bus_info = e1000_get_bus_info_pcie,
+ .get_bus_info = e1000e_get_bus_info_pcie,
/* .get_link_up_info: media type dependent */
- .led_on = e1000_led_on_generic,
- .led_off = e1000_led_off_generic,
+ .led_on = e1000e_led_on_generic,
+ .led_off = e1000e_led_off_generic,
.mc_addr_list_update = e1000_mc_addr_list_update_82571,
.reset_hw = e1000_reset_hw_82571,
.init_hw = e1000_init_hw_82571,
@@ -1240,39 +1239,39 @@ static struct e1000_mac_operations e82571_mac_ops = {
static struct e1000_phy_operations e82_phy_ops_igp = {
.acquire_phy = e1000_get_hw_semaphore_82571,
- .check_reset_block = e1000_check_reset_block_generic,
+ .check_reset_block = e1000e_check_reset_block_generic,
.commit_phy = NULL,
- .force_speed_duplex = e1000_phy_force_speed_duplex_igp,
+ .force_speed_duplex = e1000e_phy_force_speed_duplex_igp,
.get_cfg_done = e1000_get_cfg_done_82571,
- .get_cable_length = e1000_get_cable_length_igp_2,
- .get_phy_info = e1000_get_phy_info_igp,
- .read_phy_reg = e1000_read_phy_reg_igp,
+ .get_cable_length = e1000e_get_cable_length_igp_2,
+ .get_phy_info = e1000e_get_phy_info_igp,
+ .read_phy_reg = e1000e_read_phy_reg_igp,
.release_phy = e1000_put_hw_semaphore_82571,
- .reset_phy = e1000_phy_hw_reset_generic,
+ .reset_phy = e1000e_phy_hw_reset_generic,
.set_d0_lplu_state = e1000_set_d0_lplu_state_82571,
- .set_d3_lplu_state = e1000_set_d3_lplu_state,
- .write_phy_reg = e1000_write_phy_reg_igp,
+ .set_d3_lplu_state = e1000e_set_d3_lplu_state,
+ .write_phy_reg = e1000e_write_phy_reg_igp,
};
static struct e1000_phy_operations e82_phy_ops_m88 = {
.acquire_phy = e1000_get_hw_semaphore_82571,
- .check_reset_block = e1000_check_reset_block_generic,
- .commit_phy = e1000_phy_sw_reset,
- .force_speed_duplex = e1000_phy_force_speed_duplex_m88,
- .get_cfg_done = e1000_get_cfg_done,
- .get_cable_length = e1000_get_cable_length_m88,
- .get_phy_info = e1000_get_phy_info_m88,
- .read_phy_reg = e1000_read_phy_reg_m88,
+ .check_reset_block = e1000e_check_reset_block_generic,
+ .commit_phy = e1000e_phy_sw_reset,
+ .force_speed_duplex = e1000e_phy_force_speed_duplex_m88,
+ .get_cfg_done = e1000e_get_cfg_done,
+ .get_cable_length = e1000e_get_cable_length_m88,
+ .get_phy_info = e1000e_get_phy_info_m88,
+ .read_phy_reg = e1000e_read_phy_reg_m88,
.release_phy = e1000_put_hw_semaphore_82571,
- .reset_phy = e1000_phy_hw_reset_generic,
+ .reset_phy = e1000e_phy_hw_reset_generic,
.set_d0_lplu_state = e1000_set_d0_lplu_state_82571,
- .set_d3_lplu_state = e1000_set_d3_lplu_state,
- .write_phy_reg = e1000_write_phy_reg_m88,
+ .set_d3_lplu_state = e1000e_set_d3_lplu_state,
+ .write_phy_reg = e1000e_write_phy_reg_m88,
};
static struct e1000_nvm_operations e82571_nvm_ops = {
.acquire_nvm = e1000_acquire_nvm_82571,
- .read_nvm = e1000_read_nvm_spi,
+ .read_nvm = e1000e_read_nvm_spi,
.release_nvm = e1000_release_nvm_82571,
.update_nvm = e1000_update_nvm_checksum_82571,
.valid_led_default = e1000_valid_led_default_82571,
@@ -1282,7 +1281,7 @@ static struct e1000_nvm_operations e82571_nvm_ops = {
static struct e1000_nvm_operations e82573_nvm_ops = {
.acquire_nvm = e1000_acquire_nvm_82571,
- .read_nvm = e1000_read_nvm_eerd,
+ .read_nvm = e1000e_read_nvm_eerd,
.release_nvm = e1000_release_nvm_82571,
.update_nvm = e1000_update_nvm_checksum_82571,
.valid_led_default = e1000_valid_led_default_82571,
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index de17537..3475e48 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -337,26 +337,26 @@ enum latency_range {
latency_invalid = 255
};
-extern char e1000_driver_name[];
-extern const char e1000_driver_version[];
-
-extern void e1000_check_options(struct e1000_adapter *adapter);
-extern void e1000_set_ethtool_ops(struct net_device *netdev);
-
-extern int e1000_up(struct e1000_adapter *adapter);
-extern void e1000_down(struct e1000_adapter *adapter);
-extern void e1000_reinit_locked(struct e1000_adapter *adapter);
-extern void e1000_reset(struct e1000_adapter *adapter);
-extern void e1000_power_up_phy(struct e1000_adapter *adapter);
-extern int e1000_setup_rx_resources(struct e1000_adapter *adapter);
-extern int e1000_setup_tx_resources(struct e1000_adapter *adapter);
-extern void e1000_free_rx_resources(struct e1000_adapter *adapter);
-extern void e1000_free_tx_resources(struct e1000_adapter *adapter);
-extern void e1000_update_stats(struct e1000_adapter *adapter);
+extern char e1000e_driver_name[];
+extern const char e1000e_driver_version[];
+
+extern void e1000e_check_options(struct e1000_adapter *adapter);
+extern void e1000e_set_ethtool_ops(struct net_device *netdev);
+
+extern int e1000e_up(struct e1000_adapter *adapter);
+extern void e1000e_down(struct e1000_adapter *adapter);
+extern void e1000e_reinit_locked(struct e1000_adapter *adapter);
+extern void e1000e_reset(struct e1000_adapter *adapter);
+extern void e1000e_power_up_phy(struct e1000_adapter *adapter);
+extern int e1000e_setup_rx_resources(struct e1000_adapter *adapter);
+extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter);
+extern void e1000e_free_rx_resources(struct e1000_adapter *adapter);
+extern void e1000e_free_tx_resources(struct e1000_adapter *adapter);
+extern void e1000e_update_stats(struct e1000_adapter *adapter);
extern unsigned int copybreak;
-extern char *e1000_get_hw_dev_name(struct e1000_hw *hw);
+extern char *e1000e_get_hw_dev_name(struct e1000_hw *hw);
extern struct e1000_info e1000_82571_info;
extern struct e1000_info e1000_82572_info;
@@ -365,79 +365,79 @@ extern struct e1000_info e1000_ich8_info;
extern struct e1000_info e1000_ich9_info;
extern struct e1000_info e1000_es2_info;
-extern s32 e1000_commit_phy(struct e1000_hw *hw);
+extern s32 e1000e_commit_phy(struct e1000_hw *hw);
-extern bool e1000_enable_mng_pass_thru(struct e1000_hw *hw);
+extern bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw);
-extern bool e1000_get_laa_state_82571(struct e1000_hw *hw);
-extern void e1000_set_laa_state_82571(struct e1000_hw *hw, bool state);
+extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw);
+extern void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state);
-extern void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
+extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
bool state);
-extern void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
-extern void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw);
-
-extern s32 e1000_check_for_copper_link(struct e1000_hw *hw);
-extern s32 e1000_check_for_fiber_link(struct e1000_hw *hw);
-extern s32 e1000_check_for_serdes_link(struct e1000_hw *hw);
-extern s32 e1000_cleanup_led_generic(struct e1000_hw *hw);
-extern s32 e1000_led_on_generic(struct e1000_hw *hw);
-extern s32 e1000_led_off_generic(struct e1000_hw *hw);
-extern s32 e1000_get_bus_info_pcie(struct e1000_hw *hw);
-extern s32 e1000_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u16 *duplex);
-extern s32 e1000_get_speed_and_duplex_fiber_serdes(struct e1000_hw *hw, u16 *speed, u16 *duplex);
-extern s32 e1000_disable_pcie_master(struct e1000_hw *hw);
-extern s32 e1000_get_auto_rd_done(struct e1000_hw *hw);
-extern s32 e1000_id_led_init(struct e1000_hw *hw);
-extern void e1000_clear_hw_cntrs_base(struct e1000_hw *hw);
-extern s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw);
-extern s32 e1000_copper_link_setup_m88(struct e1000_hw *hw);
-extern s32 e1000_copper_link_setup_igp(struct e1000_hw *hw);
-extern s32 e1000_setup_link(struct e1000_hw *hw);
-extern void e1000_clear_vfta(struct e1000_hw *hw);
-extern void e1000_init_rx_addrs(struct e1000_hw *hw, u16 rar_count);
-extern void e1000_mc_addr_list_update_generic(struct e1000_hw *hw,
+extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
+extern void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw);
+
+extern s32 e1000e_check_for_copper_link(struct e1000_hw *hw);
+extern s32 e1000e_check_for_fiber_link(struct e1000_hw *hw);
+extern s32 e1000e_check_for_serdes_link(struct e1000_hw *hw);
+extern s32 e1000e_cleanup_led_generic(struct e1000_hw *hw);
+extern s32 e1000e_led_on_generic(struct e1000_hw *hw);
+extern s32 e1000e_led_off_generic(struct e1000_hw *hw);
+extern s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw);
+extern s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u16 *duplex);
+extern s32 e1000e_get_speed_and_duplex_fiber_serdes(struct e1000_hw *hw, u16 *speed, u16 *duplex);
+extern s32 e1000e_disable_pcie_master(struct e1000_hw *hw);
+extern s32 e1000e_get_auto_rd_done(struct e1000_hw *hw);
+extern s32 e1000e_id_led_init(struct e1000_hw *hw);
+extern void e1000e_clear_hw_cntrs_base(struct e1000_hw *hw);
+extern s32 e1000e_setup_fiber_serdes_link(struct e1000_hw *hw);
+extern s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw);
+extern s32 e1000e_copper_link_setup_igp(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_init_rx_addrs(struct e1000_hw *hw, u16 rar_count);
+extern void e1000e_mc_addr_list_update_generic(struct e1000_hw *hw,
u8 *mc_addr_list, u32 mc_addr_count,
u32 rar_used_count, u32 rar_count);
-extern void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
-extern s32 e1000_set_fc_watermarks(struct e1000_hw *hw);
-extern void e1000_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop);
-extern s32 e1000_get_hw_semaphore(struct e1000_hw *hw);
-extern s32 e1000_valid_led_default(struct e1000_hw *hw, u16 *data);
-extern void e1000_config_collision_dist(struct e1000_hw *hw);
-extern s32 e1000_config_fc_after_link_up(struct e1000_hw *hw);
-extern s32 e1000_force_mac_fc(struct e1000_hw *hw);
-extern s32 e1000_blink_led(struct e1000_hw *hw);
-extern void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);
-extern void e1000_reset_adaptive(struct e1000_hw *hw);
-extern void e1000_update_adaptive(struct e1000_hw *hw);
-
-extern s32 e1000_setup_copper_link(struct e1000_hw *hw);
-extern s32 e1000_get_phy_id(struct e1000_hw *hw);
-extern void e1000_put_hw_semaphore(struct e1000_hw *hw);
-extern s32 e1000_check_reset_block_generic(struct e1000_hw *hw);
-extern s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw);
-extern s32 e1000_get_cable_length_igp_2(struct e1000_hw *hw);
-extern s32 e1000_get_phy_info_igp(struct e1000_hw *hw);
-extern s32 e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data);
-extern s32 e1000_phy_hw_reset_generic(struct e1000_hw *hw);
-extern s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active);
-extern s32 e1000_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data);
-extern s32 e1000_phy_sw_reset(struct e1000_hw *hw);
-extern s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw);
-extern s32 e1000_get_cfg_done(struct e1000_hw *hw);
-extern s32 e1000_get_cable_length_m88(struct e1000_hw *hw);
-extern s32 e1000_get_phy_info_m88(struct e1000_hw *hw);
-extern s32 e1000_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data);
-extern s32 e1000_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data);
-extern enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id);
-extern void e1000_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl);
-extern s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
-extern s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
-extern s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
+extern void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
+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 s32 e1000e_get_hw_semaphore(struct e1000_hw *hw);
+extern s32 e1000e_valid_led_default(struct e1000_hw *hw, u16 *data);
+extern void e1000e_config_collision_dist(struct e1000_hw *hw);
+extern s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw);
+extern s32 e1000e_force_mac_fc(struct e1000_hw *hw);
+extern s32 e1000e_blink_led(struct e1000_hw *hw);
+extern void e1000e_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);
+extern void e1000e_reset_adaptive(struct e1000_hw *hw);
+extern void e1000e_update_adaptive(struct e1000_hw *hw);
+
+extern s32 e1000e_setup_copper_link(struct e1000_hw *hw);
+extern s32 e1000e_get_phy_id(struct e1000_hw *hw);
+extern void e1000e_put_hw_semaphore(struct e1000_hw *hw);
+extern s32 e1000e_check_reset_block_generic(struct e1000_hw *hw);
+extern s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw);
+extern s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw);
+extern s32 e1000e_get_phy_info_igp(struct e1000_hw *hw);
+extern s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data);
+extern s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw);
+extern s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active);
+extern s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data);
+extern s32 e1000e_phy_sw_reset(struct e1000_hw *hw);
+extern s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw);
+extern s32 e1000e_get_cfg_done(struct e1000_hw *hw);
+extern s32 e1000e_get_cable_length_m88(struct e1000_hw *hw);
+extern s32 e1000e_get_phy_info_m88(struct e1000_hw *hw);
+extern s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data);
+extern s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data);
+extern enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id);
+extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl);
+extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
+extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
+extern s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
u32 usec_interval, bool *success);
-extern s32 e1000_phy_reset_dsp(struct e1000_hw *hw);
-extern s32 e1000_check_downshift(struct e1000_hw *hw);
+extern s32 e1000e_phy_reset_dsp(struct e1000_hw *hw);
+extern s32 e1000e_check_downshift(struct e1000_hw *hw);
static inline s32 e1000_phy_hw_reset(struct e1000_hw *hw)
{
@@ -464,23 +464,23 @@ static inline s32 e1000_get_cable_length(struct e1000_hw *hw)
return hw->phy.ops.get_cable_length(hw);
}
-extern s32 e1000_acquire_nvm(struct e1000_hw *hw);
-extern s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
-extern s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw);
-extern s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg);
-extern s32 e1000_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
-extern s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
-extern s32 e1000_validate_nvm_checksum_generic(struct e1000_hw *hw);
-extern void e1000_release_nvm(struct e1000_hw *hw);
-extern void e1000_reload_nvm(struct e1000_hw *hw);
-extern s32 e1000_read_mac_addr(struct e1000_hw *hw);
+extern s32 e1000e_acquire_nvm(struct e1000_hw *hw);
+extern s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
+extern s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw);
+extern s32 e1000e_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg);
+extern s32 e1000e_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
+extern s32 e1000e_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
+extern s32 e1000e_validate_nvm_checksum_generic(struct e1000_hw *hw);
+extern void e1000e_release_nvm(struct e1000_hw *hw);
+extern void e1000e_reload_nvm(struct e1000_hw *hw);
+extern s32 e1000e_read_mac_addr(struct e1000_hw *hw);
static inline s32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
{
return hw->nvm.ops.validate_nvm(hw);
}
-static inline s32 e1000_update_nvm_checksum(struct e1000_hw *hw)
+static inline s32 e1000e_update_nvm_checksum(struct e1000_hw *hw)
{
return hw->nvm.ops.update_nvm(hw);
}
@@ -500,9 +500,9 @@ static inline s32 e1000_get_phy_info(struct e1000_hw *hw)
return hw->phy.ops.get_phy_info(hw);
}
-extern bool e1000_check_mng_mode(struct e1000_hw *hw);
-extern bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);
-extern s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length);
+extern bool e1000e_check_mng_mode(struct e1000_hw *hw);
+extern bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw);
+extern s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length);
static inline u32 __er32(struct e1000_hw *hw, unsigned long reg)
{
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index 8100d03..88657ad 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -129,7 +129,7 @@ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw)
phy->type = e1000_phy_gg82563;
/* This can only be done after all function pointers are setup. */
- ret_val = e1000_get_phy_id(hw);
+ ret_val = e1000e_get_phy_id(hw);
/* Verify phy id */
if (phy->id != GG82563_E_PHY_ID)
@@ -215,15 +215,15 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)
switch (hw->media_type) {
case e1000_media_type_copper:
func->setup_physical_interface = e1000_setup_copper_link_80003es2lan;
- func->check_for_link = e1000_check_for_copper_link;
+ func->check_for_link = e1000e_check_for_copper_link;
break;
case e1000_media_type_fiber:
- func->setup_physical_interface = e1000_setup_fiber_serdes_link;
- func->check_for_link = e1000_check_for_fiber_link;
+ func->setup_physical_interface = e1000e_setup_fiber_serdes_link;
+ func->check_for_link = e1000e_check_for_fiber_link;
break;
case e1000_media_type_internal_serdes:
- func->setup_physical_interface = e1000_setup_fiber_serdes_link;
- func->check_for_link = e1000_check_for_serdes_link;
+ func->setup_physical_interface = e1000e_setup_fiber_serdes_link;
+ func->check_for_link = e1000e_check_for_serdes_link;
break;
default:
return -E1000_ERR_CONFIG;
@@ -299,7 +299,7 @@ static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw)
if (ret_val)
return ret_val;
- ret_val = e1000_acquire_nvm(hw);
+ ret_val = e1000e_acquire_nvm(hw);
if (ret_val)
e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM);
@@ -316,7 +316,7 @@ static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw)
**/
static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw)
{
- e1000_release_nvm(hw);
+ e1000e_release_nvm(hw);
e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM);
}
@@ -337,7 +337,7 @@ static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
s32 timeout = 200;
while (i < timeout) {
- if (e1000_get_hw_semaphore(hw))
+ if (e1000e_get_hw_semaphore(hw))
return -E1000_ERR_SWFW_SYNC;
swfw_sync = er32(SW_FW_SYNC);
@@ -346,7 +346,7 @@ static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
/* Firmware currently using resource (fwmask)
* or other software thread using resource (swmask) */
- e1000_put_hw_semaphore(hw);
+ e1000e_put_hw_semaphore(hw);
mdelay(5);
i++;
}
@@ -360,7 +360,7 @@ static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
swfw_sync |= swmask;
ew32(SW_FW_SYNC, swfw_sync);
- e1000_put_hw_semaphore(hw);
+ e1000e_put_hw_semaphore(hw);
return 0;
}
@@ -377,14 +377,14 @@ static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
{
u32 swfw_sync;
- while (e1000_get_hw_semaphore(hw) != 0);
+ while (e1000e_get_hw_semaphore(hw) != 0);
/* Empty */
swfw_sync = er32(SW_FW_SYNC);
swfw_sync &= ~mask;
ew32(SW_FW_SYNC, swfw_sync);
- e1000_put_hw_semaphore(hw);
+ e1000e_put_hw_semaphore(hw);
}
/**
@@ -413,7 +413,7 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
page_select = GG82563_PHY_PAGE_SELECT_ALT;
temp = (u16)((u16)offset >> GG82563_PAGE_SHIFT);
- ret_val = e1000_write_phy_reg_m88(hw, page_select, temp);
+ ret_val = e1000e_write_phy_reg_m88(hw, page_select, temp);
if (ret_val)
return ret_val;
@@ -424,7 +424,7 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
udelay(200);
/* ...and verify the command was successful. */
- ret_val = e1000_read_phy_reg_m88(hw, page_select, &temp);
+ ret_val = e1000e_read_phy_reg_m88(hw, page_select, &temp);
if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) {
ret_val = -E1000_ERR_PHY;
@@ -433,7 +433,7 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
udelay(200);
- ret_val = e1000_read_phy_reg_m88(hw,
+ ret_val = e1000e_read_phy_reg_m88(hw,
MAX_PHY_REG_ADDRESS & offset,
data);
@@ -468,7 +468,7 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
page_select = GG82563_PHY_PAGE_SELECT_ALT;
temp = (u16)((u16)offset >> GG82563_PAGE_SHIFT);
- ret_val = e1000_write_phy_reg_m88(hw, page_select, temp);
+ ret_val = e1000e_write_phy_reg_m88(hw, page_select, temp);
if (ret_val)
return ret_val;
@@ -480,14 +480,14 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
udelay(200);
/* ...and verify the command was successful. */
- ret_val = e1000_read_phy_reg_m88(hw, page_select, &temp);
+ ret_val = e1000e_read_phy_reg_m88(hw, page_select, &temp);
if (((u16)offset >> GG82563_PAGE_SHIFT) != temp)
return -E1000_ERR_PHY;
udelay(200);
- ret_val = e1000_write_phy_reg_m88(hw,
+ ret_val = e1000e_write_phy_reg_m88(hw,
MAX_PHY_REG_ADDRESS & offset,
data);
@@ -509,7 +509,7 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset,
u16 words, u16 *data)
{
- return e1000_write_nvm_spi(hw, offset, words, data);
+ return e1000e_write_nvm_spi(hw, offset, words, data);
}
/**
@@ -572,7 +572,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
if (ret_val)
return ret_val;
- e1000_phy_force_speed_duplex_setup(hw, &phy_data);
+ e1000e_phy_force_speed_duplex_setup(hw, &phy_data);
/* Reset the phy to commit changes. */
phy_data |= MII_CR_RESET;
@@ -587,7 +587,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
hw_dbg(hw, "Waiting for forced speed/duplex link "
"on GG82563 phy.\n");
- ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
+ ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
100000, &link);
if (ret_val)
return ret_val;
@@ -596,13 +596,13 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
/* We didn't get link.
* Reset the DSP and cross our fingers.
*/
- ret_val = e1000_phy_reset_dsp(hw);
+ ret_val = e1000e_phy_reset_dsp(hw);
if (ret_val)
return ret_val;
}
/* Try once more */
- ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
+ ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
100000, &link);
if (ret_val)
return ret_val;
@@ -672,7 +672,7 @@ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
s32 ret_val;
if (hw->media_type == e1000_media_type_copper) {
- ret_val = e1000_get_speed_and_duplex_copper(hw,
+ ret_val = e1000e_get_speed_and_duplex_copper(hw,
speed,
duplex);
if (ret_val)
@@ -683,7 +683,7 @@ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
ret_val = e1000_cfg_kmrn_10_100_80003es2lan(hw,
*duplex);
} else {
- ret_val = e1000_get_speed_and_duplex_fiber_serdes(hw,
+ ret_val = e1000e_get_speed_and_duplex_fiber_serdes(hw,
speed,
duplex);
}
@@ -707,7 +707,7 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
/* Prevent the PCI-E bus from sticking if there is no TLP connection
* on the last TLP read/write transaction when MAC is reset.
*/
- ret_val = e1000_disable_pcie_master(hw);
+ ret_val = e1000e_disable_pcie_master(hw);
if (ret_val)
hw_dbg(hw, "PCI-E Master disable polling has failed.\n");
@@ -725,7 +725,7 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
hw_dbg(hw, "Issuing a global reset to MAC\n");
ew32(CTRL, ctrl | E1000_CTRL_RST);
- ret_val = e1000_get_auto_rd_done(hw);
+ ret_val = e1000e_get_auto_rd_done(hw);
if (ret_val)
/* We don't want to continue accessing MAC registers. */
return ret_val;
@@ -754,7 +754,7 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
e1000_initialize_hw_bits_80003es2lan(hw);
/* Initialize identification LED */
- ret_val = e1000_id_led_init(hw);
+ ret_val = e1000e_id_led_init(hw);
if (ret_val) {
hw_dbg(hw, "Error initializing identification LED\n");
return ret_val;
@@ -762,10 +762,10 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
/* Disabling VLAN filtering */
hw_dbg(hw, "Initializing the IEEE VLAN\n");
- e1000_clear_vfta(hw);
+ e1000e_clear_vfta(hw);
/* Setup the receive address. */
- e1000_init_rx_addrs(hw, mac->rar_entry_count);
+ e1000e_init_rx_addrs(hw, mac->rar_entry_count);
/* Zero out the Multicast HASH table */
hw_dbg(hw, "Zeroing the MTA\n");
@@ -773,7 +773,7 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
/* Setup link and flow control */
- ret_val = e1000_setup_link(hw);
+ ret_val = e1000e_setup_link(hw);
/* Set the transmit descriptor write-back policy */
reg_data = er32(TXDCTL);
@@ -922,14 +922,14 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
return ret_val;
/* SW Reset the PHY so all changes take effect */
- ret_val = e1000_commit_phy(hw);
+ ret_val = e1000e_commit_phy(hw);
if (ret_val) {
hw_dbg(hw, "Error Resetting the PHY\n");
return ret_val;
}
/* Bypass RX and TX FIFO's */
- ret_val = e1000_write_kmrn_reg(hw,
+ ret_val = e1000e_write_kmrn_reg(hw,
E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL,
E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS |
E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS);
@@ -957,7 +957,7 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
* firmware will have already initialized them. We only initialize
* them if the HW is not in IAMT mode.
*/
- if (!e1000_check_mng_mode(hw)) {
+ if (!e1000e_check_mng_mode(hw)) {
/* Enable Electrical Idle on the PHY */
data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE;
ret_val = e1e_wphy(hw, GG82563_PHY_PWR_MGMT_CTRL, data);
@@ -1010,23 +1010,23 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw)
/* Set the mac to wait the maximum time between each
* iteration and increase the max iterations when
* polling the phy; this fixes erroneous timeouts at 10Mbps. */
- ret_val = e1000_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF);
+ ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF);
if (ret_val)
return ret_val;
- ret_val = e1000_read_kmrn_reg(hw, GG82563_REG(0x34, 9), ®_data);
+ ret_val = e1000e_read_kmrn_reg(hw, GG82563_REG(0x34, 9), ®_data);
if (ret_val)
return ret_val;
reg_data |= 0x3F;
- ret_val = e1000_write_kmrn_reg(hw, GG82563_REG(0x34, 9), reg_data);
+ ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 9), reg_data);
if (ret_val)
return ret_val;
- ret_val = e1000_read_kmrn_reg(hw,
+ ret_val = e1000e_read_kmrn_reg(hw,
E1000_KMRNCTRLSTA_OFFSET_INB_CTRL,
®_data);
if (ret_val)
return ret_val;
reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING;
- ret_val = e1000_write_kmrn_reg(hw,
+ ret_val = e1000e_write_kmrn_reg(hw,
E1000_KMRNCTRLSTA_OFFSET_INB_CTRL,
reg_data);
if (ret_val)
@@ -1036,7 +1036,7 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw)
if (ret_val)
return ret_val;
- ret_val = e1000_setup_copper_link(hw);
+ ret_val = e1000e_setup_copper_link(hw);
return 0;
}
@@ -1056,7 +1056,7 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex)
u16 reg_data;
reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT;
- ret_val = e1000_write_kmrn_reg(hw,
+ ret_val = e1000e_write_kmrn_reg(hw,
E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
reg_data);
if (ret_val)
@@ -1096,7 +1096,7 @@ static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw)
u32 tipg;
reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT;
- ret_val = e1000_write_kmrn_reg(hw,
+ ret_val = e1000e_write_kmrn_reg(hw,
E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
reg_data);
if (ret_val)
@@ -1128,7 +1128,7 @@ static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw)
{
u32 temp;
- e1000_clear_hw_cntrs_base(hw);
+ e1000e_clear_hw_cntrs_base(hw);
temp = er32(PRC64);
temp = er32(PRC127);
@@ -1169,42 +1169,42 @@ static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw)
static struct e1000_mac_operations es2_mac_ops = {
.mng_mode_enab = E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT,
/* check_for_link dependent on media type */
- .cleanup_led = e1000_cleanup_led_generic,
+ .cleanup_led = e1000e_cleanup_led_generic,
.clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan,
- .get_bus_info = e1000_get_bus_info_pcie,
+ .get_bus_info = e1000e_get_bus_info_pcie,
.get_link_up_info = e1000_get_link_up_info_80003es2lan,
- .led_on = e1000_led_on_generic,
- .led_off = e1000_led_off_generic,
- .mc_addr_list_update = e1000_mc_addr_list_update_generic,
+ .led_on = e1000e_led_on_generic,
+ .led_off = e1000e_led_off_generic,
+ .mc_addr_list_update = e1000e_mc_addr_list_update_generic,
.reset_hw = e1000_reset_hw_80003es2lan,
.init_hw = e1000_init_hw_80003es2lan,
- .setup_link = e1000_setup_link,
+ .setup_link = e1000e_setup_link,
/* setup_physical_interface dependent on media type */
};
static struct e1000_phy_operations es2_phy_ops = {
.acquire_phy = e1000_acquire_phy_80003es2lan,
- .check_reset_block = e1000_check_reset_block_generic,
- .commit_phy = e1000_phy_sw_reset,
+ .check_reset_block = e1000e_check_reset_block_generic,
+ .commit_phy = e1000e_phy_sw_reset,
.force_speed_duplex = e1000_phy_force_speed_duplex_80003es2lan,
.get_cfg_done = e1000_get_cfg_done_80003es2lan,
.get_cable_length = e1000_get_cable_length_80003es2lan,
- .get_phy_info = e1000_get_phy_info_m88,
+ .get_phy_info = e1000e_get_phy_info_m88,
.read_phy_reg = e1000_read_phy_reg_gg82563_80003es2lan,
.release_phy = e1000_release_phy_80003es2lan,
- .reset_phy = e1000_phy_hw_reset_generic,
+ .reset_phy = e1000e_phy_hw_reset_generic,
.set_d0_lplu_state = NULL,
- .set_d3_lplu_state = e1000_set_d3_lplu_state,
+ .set_d3_lplu_state = e1000e_set_d3_lplu_state,
.write_phy_reg = e1000_write_phy_reg_gg82563_80003es2lan,
};
static struct e1000_nvm_operations es2_nvm_ops = {
.acquire_nvm = e1000_acquire_nvm_80003es2lan,
- .read_nvm = e1000_read_nvm_eerd,
+ .read_nvm = e1000e_read_nvm_eerd,
.release_nvm = e1000_release_nvm_80003es2lan,
- .update_nvm = e1000_update_nvm_checksum_generic,
- .valid_led_default = e1000_valid_led_default,
- .validate_nvm = e1000_validate_nvm_checksum_generic,
+ .update_nvm = e1000e_update_nvm_checksum_generic,
+ .valid_led_default = e1000e_valid_led_default,
+ .validate_nvm = e1000e_validate_nvm_checksum_generic,
.write_nvm = e1000_write_nvm_80003es2lan,
};
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index a8fa1db..c9d74a8 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -246,10 +246,10 @@ static int e1000_set_settings(struct net_device *netdev,
/* reset the link */
if (netif_running(adapter->netdev)) {
- e1000_down(adapter);
- e1000_up(adapter);
+ e1000e_down(adapter);
+ e1000e_up(adapter);
} else {
- e1000_reset(adapter);
+ e1000e_reset(adapter);
}
clear_bit(__E1000_RESETTING, &adapter->state);
@@ -300,14 +300,14 @@ static int e1000_set_pauseparam(struct net_device *netdev,
if (adapter->fc_autoneg == AUTONEG_ENABLE) {
if (netif_running(adapter->netdev)) {
- e1000_down(adapter);
- e1000_up(adapter);
+ e1000e_down(adapter);
+ e1000e_up(adapter);
} else {
- e1000_reset(adapter);
+ e1000e_reset(adapter);
}
} else {
retval = ((hw->media_type == e1000_media_type_fiber) ?
- hw->mac.ops.setup_link(hw) : e1000_force_mac_fc(hw));
+ hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw));
}
clear_bit(__E1000_RESETTING, &adapter->state);
@@ -330,9 +330,9 @@ static int e1000_set_rx_csum(struct net_device *netdev, u32 data)
adapter->flags &= ~FLAG_RX_CSUM_ENABLED;
if (netif_running(netdev))
- e1000_reinit_locked(adapter);
+ e1000e_reinit_locked(adapter);
else
- e1000_reset(adapter);
+ e1000e_reset(adapter);
return 0;
}
@@ -549,7 +549,7 @@ static int e1000_set_eeprom(struct net_device *netdev,
* and flush shadow RAM for 82573 controllers */
if ((ret_val == 0) && ((first_word <= NVM_CHECKSUM_REG) ||
(hw->mac.type == e1000_82573)))
- e1000_update_nvm_checksum(hw);
+ e1000e_update_nvm_checksum(hw);
kfree(eeprom_buff);
return ret_val;
@@ -562,8 +562,8 @@ static void e1000_get_drvinfo(struct net_device *netdev,
char firmware_version[32];
u16 eeprom_data;
- strncpy(drvinfo->driver, e1000_driver_name, 32);
- strncpy(drvinfo->version, e1000_driver_version, 32);
+ strncpy(drvinfo->driver, e1000e_driver_name, 32);
+ strncpy(drvinfo->version, e1000e_driver_version, 32);
/* EEPROM image version # is reported as firmware version # for
* PCI-E controllers */
@@ -613,7 +613,7 @@ static int e1000_set_ringparam(struct net_device *netdev,
msleep(1);
if (netif_running(adapter->netdev))
- e1000_down(adapter);
+ e1000e_down(adapter);
tx_old = adapter->tx_ring;
rx_old = adapter->rx_ring;
@@ -640,10 +640,10 @@ static int e1000_set_ringparam(struct net_device *netdev,
if (netif_running(adapter->netdev)) {
/* Try to get new resources before deleting old */
- err = e1000_setup_rx_resources(adapter);
+ err = e1000e_setup_rx_resources(adapter);
if (err)
goto err_setup_rx;
- err = e1000_setup_tx_resources(adapter);
+ err = e1000e_setup_tx_resources(adapter);
if (err)
goto err_setup_tx;
@@ -651,13 +651,13 @@ static int e1000_set_ringparam(struct net_device *netdev,
* then restore the new back again */
adapter->rx_ring = rx_old;
adapter->tx_ring = tx_old;
- e1000_free_rx_resources(adapter);
- e1000_free_tx_resources(adapter);
+ e1000e_free_rx_resources(adapter);
+ e1000e_free_tx_resources(adapter);
kfree(tx_old);
kfree(rx_old);
adapter->rx_ring = rx_ring;
adapter->tx_ring = tx_ring;
- err = e1000_up(adapter);
+ err = e1000e_up(adapter);
if (err)
goto err_setup;
}
@@ -665,7 +665,7 @@ static int e1000_set_ringparam(struct net_device *netdev,
clear_bit(__E1000_RESETTING, &adapter->state);
return 0;
err_setup_tx:
- e1000_free_rx_resources(adapter);
+ e1000e_free_rx_resources(adapter);
err_setup_rx:
adapter->rx_ring = rx_old;
adapter->tx_ring = tx_old;
@@ -673,7 +673,7 @@ err_setup_rx:
err_alloc_rx:
kfree(tx_ring);
err_alloc_tx:
- e1000_up(adapter);
+ e1000e_up(adapter);
err_setup:
clear_bit(__E1000_RESETTING, &adapter->state);
return err;
@@ -1326,7 +1326,7 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
if (phy_reg & MII_CR_LOOPBACK) {
phy_reg &= ~MII_CR_LOOPBACK;
e1e_wphy(hw, PHY_CONTROL, phy_reg);
- e1000_commit_phy(hw);
+ e1000e_commit_phy(hw);
}
break;
}
@@ -1517,22 +1517,22 @@ static void e1000_diag_test(struct net_device *netdev,
/* indicate we're in test mode */
dev_close(netdev);
else
- e1000_reset(adapter);
+ e1000e_reset(adapter);
if (e1000_reg_test(adapter, &data[0]))
eth_test->flags |= ETH_TEST_FL_FAILED;
- e1000_reset(adapter);
+ e1000e_reset(adapter);
if (e1000_eeprom_test(adapter, &data[1]))
eth_test->flags |= ETH_TEST_FL_FAILED;
- e1000_reset(adapter);
+ e1000e_reset(adapter);
if (e1000_intr_test(adapter, &data[2]))
eth_test->flags |= ETH_TEST_FL_FAILED;
- e1000_reset(adapter);
+ e1000e_reset(adapter);
/* make sure the phy is powered up */
- e1000_power_up_phy(adapter);
+ e1000e_power_up_phy(adapter);
if (e1000_loopback_test(adapter, &data[3]))
eth_test->flags |= ETH_TEST_FL_FAILED;
@@ -1543,7 +1543,7 @@ static void e1000_diag_test(struct net_device *netdev,
/* force this routine to wait until autoneg complete/timeout */
adapter->hw.phy.wait_for_link = 1;
- e1000_reset(adapter);
+ e1000e_reset(adapter);
adapter->hw.phy.wait_for_link = 0;
clear_bit(__E1000_TESTING, &adapter->state);
@@ -1663,7 +1663,7 @@ static int e1000_phys_id(struct net_device *netdev, u32 data)
e1e_wphy(&adapter->hw,
IFE_PHY_SPECIAL_CONTROL_LED, 0);
} else {
- e1000_blink_led(&adapter->hw);
+ e1000e_blink_led(&adapter->hw);
msleep_interruptible(data * 1000);
}
@@ -1678,7 +1678,7 @@ static int e1000_nway_reset(struct net_device *netdev)
{
struct e1000_adapter *adapter = netdev_priv(netdev);
if (netif_running(netdev))
- e1000_reinit_locked(adapter);
+ e1000e_reinit_locked(adapter);
return 0;
}
@@ -1694,7 +1694,7 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
struct e1000_adapter *adapter = netdev_priv(netdev);
int i;
- e1000_update_stats(adapter);
+ e1000e_update_stats(adapter);
for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
char *p = (char *)adapter+e1000_gstrings_stats[i].stat_offset;
data[i] = (e1000_gstrings_stats[i].sizeof_stat ==
@@ -1758,7 +1758,7 @@ static const struct ethtool_ops e1000_ethtool_ops = {
.get_ethtool_stats = e1000_get_ethtool_stats,
};
-void e1000_set_ethtool_ops(struct net_device *netdev)
+void e1000e_set_ethtool_ops(struct net_device *netdev)
{
SET_ETHTOOL_OPS(netdev, &e1000_ethtool_ops);
}
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 85095af..8f8139d 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -199,10 +199,10 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
phy->reset_delay_us = 100;
phy->id = 0;
- while ((e1000_phy_unknown == e1000_get_phy_type_from_id(phy->id)) &&
+ while ((e1000_phy_unknown == e1000e_get_phy_type_from_id(phy->id)) &&
(i++ < 100)) {
msleep(1);
- ret_val = e1000_get_phy_id(hw);
+ ret_val = e1000e_get_phy_id(hw);
if (ret_val)
return ret_val;
}
@@ -308,7 +308,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
/* Enable PCS Lock-loss workaround for ICH8 */
if (mac->type == e1000_ich8lan)
- e1000_set_kmrn_lock_loss_workaround_ich8lan(hw, 1);
+ e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, 1);
return 0;
}
@@ -420,7 +420,7 @@ static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw)
bool link;
if (phy->type != e1000_phy_ife) {
- ret_val = e1000_phy_force_speed_duplex_igp(hw);
+ ret_val = e1000e_phy_force_speed_duplex_igp(hw);
return ret_val;
}
@@ -428,7 +428,7 @@ static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw)
if (ret_val)
return ret_val;
- e1000_phy_force_speed_duplex_setup(hw, &data);
+ e1000e_phy_force_speed_duplex_setup(hw, &data);
ret_val = e1e_wphy(hw, PHY_CONTROL, data);
if (ret_val)
@@ -453,7 +453,7 @@ static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw)
if (phy->wait_for_link) {
hw_dbg(hw, "Waiting for forced speed/duplex link on IFE phy.\n");
- ret_val = e1000_phy_has_link_generic(hw,
+ ret_val = e1000e_phy_has_link_generic(hw,
PHY_FORCE_LIMIT,
100000,
&link);
@@ -464,7 +464,7 @@ static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw)
hw_dbg(hw, "Link taking longer than expected.\n");
/* Try once more */
- ret_val = e1000_phy_has_link_generic(hw,
+ ret_val = e1000e_phy_has_link_generic(hw,
PHY_FORCE_LIMIT,
100000,
&link);
@@ -492,7 +492,7 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
u16 loop = E1000_ICH8_LAN_INIT_TIMEOUT;
u16 word_addr, reg_data, reg_addr, phy_page = 0;
- ret_val = e1000_phy_hw_reset_generic(hw);
+ ret_val = e1000e_phy_hw_reset_generic(hw);
if (ret_val)
return ret_val;
@@ -604,7 +604,7 @@ static s32 e1000_get_phy_info_ife_ich8lan(struct e1000_hw *hw)
u16 data;
bool link;
- ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
+ ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
if (ret_val)
return ret_val;
@@ -658,7 +658,7 @@ static s32 e1000_get_phy_info_ich8lan(struct e1000_hw *hw)
return e1000_get_phy_info_ife_ich8lan(hw);
break;
case e1000_phy_igp_3:
- return e1000_get_phy_info_igp(hw);
+ return e1000e_get_phy_info_igp(hw);
break;
default:
break;
@@ -735,7 +735,7 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
* any PHY registers */
if ((hw->mac.type == e1000_ich8lan) &&
(hw->phy.type == e1000_phy_igp_3))
- e1000_gig_downshift_workaround_ich8lan(hw);
+ e1000e_gig_downshift_workaround_ich8lan(hw);
/* When LPLU is enabled, we should disable SmartSpeed */
ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data);
@@ -845,7 +845,7 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
* any PHY registers */
if ((hw->mac.type == e1000_ich8lan) &&
(hw->phy.type == e1000_phy_igp_3))
- e1000_gig_downshift_workaround_ich8lan(hw);
+ e1000e_gig_downshift_workaround_ich8lan(hw);
/* When LPLU is enabled, we should disable SmartSpeed */
ret_val = e1e_rphy(hw,
@@ -1166,7 +1166,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
s32 ret_val;
u16 data;
- ret_val = e1000_update_nvm_checksum_generic(hw);
+ ret_val = e1000e_update_nvm_checksum_generic(hw);
if (ret_val)
return ret_val;;
@@ -1275,7 +1275,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
/* Reload the EEPROM, or else modifications will not appear
* until after the next adapter reset.
*/
- e1000_reload_nvm(hw);
+ e1000e_reload_nvm(hw);
msleep(10);
return ret_val;
@@ -1308,12 +1308,12 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)
ret_val = e1000_write_nvm(hw, 0x19, 1, &data);
if (ret_val)
return ret_val;
- ret_val = e1000_update_nvm_checksum(hw);
+ ret_val = e1000e_update_nvm_checksum(hw);
if (ret_val)
return ret_val;
}
- return e1000_validate_nvm_checksum_generic(hw);
+ return e1000e_validate_nvm_checksum_generic(hw);
}
/**
@@ -1583,7 +1583,7 @@ static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw)
struct e1000_bus_info *bus = &hw->bus;
s32 ret_val;
- ret_val = e1000_get_bus_info_pcie(hw);
+ ret_val = e1000e_get_bus_info_pcie(hw);
/* ICH devices are "PCI Express"-ish. They have
* a configuration space, but do not contain
@@ -1611,7 +1611,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
/* Prevent the PCI-E bus from sticking if there is no TLP connection
* on the last TLP read/write transaction when MAC is reset.
*/
- ret_val = e1000_disable_pcie_master(hw);
+ ret_val = e1000e_disable_pcie_master(hw);
if (ret_val) {
hw_dbg(hw, "PCI-E Master disable polling has failed.\n");
}
@@ -1651,7 +1651,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
ew32(CTRL, (ctrl | E1000_CTRL_RST));
msleep(20);
- ret_val = e1000_get_auto_rd_done(hw);
+ ret_val = e1000e_get_auto_rd_done(hw);
if (ret_val) {
/*
* When auto config read does not complete, do not
@@ -1693,14 +1693,14 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
e1000_initialize_hw_bits_ich8lan(hw);
/* Initialize identification LED */
- ret_val = e1000_id_led_init(hw);
+ ret_val = e1000e_id_led_init(hw);
if (ret_val) {
hw_dbg(hw, "Error initializing identification LED\n");
return ret_val;
}
/* Setup the receive address. */
- e1000_init_rx_addrs(hw, mac->rar_entry_count);
+ e1000e_init_rx_addrs(hw, mac->rar_entry_count);
/* Zero out the Multicast HASH table */
hw_dbg(hw, "Zeroing the MTA\n");
@@ -1730,7 +1730,7 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
snoop = PCIE_ICH8_SNOOP_ALL;
else
snoop = (u32) ~(PCIE_NO_SNOOP_ALL);
- e1000_set_pcie_no_snoop(hw, snoop);
+ e1000e_set_pcie_no_snoop(hw, snoop);
ctrl_ext = er32(CTRL_EXT);
ctrl_ext |= E1000_CTRL_EXT_RO_DIS;
@@ -1831,7 +1831,7 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
ew32(FCTTV, mac->fc_pause_time);
- return e1000_set_fc_watermarks(hw);
+ return e1000e_set_fc_watermarks(hw);
}
/**
@@ -1856,24 +1856,24 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw)
/* Set the mac to wait the maximum time between each iteration
* and increase the max iterations when polling the phy;
* this fixes erroneous timeouts at 10Mbps. */
- ret_val = e1000_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF);
+ ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF);
if (ret_val)
return ret_val;
- ret_val = e1000_read_kmrn_reg(hw, GG82563_REG(0x34, 9), ®_data);
+ ret_val = e1000e_read_kmrn_reg(hw, GG82563_REG(0x34, 9), ®_data);
if (ret_val)
return ret_val;
reg_data |= 0x3F;
- ret_val = e1000_write_kmrn_reg(hw, GG82563_REG(0x34, 9), reg_data);
+ ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 9), reg_data);
if (ret_val)
return ret_val;
if (hw->phy.type == e1000_phy_igp_3) {
- ret_val = e1000_copper_link_setup_igp(hw);
+ ret_val = e1000e_copper_link_setup_igp(hw);
if (ret_val)
return ret_val;
}
- return e1000_setup_copper_link(hw);
+ return e1000e_setup_copper_link(hw);
}
/**
@@ -1891,7 +1891,7 @@ static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed,
{
s32 ret_val;
- ret_val = e1000_get_speed_and_duplex_copper(hw, speed, duplex);
+ ret_val = e1000e_get_speed_and_duplex_copper(hw, speed, duplex);
if (ret_val)
return ret_val;
@@ -1933,7 +1933,7 @@ static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw)
/* Make sure link is up before proceeding. If not just return.
* Attempting this while link is negotiating fouled up link
* stability */
- ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
+ ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
if (!link)
return 0;
@@ -1963,7 +1963,7 @@ static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw)
/* Call gig speed drop workaround on Giga disable before accessing
* any PHY registers */
- e1000_gig_downshift_workaround_ich8lan(hw);
+ e1000e_gig_downshift_workaround_ich8lan(hw);
/* unable to acquire PCS lock */
return -E1000_ERR_PHY;
@@ -1977,7 +1977,7 @@ static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw)
* If ICH8, set the current Kumeran workaround state (enabled - TRUE
* /disabled - FALSE).
**/
-void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
+void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
bool state)
{
struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
@@ -2000,7 +2000,7 @@ void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
* 3) read it back
* Continue if successful, else issue LCD reset and repeat
**/
-void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw)
+void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw)
{
u32 reg;
u16 data;
@@ -2020,7 +2020,7 @@ void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw)
/* Call gig speed drop workaround on Giga disable before
* accessing any PHY registers */
if (hw->mac.type == e1000_ich8lan)
- e1000_gig_downshift_workaround_ich8lan(hw);
+ e1000e_gig_downshift_workaround_ich8lan(hw);
/* Write VR power-down enable */
e1e_rphy(hw, IGP3_VR_CTRL, &data);
@@ -2041,7 +2041,7 @@ void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw)
}
/**
- * e1000_gig_downshift_workaround_ich8lan - WoL from S5 stops working
+ * e1000e_gig_downshift_workaround_ich8lan - WoL from S5 stops working
* @hw: pointer to the HW structure
*
* Steps to take when dropping from 1Gb/s (eg. link cable removal (LSC),
@@ -2050,7 +2050,7 @@ void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw)
* 2) Clear Kumeran Near-end loopback
* Should only be called for ICH8[m] devices with IGP_3 Phy.
**/
-void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw)
+void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw)
{
s32 ret_val;
u16 reg_data;
@@ -2059,17 +2059,17 @@ void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw)
(hw->phy.type != e1000_phy_igp_3))
return;
- ret_val = e1000_read_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
+ ret_val = e1000e_read_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
®_data);
if (ret_val)
return;
reg_data |= E1000_KMRNCTRLSTA_DIAG_NELPBK;
- ret_val = e1000_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
+ ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
reg_data);
if (ret_val)
return;
reg_data &= ~E1000_KMRNCTRLSTA_DIAG_NELPBK;
- ret_val = e1000_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
+ ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
reg_data);
}
@@ -2131,7 +2131,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
{
u32 temp;
- e1000_clear_hw_cntrs_base(hw);
+ e1000e_clear_hw_cntrs_base(hw);
temp = er32(ALGNERRC);
temp = er32(RXERRC);
@@ -2151,14 +2151,14 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
static struct e1000_mac_operations ich8_mac_ops = {
.mng_mode_enab = E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT,
- .check_for_link = e1000_check_for_copper_link,
+ .check_for_link = e1000e_check_for_copper_link,
.cleanup_led = e1000_cleanup_led_ich8lan,
.clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan,
.get_bus_info = e1000_get_bus_info_ich8lan,
.get_link_up_info = e1000_get_link_up_info_ich8lan,
.led_on = e1000_led_on_ich8lan,
.led_off = e1000_led_off_ich8lan,
- .mc_addr_list_update = e1000_mc_addr_list_update_generic,
+ .mc_addr_list_update = e1000e_mc_addr_list_update_generic,
.reset_hw = e1000_reset_hw_ich8lan,
.init_hw = e1000_init_hw_ich8lan,
.setup_link = e1000_setup_link_ich8lan,
@@ -2170,15 +2170,15 @@ static struct e1000_phy_operations ich8_phy_ops = {
.check_reset_block = e1000_check_reset_block_ich8lan,
.commit_phy = NULL,
.force_speed_duplex = e1000_phy_force_speed_duplex_ich8lan,
- .get_cfg_done = e1000_get_cfg_done,
- .get_cable_length = e1000_get_cable_length_igp_2,
+ .get_cfg_done = e1000e_get_cfg_done,
+ .get_cable_length = e1000e_get_cable_length_igp_2,
.get_phy_info = e1000_get_phy_info_ich8lan,
- .read_phy_reg = e1000_read_phy_reg_igp,
+ .read_phy_reg = e1000e_read_phy_reg_igp,
.release_phy = e1000_release_swflag_ich8lan,
.reset_phy = e1000_phy_hw_reset_ich8lan,
.set_d0_lplu_state = e1000_set_d0_lplu_state_ich8lan,
.set_d3_lplu_state = e1000_set_d3_lplu_state_ich8lan,
- .write_phy_reg = e1000_write_phy_reg_igp,
+ .write_phy_reg = e1000e_write_phy_reg_igp,
};
static struct e1000_nvm_operations ich8_nvm_ops = {
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index c92ea77..a04c1e4 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -47,14 +47,14 @@ enum e1000_mng_mode {
* Technology signature */
/**
- * e1000_get_bus_info_pcie - Get PCIe bus information
+ * e1000e_get_bus_info_pcie - Get PCIe bus information
* @hw: pointer to the HW structure
*
* Determines and stores the system bus information for a particular
* network interface. The following bus information is determined and stored:
* bus speed, bus width, type (PCIe), and PCIe function.
**/
-s32 e1000_get_bus_info_pcie(struct e1000_hw *hw)
+s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw)
{
struct e1000_bus_info *bus = &hw->bus;
struct e1000_adapter *adapter = hw->adapter;
@@ -87,7 +87,7 @@ s32 e1000_get_bus_info_pcie(struct e1000_hw *hw)
}
/**
- * e1000_write_vfta - Write value to VLAN filter table
+ * e1000e_write_vfta - Write value to VLAN filter table
* @hw: pointer to the HW structure
* @offset: register offset in VLAN filter table
* @value: register value written to VLAN filter table
@@ -95,14 +95,14 @@ s32 e1000_get_bus_info_pcie(struct e1000_hw *hw)
* Writes value at the given offset in the register array which stores
* the VLAN filter table.
**/
-void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
+void e1000e_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
{
E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, value);
e1e_flush();
}
/**
- * e1000_init_rx_addrs - Initialize receive address's
+ * e1000e_init_rx_addrs - Initialize receive address's
* @hw: pointer to the HW structure
* @rar_count: receive address registers
*
@@ -110,14 +110,14 @@ void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
* register to the devices MAC address and clearing all the other receive
* address registers to 0.
**/
-void e1000_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
+void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
{
u32 i;
/* Setup the receive address */
hw_dbg(hw, "Programming MAC Address into RAR[0]\n");
- e1000_rar_set(hw, hw->mac.addr, 0);
+ e1000e_rar_set(hw, hw->mac.addr, 0);
/* Zero out the other (rar_entry_count - 1) receive addresses */
hw_dbg(hw, "Clearing RAR[1-%u]\n", rar_count-1);
@@ -130,7 +130,7 @@ void e1000_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
}
/**
- * e1000_rar_set - Set receive address register
+ * e1000e_rar_set - Set receive address register
* @hw: pointer to the HW structure
* @addr: pointer to the receive address
* @index: receive address array register
@@ -138,7 +138,7 @@ void e1000_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
* Sets the receive address array register at index to the address passed
* in by addr.
**/
-void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
+void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
{
u32 rar_low, rar_high;
@@ -260,7 +260,7 @@ static u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
}
/**
- * e1000_mc_addr_list_update_generic - Update Multicast addresses
+ * e1000e_mc_addr_list_update_generic - Update Multicast addresses
* @hw: pointer to the HW structure
* @mc_addr_list: array of multicast addresses to program
* @mc_addr_count: number of multicast addresses to program
@@ -272,7 +272,7 @@ static u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
* The parameter rar_count will usually be hw->mac.rar_entry_count
* unless there are workarounds that change this.
**/
-void e1000_mc_addr_list_update_generic(struct e1000_hw *hw,
+void e1000e_mc_addr_list_update_generic(struct e1000_hw *hw,
u8 *mc_addr_list, u32 mc_addr_count,
u32 rar_used_count, u32 rar_count)
{
@@ -285,7 +285,7 @@ void e1000_mc_addr_list_update_generic(struct e1000_hw *hw,
*/
for (i = rar_used_count; i < rar_count; i++) {
if (mc_addr_count) {
- e1000_rar_set(hw, mc_addr_list, i);
+ e1000e_rar_set(hw, mc_addr_list, i);
mc_addr_count--;
mc_addr_list += ETH_ALEN;
} else {
@@ -313,12 +313,12 @@ void e1000_mc_addr_list_update_generic(struct e1000_hw *hw,
}
/**
- * e1000_clear_hw_cntrs_base - Clear base hardware counters
+ * e1000e_clear_hw_cntrs_base - Clear base hardware counters
* @hw: pointer to the HW structure
*
* Clears the base hardware counters by reading the counter registers.
**/
-void e1000_clear_hw_cntrs_base(struct e1000_hw *hw)
+void e1000e_clear_hw_cntrs_base(struct e1000_hw *hw)
{
u32 temp;
@@ -362,14 +362,14 @@ void e1000_clear_hw_cntrs_base(struct e1000_hw *hw)
}
/**
- * e1000_check_for_copper_link - Check for link (Copper)
+ * e1000e_check_for_copper_link - Check for link (Copper)
* @hw: pointer to the HW structure
*
* Checks to see of the link status of the hardware has changed. If a
* change in link status has been detected, then we read the PHY registers
* to get the current speed/duplex if link exists.
**/
-s32 e1000_check_for_copper_link(struct e1000_hw *hw)
+s32 e1000e_check_for_copper_link(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
s32 ret_val;
@@ -387,7 +387,7 @@ s32 e1000_check_for_copper_link(struct e1000_hw *hw)
* link. If so, then we want to get the current speed/duplex
* of the PHY.
*/
- ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
+ ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
if (ret_val)
return ret_val;
@@ -398,7 +398,7 @@ s32 e1000_check_for_copper_link(struct e1000_hw *hw)
/* Check if there was DownShift, must be checked
* immediately after link-up */
- e1000_check_downshift(hw);
+ e1000e_check_downshift(hw);
/* If we are forcing speed/duplex, then we simply return since
* we have already determined whether we have link or not.
@@ -412,14 +412,14 @@ s32 e1000_check_for_copper_link(struct e1000_hw *hw)
* of MAC speed/duplex configuration. So we only need to
* configure Collision Distance in the MAC.
*/
- e1000_config_collision_dist(hw);
+ e1000e_config_collision_dist(hw);
/* Configure Flow Control now that Auto-Neg has completed.
* First, we need to restore the desired flow control
* settings because we may have had to re-autoneg with a
* different link partner.
*/
- ret_val = e1000_config_fc_after_link_up(hw);
+ ret_val = e1000e_config_fc_after_link_up(hw);
if (ret_val) {
hw_dbg(hw, "Error configuring flow control\n");
}
@@ -428,13 +428,13 @@ s32 e1000_check_for_copper_link(struct e1000_hw *hw)
}
/**
- * e1000_check_for_fiber_link - Check for link (Fiber)
+ * e1000e_check_for_fiber_link - Check for link (Fiber)
* @hw: pointer to the HW structure
*
* Checks for link up on the hardware. If link is not up and we have
* a signal, then we need to force link up.
**/
-s32 e1000_check_for_fiber_link(struct e1000_hw *hw)
+s32 e1000e_check_for_fiber_link(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
u32 rxcw;
@@ -471,7 +471,7 @@ s32 e1000_check_for_fiber_link(struct e1000_hw *hw)
ew32(CTRL, ctrl);
/* Configure Flow Control after forcing link up. */
- ret_val = e1000_config_fc_after_link_up(hw);
+ ret_val = e1000e_config_fc_after_link_up(hw);
if (ret_val) {
hw_dbg(hw, "Error configuring flow control\n");
return ret_val;
@@ -493,13 +493,13 @@ s32 e1000_check_for_fiber_link(struct e1000_hw *hw)
}
/**
- * e1000_check_for_serdes_link - Check for link (Serdes)
+ * e1000e_check_for_serdes_link - Check for link (Serdes)
* @hw: pointer to the HW structure
*
* Checks for link up on the hardware. If link is not up and we have
* a signal, then we need to force link up.
**/
-s32 e1000_check_for_serdes_link(struct e1000_hw *hw)
+s32 e1000e_check_for_serdes_link(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
u32 rxcw;
@@ -534,7 +534,7 @@ s32 e1000_check_for_serdes_link(struct e1000_hw *hw)
ew32(CTRL, ctrl);
/* Configure Flow Control after forcing link up. */
- ret_val = e1000_config_fc_after_link_up(hw);
+ ret_val = e1000e_config_fc_after_link_up(hw);
if (ret_val) {
hw_dbg(hw, "Error configuring flow control\n");
return ret_val;
@@ -619,7 +619,7 @@ static s32 e1000_set_default_fc_generic(struct e1000_hw *hw)
}
/**
- * e1000_setup_link - Setup flow control and link settings
+ * e1000e_setup_link - Setup flow control and link settings
* @hw: pointer to the HW structure
*
* Determines which flow control settings to use, then configures flow
@@ -628,7 +628,7 @@ static s32 e1000_set_default_fc_generic(struct e1000_hw *hw)
* should be established. Assumes the hardware has previously been reset
* and the transmitter and receiver are not enabled.
**/
-s32 e1000_setup_link(struct e1000_hw *hw)
+s32 e1000e_setup_link(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
s32 ret_val;
@@ -668,7 +668,7 @@ s32 e1000_setup_link(struct e1000_hw *hw)
ew32(FCTTV, mac->fc_pause_time);
- return e1000_set_fc_watermarks(hw);
+ return e1000e_set_fc_watermarks(hw);
}
/**
@@ -786,13 +786,13 @@ static s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw)
}
/**
- * e1000_setup_fiber_serdes_link - Setup link for fiber/serdes
+ * e1000e_setup_fiber_serdes_link - Setup link for fiber/serdes
* @hw: pointer to the HW structure
*
* Configures collision distance and flow control for fiber and serdes
* links. Upon successful setup, poll for link.
**/
-s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw)
+s32 e1000e_setup_fiber_serdes_link(struct e1000_hw *hw)
{
u32 ctrl;
s32 ret_val;
@@ -802,7 +802,7 @@ s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw)
/* Take the link out of reset */
ctrl &= ~E1000_CTRL_LRST;
- e1000_config_collision_dist(hw);
+ e1000e_config_collision_dist(hw);
ret_val = e1000_commit_fc_settings_generic(hw);
if (ret_val)
@@ -835,14 +835,14 @@ s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw)
}
/**
- * e1000_config_collision_dist - Configure collision distance
+ * e1000e_config_collision_dist - Configure collision distance
* @hw: pointer to the HW structure
*
* Configures the collision distance to the default value and is used
* during link setup. Currently no func pointer exists and all
* implementations are handled in the generic version of this function.
**/
-void e1000_config_collision_dist(struct e1000_hw *hw)
+void e1000e_config_collision_dist(struct e1000_hw *hw)
{
u32 tctl;
@@ -856,14 +856,14 @@ void e1000_config_collision_dist(struct e1000_hw *hw)
}
/**
- * e1000_set_fc_watermarks - Set flow control high/low watermarks
+ * e1000e_set_fc_watermarks - Set flow control high/low watermarks
* @hw: pointer to the HW structure
*
* Sets the flow control high/low threshold (watermark) registers. If
* flow control XON frame transmission is enabled, then set XON frame
* tansmission as well.
**/
-s32 e1000_set_fc_watermarks(struct e1000_hw *hw)
+s32 e1000e_set_fc_watermarks(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
u32 fcrtl = 0, fcrth = 0;
@@ -890,7 +890,7 @@ s32 e1000_set_fc_watermarks(struct e1000_hw *hw)
}
/**
- * e1000_force_mac_fc - Force the MAC's flow control settings
+ * e1000e_force_mac_fc - Force the MAC's flow control settings
* @hw: pointer to the HW structure
*
* Force the MAC's flow control settings. Sets the TFCE and RFCE bits in the
@@ -899,7 +899,7 @@ s32 e1000_set_fc_watermarks(struct e1000_hw *hw)
* autonegotiation is managed by the PHY rather than the MAC. Software must
* also configure these bits when link is forced on a fiber connection.
**/
-s32 e1000_force_mac_fc(struct e1000_hw *hw)
+s32 e1000e_force_mac_fc(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
u32 ctrl;
@@ -951,7 +951,7 @@ s32 e1000_force_mac_fc(struct e1000_hw *hw)
}
/**
- * e1000_config_fc_after_link_up - Configures flow control after link
+ * e1000e_config_fc_after_link_up - Configures flow control after link
* @hw: pointer to the HW structure
*
* Checks the status of auto-negotiation after link up to ensure that the
@@ -960,7 +960,7 @@ s32 e1000_force_mac_fc(struct e1000_hw *hw)
* and did not fail, then we configure flow control based on our link
* partner.
**/
-s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
+s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
s32 ret_val = 0;
@@ -974,10 +974,10 @@ s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
if (mac->autoneg_failed) {
if (hw->media_type == e1000_media_type_fiber ||
hw->media_type == e1000_media_type_internal_serdes)
- ret_val = e1000_force_mac_fc(hw);
+ ret_val = e1000e_force_mac_fc(hw);
} else {
if (hw->media_type == e1000_media_type_copper)
- ret_val = e1000_force_mac_fc(hw);
+ ret_val = e1000e_force_mac_fc(hw);
}
if (ret_val) {
@@ -1147,7 +1147,7 @@ s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
/* Now we call a subroutine to actually force the MAC
* controller to use the correct flow control settings.
*/
- ret_val = e1000_force_mac_fc(hw);
+ ret_val = e1000e_force_mac_fc(hw);
if (ret_val) {
hw_dbg(hw, "Error forcing flow control settings\n");
return ret_val;
@@ -1158,7 +1158,7 @@ s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
}
/**
- * e1000_get_speed_and_duplex_copper - Retreive current speed/duplex
+ * e1000e_get_speed_and_duplex_copper - Retreive current speed/duplex
* @hw: pointer to the HW structure
* @speed: stores the current speed
* @duplex: stores the current duplex
@@ -1166,7 +1166,7 @@ s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
* Read the status register for the current speed/duplex and store the current
* speed and duplex for copper connections.
**/
-s32 e1000_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u16 *duplex)
+s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u16 *duplex)
{
u32 status;
@@ -1194,7 +1194,7 @@ s32 e1000_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u16 *dupl
}
/**
- * e1000_get_speed_and_duplex_fiber_serdes - Retreive current speed/duplex
+ * e1000e_get_speed_and_duplex_fiber_serdes - Retreive current speed/duplex
* @hw: pointer to the HW structure
* @speed: stores the current speed
* @duplex: stores the current duplex
@@ -1202,7 +1202,7 @@ s32 e1000_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u16 *dupl
* Sets the speed and duplex to gigabit full duplex (the only possible option)
* for fiber/serdes links.
**/
-s32 e1000_get_speed_and_duplex_fiber_serdes(struct e1000_hw *hw, u16 *speed, u16 *duplex)
+s32 e1000e_get_speed_and_duplex_fiber_serdes(struct e1000_hw *hw, u16 *speed, u16 *duplex)
{
*speed = SPEED_1000;
*duplex = FULL_DUPLEX;
@@ -1211,12 +1211,12 @@ s32 e1000_get_speed_and_duplex_fiber_serdes(struct e1000_hw *hw, u16 *speed, u16
}
/**
- * e1000_get_hw_semaphore - Acquire hardware semaphore
+ * e1000e_get_hw_semaphore - Acquire hardware semaphore
* @hw: pointer to the HW structure
*
* Acquire the HW semaphore to access the PHY or NVM
**/
-s32 e1000_get_hw_semaphore(struct e1000_hw *hw)
+s32 e1000e_get_hw_semaphore(struct e1000_hw *hw)
{
u32 swsm;
s32 timeout = hw->nvm.word_size + 1;
@@ -1251,7 +1251,7 @@ s32 e1000_get_hw_semaphore(struct e1000_hw *hw)
if (i == timeout) {
/* Release semaphores */
- e1000_put_hw_semaphore(hw);
+ e1000e_put_hw_semaphore(hw);
hw_dbg(hw, "Driver can't access the NVM\n");
return -E1000_ERR_NVM;
}
@@ -1260,12 +1260,12 @@ s32 e1000_get_hw_semaphore(struct e1000_hw *hw)
}
/**
- * e1000_put_hw_semaphore - Release hardware semaphore
+ * e1000e_put_hw_semaphore - Release hardware semaphore
* @hw: pointer to the HW structure
*
* Release hardware semaphore used to access the PHY or NVM
**/
-void e1000_put_hw_semaphore(struct e1000_hw *hw)
+void e1000e_put_hw_semaphore(struct e1000_hw *hw)
{
u32 swsm;
@@ -1275,12 +1275,12 @@ void e1000_put_hw_semaphore(struct e1000_hw *hw)
}
/**
- * e1000_get_auto_rd_done - Check for auto read completion
+ * e1000e_get_auto_rd_done - Check for auto read completion
* @hw: pointer to the HW structure
*
* Check EEPROM for Auto Read done bit.
**/
-s32 e1000_get_auto_rd_done(struct e1000_hw *hw)
+s32 e1000e_get_auto_rd_done(struct e1000_hw *hw)
{
s32 i = 0;
@@ -1300,14 +1300,14 @@ s32 e1000_get_auto_rd_done(struct e1000_hw *hw)
}
/**
- * e1000_valid_led_default - Verify a valid default LED config
+ * e1000e_valid_led_default - Verify a valid default LED config
* @hw: pointer to the HW structure
* @data: pointer to the NVM (EEPROM)
*
* Read the EEPROM for the current default LED configuration. If the
* LED configuration is not valid, set to a valid LED configuration.
**/
-s32 e1000_valid_led_default(struct e1000_hw *hw, u16 *data)
+s32 e1000e_valid_led_default(struct e1000_hw *hw, u16 *data)
{
s32 ret_val;
@@ -1324,11 +1324,11 @@ s32 e1000_valid_led_default(struct e1000_hw *hw, u16 *data)
}
/**
- * e1000_id_led_init -
+ * e1000e_id_led_init -
* @hw: pointer to the HW structure
*
**/
-s32 e1000_id_led_init(struct e1000_hw *hw)
+s32 e1000e_id_led_init(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
s32 ret_val;
@@ -1388,25 +1388,25 @@ s32 e1000_id_led_init(struct e1000_hw *hw)
}
/**
- * e1000_cleanup_led_generic - Set LED config to default operation
+ * e1000e_cleanup_led_generic - Set LED config to default operation
* @hw: pointer to the HW structure
*
* Remove the current LED configuration and set the LED configuration
* to the default value, saved from the EEPROM.
**/
-s32 e1000_cleanup_led_generic(struct e1000_hw *hw)
+s32 e1000e_cleanup_led_generic(struct e1000_hw *hw)
{
ew32(LEDCTL, hw->mac.ledctl_default);
return 0;
}
/**
- * e1000_blink_led - Blink LED
+ * e1000e_blink_led - Blink LED
* @hw: pointer to the HW structure
*
* Blink the led's which are set to be on.
**/
-s32 e1000_blink_led(struct e1000_hw *hw)
+s32 e1000e_blink_led(struct e1000_hw *hw)
{
u32 ledctl_blink = 0;
u32 i;
@@ -1432,12 +1432,12 @@ s32 e1000_blink_led(struct e1000_hw *hw)
}
/**
- * e1000_led_on_generic - Turn LED on
+ * e1000e_led_on_generic - Turn LED on
* @hw: pointer to the HW structure
*
* Turn LED on.
**/
-s32 e1000_led_on_generic(struct e1000_hw *hw)
+s32 e1000e_led_on_generic(struct e1000_hw *hw)
{
u32 ctrl;
@@ -1459,12 +1459,12 @@ s32 e1000_led_on_generic(struct e1000_hw *hw)
}
/**
- * e1000_led_off_generic - Turn LED off
+ * e1000e_led_off_generic - Turn LED off
* @hw: pointer to the HW structure
*
* Turn LED off.
**/
-s32 e1000_led_off_generic(struct e1000_hw *hw)
+s32 e1000e_led_off_generic(struct e1000_hw *hw)
{
u32 ctrl;
@@ -1486,13 +1486,13 @@ s32 e1000_led_off_generic(struct e1000_hw *hw)
}
/**
- * e1000_set_pcie_no_snoop - Set PCI-express capabilities
+ * e1000e_set_pcie_no_snoop - Set PCI-express capabilities
* @hw: pointer to the HW structure
* @no_snoop: bitmap of snoop events
*
* Set the PCI-express register to snoop for events enabled in 'no_snoop'.
**/
-void e1000_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop)
+void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop)
{
u32 gcr;
@@ -1505,7 +1505,7 @@ void e1000_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop)
}
/**
- * e1000_disable_pcie_master - Disables PCI-express master access
+ * e1000e_disable_pcie_master - Disables PCI-express master access
* @hw: pointer to the HW structure
*
* Returns 0 if successful, else returns -10
@@ -1515,7 +1515,7 @@ void e1000_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop)
* Disables PCI-Express master access and verifies there are no pending
* requests.
**/
-s32 e1000_disable_pcie_master(struct e1000_hw *hw)
+s32 e1000e_disable_pcie_master(struct e1000_hw *hw)
{
u32 ctrl;
s32 timeout = MASTER_DISABLE_TIMEOUT;
@@ -1541,12 +1541,12 @@ s32 e1000_disable_pcie_master(struct e1000_hw *hw)
}
/**
- * e1000_reset_adaptive - Reset Adaptive Interframe Spacing
+ * e1000e_reset_adaptive - Reset Adaptive Interframe Spacing
* @hw: pointer to the HW structure
*
* Reset the Adaptive Interframe Spacing throttle to default values.
**/
-void e1000_reset_adaptive(struct e1000_hw *hw)
+void e1000e_reset_adaptive(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
@@ -1561,13 +1561,13 @@ void e1000_reset_adaptive(struct e1000_hw *hw)
}
/**
- * e1000_update_adaptive - Update Adaptive Interframe Spacing
+ * e1000e_update_adaptive - Update Adaptive Interframe Spacing
* @hw: pointer to the HW structure
*
* Update the Adaptive Interframe Spacing Throttle value based on the
* time between transmitted packets and time between collisions.
**/
-void e1000_update_adaptive(struct e1000_hw *hw)
+void e1000e_update_adaptive(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
@@ -1704,14 +1704,14 @@ static u16 e1000_shift_in_eec_bits(struct e1000_hw *hw, u16 count)
}
/**
- * e1000_poll_eerd_eewr_done - Poll for EEPROM read/write completion
+ * e1000e_poll_eerd_eewr_done - Poll for EEPROM read/write completion
* @hw: pointer to the HW structure
* @ee_reg: EEPROM flag for polling
*
* Polls the EEPROM status bit for either read or write completion based
* upon the value of 'ee_reg'.
**/
-s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
+s32 e1000e_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
{
u32 attempts = 100000;
u32 i, reg = 0;
@@ -1732,14 +1732,14 @@ s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
}
/**
- * e1000_acquire_nvm - Generic request for access to EEPROM
+ * e1000e_acquire_nvm - Generic request for access to EEPROM
* @hw: pointer to the HW structure
*
* Set the EEPROM access request bit and wait for EEPROM access grant bit.
* Return successful if access grant bit set, else clear the request for
* EEPROM access and return -E1000_ERR_NVM (-1).
**/
-s32 e1000_acquire_nvm(struct e1000_hw *hw)
+s32 e1000e_acquire_nvm(struct e1000_hw *hw)
{
u32 eecd = er32(EECD);
s32 timeout = E1000_NVM_GRANT_ATTEMPTS;
@@ -1808,12 +1808,12 @@ static void e1000_stop_nvm(struct e1000_hw *hw)
}
/**
- * e1000_release_nvm - Release exclusive access to EEPROM
+ * e1000e_release_nvm - Release exclusive access to EEPROM
* @hw: pointer to the HW structure
*
* Stop any current commands to the EEPROM and clear the EEPROM request bit.
**/
-void e1000_release_nvm(struct e1000_hw *hw)
+void e1000e_release_nvm(struct e1000_hw *hw)
{
u32 eecd;
@@ -1870,7 +1870,7 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
}
/**
- * e1000_read_nvm_spi - Read EEPROM's using SPI
+ * e1000e_read_nvm_spi - Read EEPROM's using SPI
* @hw: pointer to the HW structure
* @offset: offset of word in the EEPROM to read
* @words: number of words to read
@@ -1878,7 +1878,7 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
*
* Reads a 16 bit word from the EEPROM.
**/
-s32 e1000_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
+s32 e1000e_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
{
struct e1000_nvm_info *nvm = &hw->nvm;
u32 i = 0;
@@ -1926,7 +1926,7 @@ s32 e1000_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
}
/**
- * e1000_read_nvm_eerd - Reads EEPROM using EERD register
+ * e1000e_read_nvm_eerd - Reads EEPROM using EERD register
* @hw: pointer to the HW structure
* @offset: offset of word in the EEPROM to read
* @words: number of words to read
@@ -1934,7 +1934,7 @@ s32 e1000_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
*
* Reads a 16 bit word from the EEPROM using the EERD register.
**/
-s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
+s32 e1000e_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
{
struct e1000_nvm_info *nvm = &hw->nvm;
u32 i, eerd = 0;
@@ -1953,7 +1953,7 @@ s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
E1000_NVM_RW_REG_START;
ew32(EERD, eerd);
- ret_val = e1000_poll_eerd_eewr_done(hw, E1000_NVM_POLL_READ);
+ ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_READ);
if (ret_val)
break;
@@ -1965,7 +1965,7 @@ s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
}
/**
- * e1000_write_nvm_spi - Write to EEPROM using SPI
+ * e1000e_write_nvm_spi - Write to EEPROM using SPI
* @hw: pointer to the HW structure
* @offset: offset within the EEPROM to be written to
* @words: number of words to write
@@ -1973,10 +1973,10 @@ s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
*
* Writes data to EEPROM at offset using SPI interface.
*
- * If e1000_update_nvm_checksum is not called after this function , the
+ * If e1000e_update_nvm_checksum is not called after this function , the
* EEPROM will most likley contain an invalid checksum.
**/
-s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
+s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
{
struct e1000_nvm_info *nvm = &hw->nvm;
s32 ret_val;
@@ -2042,14 +2042,14 @@ s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
}
/**
- * e1000_read_mac_addr - Read device MAC address
+ * e1000e_read_mac_addr - Read device MAC address
* @hw: pointer to the HW structure
*
* Reads the device MAC address from the EEPROM and stores the value.
* Since devices with two ports use the same EEPROM, we increment the
* last bit in the MAC address for the second port.
**/
-s32 e1000_read_mac_addr(struct e1000_hw *hw)
+s32 e1000e_read_mac_addr(struct e1000_hw *hw)
{
s32 ret_val;
u16 offset, nvm_data, i;
@@ -2076,13 +2076,13 @@ s32 e1000_read_mac_addr(struct e1000_hw *hw)
}
/**
- * e1000_validate_nvm_checksum_generic - Validate EEPROM checksum
+ * e1000e_validate_nvm_checksum_generic - Validate EEPROM checksum
* @hw: pointer to the HW structure
*
* Calculates the EEPROM checksum by reading/adding each word of the EEPROM
* and then verifies that the sum of the EEPROM is equal to 0xBABA.
**/
-s32 e1000_validate_nvm_checksum_generic(struct e1000_hw *hw)
+s32 e1000e_validate_nvm_checksum_generic(struct e1000_hw *hw)
{
s32 ret_val;
u16 checksum = 0;
@@ -2106,14 +2106,14 @@ s32 e1000_validate_nvm_checksum_generic(struct e1000_hw *hw)
}
/**
- * e1000_update_nvm_checksum_generic - Update EEPROM checksum
+ * e1000e_update_nvm_checksum_generic - Update EEPROM checksum
* @hw: pointer to the HW structure
*
* Updates the EEPROM checksum by reading/adding each word of the EEPROM
* up to the checksum. Then calculates the EEPROM checksum and writes the
* value to the EEPROM.
**/
-s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw)
+s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw)
{
s32 ret_val;
u16 checksum = 0;
@@ -2136,13 +2136,13 @@ s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw)
}
/**
- * e1000_reload_nvm - Reloads EEPROM
+ * e1000e_reload_nvm - Reloads EEPROM
* @hw: pointer to the HW structure
*
* Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
* extended control register.
**/
-void e1000_reload_nvm(struct e1000_hw *hw)
+void e1000e_reload_nvm(struct e1000_hw *hw)
{
u32 ctrl_ext;
@@ -2213,13 +2213,13 @@ static s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
}
/**
- * e1000_check_mng_mode - check managament mode
+ * e1000e_check_mng_mode - check managament mode
* @hw: pointer to the HW structure
*
* Reads the firmware semaphore register and returns true (>0) if
* manageability is enabled, else false (0).
**/
-bool e1000_check_mng_mode(struct e1000_hw *hw)
+bool e1000e_check_mng_mode(struct e1000_hw *hw)
{
u32 fwsm = er32(FWSM);
@@ -2227,13 +2227,13 @@ bool e1000_check_mng_mode(struct e1000_hw *hw)
}
/**
- * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
+ * e1000e_enable_tx_pkt_filtering - Enable packet filtering on TX
* @hw: pointer to the HW structure
*
* Enables packet filtering on transmit packets if manageability is enabled
* and host interface is enabled.
**/
-bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
+bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
{
struct e1000_host_mng_dhcp_cookie *hdr = &hw->mng_cookie;
u32 *buffer = (u32 *)&hw->mng_cookie;
@@ -2242,7 +2242,7 @@ bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
u8 i, len;
/* No manageability, no filtering */
- if (!e1000_check_mng_mode(hw)) {
+ if (!e1000e_check_mng_mode(hw)) {
hw->mac.tx_pkt_filtering = 0;
return 0;
}
@@ -2383,14 +2383,14 @@ static s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer,
}
/**
- * e1000_mng_write_dhcp_info - Writes DHCP info to host interface
+ * e1000e_mng_write_dhcp_info - Writes DHCP info to host interface
* @hw: pointer to the HW structure
* @buffer: pointer to the host interface
* @length: size of the buffer
*
* Writes the DHCP information to the host interface.
**/
-s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
+s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
{
struct e1000_host_mng_command_header hdr;
s32 ret_val;
@@ -2426,12 +2426,12 @@ s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
}
/**
- * e1000_enable_mng_pass_thru - Enable processing of ARP's
+ * e1000e_enable_mng_pass_thru - Enable processing of ARP's
* @hw: pointer to the HW structure
*
* Verifies the hardware needs to allow ARPs to be processed by the host.
**/
-bool e1000_enable_mng_pass_thru(struct e1000_hw *hw)
+bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw)
{
u32 manc;
u32 fwsm, factps;
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 01a9a4f..d711e14 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -47,8 +47,8 @@
#include "e1000.h"
#define DRV_VERSION "0.2.0"
-char e1000_driver_name[] = "e1000e";
-const char e1000_driver_version[] = DRV_VERSION;
+char e1000e_driver_name[] = "e1000e";
+const char e1000e_driver_version[] = DRV_VERSION;
static const struct e1000_info *e1000_info_tbl[] = {
[board_82571] = &e1000_82571_info,
@@ -64,7 +64,7 @@ static const struct e1000_info *e1000_info_tbl[] = {
* e1000_get_hw_dev_name - return device name string
* used by hardware layer to print debugging information
**/
-char *e1000_get_hw_dev_name(struct e1000_hw *hw)
+char *e1000e_get_hw_dev_name(struct e1000_hw *hw)
{
struct e1000_adapter *adapter = hw->back;
struct net_device *netdev = adapter->netdev;
@@ -1108,7 +1108,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
* disconnect (LSC) before accessing any PHY registers */
if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) &&
(!(er32(STATUS) & E1000_STATUS_LU)))
- e1000_gig_downshift_workaround_ich8lan(hw);
+ e1000e_gig_downshift_workaround_ich8lan(hw);
/* 80003ES2LAN workaround-- For packet buffer work-around on
* link down event; disable receives here in the ISR and reset
@@ -1169,7 +1169,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
* disconnect (LSC) before accessing any PHY registers */
if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) &&
(!(er32(STATUS) & E1000_STATUS_LU)))
- e1000_gig_downshift_workaround_ich8lan(hw);
+ e1000e_gig_downshift_workaround_ich8lan(hw);
/* 80003ES2LAN workaround--
* For packet buffer work-around on link down event;
@@ -1352,12 +1352,12 @@ static int e1000_alloc_ring_dma(struct e1000_adapter *adapter,
}
/**
- * e1000_setup_tx_resources - allocate Tx resources (Descriptors)
+ * e1000e_setup_tx_resources - allocate Tx resources (Descriptors)
* @adapter: board private structure
*
* Return 0 on success, negative on failure
**/
-int e1000_setup_tx_resources(struct e1000_adapter *adapter)
+int e1000e_setup_tx_resources(struct e1000_adapter *adapter)
{
struct e1000_ring *tx_ring = adapter->tx_ring;
int err = -ENOMEM, size;
@@ -1389,12 +1389,12 @@ err:
}
/**
- * e1000_setup_rx_resources - allocate Rx resources (Descriptors)
+ * e1000e_setup_rx_resources - allocate Rx resources (Descriptors)
* @adapter: board private structure
*
* Returns 0 on success, negative on failure
**/
-int e1000_setup_rx_resources(struct e1000_adapter *adapter)
+int e1000e_setup_rx_resources(struct e1000_adapter *adapter)
{
struct e1000_ring *rx_ring = adapter->rx_ring;
int size, desc_len, err = -ENOMEM;
@@ -1464,12 +1464,12 @@ static void e1000_clean_tx_ring(struct e1000_adapter *adapter)
}
/**
- * e1000_free_tx_resources - Free Tx Resources per Queue
+ * e1000e_free_tx_resources - Free Tx Resources per Queue
* @adapter: board private structure
*
* Free all transmit software resources
**/
-void e1000_free_tx_resources(struct e1000_adapter *adapter)
+void e1000e_free_tx_resources(struct e1000_adapter *adapter)
{
struct pci_dev *pdev = adapter->pdev;
struct e1000_ring *tx_ring = adapter->tx_ring;
@@ -1484,13 +1484,13 @@ void e1000_free_tx_resources(struct e1000_adapter *adapter)
}
/**
- * e1000_free_rx_resources - Free Rx Resources
+ * e1000e_free_rx_resources - Free Rx Resources
* @adapter: board private structure
*
* Free all receive software resources
**/
-void e1000_free_rx_resources(struct e1000_adapter *adapter)
+void e1000e_free_rx_resources(struct e1000_adapter *adapter)
{
struct pci_dev *pdev = adapter->pdev;
struct e1000_ring *rx_ring = adapter->rx_ring;
@@ -1693,7 +1693,7 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
index = (vid >> 5) & 0x7F;
vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index);
vfta |= (1 << (vid & 0x1F));
- e1000_write_vfta(hw, index, vfta);
+ e1000e_write_vfta(hw, index, vfta);
}
static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
@@ -1718,7 +1718,7 @@ static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
index = (vid >> 5) & 0x7F;
vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index);
vfta &= ~(1 << (vid & 0x1F));
- e1000_write_vfta(hw, index, vfta);
+ e1000e_write_vfta(hw, index, vfta);
}
static void e1000_update_mng_vlan(struct e1000_adapter *adapter)
@@ -1904,7 +1904,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
ew32(TARC1, tarc);
}
- e1000_config_collision_dist(hw);
+ e1000e_config_collision_dist(hw);
/* Setup Transmit Descriptor Settings for eop descriptor */
adapter->txd_cmd = E1000_TXD_CMD_EOP | E1000_TXD_CMD_IFCS;
@@ -2237,14 +2237,14 @@ static void e1000_configure(struct e1000_adapter *adapter)
}
/**
- * e1000_power_up_phy - restore link in case the phy was powered down
+ * e1000e_power_up_phy - restore link in case the phy was powered down
* @adapter: address of board private structure
*
* The phy may be powered down to save power and turn off link when the
* driver is unloaded and wake on lan is not enabled (among others)
- * *** this routine MUST be followed by a call to e1000_reset ***
+ * *** this routine MUST be followed by a call to e1000e_reset ***
**/
-void e1000_power_up_phy(struct e1000_adapter *adapter)
+void e1000e_power_up_phy(struct e1000_adapter *adapter)
{
u16 mii_reg = 0;
@@ -2280,7 +2280,7 @@ static void e1000_power_down_phy(struct e1000_adapter *adapter)
return;
/* reset is blocked because of a SoL/IDER session */
- if (e1000_check_mng_mode(hw) ||
+ if (e1000e_check_mng_mode(hw) ||
e1000_check_reset_block(hw))
return;
@@ -2296,14 +2296,14 @@ static void e1000_power_down_phy(struct e1000_adapter *adapter)
}
/**
- * e1000_reset - bring the hardware into a known good state
+ * e1000e_reset - bring the hardware into a known good state
*
* This function boots the hardware and enables some settings that
* require a configuration cycle of the hardware - those cannot be
* set/changed during runtime. After reset the device needs to be
* properly configured for rx, tx etc.
*/
-void e1000_reset(struct e1000_adapter *adapter)
+void e1000e_reset(struct e1000_adapter *adapter)
{
struct e1000_mac_info *mac = &adapter->hw.mac;
struct e1000_hw *hw = &adapter->hw;
@@ -2388,7 +2388,7 @@ void e1000_reset(struct e1000_adapter *adapter)
/* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
ew32(VET, ETH_P_8021Q);
- e1000_reset_adaptive(hw);
+ e1000e_reset_adaptive(hw);
e1000_get_phy_info(hw);
if (!(adapter->flags & FLAG_SMART_POWER_DOWN)) {
@@ -2404,7 +2404,7 @@ void e1000_reset(struct e1000_adapter *adapter)
e1000_release_manageability(adapter);
}
-int e1000_up(struct e1000_adapter *adapter)
+int e1000e_up(struct e1000_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
@@ -2421,7 +2421,7 @@ int e1000_up(struct e1000_adapter *adapter)
return 0;
}
-void e1000_down(struct e1000_adapter *adapter)
+void e1000e_down(struct e1000_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
struct e1000_hw *hw = &adapter->hw;
@@ -2457,7 +2457,7 @@ void e1000_down(struct e1000_adapter *adapter)
adapter->link_speed = 0;
adapter->link_duplex = 0;
- e1000_reset(adapter);
+ e1000e_reset(adapter);
e1000_clean_tx_ring(adapter);
e1000_clean_rx_ring(adapter);
@@ -2467,13 +2467,13 @@ void e1000_down(struct e1000_adapter *adapter)
*/
}
-void e1000_reinit_locked(struct e1000_adapter *adapter)
+void e1000e_reinit_locked(struct e1000_adapter *adapter)
{
might_sleep();
while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
msleep(1);
- e1000_down(adapter);
- e1000_up(adapter);
+ e1000e_down(adapter);
+ e1000e_up(adapter);
clear_bit(__E1000_RESETTING, &adapter->state);
}
@@ -2544,16 +2544,16 @@ static int e1000_open(struct net_device *netdev)
return -EBUSY;
/* allocate transmit descriptors */
- err = e1000_setup_tx_resources(adapter);
+ err = e1000e_setup_tx_resources(adapter);
if (err)
goto err_setup_tx;
/* allocate receive descriptors */
- err = e1000_setup_rx_resources(adapter);
+ err = e1000e_setup_rx_resources(adapter);
if (err)
goto err_setup_rx;
- e1000_power_up_phy(adapter);
+ e1000e_power_up_phy(adapter);
adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
if ((adapter->hw.mng_cookie.status &
@@ -2563,7 +2563,7 @@ static int e1000_open(struct net_device *netdev)
/* If AMT is enabled, let the firmware know that the network
* interface is now open */
if ((adapter->flags & FLAG_HAS_AMT) &&
- e1000_check_mng_mode(&adapter->hw))
+ e1000e_check_mng_mode(&adapter->hw))
e1000_get_hw_control(adapter);
/* before we allocate an interrupt, we must be ready to handle it.
@@ -2576,7 +2576,7 @@ static int e1000_open(struct net_device *netdev)
if (err)
goto err_req_irq;
- /* From here on the code is the same as e1000_up() */
+ /* From here on the code is the same as e1000e_up() */
clear_bit(__E1000_DOWN, &adapter->state);
netif_poll_enable(netdev);
@@ -2591,11 +2591,11 @@ static int e1000_open(struct net_device *netdev)
err_req_irq:
e1000_release_hw_control(adapter);
e1000_power_down_phy(adapter);
- e1000_free_rx_resources(adapter);
+ e1000e_free_rx_resources(adapter);
err_setup_rx:
- e1000_free_tx_resources(adapter);
+ e1000e_free_tx_resources(adapter);
err_setup_tx:
- e1000_reset(adapter);
+ e1000e_reset(adapter);
return err;
}
@@ -2616,12 +2616,12 @@ static int e1000_close(struct net_device *netdev)
struct e1000_adapter *adapter = netdev_priv(netdev);
WARN_ON(test_bit(__E1000_RESETTING, &adapter->state));
- e1000_down(adapter);
+ e1000e_down(adapter);
e1000_power_down_phy(adapter);
e1000_free_irq(adapter);
- e1000_free_tx_resources(adapter);
- e1000_free_rx_resources(adapter);
+ e1000e_free_tx_resources(adapter);
+ e1000e_free_rx_resources(adapter);
/* kill manageability vlan ID if supported, but not if a vlan with
* the same ID is registered on the host OS (let 8021q kill it) */
@@ -2634,7 +2634,7 @@ static int e1000_close(struct net_device *netdev)
/* If AMT is enabled, let the firmware know that the network
* interface is now closed */
if ((adapter->flags & FLAG_HAS_AMT) &&
- e1000_check_mng_mode(&adapter->hw))
+ e1000e_check_mng_mode(&adapter->hw))
e1000_release_hw_control(adapter);
return 0;
@@ -2657,11 +2657,11 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
memcpy(adapter->hw.mac.addr, addr->sa_data, netdev->addr_len);
- e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0);
+ e1000e_rar_set(&adapter->hw, adapter->hw.mac.addr, 0);
if (adapter->flags & FLAG_RESET_OVERWRITES_LAA) {
/* activate the work around */
- e1000_set_laa_state_82571(&adapter->hw, 1);
+ e1000e_set_laa_state_82571(&adapter->hw, 1);
/* 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
@@ -2669,7 +2669,7 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
* of the RARs and no incoming packets directed to this port
* are dropped. Eventually the LAA will be in RAR[0] and
* RAR[14] */
- e1000_rar_set(&adapter->hw,
+ e1000e_rar_set(&adapter->hw,
adapter->hw.mac.addr,
adapter->hw.mac.rar_entry_count - 1);
}
@@ -2686,10 +2686,10 @@ static void e1000_update_phy_info(unsigned long data)
}
/**
- * e1000_update_stats - Update the board statistics counters
+ * e1000e_update_stats - Update the board statistics counters
* @adapter: board private structure
**/
-void e1000_update_stats(struct e1000_adapter *adapter)
+void e1000e_update_stats(struct e1000_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
struct pci_dev *pdev = adapter->pdev;
@@ -2903,7 +2903,7 @@ static void e1000_watchdog_task(struct work_struct *work)
"Gigabit has been disabled, downgrading speed\n");
}
- if ((e1000_enable_tx_pkt_filtering(hw)) &&
+ if ((e1000e_enable_tx_pkt_filtering(hw)) &&
(adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id))
e1000_update_mng_vlan(adapter);
@@ -3005,7 +3005,7 @@ static void e1000_watchdog_task(struct work_struct *work)
}
link_up:
- e1000_update_stats(adapter);
+ e1000e_update_stats(adapter);
mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old;
adapter->tpt_old = adapter->stats.tpt;
@@ -3017,7 +3017,7 @@ link_up:
adapter->gotcl = adapter->stats.gotcl - adapter->gotcl_old;
adapter->gotcl_old = adapter->stats.gotcl;
- e1000_update_adaptive(&adapter->hw);
+ e1000e_update_adaptive(&adapter->hw);
if (!netif_carrier_ok(netdev)) {
tx_pending = (e1000_desc_unused(tx_ring) + 1 <
@@ -3040,8 +3040,8 @@ link_up:
/* With 82571 controllers, LAA may be overwritten due to controller
* reset from the other port. Set the appropriate LAA in RAR[0] */
- if (e1000_get_laa_state_82571(hw))
- e1000_rar_set(hw, adapter->hw.mac.addr, 0);
+ if (e1000e_get_laa_state_82571(hw))
+ e1000e_rar_set(hw, adapter->hw.mac.addr, 0);
/* Reset the timer */
if (!test_bit(__E1000_DOWN, &adapter->state))
@@ -3358,7 +3358,7 @@ static int e1000_transfer_dhcp_info(struct e1000_adapter *adapter,
offset = (u8 *)udp + 8 - skb->data;
length = skb->len - offset;
- return e1000_mng_write_dhcp_info(hw, (u8 *)udp + 8, length);
+ return e1000e_mng_write_dhcp_info(hw, (u8 *)udp + 8, length);
}
return 0;
@@ -3540,7 +3540,7 @@ static void e1000_reset_task(struct work_struct *work)
struct e1000_adapter *adapter;
adapter = container_of(work, struct e1000_adapter, reset_task);
- e1000_reinit_locked(adapter);
+ e1000e_reinit_locked(adapter);
}
/**
@@ -3596,10 +3596,10 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
msleep(1);
- /* e1000_down has a dependency on max_frame_size */
+ /* e1000e_down has a dependency on max_frame_size */
adapter->hw.mac.max_frame_size = max_frame;
if (netif_running(netdev))
- e1000_down(adapter);
+ e1000e_down(adapter);
/* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
* means we reserve 2 more, this pushes us to allocate from the next
@@ -3630,9 +3630,9 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
netdev->mtu = new_mtu;
if (netif_running(netdev))
- e1000_up(adapter);
+ e1000e_up(adapter);
else
- e1000_reset(adapter);
+ e1000e_reset(adapter);
clear_bit(__E1000_RESETTING, &adapter->state);
@@ -3696,7 +3696,7 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
if (netif_running(netdev)) {
WARN_ON(test_bit(__E1000_RESETTING, &adapter->state));
- e1000_down(adapter);
+ e1000e_down(adapter);
e1000_free_irq(adapter);
}
@@ -3737,7 +3737,7 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
}
/* Allow time for pending master requests to run */
- e1000_disable_pcie_master(&adapter->hw);
+ e1000e_disable_pcie_master(&adapter->hw);
ew32(WUC, E1000_WUC_PME_EN);
ew32(WUFC, wufc);
@@ -3759,7 +3759,7 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
}
if (adapter->hw.phy.type == e1000_phy_igp_3)
- e1000_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw);
+ e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw);
/* Release control of h/w to f/w. If f/w is AMT enabled, this
* would have already happened in close and is redundant. */
@@ -3800,21 +3800,21 @@ static int e1000_resume(struct pci_dev *pdev)
return err;
}
- e1000_power_up_phy(adapter);
- e1000_reset(adapter);
+ e1000e_power_up_phy(adapter);
+ e1000e_reset(adapter);
ew32(WUS, ~0);
e1000_init_manageability(adapter);
if (netif_running(netdev))
- e1000_up(adapter);
+ e1000e_up(adapter);
netif_device_attach(netdev);
/* If the controller has AMT, do not set DRV_LOAD until the interface
* is up. For all other cases, let the f/w know that the h/w is now
* under the control of the driver. */
- if (!(adapter->flags & FLAG_HAS_AMT) || !e1000_check_mng_mode(&adapter->hw))
+ if (!(adapter->flags & FLAG_HAS_AMT) || !e1000e_check_mng_mode(&adapter->hw))
e1000_get_hw_control(adapter);
return 0;
@@ -3862,7 +3862,7 @@ static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev,
netif_device_detach(netdev);
if (netif_running(netdev))
- e1000_down(adapter);
+ e1000e_down(adapter);
pci_disable_device(pdev);
/* Request a slot slot reset. */
@@ -3892,7 +3892,7 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
pci_enable_wake(pdev, PCI_D3hot, 0);
pci_enable_wake(pdev, PCI_D3cold, 0);
- e1000_reset(adapter);
+ e1000e_reset(adapter);
ew32(WUS, ~0);
return PCI_ERS_RESULT_RECOVERED;
@@ -3914,7 +3914,7 @@ static void e1000_io_resume(struct pci_dev *pdev)
e1000_init_manageability(adapter);
if (netif_running(netdev)) {
- if (e1000_up(adapter)) {
+ if (e1000e_up(adapter)) {
dev_err(&pdev->dev,
"can't bring device back up after reset\n");
return;
@@ -3927,7 +3927,7 @@ static void e1000_io_resume(struct pci_dev *pdev)
* is up. For all other cases, let the f/w know that the h/w is now
* under the control of the driver. */
if (!(adapter->flags & FLAG_HAS_AMT) ||
- !e1000_check_mng_mode(&adapter->hw))
+ !e1000e_check_mng_mode(&adapter->hw))
e1000_get_hw_control(adapter);
}
@@ -4001,7 +4001,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
}
}
- err = pci_request_regions(pdev, e1000_driver_name);
+ err = pci_request_regions(pdev, e1000e_driver_name);
if (err)
goto err_pci_reg;
@@ -4053,7 +4053,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
netdev->set_mac_address = &e1000_set_mac;
netdev->change_mtu = &e1000_change_mtu;
netdev->do_ioctl = &e1000_ioctl;
- e1000_set_ethtool_ops(netdev);
+ e1000e_set_ethtool_ops(netdev);
netdev->tx_timeout = &e1000_tx_timeout;
netdev->watchdog_timeo = 5 * HZ;
netdev->poll = &e1000_clean;
@@ -4119,7 +4119,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
* it. */
netdev->features |= NETIF_F_LLTX;
- if (e1000_enable_mng_pass_thru(&adapter->hw))
+ if (e1000e_enable_mng_pass_thru(&adapter->hw))
adapter->flags |= FLAG_MNG_PT_ENABLED;
/* before reading the NVM, reset the controller to
@@ -4141,7 +4141,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
}
/* copy the MAC address out of the NVM */
- if (e1000_read_mac_addr(&adapter->hw))
+ if (e1000e_read_mac_addr(&adapter->hw))
ndev_err(netdev, "NVM Read Error while reading MAC address\n");
memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
@@ -4168,7 +4168,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
INIT_WORK(&adapter->reset_task, e1000_reset_task);
INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
- e1000_check_options(adapter);
+ e1000e_check_options(adapter);
/* Initialize link parameters. User can change them with ethtool */
adapter->hw.mac.autoneg = 1;
@@ -4214,13 +4214,13 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
adapter->wol = adapter->eeprom_wol;
/* reset the hardware with the new settings */
- e1000_reset(adapter);
+ e1000e_reset(adapter);
/* If the controller has AMT, do not set DRV_LOAD until the interface
* is up. For all other cases, let the f/w know that the h/w is now
* under the control of the driver. */
if (!(adapter->flags & FLAG_HAS_AMT) ||
- !e1000_check_mng_mode(&adapter->hw))
+ !e1000e_check_mng_mode(&adapter->hw))
e1000_get_hw_control(adapter);
/* tell the stack to leave us alone until e1000_open() is called */
@@ -4315,7 +4315,7 @@ static struct pci_error_handlers e1000_err_handler = {
.resume = e1000_io_resume,
};
-static struct pci_device_id e1000e_pci_tbl[] = {
+static struct pci_device_id e1000_pci_tbl[] = {
/*
* Support for 82571/2/3, es2lan and ich8 will be phased in
* stepwise.
@@ -4358,12 +4358,12 @@ static struct pci_device_id e1000e_pci_tbl[] = {
{ } /* terminate list */
};
-MODULE_DEVICE_TABLE(pci, e1000e_pci_tbl);
+MODULE_DEVICE_TABLE(pci, e1000_pci_tbl);
/* PCI Device API Driver */
static struct pci_driver e1000_driver = {
- .name = e1000_driver_name,
- .id_table = e1000e_pci_tbl,
+ .name = e1000e_driver_name,
+ .id_table = e1000_pci_tbl,
.probe = e1000_probe,
.remove = __devexit_p(e1000_remove),
#ifdef CONFIG_PM
@@ -4381,17 +4381,17 @@ static struct pci_driver e1000_driver = {
* e1000_init_module is the first routine called when the driver is
* loaded. All it does is register with the PCI subsystem.
**/
-static int __init e1000e_init_module(void)
+static int __init e1000_init_module(void)
{
int ret;
printk(KERN_INFO "Intel(R) PRO/1000 Network Driver - %s\n",
- e1000_driver_version);
+ e1000e_driver_version);
printk(KERN_INFO "Copyright (c) 1999-2007 Intel Corporation.\n");
ret = pci_register_driver(&e1000_driver);
return ret;
}
-module_init(e1000e_init_module);
+module_init(e1000_init_module);
/**
* e1000_exit_module - Driver Exit Cleanup Routine
@@ -4399,11 +4399,11 @@ module_init(e1000e_init_module);
* e1000_exit_module is called just before the driver is removed
* from memory.
**/
-static void __exit e1000e_exit_module(void)
+static void __exit e1000_exit_module(void)
{
pci_unregister_driver(&e1000_driver);
}
-module_exit(e1000e_exit_module);
+module_exit(e1000_exit_module);
MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
index 9a70d22..e4e655e 100644
--- a/drivers/net/e1000e/param.c
+++ b/drivers/net/e1000e/param.c
@@ -192,7 +192,7 @@ static int __devinit e1000_validate_option(int *value,
}
/**
- * e1000_check_options - Range Checking for Command Line Parameters
+ * e1000e_check_options - Range Checking for Command Line Parameters
* @adapter: board private structure
*
* This routine checks all command line parameters for valid user
@@ -200,7 +200,7 @@ static int __devinit e1000_validate_option(int *value,
* value exists, a default value is used. The final value is stored
* in a variable in the adapter structure.
**/
-void __devinit e1000_check_options(struct e1000_adapter *adapter)
+void __devinit e1000e_check_options(struct e1000_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
struct net_device *netdev = adapter->netdev;
@@ -371,11 +371,11 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
int kmrn_lock_loss = KumeranLockLoss[bd];
e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
if (hw->mac.type == e1000_ich8lan)
- e1000_set_kmrn_lock_loss_workaround_ich8lan(hw,
+ e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw,
kmrn_lock_loss);
} else {
if (hw->mac.type == e1000_ich8lan)
- e1000_set_kmrn_lock_loss_workaround_ich8lan(hw,
+ e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw,
opt.def);
}
}
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index c9304d8..1efb47a 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -53,14 +53,14 @@ static const u16 e1000_igp_2_cable_length_table[] =
sizeof(e1000_igp_2_cable_length_table[0]))
/**
- * e1000_check_reset_block_generic - Check if PHY reset is blocked
+ * e1000e_check_reset_block_generic - Check if PHY reset is blocked
* @hw: pointer to the HW structure
*
* Read the PHY management control register and check whether a PHY reset
* is blocked. If a reset is not blocked return 0, otherwise
* return E1000_BLK_PHY_RESET (12).
**/
-s32 e1000_check_reset_block_generic(struct e1000_hw *hw)
+s32 e1000e_check_reset_block_generic(struct e1000_hw *hw)
{
u32 manc;
@@ -71,13 +71,13 @@ s32 e1000_check_reset_block_generic(struct e1000_hw *hw)
}
/**
- * e1000_get_phy_id - Retrieve the PHY ID and revision
+ * e1000e_get_phy_id - Retrieve the PHY ID and revision
* @hw: pointer to the HW structure
*
* Reads the PHY registers and stores the PHY ID and possibly the PHY
* revision in the hardware structure.
**/
-s32 e1000_get_phy_id(struct e1000_hw *hw)
+s32 e1000e_get_phy_id(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
@@ -100,12 +100,12 @@ s32 e1000_get_phy_id(struct e1000_hw *hw)
}
/**
- * e1000_phy_reset_dsp - Reset PHY DSP
+ * e1000e_phy_reset_dsp - Reset PHY DSP
* @hw: pointer to the HW structure
*
* Reset the digital signal processor.
**/
-s32 e1000_phy_reset_dsp(struct e1000_hw *hw)
+s32 e1000e_phy_reset_dsp(struct e1000_hw *hw)
{
s32 ret_val;
@@ -210,7 +210,7 @@ static s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
}
/**
- * e1000_read_phy_reg_m88 - Read m88 PHY register
+ * e1000e_read_phy_reg_m88 - Read m88 PHY register
* @hw: pointer to the HW structure
* @offset: register offset to be read
* @data: pointer to the read data
@@ -219,7 +219,7 @@ static s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
* and storing the retrieved information in data. Release any acquired
* semaphores before exiting.
**/
-s32 e1000_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data)
+s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data)
{
s32 ret_val;
@@ -237,7 +237,7 @@ s32 e1000_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data)
}
/**
- * e1000_write_phy_reg_m88 - Write m88 PHY register
+ * e1000e_write_phy_reg_m88 - Write m88 PHY register
* @hw: pointer to the HW structure
* @offset: register offset to write to
* @data: data to write at register offset
@@ -245,7 +245,7 @@ s32 e1000_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data)
* Acquires semaphore, if necessary, then writes the data to PHY register
* at the offset. Release any acquired semaphores before exiting.
**/
-s32 e1000_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data)
+s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data)
{
s32 ret_val;
@@ -263,7 +263,7 @@ s32 e1000_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data)
}
/**
- * e1000_read_phy_reg_igp - Read igp PHY register
+ * e1000e_read_phy_reg_igp - Read igp PHY register
* @hw: pointer to the HW structure
* @offset: register offset to be read
* @data: pointer to the read data
@@ -272,7 +272,7 @@ s32 e1000_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data)
* and storing the retrieved information in data. Release any acquired
* semaphores before exiting.
**/
-s32 e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
+s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
{
s32 ret_val;
@@ -300,7 +300,7 @@ s32 e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
}
/**
- * e1000_write_phy_reg_igp - Write igp PHY register
+ * e1000e_write_phy_reg_igp - Write igp PHY register
* @hw: pointer to the HW structure
* @offset: register offset to write to
* @data: data to write at register offset
@@ -308,7 +308,7 @@ s32 e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
* Acquires semaphore, if necessary, then writes the data to PHY register
* at the offset. Release any acquired semaphores before exiting.
**/
-s32 e1000_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
+s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
{
s32 ret_val;
@@ -336,7 +336,7 @@ s32 e1000_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
}
/**
- * e1000_read_kmrn_reg - Read kumeran register
+ * e1000e_read_kmrn_reg - Read kumeran register
* @hw: pointer to the HW structure
* @offset: register offset to be read
* @data: pointer to the read data
@@ -345,7 +345,7 @@ s32 e1000_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
* using the kumeran interface. The information retrieved is stored in data.
* Release any acquired semaphores before exiting.
**/
-s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
+s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
{
u32 kmrnctrlsta;
s32 ret_val;
@@ -369,7 +369,7 @@ s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
}
/**
- * e1000_write_kmrn_reg - Write kumeran register
+ * e1000e_write_kmrn_reg - Write kumeran register
* @hw: pointer to the HW structure
* @offset: register offset to write to
* @data: data to write at register offset
@@ -378,7 +378,7 @@ s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
* at the offset using the kumeran interface. Release any acquired semaphores
* before exiting.
**/
-s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
+s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
{
u32 kmrnctrlsta;
s32 ret_val;
@@ -398,13 +398,13 @@ s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
}
/**
- * e1000_copper_link_setup_m88 - Setup m88 PHY's for copper link
+ * e1000e_copper_link_setup_m88 - Setup m88 PHY's for copper link
* @hw: pointer to the HW structure
*
* Sets up MDI/MDI-X and polarity for m88 PHY's. If necessary, transmit clock
* and downshift values are set also.
**/
-s32 e1000_copper_link_setup_m88(struct e1000_hw *hw)
+s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
@@ -484,7 +484,7 @@ s32 e1000_copper_link_setup_m88(struct e1000_hw *hw)
}
/* Commit the changes. */
- ret_val = e1000_commit_phy(hw);
+ ret_val = e1000e_commit_phy(hw);
if (ret_val)
hw_dbg(hw, "Error committing the PHY changes\n");
@@ -492,13 +492,13 @@ s32 e1000_copper_link_setup_m88(struct e1000_hw *hw)
}
/**
- * e1000_copper_link_setup_igp - Setup igp PHY's for copper link
+ * e1000e_copper_link_setup_igp - Setup igp PHY's for copper link
* @hw: pointer to the HW structure
*
* Sets up LPLU, MDI/MDI-X, polarity, Smartspeed and Master/Slave config for
* igp PHY's.
**/
-s32 e1000_copper_link_setup_igp(struct e1000_hw *hw)
+s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
@@ -715,7 +715,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
/* Since there really isn't a way to advertise that we are
* capable of RX Pause ONLY, we will advertise that we
* support both symmetric and asymmetric RX PAUSE. Later
- * (in e1000_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.
*/
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
@@ -816,7 +816,7 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
}
/**
- * e1000_setup_copper_link - Configure copper link settings
+ * e1000e_setup_copper_link - Configure copper link settings
* @hw: pointer to the HW structure
*
* Calls the appropriate function to configure the link for auto-neg or forced
@@ -824,7 +824,7 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
* to configure collision distance and flow control are called. If link is
* not established, we return -E1000_ERR_PHY (-2).
**/
-s32 e1000_setup_copper_link(struct e1000_hw *hw)
+s32 e1000e_setup_copper_link(struct e1000_hw *hw)
{
s32 ret_val;
bool link;
@@ -849,7 +849,7 @@ s32 e1000_setup_copper_link(struct e1000_hw *hw)
/* Check link status. Wait up to 100 microseconds for link to become
* valid.
*/
- ret_val = e1000_phy_has_link_generic(hw,
+ ret_val = e1000e_phy_has_link_generic(hw,
COPPER_LINK_UP_LIMIT,
10,
&link);
@@ -858,8 +858,8 @@ s32 e1000_setup_copper_link(struct e1000_hw *hw)
if (link) {
hw_dbg(hw, "Valid link established!!!\n");
- e1000_config_collision_dist(hw);
- ret_val = e1000_config_fc_after_link_up(hw);
+ e1000e_config_collision_dist(hw);
+ ret_val = e1000e_config_fc_after_link_up(hw);
} else {
hw_dbg(hw, "Unable to establish link!!!\n");
}
@@ -868,14 +868,14 @@ s32 e1000_setup_copper_link(struct e1000_hw *hw)
}
/**
- * e1000_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY
+ * e1000e_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY
* @hw: pointer to the HW structure
*
* Calls the PHY setup function to force speed and duplex. Clears the
* auto-crossover to force MDI manually. Waits for link and returns
* successful if link up is successful, else -E1000_ERR_PHY (-2).
**/
-s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw)
+s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
@@ -886,7 +886,7 @@ s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw)
if (ret_val)
return ret_val;
- e1000_phy_force_speed_duplex_setup(hw, &phy_data);
+ e1000e_phy_force_speed_duplex_setup(hw, &phy_data);
ret_val = e1e_wphy(hw, PHY_CONTROL, phy_data);
if (ret_val)
@@ -913,7 +913,7 @@ s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw)
if (phy->wait_for_link) {
hw_dbg(hw, "Waiting for forced speed/duplex link on IGP phy.\n");
- ret_val = e1000_phy_has_link_generic(hw,
+ ret_val = e1000e_phy_has_link_generic(hw,
PHY_FORCE_LIMIT,
100000,
&link);
@@ -924,7 +924,7 @@ s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw)
hw_dbg(hw, "Link taking longer than expected.\n");
/* Try once more */
- ret_val = e1000_phy_has_link_generic(hw,
+ ret_val = e1000e_phy_has_link_generic(hw,
PHY_FORCE_LIMIT,
100000,
&link);
@@ -936,7 +936,7 @@ s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw)
}
/**
- * e1000_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY
+ * e1000e_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY
* @hw: pointer to the HW structure
*
* Calls the PHY setup function to force speed and duplex. Clears the
@@ -945,7 +945,7 @@ s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw)
* After reset, TX_CLK and CRS on TX must be set. Return successful upon
* successful completion, else return corresponding error code.
**/
-s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw)
+s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
@@ -970,7 +970,7 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw)
if (ret_val)
return ret_val;
- e1000_phy_force_speed_duplex_setup(hw, &phy_data);
+ e1000e_phy_force_speed_duplex_setup(hw, &phy_data);
/* Reset the phy to commit changes. */
phy_data |= MII_CR_RESET;
@@ -984,7 +984,7 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw)
if (phy->wait_for_link) {
hw_dbg(hw, "Waiting for forced speed/duplex link on M88 phy.\n");
- ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
+ ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
100000, &link);
if (ret_val)
return ret_val;
@@ -996,13 +996,13 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw)
ret_val = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT, 0x001d);
if (ret_val)
return ret_val;
- ret_val = e1000_phy_reset_dsp(hw);
+ ret_val = e1000e_phy_reset_dsp(hw);
if (ret_val)
return ret_val;
}
/* Try once more */
- ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
+ ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
100000, &link);
if (ret_val)
return ret_val;
@@ -1035,7 +1035,7 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw)
}
/**
- * e1000_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex
+ * e1000e_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex
* @hw: pointer to the HW structure
* @phy_ctrl: pointer to current value of PHY_CONTROL
*
@@ -1046,7 +1046,7 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw)
* caller must write to the PHY_CONTROL register for these settings to
* take affect.
**/
-void e1000_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)
+void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)
{
struct e1000_mac_info *mac = &hw->mac;
u32 ctrl;
@@ -1089,13 +1089,13 @@ void e1000_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)
hw_dbg(hw, "Forcing 10mb\n");
}
- e1000_config_collision_dist(hw);
+ e1000e_config_collision_dist(hw);
ew32(CTRL, ctrl);
}
/**
- * e1000_set_d3_lplu_state - Sets low power link up state for D3
+ * e1000e_set_d3_lplu_state - Sets low power link up state for D3
* @hw: pointer to the HW structure
* @active: boolean used to enable/disable lplu
*
@@ -1108,7 +1108,7 @@ void e1000_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)
* During driver activity, SmartSpeed should be enabled so performance is
* maintained.
**/
-s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
+s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
@@ -1173,14 +1173,14 @@ s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
}
/**
- * e1000_check_downshift - Checks whether a downshift in speed occured
+ * e1000e_check_downshift - Checks whether a downshift in speed occured
* @hw: pointer to the HW structure
*
* Success returns 0, Failure returns 1
*
* A downshift is detected by querying the PHY link health.
**/
-s32 e1000_check_downshift(struct e1000_hw *hw)
+s32 e1000e_check_downshift(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
@@ -1310,7 +1310,7 @@ static s32 e1000_wait_autoneg(struct e1000_hw *hw)
}
/**
- * e1000_phy_has_link_generic - Polls PHY for link
+ * e1000e_phy_has_link_generic - Polls PHY for link
* @hw: pointer to the HW structure
* @iterations: number of times to poll for link
* @usec_interval: delay between polling attempts
@@ -1318,7 +1318,7 @@ static s32 e1000_wait_autoneg(struct e1000_hw *hw)
*
* Polls the PHY status register for link, 'iterations' number of times.
**/
-s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
+s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
u32 usec_interval, bool *success)
{
s32 ret_val;
@@ -1349,7 +1349,7 @@ s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
}
/**
- * e1000_get_cable_length_m88 - Determine cable length for m88 PHY
+ * e1000e_get_cable_length_m88 - Determine cable length for m88 PHY
* @hw: pointer to the HW structure
*
* Reads the PHY specific status register to retrieve the cable length
@@ -1363,7 +1363,7 @@ s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
* 3 110 - 140 meters
* 4 > 140 meters
**/
-s32 e1000_get_cable_length_m88(struct e1000_hw *hw)
+s32 e1000e_get_cable_length_m88(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
@@ -1384,7 +1384,7 @@ s32 e1000_get_cable_length_m88(struct e1000_hw *hw)
}
/**
- * e1000_get_cable_length_igp_2 - Determine cable length for igp2 PHY
+ * e1000e_get_cable_length_igp_2 - Determine cable length for igp2 PHY
* @hw: pointer to the HW structure
*
* The automatic gain control (agc) normalizes the amplitude of the
@@ -1394,7 +1394,7 @@ s32 e1000_get_cable_length_m88(struct e1000_hw *hw)
* into a lookup table to obtain the approximate cable length
* for each channel.
**/
-s32 e1000_get_cable_length_igp_2(struct e1000_hw *hw)
+s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
@@ -1451,7 +1451,7 @@ s32 e1000_get_cable_length_igp_2(struct e1000_hw *hw)
}
/**
- * e1000_get_phy_info_m88 - Retrieve PHY information
+ * e1000e_get_phy_info_m88 - Retrieve PHY information
* @hw: pointer to the HW structure
*
* Valid for only copper links. Read the PHY status register (sticky read)
@@ -1460,7 +1460,7 @@ s32 e1000_get_cable_length_igp_2(struct e1000_hw *hw)
* special status register to determine MDI/MDIx and current speed. If
* speed is 1000, then determine cable length, local and remote receiver.
**/
-s32 e1000_get_phy_info_m88(struct e1000_hw *hw)
+s32 e1000e_get_phy_info_m88(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
@@ -1472,7 +1472,7 @@ s32 e1000_get_phy_info_m88(struct e1000_hw *hw)
return -E1000_ERR_CONFIG;
}
- ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
+ ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
if (ret_val)
return ret_val;
@@ -1525,7 +1525,7 @@ s32 e1000_get_phy_info_m88(struct e1000_hw *hw)
}
/**
- * e1000_get_phy_info_igp - Retrieve igp PHY information
+ * e1000e_get_phy_info_igp - Retrieve igp PHY information
* @hw: pointer to the HW structure
*
* Read PHY status to determine if link is up. If link is up, then
@@ -1533,14 +1533,14 @@ s32 e1000_get_phy_info_m88(struct e1000_hw *hw)
* PHY port status to determine MDI/MDIx and speed. Based on the speed,
* determine on the cable length, local and remote receiver.
**/
-s32 e1000_get_phy_info_igp(struct e1000_hw *hw)
+s32 e1000e_get_phy_info_igp(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
u16 data;
bool link;
- ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
+ ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
if (ret_val)
return ret_val;
@@ -1588,13 +1588,13 @@ s32 e1000_get_phy_info_igp(struct e1000_hw *hw)
}
/**
- * e1000_phy_sw_reset - PHY software reset
+ * e1000e_phy_sw_reset - PHY software reset
* @hw: pointer to the HW structure
*
* Does a software reset of the PHY by reading the PHY control register and
* setting/write the control register reset bit to the PHY.
**/
-s32 e1000_phy_sw_reset(struct e1000_hw *hw)
+s32 e1000e_phy_sw_reset(struct e1000_hw *hw)
{
s32 ret_val;
u16 phy_ctrl;
@@ -1614,7 +1614,7 @@ s32 e1000_phy_sw_reset(struct e1000_hw *hw)
}
/**
- * e1000_phy_hw_reset_generic - PHY hardware reset
+ * e1000e_phy_hw_reset_generic - PHY hardware reset
* @hw: pointer to the HW structure
*
* Verify the reset block is not blocking us from resetting. Acquire
@@ -1622,7 +1622,7 @@ s32 e1000_phy_sw_reset(struct e1000_hw *hw)
* bit in the PHY. Wait the appropriate delay time for the device to
* reset and relase the semaphore (if necessary).
**/
-s32 e1000_phy_hw_reset_generic(struct e1000_hw *hw)
+s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
@@ -1653,13 +1653,13 @@ s32 e1000_phy_hw_reset_generic(struct e1000_hw *hw)
}
/**
- * e1000_get_cfg_done - Generic configuration done
+ * e1000e_get_cfg_done - Generic configuration done
* @hw: pointer to the HW structure
*
* Generic function to wait 10 milli-seconds for configuration to complete
* and return success.
**/
-s32 e1000_get_cfg_done(struct e1000_hw *hw)
+s32 e1000e_get_cfg_done(struct e1000_hw *hw)
{
mdelay(10);
return 0;
@@ -1698,12 +1698,12 @@ static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw)
}
/**
- * e1000_get_phy_type_from_id - Get PHY type from id
+ * e1000e_get_phy_type_from_id - Get PHY type from id
* @phy_id: phy_id read from the phy
*
* Returns the phy type from the id.
**/
-enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id)
+enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id)
{
enum e1000_phy_type phy_type = e1000_phy_unknown;
@@ -1736,13 +1736,13 @@ enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id)
}
/**
- * e1000_commit_phy - Soft PHY reset
+ * e1000e_commit_phy - Soft PHY reset
* @hw: pointer to the HW structure
*
* Performs a soft PHY reset on those that apply. This is a function pointer
* entry point called by drivers.
**/
-s32 e1000_commit_phy(struct e1000_hw *hw)
+s32 e1000e_commit_phy(struct e1000_hw *hw)
{
if (hw->phy.ops.commit_phy)
return hw->phy.ops.commit_phy(hw);
^ permalink raw reply related
* [PATCH 3/6] e1000e: Use dma_alloc_coherent where possible
From: Auke Kok @ 2007-08-10 20:00 UTC (permalink / raw)
To: jeff; +Cc: netdev, akpm, andi
In-Reply-To: <20070810200038.21509.77815.stgit@localhost.localdomain>
Instead of using pci_alloc_consistent at GFP_ATOMIC we can be
more reliable at startup and use dma_alloc_coherent instead with
GFP_KERNEL.
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e1000e/ethtool.c | 16 ++++++++--------
drivers/net/e1000e/netdev.c | 9 ++++++---
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index c9d74a8..d184116 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -962,13 +962,13 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter)
}
if (tx_ring->desc) {
- pci_free_consistent(pdev, tx_ring->size, tx_ring->desc,
- tx_ring->dma);
+ dma_free_coherent(&pdev->dev, tx_ring->size, tx_ring->desc,
+ tx_ring->dma);
tx_ring->desc = NULL;
}
if (rx_ring->desc) {
- pci_free_consistent(pdev, rx_ring->size, rx_ring->desc,
- rx_ring->dma);
+ dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc,
+ rx_ring->dma);
rx_ring->desc = NULL;
}
@@ -1004,8 +1004,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc);
tx_ring->size = ALIGN(tx_ring->size, 4096);
- tx_ring->desc = pci_alloc_consistent(pdev, tx_ring->size,
- &tx_ring->dma);
+ tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size,
+ &tx_ring->dma, GFP_KERNEL);
if (!tx_ring->desc) {
ret_val = 2;
goto err_nomem;
@@ -1065,8 +1065,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
memset(rx_ring->buffer_info, 0, size);
rx_ring->size = rx_ring->count * sizeof(struct e1000_rx_desc);
- rx_ring->desc = pci_alloc_consistent(pdev, rx_ring->size,
- &rx_ring->dma);
+ rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size,
+ &rx_ring->dma, GFP_KERNEL);
if (!rx_ring->desc) {
ret_val = 5;
goto err_nomem;
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index d711e14..51c9024 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1344,7 +1344,8 @@ static int e1000_alloc_ring_dma(struct e1000_adapter *adapter,
{
struct pci_dev *pdev = adapter->pdev;
- ring->desc = pci_alloc_consistent(pdev, ring->size, &ring->dma);
+ ring->desc = dma_alloc_coherent(&pdev->dev, ring->size, &ring->dma,
+ GFP_KERNEL);
if (!ring->desc)
return -ENOMEM;
@@ -1479,7 +1480,8 @@ void e1000e_free_tx_resources(struct e1000_adapter *adapter)
vfree(tx_ring->buffer_info);
tx_ring->buffer_info = NULL;
- pci_free_consistent(pdev, tx_ring->size, tx_ring->desc, tx_ring->dma);
+ dma_free_coherent(&pdev->dev, tx_ring->size, tx_ring->desc,
+ tx_ring->dma);
tx_ring->desc = NULL;
}
@@ -1503,7 +1505,8 @@ void e1000e_free_rx_resources(struct e1000_adapter *adapter)
kfree(rx_ring->ps_pages);
rx_ring->ps_pages = NULL;
- pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma);
+ dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc,
+ rx_ring->dma);
rx_ring->desc = NULL;
}
^ permalink raw reply related
* [PATCH 4/6] e1000e: Use time_after to account for jiffies wrapping
From: Auke Kok @ 2007-08-10 20:00 UTC (permalink / raw)
To: jeff; +Cc: netdev, akpm, andi
In-Reply-To: <20070810200038.21509.77815.stgit@localhost.localdomain>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e1000e/ethtool.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index d184116..d14cc4b 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1411,7 +1411,7 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
* enough time to complete the receives, if it's
* exceeded, break and error off
*/
- } while (good_cnt < 64 && jiffies < (time + 20));
+ } while ((good_cnt < 64) && !time_after(jiffies, time + 20));
if (good_cnt != 64) {
ret_val = 13; /* ret_val is the same as mis-compare */
break;
^ permalink raw reply related
* [PATCH 5/6] e1000e: error handling for pci_map_single calls.
From: Auke Kok @ 2007-08-10 20:01 UTC (permalink / raw)
To: jeff; +Cc: netdev, akpm, andi
In-Reply-To: <20070810200038.21509.77815.stgit@localhost.localdomain>
Add proper error handling for various callers of pci_map_single.
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e1000e/e1000.h | 2 ++
drivers/net/e1000e/ethtool.c | 16 +++++++++++---
drivers/net/e1000e/netdev.c | 49 +++++++++++++++++++++++++++++++++++++++---
3 files changed, 61 insertions(+), 6 deletions(-)
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index 3475e48..e3cd877 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -220,6 +220,7 @@ struct e1000_adapter {
u32 tx_fifo_head;
u32 tx_head_addr;
u32 tx_fifo_size;
+ u32 tx_dma_failed;
/*
* RX
@@ -241,6 +242,7 @@ struct e1000_adapter {
u64 gorcl_old;
u32 gorcl;
u32 alloc_rx_buff_failed;
+ u32 rx_dma_failed;
unsigned int rx_ps_pages;
u16 rx_ps_bsize0;
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index d14cc4b..0e80406 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -91,6 +91,8 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
{ "tx_smbus", E1000_STAT(stats.mgptc) },
{ "rx_smbus", E1000_STAT(stats.mgprc) },
{ "dropped_smbus", E1000_STAT(stats.mgpdc) },
+ { "rx_dma_failed", E1000_STAT(rx_dma_failed) },
+ { "tx_dma_failed", E1000_STAT(tx_dma_failed) },
};
#define E1000_GLOBAL_STATS_LEN \
@@ -1042,6 +1044,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
tx_ring->buffer_info[i].dma =
pci_map_single(pdev, skb->data, skb->len,
PCI_DMA_TODEVICE);
+ if (pci_dma_mapping_error(tx_ring->buffer_info[i].dma)) {
+ ret_val = 4;
+ goto err_nomem;
+ }
tx_desc->buffer_addr = cpu_to_le64(
tx_ring->buffer_info[i].dma);
tx_desc->lower.data = cpu_to_le32(skb->len);
@@ -1059,7 +1065,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
size = rx_ring->count * sizeof(struct e1000_buffer);
rx_ring->buffer_info = kmalloc(size, GFP_KERNEL);
if (!rx_ring->buffer_info) {
- ret_val = 4;
+ ret_val = 5;
goto err_nomem;
}
memset(rx_ring->buffer_info, 0, size);
@@ -1068,7 +1074,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size,
&rx_ring->dma, GFP_KERNEL);
if (!rx_ring->desc) {
- ret_val = 5;
+ ret_val = 6;
goto err_nomem;
}
memset(rx_ring->desc, 0, rx_ring->size);
@@ -1093,7 +1099,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
skb = alloc_skb(2048 + NET_IP_ALIGN, GFP_KERNEL);
if (!skb) {
- ret_val = 6;
+ ret_val = 7;
goto err_nomem;
}
skb_reserve(skb, NET_IP_ALIGN);
@@ -1101,6 +1107,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
rx_ring->buffer_info[i].dma =
pci_map_single(pdev, skb->data, 2048,
PCI_DMA_FROMDEVICE);
+ if (pci_dma_mapping_error(rx_ring->buffer_info[i].dma)) {
+ ret_val = 8;
+ goto err_nomem;
+ }
rx_desc->buffer_addr =
cpu_to_le64(rx_ring->buffer_info[i].dma);
memset(skb->data, 0x00, skb->len);
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 51c9024..8ebe238 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -195,6 +195,11 @@ map_skb:
buffer_info->dma = pci_map_single(pdev, skb->data,
adapter->rx_buffer_len,
PCI_DMA_FROMDEVICE);
+ if (pci_dma_mapping_error(buffer_info->dma)) {
+ dev_err(&pdev->dev, "RX DMA map failed\n");
+ adapter->rx_dma_failed++;
+ break;
+ }
rx_desc = E1000_RX_DESC(*rx_ring, i);
rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
@@ -255,6 +260,13 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
ps_page->page,
0, PAGE_SIZE,
PCI_DMA_FROMDEVICE);
+ if (pci_dma_mapping_error(
+ ps_page->dma)) {
+ dev_err(&adapter->pdev->dev,
+ "RX DMA page map failed\n");
+ adapter->rx_dma_failed++;
+ goto no_buffers;
+ }
}
/*
* Refresh the desc even if buffer_addrs
@@ -286,6 +298,14 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
buffer_info->dma = pci_map_single(pdev, skb->data,
adapter->rx_ps_bsize0,
PCI_DMA_FROMDEVICE);
+ if (pci_dma_mapping_error(buffer_info->dma)) {
+ dev_err(&pdev->dev, "RX DMA map failed\n");
+ adapter->rx_dma_failed++;
+ /* cleanup skb */
+ dev_kfree_skb_any(skb);
+ buffer_info->skb = NULL;
+ break;
+ }
rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma);
@@ -374,6 +394,11 @@ check_page:
buffer_info->page, 0,
PAGE_SIZE,
PCI_DMA_FROMDEVICE);
+ if (pci_dma_mapping_error(buffer_info->dma)) {
+ dev_err(&adapter->pdev->dev, "RX DMA page map failed\n");
+ adapter->rx_dma_failed++;
+ break;
+ }
rx_desc = E1000_RX_DESC(*rx_ring, i);
rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
@@ -3214,6 +3239,11 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
skb->data + offset,
size,
PCI_DMA_TODEVICE);
+ if (pci_dma_mapping_error(buffer_info->dma)) {
+ dev_err(&adapter->pdev->dev, "TX DMA map failed\n");
+ adapter->tx_dma_failed++;
+ return -1;
+ }
buffer_info->next_to_watch = i;
len -= size;
@@ -3247,6 +3277,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
offset,
size,
PCI_DMA_TODEVICE);
+ if (pci_dma_mapping_error(buffer_info->dma)) {
+ dev_err(&adapter->pdev->dev,
+ "TX DMA page map failed\n");
+ adapter->tx_dma_failed++;
+ return -1;
+ }
+
buffer_info->next_to_watch = i;
len -= size;
@@ -3512,9 +3549,15 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
if (skb->protocol == htons(ETH_P_IP))
tx_flags |= E1000_TX_FLAGS_IPV4;
- e1000_tx_queue(adapter, tx_flags,
- e1000_tx_map(adapter, skb, first,
- max_per_txd, nr_frags, mss));
+ count = e1000_tx_map(adapter, skb, first, max_per_txd, nr_frags, mss);
+ if (count < 0) {
+ /* handle pci_map_single() error in e1000_tx_map */
+ dev_kfree_skb_any(skb);
+ spin_unlock_irqrestore(&adapter->tx_queue_lock, irq_flags);
+ return NETDEV_TX_BUSY;
+ }
+
+ e1000_tx_queue(adapter, tx_flags, count);
netdev->trans_start = jiffies;
^ permalink raw reply related
* [PATCH 6/6] e1000e: Remove two compile warnings
From: Auke Kok @ 2007-08-10 20:01 UTC (permalink / raw)
To: jeff; +Cc: netdev, akpm, andi
In-Reply-To: <20070810200038.21509.77815.stgit@localhost.localdomain>
CC [M] drivers/net/e1000e/lib.o
drivers/net/e1000e/lib.c: In function 'e1000e_read_nvm_eerd':
drivers/net/e1000e/lib.c:1941: warning: 'ret_val' may be used uninitialized
in this function
CC [M] drivers/net/e1000e/phy.o
drivers/net/e1000e/phy.c: In function 'e1000e_phy_has_link_generic':
drivers/net/e1000e/phy.c:1324: warning: 'ret_val' may be used
uninitialized in this function
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e1000e/lib.c | 2 +-
drivers/net/e1000e/phy.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index a04c1e4..6645c21 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -1938,7 +1938,7 @@ s32 e1000e_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
{
struct e1000_nvm_info *nvm = &hw->nvm;
u32 i, eerd = 0;
- s32 ret_val;
+ s32 ret_val = 0;
/* A check for invalid values: offset too large, too many words,
* and not enough words. */
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 1efb47a..7932318 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -1321,7 +1321,7 @@ static s32 e1000_wait_autoneg(struct e1000_hw *hw)
s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
u32 usec_interval, bool *success)
{
- s32 ret_val;
+ s32 ret_val = 0;
u16 i, phy_status;
for (i = 0; i < iterations; i++) {
^ permalink raw reply related
* Re: [PATCH 1/24] make atomic_read() behave consistently on alpha
From: Segher Boessenkool @ 2007-08-10 20:07 UTC (permalink / raw)
To: Herbert Xu
Cc: paulmck, heiko.carstens, horms, linux-kernel, csnook, rpjday,
netdev, ak, cfriesen, akpm, torvalds, jesper.juhl, linux-arch,
zlynx, schwidefsky, davem, wensong, wjiang
In-Reply-To: <E1IJPkg-0000x0-00@gondolin.me.apana.org.au>
>> The compiler is within its rights to read a 32-bit quantity 16 bits at
>> at time, even on a 32-bit machine. I would be glad to help pummel any
>> compiler writer that pulls such a dirty trick, but the C standard
>> really
>> does permit this.
>
> Code all over the kernel assumes that 32-bit reads/writes
> are atomic so while such a compiler might be legal it certainly
> can't compile Linux.
That means GCC cannot compile Linux; it already optimises
some accesses to scalars to smaller accesses when it knows
it is allowed to. Not often though, since it hardly ever
helps in the cost model it employs.
Segher
^ permalink raw reply
* Re: [PATCH] e1000e: New pci-express e1000 driver (currently for ICH9 devices only)
From: Kok, Auke @ 2007-08-10 20:17 UTC (permalink / raw)
To: Andi Kleen
Cc: Kok, Auke, Jeff Garzik, NetDev, Andrew Morton, Arjan van de Ven,
Ronciak, John
In-Reply-To: <p737io8caai.fsf@bingen.suse.de>
Andi Kleen wrote:
> "Kok, Auke" <auke-jan.h.kok@intel.com> writes:
>
>> All,
>>
>> Another update on e1000e. Many thanks to Jeff for helping out and
>> getting this going forward. The driver is unfortunately still too
>> large to post, so please use the URL's below to review:
>
> Just some things I noticed; no comprehensive review
OK, I just pushed a bunch of patches to Jeff to address some of this...
> +static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw)
> +{
> + u32 temp;
> +
> + e1000_clear_hw_cntrs_base(hw);
>
> Would be much nicer with a table and a loop. Same in similar functions.
I'm leaving this for now. We've always done it this way and while I tend to
agree it could be more organized, it's a low priority for me to do stuff like
this for now :)
> + tx_ring->buffer_info[i].dma =
> + pci_map_single(pdev, skb->data, skb->len,
> + PCI_DMA_TODEVICE);
>
> Misses error handling. Multiple occurrences.
I tried to address all of these properly. It's interesting to see how few
drivers do this properly. I wonder how much it impacts performance and if it is
really worth it.
> + rx_ring->desc = pci_alloc_consistent(pdev, rx_ring->size,
> + &rx_ring->dma);
>
> If you use dma_alloc_coherent and don't hold a lock (I think you do
> not) you could specify GFP_KERNEL and be more reliable. p_a_c()
> unfortunately defaults to flakey GFP_ATOMIC for historical reasons
> Multiple occurrences.
done, seems like a very good idea indead.
> + skb = alloc_skb(2048 + NET_IP_ALIGN, GFP_KERNEL);
>
> alloc_skb already aligns to the next cache line, more might be not needed.
> The allocation is quite wasteful because you'll get a full 4K page with
> most of it unused.
>
> I remember this being discussed some time ago; it's sad even newer e1000
> problems still have the same issue
not an e1000 problem. All drivers do this as it's a significant gain. See
original thread from 2004 here:
http://lwn.net/Articles/89770/
> It's unclear why you clear the skbs here.
>
> + } while (good_cnt < 64 && jiffies < (time + 20));
> Doesn't handle jiffies wrap; use time_*
> More occurrences all over.
made it use time_after()
> + mod_timer(&adapter->blink_timer, jiffies + E1000_ID_INTERVAL);
> Should use round_jiffies to avoid wakeups
I don't expect people to have their leds blinking 24/7 while the rtnl lock is
held, so those 2 extra wakeups per second are nice to have at proper intervals.
> +s32 e1000_get_bus_info_pcie(struct e1000_hw *hw)
> A couple of drivers have similar functions. Should be really put
> into a generic function into the PCI layer instead of reinventing the wheel.
>
> + if (ret_val)
> + goto out;
> ...
> +out:
> + return ret_val;
>
> Totally unnecessary goto. Lots of occurrences.
cleaned up.
> /* Force memory writes to complete before letting h/w
> + * know there are new descriptors to fetch. (Only
> + * applicable for weak-ordered memory model archs,
> + * such as IA-64). */
> + wmb();
>
> That is not what a memory barrier does. It just orders the writes,
> but doesn't actually flush them.
>
> + /* Make buffer alignment 2 beyond a 16 byte boundary
> + * this will result in a 16 byte aligned IP header after
> + * the 14 byte MAC header is removed
> + */
> + skb_reserve(skb, NET_IP_ALIGN);
> At least on x86 (or other architectures with cheap unalignment
> support) it seems like a bad trade off :- it forces the NIC to
> do R-M-W to get these 14 bytes and it doesn't help the CPU
> too much.
>
> Have you tried if performance improves if the beginning is just
> cache line aligned?
I'll need to look into that, but as said above and as can be seen in the kernel
code, on PPC (e.g.) NET_IP_ALIGN is zero due to the expensiveness of this
alignment, and so we have that problem covered.
> + /* It must be a TCP or UDP packet with a valid checksum */
> You could set skb->protocol then if you know.
> If the hw also tells you if the packet was unicast for you then
> you could also set skb->pkt_type and avoid an early cache miss.
>
> In general you don't seem to care about PCI posting too much.
> I guess it's ok on Intel chipsets, but other chipsets do buffer
> a lot.
we've added (over time) some write flushes in problematic areas, I think we're
OK currently.
>> E1000_SUCCESS everywhere
> It is weird to have an own define for this. How about just 0 as
> the rest of the kernel?
all gone.
thanks for the comments,
Auke
^ permalink raw reply
* Re: 2.6.23-rc2-mm2 -- conntrack divide error
From: Jiri Slaby @ 2007-08-10 20:22 UTC (permalink / raw)
To: Gabriel C; +Cc: Dave Young, Andrew Morton, linux-kernel, netdev
In-Reply-To: <46BC49C3.6020100@googlemail.com>
Gabriel C napsal(a):
> Dave Young wrote:
>>> On 8/10/07, Dave Young <hidave.darkstar@gmail.com> wrote:
>>>> On 8/10/07, Andrew Morton <akpm@linux-foundation.org> wrote:
>>>> On Fri, 10 Aug 2007 16:18:38 +0800 "Dave Young" <hidave.darkstar@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>> 2.6.23-rc2-mm2:
>>>>> config with CONFIG_NF_CONNTRACK_AMANDA=y
>>>>> boot oops:
>>>>>
>>>>> hand copyed :
>>>>> the EIP: helper_hash
>>>>>
>>>>> backtrace:
>>>>> do_basic_setup
>>>>> ...
>>>>> nf_conntrack_amanda_init
>>>>> error_code
>>>>> do_vivide_error
>>>>> ...
>>>>>
>>>> cc netdev
>>>>
>>>> please send config
>>>>
>>>> presumably nf_ct_helper_hsize is zero
I think so. 2.6.23-rc2-mm1 seemed be OK.
>>>>
>>>> I'd have thought that the same bug would be present in mainline - there's
>>>> nothing in git-net.patch.
>>>>
>>>> (hunts around, discovers that there's a net-2.6.24 tree now. Bah)
>>>>
>>> MY config file for test:
>>> -----cut---
>> Hi,
>> config the CONFIG_NF_CONNTRACK_AMANDA=m, reboot , still oops, but this
>> time the point is nf_conntrack_ftp_init, (I doubt the
>> nf_conntrack_core is not initialized.)
>>
>> boot with vga_ask and select 80x60, copyed more infomations:
>> ---------pre oops:-----------
>> sysctl table check failed: /net/netfilter/nf_conntrack_generic_timeout
>> .3.19.13 Missing strategy
>> ...
>> nf_conntrack_14_proto_sctp4 protocol register failed
>> ...
>> ---------oops:----------------
>> divide error: 0000 [#1] SMP
>> EIP: 0060: [<c088477b>] EFLAGS 00010246
>> Process swapper
>> ...
>> nf_conntrack_ftp_init
>> ...
>>
>> Code: <...>
>> EIP <...> helper_hash +0x1b/0x24
>
> Does not Oops here but is broken.
My $0.02:
http://www.fi.muni.cz/~xslaby/sklad/panics/nf_oops.png
http://www.fi.muni.cz/~xslaby/sklad/panics/nf_oops.config
--
Jiri Slaby (jirislaby@gmail.com)
Faculty of Informatics, Masaryk University
^ permalink raw reply
* [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls
From: Jeff Garzik @ 2007-08-10 20:24 UTC (permalink / raw)
To: netdev; +Cc: davem, LKML
Also, adds support for the first flag, LRO.
Earlier version of this patch posted about 12 hours ago.
commit 84bf82f38dacde0fa86986e23c061728e819810e
Author: Jeff Garzik <jeff@garzik.org>
Date: Fri Aug 10 05:27:23 2007 -0400
[ETHTOOL] Add ETHTOOL_[GS]FLAGS sub-ioctls
Signed-off-by: Jeff Garzik <jeff@garzik.org>
include/linux/ethtool.h | 21 +++++++++++++++
include/linux/netdevice.h | 1
net/core/ethtool.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 83 insertions(+)
84bf82f38dacde0fa86986e23c061728e819810e
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 23ccea8..0e5de2f 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -256,6 +256,19 @@ struct ethtool_perm_addr {
__u8 data[0];
};
+/* boolean flags controlling per-interface behavior characteristics.
+ * When reading, the flag indicates whether or not a certain behavior
+ * is enabled/present. When writing, the flag indicates whether
+ * or not the driver should turn on (set) or off (clear) a behavior.
+ *
+ * Some behaviors may read-only (unconditionally absent or present).
+ * If such is the case, return EINVAL in the set-flags operation if the
+ * flag differs from the read-only value.
+ */
+enum ethtool_flags {
+ ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
+};
+
#ifdef __KERNEL__
struct net_device;
@@ -272,6 +285,8 @@ u32 ethtool_op_get_tso(struct net_device *dev);
int ethtool_op_set_tso(struct net_device *dev, u32 data);
u32 ethtool_op_get_ufo(struct net_device *dev);
int ethtool_op_set_ufo(struct net_device *dev, u32 data);
+u32 ethtool_op_get_flags(struct net_device *dev);
+int ethtool_op_set_flags(struct net_device *dev, u32 data);
/**
* ðtool_ops - Alter and report network device settings
@@ -307,6 +322,8 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data);
* get_strings: Return a set of strings that describe the requested objects
* phys_id: Identify the device
* get_stats: Return statistics about the device
+ * get_flags: get 32-bit flags bitmap
+ * set_flags: set 32-bit flags bitmap
*
* Description:
*
@@ -369,6 +386,8 @@ struct ethtool_ops {
void (*complete)(struct net_device *);
u32 (*get_ufo)(struct net_device *);
int (*set_ufo)(struct net_device *, u32);
+ u32 (*get_flags)(struct net_device *);
+ int (*set_flags)(struct net_device *, u32);
};
#endif /* __KERNEL__ */
@@ -410,6 +429,8 @@ struct ethtool_ops {
#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
+#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
+#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
/* compatibility with older code */
#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4a616d7..559a4dc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -341,6 +341,7 @@ struct net_device
#define NETIF_F_GSO 2048 /* Enable software GSO. */
#define NETIF_F_LLTX 4096 /* LockLess TX */
#define NETIF_F_MULTI_QUEUE 16384 /* Has multiple TX/RX queues */
+#define NETIF_F_LRO 32768 /* large receive offload */
/* Segmentation offload features */
#define NETIF_F_GSO_SHIFT 16
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 2ab0a60..6e8563e 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -109,6 +109,32 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data)
return 0;
}
+/* the following list of flags are the same as their associated
+ * NETIF_F_xxx values in include/linux/netdevice.h
+ */
+static const u32 flags_dup_features =
+ ETH_FLAG_LRO;
+
+u32 ethtool_op_get_flags(struct net_device *dev)
+{
+ /* in the future, this function will probably contain additional
+ * handling for flags which are not so easily handled
+ * by a simple masking operation
+ */
+
+ return dev->features & flags_dup_features;
+}
+
+int ethtool_op_set_flags(struct net_device *dev, u32 data)
+{
+ if (data & ETH_FLAG_LRO)
+ dev->features |= NETIF_F_LRO;
+ else
+ dev->features &= ~NETIF_F_LRO;
+
+ return 0;
+}
+
/* Handlers for each ethtool command */
static int ethtool_get_settings(struct net_device *dev, void __user *useraddr)
@@ -783,6 +809,33 @@ static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr)
return 0;
}
+static int ethtool_get_flags(struct net_device *dev, char __user *useraddr)
+{
+ struct ethtool_value edata = { ETHTOOL_GFLAGS };
+
+ if (!dev->ethtool_ops->get_flags)
+ return -EOPNOTSUPP;
+
+ edata.data = dev->ethtool_ops->get_flags(dev);
+
+ if (copy_to_user(useraddr, &edata, sizeof(edata)))
+ return -EFAULT;
+ return 0;
+}
+
+static int ethtool_set_flags(struct net_device *dev, char __user *useraddr)
+{
+ struct ethtool_value edata;
+
+ if (!dev->ethtool_ops->set_flags)
+ return -EOPNOTSUPP;
+
+ if (copy_from_user(&edata, useraddr, sizeof(edata)))
+ return -EFAULT;
+
+ return dev->ethtool_ops->set_flags(dev, edata.data);
+}
+
/* The main entry point in this file. Called from net/core/dev.c */
int dev_ethtool(struct ifreq *ifr)
@@ -935,6 +988,12 @@ int dev_ethtool(struct ifreq *ifr)
case ETHTOOL_SGSO:
rc = ethtool_set_gso(dev, useraddr);
break;
+ case ETHTOOL_GFLAGS:
+ rc = ethtool_get_flags(dev, useraddr);
+ break;
+ case ETHTOOL_SFLAGS:
+ rc = ethtool_set_flags(dev, useraddr);
+ break;
default:
rc = -EOPNOTSUPP;
}
@@ -960,3 +1019,5 @@ EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum);
EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum);
EXPORT_SYMBOL(ethtool_op_set_ufo);
EXPORT_SYMBOL(ethtool_op_get_ufo);
+EXPORT_SYMBOL(ethtool_op_set_flags);
+EXPORT_SYMBOL(ethtool_op_get_flags);
^ permalink raw reply related
* [PATCH 2/4] ethtool: introduce get_sset_count
From: Jeff Garzik @ 2007-08-10 20:25 UTC (permalink / raw)
To: netdev; +Cc: davem, LKML
In-Reply-To: <20070810202426.GA25050@havoc.gtf.org>
Required prep for the priv-flags changeset (next patch), which also uses
ethtool string sets.
commit 86fe0ff220a795c82aa9dea5dc4b7359519a1366
Author: Jeff Garzik <jeff@garzik.org>
Date: Fri Aug 10 15:49:21 2007 -0400
[ETHTOOL] Introduce get_sset_count. Obsolete get_stats_count, self_test_count
Signed-off-by: Jeff Garzik <jeff@garzik.org>
include/linux/ethtool.h | 7 ++-
net/core/ethtool.c | 95 +++++++++++++++++++++++++++++++++++-------------
2 files changed, 75 insertions(+), 27 deletions(-)
86fe0ff220a795c82aa9dea5dc4b7359519a1366
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 0e5de2f..f617998 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -376,11 +376,9 @@ struct ethtool_ops {
int (*set_sg)(struct net_device *, u32);
u32 (*get_tso)(struct net_device *);
int (*set_tso)(struct net_device *, u32);
- int (*self_test_count)(struct net_device *);
void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
void (*get_strings)(struct net_device *, u32 stringset, u8 *);
int (*phys_id)(struct net_device *, u32);
- int (*get_stats_count)(struct net_device *);
void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
int (*begin)(struct net_device *);
void (*complete)(struct net_device *);
@@ -388,6 +386,11 @@ struct ethtool_ops {
int (*set_ufo)(struct net_device *, u32);
u32 (*get_flags)(struct net_device *);
int (*set_flags)(struct net_device *, u32);
+ int (*get_sset_count)(struct net_device *, int);
+
+ /* the following hooks are obsolete */
+ int (*self_test_count)(struct net_device *);/* use get_sset_count */
+ int (*get_stats_count)(struct net_device *);/* use get_sset_count */
};
#endif /* __KERNEL__ */
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 6e8563e..2b366a5 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -179,10 +179,23 @@ static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr)
info.cmd = ETHTOOL_GDRVINFO;
ops->get_drvinfo(dev, &info);
- if (ops->self_test_count)
- info.testinfo_len = ops->self_test_count(dev);
- if (ops->get_stats_count)
- info.n_stats = ops->get_stats_count(dev);
+ if (ops->get_sset_count) {
+ int rc;
+
+ rc = ops->get_sset_count(dev, ETH_SS_TEST);
+ if (rc >= 0)
+ info.testinfo_len = rc;
+ rc = ops->get_sset_count(dev, ETH_SS_STATS);
+ if (rc >= 0)
+ info.n_stats = rc;
+ } else {
+ /* code path for obsolete hooks */
+
+ if (ops->self_test_count)
+ info.testinfo_len = ops->self_test_count(dev);
+ if (ops->get_stats_count)
+ info.n_stats = ops->get_stats_count(dev);
+ }
if (ops->get_regs_len)
info.regdump_len = ops->get_regs_len(dev);
if (ops->get_eeprom_len)
@@ -669,16 +682,27 @@ static int ethtool_self_test(struct net_device *dev, char __user *useraddr)
struct ethtool_test test;
const struct ethtool_ops *ops = dev->ethtool_ops;
u64 *data;
- int ret;
+ int ret, test_len;
- if (!ops->self_test || !ops->self_test_count)
+ if (!ops->self_test)
+ return -EOPNOTSUPP;
+ if (!ops->get_sset_count && !ops->self_test_count)
return -EOPNOTSUPP;
+ if (ops->get_sset_count)
+ test_len = ops->get_sset_count(dev, ETH_SS_TEST);
+ else
+ /* code path for obsolete hook */
+ test_len = ops->self_test_count(dev);
+ if (test_len < 0)
+ return test_len;
+ WARN_ON(test_len == 0);
+
if (copy_from_user(&test, useraddr, sizeof(test)))
return -EFAULT;
- test.len = ops->self_test_count(dev);
- data = kmalloc(test.len * sizeof(u64), GFP_USER);
+ test.len = test_len;
+ data = kmalloc(test_len * sizeof(u64), GFP_USER);
if (!data)
return -ENOMEM;
@@ -710,19 +734,29 @@ static int ethtool_get_strings(struct net_device *dev, void __user *useraddr)
if (copy_from_user(&gstrings, useraddr, sizeof(gstrings)))
return -EFAULT;
- switch (gstrings.string_set) {
- case ETH_SS_TEST:
- if (!ops->self_test_count)
- return -EOPNOTSUPP;
- gstrings.len = ops->self_test_count(dev);
- break;
- case ETH_SS_STATS:
- if (!ops->get_stats_count)
- return -EOPNOTSUPP;
- gstrings.len = ops->get_stats_count(dev);
- break;
- default:
- return -EINVAL;
+ if (ops->get_sset_count) {
+ ret = ops->get_sset_count(dev, gstrings.string_set);
+ if (ret < 0)
+ return ret;
+
+ gstrings.len = ret;
+ } else {
+ /* code path for obsolete hooks */
+
+ switch (gstrings.string_set) {
+ case ETH_SS_TEST:
+ if (!ops->self_test_count)
+ return -EOPNOTSUPP;
+ gstrings.len = ops->self_test_count(dev);
+ break;
+ case ETH_SS_STATS:
+ if (!ops->get_stats_count)
+ return -EOPNOTSUPP;
+ gstrings.len = ops->get_stats_count(dev);
+ break;
+ default:
+ return -EINVAL;
+ }
}
data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
@@ -762,16 +796,27 @@ static int ethtool_get_stats(struct net_device *dev, void __user *useraddr)
struct ethtool_stats stats;
const struct ethtool_ops *ops = dev->ethtool_ops;
u64 *data;
- int ret;
+ int ret, n_stats;
- if (!ops->get_ethtool_stats || !ops->get_stats_count)
+ if (!ops->get_ethtool_stats)
return -EOPNOTSUPP;
+ if (!ops->get_sset_count && !ops->get_stats_count)
+ return -EOPNOTSUPP;
+
+ if (ops->get_sset_count)
+ n_stats = ops->get_sset_count(dev, ETH_SS_STATS);
+ else
+ /* code path for obsolete hook */
+ n_stats = ops->get_stats_count(dev);
+ if (n_stats < 0)
+ return n_stats;
+ WARN_ON(n_stats == 0);
if (copy_from_user(&stats, useraddr, sizeof(stats)))
return -EFAULT;
- stats.n_stats = ops->get_stats_count(dev);
- data = kmalloc(stats.n_stats * sizeof(u64), GFP_USER);
+ stats.n_stats = n_stats;
+ data = kmalloc(n_stats * sizeof(u64), GFP_USER);
if (!data)
return -ENOMEM;
^ permalink raw reply related
* [PATCH 3/4] Add ETHTOOL_[GS]PFLAGS sub-ioctls
From: Jeff Garzik @ 2007-08-10 20:26 UTC (permalink / raw)
To: netdev; +Cc: davem, LKML
In-Reply-To: <20070810202426.GA25050@havoc.gtf.org>
Driver-private flags. Driver writer's guide will follow in a reply to this
patch.
commit 4901236cec047029b970261b95e47d6be60f523e
Author: Jeff Garzik <jeff@garzik.org>
Date: Fri Aug 10 15:52:06 2007 -0400
[ETHTOOL] Introduce ->{get,set}_priv_flags, ETHTOOL_[GS]PFLAGS
Signed-off-by: Jeff Garzik <jeff@garzik.org>
include/linux/ethtool.h | 8 +++++++-
net/core/ethtool.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)
4901236cec047029b970261b95e47d6be60f523e
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index f617998..71d4ada 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -39,7 +39,8 @@ struct ethtool_drvinfo {
char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */
/* For PCI devices, use pci_name(pci_dev). */
char reserved1[32];
- char reserved2[16];
+ char reserved2[12];
+ __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
__u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
__u32 testinfo_len;
__u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */
@@ -219,6 +220,7 @@ struct ethtool_pauseparam {
enum ethtool_stringset {
ETH_SS_TEST = 0,
ETH_SS_STATS,
+ ETH_SS_PRIV_FLAGS,
};
/* for passing string sets for data tagging */
@@ -386,6 +388,8 @@ struct ethtool_ops {
int (*set_ufo)(struct net_device *, u32);
u32 (*get_flags)(struct net_device *);
int (*set_flags)(struct net_device *, u32);
+ u32 (*get_priv_flags)(struct net_device *);
+ int (*set_priv_flags)(struct net_device *, u32);
int (*get_sset_count)(struct net_device *, int);
/* the following hooks are obsolete */
@@ -434,6 +438,8 @@ struct ethtool_ops {
#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
+#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
+#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
/* compatibility with older code */
#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 2b366a5..f721e38 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -188,6 +188,9 @@ static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr)
rc = ops->get_sset_count(dev, ETH_SS_STATS);
if (rc >= 0)
info.n_stats = rc;
+ rc = ops->get_sset_count(dev, ETH_SS_PRIV_FLAGS);
+ if (rc >= 0)
+ info.n_priv_flags = rc;
} else {
/* code path for obsolete hooks */
@@ -881,6 +884,33 @@ static int ethtool_set_flags(struct net_device *dev, char __user *useraddr)
return dev->ethtool_ops->set_flags(dev, edata.data);
}
+static int ethtool_get_priv_flags(struct net_device *dev, char __user *useraddr)
+{
+ struct ethtool_value edata = { ETHTOOL_GPFLAGS };
+
+ if (!dev->ethtool_ops->get_priv_flags)
+ return -EOPNOTSUPP;
+
+ edata.data = dev->ethtool_ops->get_priv_flags(dev);
+
+ if (copy_to_user(useraddr, &edata, sizeof(edata)))
+ return -EFAULT;
+ return 0;
+}
+
+static int ethtool_set_priv_flags(struct net_device *dev, char __user *useraddr)
+{
+ struct ethtool_value edata;
+
+ if (!dev->ethtool_ops->set_priv_flags)
+ return -EOPNOTSUPP;
+
+ if (copy_from_user(&edata, useraddr, sizeof(edata)))
+ return -EFAULT;
+
+ return dev->ethtool_ops->set_priv_flags(dev, edata.data);
+}
+
/* The main entry point in this file. Called from net/core/dev.c */
int dev_ethtool(struct ifreq *ifr)
@@ -915,6 +945,8 @@ int dev_ethtool(struct ifreq *ifr)
case ETHTOOL_GPERMADDR:
case ETHTOOL_GUFO:
case ETHTOOL_GGSO:
+ case ETHTOOL_GFLAGS:
+ case ETHTOOL_GPFLAGS:
break;
default:
if (!capable(CAP_NET_ADMIN))
@@ -1039,6 +1071,12 @@ int dev_ethtool(struct ifreq *ifr)
case ETHTOOL_SFLAGS:
rc = ethtool_set_flags(dev, useraddr);
break;
+ case ETHTOOL_GPFLAGS:
+ rc = ethtool_get_priv_flags(dev, useraddr);
+ break;
+ case ETHTOOL_SPFLAGS:
+ rc = ethtool_set_priv_flags(dev, useraddr);
+ break;
default:
rc = -EOPNOTSUPP;
}
^ permalink raw reply related
* Re: [PATCH 1/24] make atomic_read() behave consistently on alpha
From: Paul E. McKenney @ 2007-08-10 20:26 UTC (permalink / raw)
To: Chris Snook
Cc: linux-kernel, linux-arch, torvalds, netdev, akpm, ak,
heiko.carstens, davem, schwidefsky, wensong, horms, wjiang,
cfriesen, zlynx, rpjday, jesper.juhl
In-Reply-To: <46BCC12F.9020803@redhat.com>
On Fri, Aug 10, 2007 at 03:49:03PM -0400, Chris Snook wrote:
> Paul E. McKenney wrote:
> >On Thu, Aug 09, 2007 at 03:24:40PM -0400, Chris Snook wrote:
> >>Paul E. McKenney wrote:
> >>>On Thu, Aug 09, 2007 at 02:13:52PM -0400, Chris Snook wrote:
> >>>>Paul E. McKenney wrote:
> >>>>>On Thu, Aug 09, 2007 at 01:14:35PM -0400, Chris Snook wrote:
> >>>>>> If you're depending on volatile writes
> >>>>>>being visible to other CPUs, you're screwed either way, because the
> >>>>>>CPU can hold that data in cache as long as it wants before it writes
> >>>>>>it to memory. When this finally does happen, it will happen
> >>>>>>atomically, which is all that atomic_set guarantees. If you need to
> >>>>>>guarantee that the value is written to memory at a particular time in
> >>>>>>your execution sequence, you either have to read it from memory to
> >>>>>>force the compiler to store it first (and a volatile cast in
> >>>>>>atomic_read will suffice for this) or you have to use LOCK_PREFIX
> >>>>>>instructions which will invalidate remote cache lines containing the
> >>>>>>same variable. This patch doesn't change either of these cases.
> >>>>>The case that it -can- change is interactions with interrupt handlers.
> >>>>>And NMI/SMI handlers, for that matter.
> >>>>You have a point here, but only if you can guarantee that the interrupt
> >>>>handler is running on a processor sharing the cache that has the
> >>>>not-yet-written volatile value. That implies a strictly non-SMP
> >>>>architecture. At the moment, none of those have volatile in their
> >>>>declaration of atomic_t, so this patch can't break any of them.
> >>>This can also happen when using per-CPU variables. And there are a
> >>>number of per-CPU variables that are either atomic themselves or are
> >>>structures containing atomic fields.
> >>Accessing per-CPU variables in this fashion reliably already requires a
> >>suitable smp/non-smp read/write memory barrier. I maintain that if we
> >>break anything with this change, it was really already broken, if less
> >>obviously. Can you give a real or synthetic example of legitimate code
> >>that could break?
> >
> >My main concern is actually the lack of symmetry -- I would expect
> >that an atomic_set() would have the same properties as atomic_read().
> >It is easy and cheap to provide them with similar properties, so why not?
> >Debugging even a single problem would consume far more time than simply
> >giving them corresponding semantics.
> >
> >But you asked for examples. These are synthetic, and of course legitimacy
> >is in the eye of the beholder.
> >
> >1. Watchdog variable.
> >
> > atomic_t watchdog = ATOMIC_INIT(0);
> >
> > ...
> >
> > int i;
> > while (!done) {
> >
> > /* Do so stuff that doesn't take more than a few us. */
> > /* Could do atomic increment, but throughput penalty. */
> >
> > i++;
> > atomic_set(&watchdog, i);
> > }
> > do_something_with(&watchdog);
> >
> >
> > /* Every so often on some other CPU... */
> >
> > if ((new_watchdog = atomic_read(&watchdog)) == old_watchdog)
> > die_horribly();
> > old_watchdog = new_watchdog;
> >
> >
> > If atomic_set() did not have volatile semantics, the compiler
> > would be within its rights optimizing it to simply get the
> > final value of "i" after exit from the loop. This would cause
> > the watchdog check to fail spuriously. Memory barriers are
> > not required in this case, because the CPU cannot hang onto
> > the value for very long -- we don't care about the exact value,
> > or about exact synchronization, but rather about whether or
> > not the value is changing.
> >
> > In this (toy) example, one might replace the atomic_set() with
> > an atomic increment (though that might be too expensive in some
> > cases) or with something like:
> >
> > atomic_set(&watchdog, atomic_read(&watchdog) + 1);
> >
> > However, other cases might not permit this transformation,
> > for example, an existing heavily used API might take int rather
> > than atomic_t.
> >
> > Some will no doubt argue that this example should use a
> > macro or an asm similar to the "forget()" asm put forward
> > elsewhere in this thread.
> >
> >2. Communicating both with interrupt handler and with other CPUs.
> > For example, data elements that are built up in a location visible
> > to interrupts and NMIs, and then added as a unit to a data structure
> > visible to other CPUs. This more-realistic example is abbreviated
> > to the point of pointlessness as follows:
> >
> > struct foo {
> > atomic_t a;
> > atomic_t b;
> > };
> >
> > DEFINE_PER_CPU(struct foo *, staging) = NULL;
> >
> > /* Create element in staging area. */
> >
> > __get_cpu_var(staging) = kzalloc(sizeof(*p), GFP_WHATEVER);
> > if (__get_cpu_var(staging) == NULL)
> > die_horribly();
> > /* allocate an element of some per-CPU array, get the result in "i"
> > */
> > atomic_set(__get_cpu_var(staging).a, i);
> > /* allocate another element of a per-CPU array, with result in "i" */
> > atomic_set(__get_cpu_var(staging).b, i);
> > rcu_assign_pointer(some_global_place, __get_cpu_var(staging));
> >
> > If atomic_set() didn't have volatile semantics, then an interrupt
> > or NMI handler could see the atomic_set() to .a and .b out of
> > order due to compiler optimizations.
> >
> >Remember, you -did- ask for these!!! ;-)
>
> Ok, I'm convinced. Part of the motivation here is to avoid heisenbugs,
> so if people expect volatile atomic_set behavior, I'm inclined to give
> it to them. I don't really feel like indulging the compiler bug
> paranoiacs, but developer expectations are a legitimate motivation, and
> a major part of why I posted this in the first place. I'll resubmit the
> patchset with a volatile cast in atomic_set. Before I do, is there
> anything *else* that desperately needs such a cast? As far as I can
> tell, all the other functions are implemented with __asm__ __volatile__,
> or with spinlocks that use that under the hood.
Sounds good!!!
The only other API that I am aware of needing volatile semantics is
rcu_dereference(), but I already sent a patch in for it. So as far
as I know, atomic_read() and atomic_set() should cover it.
Thanx, Paul
^ permalink raw reply
* [PATCH 4/4] ethtool: internal simplification
From: Jeff Garzik @ 2007-08-10 20:26 UTC (permalink / raw)
To: netdev; +Cc: davem, LKML
In-Reply-To: <20070810202426.GA25050@havoc.gtf.org>
commit 758522226b3e7758a84e721998bce8f63855caca
Author: Jeff Garzik <jeff@garzik.org>
Date: Fri Aug 10 16:17:09 2007 -0400
[ETHTOOL] Internal cleanup of ethtool_value-related handlers
Several get/set functions can be handled by a passing the ethtool_op
function pointer directly to a generic function. This permits deletion
of a fair bit of redundant code.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
net/core/ethtool.c | 199 ++++++++++-------------------------------------------
1 file changed, 39 insertions(+), 160 deletions(-)
758522226b3e7758a84e721998bce8f63855caca
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index f721e38..4559200 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -272,34 +272,6 @@ static int ethtool_set_wol(struct net_device *dev, char __user *useraddr)
return dev->ethtool_ops->set_wol(dev, &wol);
}
-static int ethtool_get_msglevel(struct net_device *dev, char __user *useraddr)
-{
- struct ethtool_value edata = { ETHTOOL_GMSGLVL };
-
- if (!dev->ethtool_ops->get_msglevel)
- return -EOPNOTSUPP;
-
- edata.data = dev->ethtool_ops->get_msglevel(dev);
-
- if (copy_to_user(useraddr, &edata, sizeof(edata)))
- return -EFAULT;
- return 0;
-}
-
-static int ethtool_set_msglevel(struct net_device *dev, char __user *useraddr)
-{
- struct ethtool_value edata;
-
- if (!dev->ethtool_ops->set_msglevel)
- return -EOPNOTSUPP;
-
- if (copy_from_user(&edata, useraddr, sizeof(edata)))
- return -EFAULT;
-
- dev->ethtool_ops->set_msglevel(dev, edata.data);
- return 0;
-}
-
static int ethtool_nway_reset(struct net_device *dev)
{
if (!dev->ethtool_ops->nway_reset)
@@ -308,20 +280,6 @@ static int ethtool_nway_reset(struct net_device *dev)
return dev->ethtool_ops->nway_reset(dev);
}
-static int ethtool_get_link(struct net_device *dev, void __user *useraddr)
-{
- struct ethtool_value edata = { ETHTOOL_GLINK };
-
- if (!dev->ethtool_ops->get_link)
- return -EOPNOTSUPP;
-
- edata.data = dev->ethtool_ops->get_link(dev);
-
- if (copy_to_user(useraddr, &edata, sizeof(edata)))
- return -EFAULT;
- return 0;
-}
-
static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
{
struct ethtool_eeprom eeprom;
@@ -489,48 +447,6 @@ static int ethtool_set_pauseparam(struct net_device *dev, void __user *useraddr)
return dev->ethtool_ops->set_pauseparam(dev, &pauseparam);
}
-static int ethtool_get_rx_csum(struct net_device *dev, char __user *useraddr)
-{
- struct ethtool_value edata = { ETHTOOL_GRXCSUM };
-
- if (!dev->ethtool_ops->get_rx_csum)
- return -EOPNOTSUPP;
-
- edata.data = dev->ethtool_ops->get_rx_csum(dev);
-
- if (copy_to_user(useraddr, &edata, sizeof(edata)))
- return -EFAULT;
- return 0;
-}
-
-static int ethtool_set_rx_csum(struct net_device *dev, char __user *useraddr)
-{
- struct ethtool_value edata;
-
- if (!dev->ethtool_ops->set_rx_csum)
- return -EOPNOTSUPP;
-
- if (copy_from_user(&edata, useraddr, sizeof(edata)))
- return -EFAULT;
-
- dev->ethtool_ops->set_rx_csum(dev, edata.data);
- return 0;
-}
-
-static int ethtool_get_tx_csum(struct net_device *dev, char __user *useraddr)
-{
- struct ethtool_value edata = { ETHTOOL_GTXCSUM };
-
- if (!dev->ethtool_ops->get_tx_csum)
- return -EOPNOTSUPP;
-
- edata.data = dev->ethtool_ops->get_tx_csum(dev);
-
- if (copy_to_user(useraddr, &edata, sizeof(edata)))
- return -EFAULT;
- return 0;
-}
-
static int __ethtool_set_sg(struct net_device *dev, u32 data)
{
int err;
@@ -569,20 +485,6 @@ static int ethtool_set_tx_csum(struct net_device *dev, char __user *useraddr)
return dev->ethtool_ops->set_tx_csum(dev, edata.data);
}
-static int ethtool_get_sg(struct net_device *dev, char __user *useraddr)
-{
- struct ethtool_value edata = { ETHTOOL_GSG };
-
- if (!dev->ethtool_ops->get_sg)
- return -EOPNOTSUPP;
-
- edata.data = dev->ethtool_ops->get_sg(dev);
-
- if (copy_to_user(useraddr, &edata, sizeof(edata)))
- return -EFAULT;
- return 0;
-}
-
static int ethtool_set_sg(struct net_device *dev, char __user *useraddr)
{
struct ethtool_value edata;
@@ -600,20 +502,6 @@ static int ethtool_set_sg(struct net_device *dev, char __user *useraddr)
return __ethtool_set_sg(dev, edata.data);
}
-static int ethtool_get_tso(struct net_device *dev, char __user *useraddr)
-{
- struct ethtool_value edata = { ETHTOOL_GTSO };
-
- if (!dev->ethtool_ops->get_tso)
- return -EOPNOTSUPP;
-
- edata.data = dev->ethtool_ops->get_tso(dev);
-
- if (copy_to_user(useraddr, &edata, sizeof(edata)))
- return -EFAULT;
- return 0;
-}
-
static int ethtool_set_tso(struct net_device *dev, char __user *useraddr)
{
struct ethtool_value edata;
@@ -630,18 +518,6 @@ static int ethtool_set_tso(struct net_device *dev, char __user *useraddr)
return dev->ethtool_ops->set_tso(dev, edata.data);
}
-static int ethtool_get_ufo(struct net_device *dev, char __user *useraddr)
-{
- struct ethtool_value edata = { ETHTOOL_GUFO };
-
- if (!dev->ethtool_ops->get_ufo)
- return -EOPNOTSUPP;
- edata.data = dev->ethtool_ops->get_ufo(dev);
- if (copy_to_user(useraddr, &edata, sizeof(edata)))
- return -EFAULT;
- return 0;
-}
-
static int ethtool_set_ufo(struct net_device *dev, char __user *useraddr)
{
struct ethtool_value edata;
@@ -857,58 +733,48 @@ static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr)
return 0;
}
-static int ethtool_get_flags(struct net_device *dev, char __user *useraddr)
+static int ethtool_get_value(struct net_device *dev, char __user *useraddr,
+ u32 cmd, u32 (*actor)(struct net_device *))
{
- struct ethtool_value edata = { ETHTOOL_GFLAGS };
+ struct ethtool_value edata = { cmd };
- if (!dev->ethtool_ops->get_flags)
+ if (!actor)
return -EOPNOTSUPP;
- edata.data = dev->ethtool_ops->get_flags(dev);
+ edata.data = actor(dev);
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
-static int ethtool_set_flags(struct net_device *dev, char __user *useraddr)
+static int ethtool_set_value_void(struct net_device *dev, char __user *useraddr,
+ void (*actor)(struct net_device *, u32))
{
struct ethtool_value edata;
- if (!dev->ethtool_ops->set_flags)
+ if (!actor)
return -EOPNOTSUPP;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
- return dev->ethtool_ops->set_flags(dev, edata.data);
-}
-
-static int ethtool_get_priv_flags(struct net_device *dev, char __user *useraddr)
-{
- struct ethtool_value edata = { ETHTOOL_GPFLAGS };
-
- if (!dev->ethtool_ops->get_priv_flags)
- return -EOPNOTSUPP;
-
- edata.data = dev->ethtool_ops->get_priv_flags(dev);
-
- if (copy_to_user(useraddr, &edata, sizeof(edata)))
- return -EFAULT;
+ actor(dev, edata.data);
return 0;
}
-static int ethtool_set_priv_flags(struct net_device *dev, char __user *useraddr)
+static int ethtool_set_value(struct net_device *dev, char __user *useraddr,
+ int (*actor)(struct net_device *, u32))
{
struct ethtool_value edata;
- if (!dev->ethtool_ops->set_priv_flags)
+ if (!actor)
return -EOPNOTSUPP;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
- return dev->ethtool_ops->set_priv_flags(dev, edata.data);
+ return actor(dev, edata.data);
}
/* The main entry point in this file. Called from net/core/dev.c */
@@ -979,16 +845,19 @@ int dev_ethtool(struct ifreq *ifr)
rc = ethtool_set_wol(dev, useraddr);
break;
case ETHTOOL_GMSGLVL:
- rc = ethtool_get_msglevel(dev, useraddr);
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ dev->ethtool_ops->get_msglevel);
break;
case ETHTOOL_SMSGLVL:
- rc = ethtool_set_msglevel(dev, useraddr);
+ rc = ethtool_set_value_void(dev, useraddr,
+ dev->ethtool_ops->set_msglevel);
break;
case ETHTOOL_NWAY_RST:
rc = ethtool_nway_reset(dev);
break;
case ETHTOOL_GLINK:
- rc = ethtool_get_link(dev, useraddr);
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ dev->ethtool_ops->get_link);
break;
case ETHTOOL_GEEPROM:
rc = ethtool_get_eeprom(dev, useraddr);
@@ -1015,25 +884,30 @@ int dev_ethtool(struct ifreq *ifr)
rc = ethtool_set_pauseparam(dev, useraddr);
break;
case ETHTOOL_GRXCSUM:
- rc = ethtool_get_rx_csum(dev, useraddr);
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ dev->ethtool_ops->get_rx_csum);
break;
case ETHTOOL_SRXCSUM:
- rc = ethtool_set_rx_csum(dev, useraddr);
+ rc = ethtool_set_value(dev, useraddr,
+ dev->ethtool_ops->set_rx_csum);
break;
case ETHTOOL_GTXCSUM:
- rc = ethtool_get_tx_csum(dev, useraddr);
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ dev->ethtool_ops->get_tx_csum);
break;
case ETHTOOL_STXCSUM:
rc = ethtool_set_tx_csum(dev, useraddr);
break;
case ETHTOOL_GSG:
- rc = ethtool_get_sg(dev, useraddr);
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ dev->ethtool_ops->get_sg);
break;
case ETHTOOL_SSG:
rc = ethtool_set_sg(dev, useraddr);
break;
case ETHTOOL_GTSO:
- rc = ethtool_get_tso(dev, useraddr);
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ dev->ethtool_ops->get_tso);
break;
case ETHTOOL_STSO:
rc = ethtool_set_tso(dev, useraddr);
@@ -1054,7 +928,8 @@ int dev_ethtool(struct ifreq *ifr)
rc = ethtool_get_perm_addr(dev, useraddr);
break;
case ETHTOOL_GUFO:
- rc = ethtool_get_ufo(dev, useraddr);
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ dev->ethtool_ops->get_ufo);
break;
case ETHTOOL_SUFO:
rc = ethtool_set_ufo(dev, useraddr);
@@ -1066,16 +941,20 @@ int dev_ethtool(struct ifreq *ifr)
rc = ethtool_set_gso(dev, useraddr);
break;
case ETHTOOL_GFLAGS:
- rc = ethtool_get_flags(dev, useraddr);
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ dev->ethtool_ops->get_flags);
break;
case ETHTOOL_SFLAGS:
- rc = ethtool_set_flags(dev, useraddr);
+ rc = ethtool_set_value(dev, useraddr,
+ dev->ethtool_ops->set_flags);
break;
case ETHTOOL_GPFLAGS:
- rc = ethtool_get_priv_flags(dev, useraddr);
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ dev->ethtool_ops->get_priv_flags);
break;
case ETHTOOL_SPFLAGS:
- rc = ethtool_set_priv_flags(dev, useraddr);
+ rc = ethtool_set_value(dev, useraddr,
+ dev->ethtool_ops->set_priv_flags);
break;
default:
rc = -EOPNOTSUPP;
^ permalink raw reply related
* Driver writer hints (was [PATCH 3/4] Add ETHTOOL_[GS]PFLAGS sub-ioctls)
From: Jeff Garzik @ 2007-08-10 20:45 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, davem, LKML
In-Reply-To: <20070810202630.GB25095@havoc.gtf.org>
Jeff Garzik wrote:
> commit 4901236cec047029b970261b95e47d6be60f523e
> Author: Jeff Garzik <jeff@garzik.org>
> Date: Fri Aug 10 15:52:06 2007 -0400
>
> [ETHTOOL] Introduce ->{get,set}_priv_flags, ETHTOOL_[GS]PFLAGS
>
> Signed-off-by: Jeff Garzik <jeff@garzik.org>
>
> include/linux/ethtool.h | 8 +++++++-
> net/core/ethtool.c | 38 ++++++++++++++++++++++++++++++++++++++
> 2 files changed, 45 insertions(+), 1 deletion(-)
This change permits driver writers to allow userspace to enable/disable
driver-specific boolean options on a per-interface basis. This is best
illustrated by describing how userland uses this:
(this is very similar to how the get-stats and self-test operations
currently work)
1) Userland issues ETHTOOL_GDRVINFO, to obtain the n_priv_flags value.
2) Userland issues ETHTOOL_GSTRINGS (ETH_SS_PRIV_FLAGS) to obtain an
array of strings. Each element in this array maps to a bit in the list
of driver-private flags. Array element #0 is the tag (name) for bit #0.
Array element #5 is the tag for bit #5. etc.
If we are getting (retrieving) flags:
3) Userland issues ETHTOOL_GPFLAGS, to obtain a 32-bit bitmap
4) Userland prints out a tag returned from ETHTOOL_GSTRINGS
for each bit set to one in the bitmap. If a bit is set,
but there is no string to describe it, that bit is ignored.
(i.e. a list of 5 strings is returned, but bit 24 is set)
If we are setting flags:
3) Userland issues ETHTOOL_GPFLAGS, to obtain 32-bit bitmap
4) Userland parses command line, which has a series of strings
in the format of "+option" (set flag) and "-option" (clear
flag).
5) Userland sets and clears bits in the 32-bit bitmap, by
matching the command line-supplied data with strings returned
by ETHTOOL_GSTRINGS.
6) If the bitmap has changed, send it back to the driver using
ETHTOOL_SPFLAGS.
In this way, you can see that the actual bit numbers are irrelevant, and
need not be a fixed part of the ABI. Everything is named-based.
This name-based stuff only applies to the private flags. The
ETHTOOL_[GS]FLAGS operations /do/ fix the bit numbers in stone, in the
ABI. There is no name list associated with ETHTOOL_[GS]FLAGS]. The
userland interface does, however, use names rather than bit numbers, for
ease of use.
Another attribute is worth pointing out at this point: ETHTOOL_SFLAGS
and ETHTOOL_SPFLAGS both permit atomic retrieval/setting of groups of
features all at once. IMO this is a nice addition to ethtool as well,
where previously you had to issue separate ioctls for each feature,
which might result in repeated NIC resets [depending on driver
implementation].
Get-flags and get-priv-flags are unpriveleged operations. Set-flags and
set-priv-flags require CAP_NET_ADMIN like other ethtool sub-ioctls.
Drivers should return -EINVAL if userland attempts to set an invariant
(read-only) flag to something other than its constant value.
^ permalink raw reply
* [PATCH for 2.6.24] SCTP: Rewrite of sctp buffer management code
From: Vlad Yasevich @ 2007-08-10 20:46 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Neil Horman, lksctp-developers@lists.sourceforge.net
This patch introduces autotuning to the sctp buffer management code
similar to the TCP. The buffer space can be grown if the advertised
receive window still has room. This might happen if small message
sizes are used, which is common in telecom environmens.
New tunables are introduced that provide limits to buffer growth
and memory pressure is entered if to much buffer spaces is used.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
include/net/sctp/sctp.h | 5 +++
net/sctp/endpointola.c | 1
net/sctp/protocol.c | 32 +++++++++++++++++++++
net/sctp/sm_statefuns.c | 73 +++++++++++-------------------------------------
net/sctp/socket.c | 67 ++++++++++++++++++++++++++++++++++++--------
net/sctp/sysctl.c | 33 +++++++++++++++++++++
net/sctp/ulpevent.c | 18 +++++++++++
net/sctp/ulpqueue.c | 1
8 files changed, 163 insertions(+), 67 deletions(-)
---
net/sctp/socket.c | 68 ++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 55 insertions(+), 13 deletions(-)
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 01c6364..03579d5 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -106,25 +106,41 @@ static int sctp_autobind(struct sock *sk);
static void sctp_sock_migrate(struct sock *, struct sock *,
struct sctp_association *, sctp_socket_type_t);
static char *sctp_hmac_alg = SCTP_COOKIE_HMAC_ALG;
+extern int sysctl_sctp_mem[3];
+extern int sysctl_sctp_rmem[3];
+extern int sysctl_sctp_wmem[3];
+int sctp_memory_pressure;
+atomic_t sctp_memory_allocated;
+atomic_t sctp_sockets_allocated;
+
+static void sctp_enter_memory_pressure(void)
+{
+ sctp_memory_pressure = 1;
+}
+
/* Get the sndbuf space available at the time on the association. */
static inline int sctp_wspace(struct sctp_association *asoc)
{
- struct sock *sk = asoc->base.sk;
- int amt = 0;
+ int amt;
- if (asoc->ep->sndbuf_policy) {
- /* make sure that no association uses more than sk_sndbuf */
- amt = sk->sk_sndbuf - asoc->sndbuf_used;
+ if (asoc->ep->sndbuf_policy)
+ amt = asoc->sndbuf_used;
+ else
+ amt = atomic_read(&asoc->base.sk->sk_wmem_alloc);
+
+ if (amt >= asoc->base.sk->sk_sndbuf) {
+ if (asoc->base.sk->sk_userlocks & SOCK_SNDBUF_LOCK)
+ amt = 0;
+ else {
+ amt = sk_stream_wspace(asoc->base.sk);
+ if (amt < 0)
+ amt = 0;
+ }
} else {
- /* do socket level accounting */
- amt = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
+ amt = asoc->base.sk->sk_sndbuf - amt;
}
-
- if (amt < 0)
- amt = 0;
-
- return amt;
+ return amt;
}
/* Increment the used sndbuf space count of the corresponding association by
@@ -155,6 +171,7 @@ static inline void sctp_set_owner_w(struct sctp_chunk *chunk)
sizeof(struct sctp_chunk);
atomic_add(sizeof(struct sctp_chunk), &sk->sk_wmem_alloc);
+ sk_charge_skb(sk, chunk->skb);
}
/* Verify that this is a valid address. */
@@ -3314,6 +3331,7 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
sp->hmac = NULL;
SCTP_DBG_OBJCNT_INC(sock);
+ atomic_inc(&sctp_sockets_allocated);
return 0;
}
@@ -3327,7 +3345,7 @@ SCTP_STATIC int sctp_destroy_sock(struct sock *sk)
/* Release our hold on the endpoint. */
ep = sctp_sk(sk)->ep;
sctp_endpoint_free(ep);
-
+ atomic_dec(&sctp_sockets_allocated);
return 0;
}
@@ -5747,6 +5765,12 @@ static void sctp_wfree(struct sk_buff *skb)
atomic_sub(sizeof(struct sctp_chunk), &sk->sk_wmem_alloc);
+ /*
+ * This undoes what is done via sk_charge_skb
+ */
+ sk->sk_wmem_queued -= skb->truesize;
+ sk->sk_forward_alloc += skb->truesize;
+
sock_wfree(skb);
__sctp_write_space(asoc);
@@ -5764,6 +5788,11 @@ void sctp_sock_rfree(struct sk_buff *skb)
struct sctp_ulpevent *event = sctp_skb2event(skb);
atomic_sub(event->rmem_len, &sk->sk_rmem_alloc);
+
+ /*
+ * Mimic the behavior of sk_stream_rfree
+ */
+ sk->sk_forward_alloc += event->rmem_len;
}
@@ -6153,6 +6182,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
sctp_release_sock(newsk);
}
+
/* This proto struct describes the ULP interface for SCTP. */
struct proto sctp_prot = {
.name = "SCTP",
@@ -6175,6 +6205,12 @@ struct proto sctp_prot = {
.unhash = sctp_unhash,
.get_port = sctp_get_port,
.obj_size = sizeof(struct sctp_sock),
+ .sysctl_mem = sysctl_sctp_mem,
+ .sysctl_rmem = sysctl_sctp_rmem,
+ .sysctl_wmem = sysctl_sctp_wmem,
+ .memory_pressure = &sctp_memory_pressure,
+ .enter_memory_pressure = sctp_enter_memory_pressure,
+ .memory_allocated = &sctp_memory_allocated,
};
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
@@ -6199,5 +6235,11 @@ struct proto sctpv6_prot = {
.unhash = sctp_unhash,
.get_port = sctp_get_port,
.obj_size = sizeof(struct sctp6_sock),
+ .sysctl_mem = sysctl_sctp_mem,
+ .sysctl_rmem = sysctl_sctp_rmem,
+ .sysctl_wmem = sysctl_sctp_wmem,
+ .memory_pressure = &sctp_memory_pressure,
+ .enter_memory_pressure = sctp_enter_memory_pressure,
+ .memory_allocated = &sctp_memory_allocated,
};
#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
--
1.5.2.4
^ permalink raw reply related
* Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls
From: Jeff Garzik @ 2007-08-10 20:56 UTC (permalink / raw)
To: netdev, davem; +Cc: LKML
In-Reply-To: <20070810202426.GA25050@havoc.gtf.org>
All this is currently checked into the 'eflags' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
But when everybody is happy with it, IMO we should get it into
net-2.6.24.git, as it enables LRO.
Jeff
^ permalink raw reply
* [PATCH 1/7] sysctl: Remove broken cdrom binary sysctls
From: Eric W. Biederman @ 2007-08-10 21:00 UTC (permalink / raw)
To: Andrew Morton
Cc: Gabriel C, Michal Piotrowski, linux-kernel, Netdev, coreteam,
Alan Cox
In-Reply-To: <20070810124156.2de9710e.akpm@linux-foundation.org>
The binary interface for the cdrom sysctls can't possilby work.
So remove the binary sysctls and reduce cdrom_sysctl_handler
to it's essentials (to kill the uses of ctl_name).
Since the last time this patch was posted I radically
simplified cdrom_sysctl_helper to meet address Alan's objections.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
drivers/cdrom/cdrom.c | 46 ++++++----------------------------------------
1 files changed, 6 insertions(+), 40 deletions(-)
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 67ee3d4..679c7c0 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -3454,47 +3454,19 @@ static void cdrom_update_settings(void)
static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
- int *valp = ctl->data;
- int val = *valp;
int ret;
ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
- if (write && *valp != val) {
+ if (write) {
/* we only care for 1 or 0. */
- if (*valp)
- *valp = 1;
- else
- *valp = 0;
+ autoclose = !!cdrom_sysctl_settings.autoclose;
+ autoeject = !!cdrom_sysctl_settings.autoeject;
+ debug = !!cdrom_sysctl_settings.debug;
+ lockdoor = !!cdrom_sysctl_settings.lock;
+ check_media_type = !!cdrom_sysctl_settings.check;
- switch (ctl->ctl_name) {
- case DEV_CDROM_AUTOCLOSE: {
- if (valp == &cdrom_sysctl_settings.autoclose)
- autoclose = cdrom_sysctl_settings.autoclose;
- break;
- }
- case DEV_CDROM_AUTOEJECT: {
- if (valp == &cdrom_sysctl_settings.autoeject)
- autoeject = cdrom_sysctl_settings.autoeject;
- break;
- }
- case DEV_CDROM_DEBUG: {
- if (valp == &cdrom_sysctl_settings.debug)
- debug = cdrom_sysctl_settings.debug;
- break;
- }
- case DEV_CDROM_LOCK: {
- if (valp == &cdrom_sysctl_settings.lock)
- lockdoor = cdrom_sysctl_settings.lock;
- break;
- }
- case DEV_CDROM_CHECK_MEDIA: {
- if (valp == &cdrom_sysctl_settings.check)
- check_media_type = cdrom_sysctl_settings.check;
- break;
- }
- }
/* update the option flags according to the changes. we
don't have per device options through sysctl yet,
but we will have and then this will disappear. */
@@ -3507,7 +3479,6 @@ static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,
/* Place files in /proc/sys/dev/cdrom */
static ctl_table cdrom_table[] = {
{
- .ctl_name = DEV_CDROM_INFO,
.procname = "info",
.data = &cdrom_sysctl_settings.info,
.maxlen = CDROM_STR_SIZE,
@@ -3515,7 +3486,6 @@ static ctl_table cdrom_table[] = {
.proc_handler = &cdrom_sysctl_info,
},
{
- .ctl_name = DEV_CDROM_AUTOCLOSE,
.procname = "autoclose",
.data = &cdrom_sysctl_settings.autoclose,
.maxlen = sizeof(int),
@@ -3523,7 +3493,6 @@ static ctl_table cdrom_table[] = {
.proc_handler = &cdrom_sysctl_handler,
},
{
- .ctl_name = DEV_CDROM_AUTOEJECT,
.procname = "autoeject",
.data = &cdrom_sysctl_settings.autoeject,
.maxlen = sizeof(int),
@@ -3531,7 +3500,6 @@ static ctl_table cdrom_table[] = {
.proc_handler = &cdrom_sysctl_handler,
},
{
- .ctl_name = DEV_CDROM_DEBUG,
.procname = "debug",
.data = &cdrom_sysctl_settings.debug,
.maxlen = sizeof(int),
@@ -3539,7 +3507,6 @@ static ctl_table cdrom_table[] = {
.proc_handler = &cdrom_sysctl_handler,
},
{
- .ctl_name = DEV_CDROM_LOCK,
.procname = "lock",
.data = &cdrom_sysctl_settings.lock,
.maxlen = sizeof(int),
@@ -3547,7 +3514,6 @@ static ctl_table cdrom_table[] = {
.proc_handler = &cdrom_sysctl_handler,
},
{
- .ctl_name = DEV_CDROM_CHECK_MEDIA,
.procname = "check_media",
.data = &cdrom_sysctl_settings.check,
.maxlen = sizeof(int),
--
1.5.1.1.181.g2de0
^ permalink raw reply related
* [PATCH 2/7] sysctl: parport remove binary paths.
From: Eric W. Biederman @ 2007-08-10 21:01 UTC (permalink / raw)
To: Andrew Morton
Cc: Gabriel C, Michal Piotrowski, linux-kernel, Netdev, coreteam,
Alan Cox
In-Reply-To: <m1ps1vw1ey.fsf_-_@ebiederm.dsl.xmission.com>
The sysctl binary paths don't look as if they even code work,
.data is not filled in, and all of the proc_handlers look at
extra1 and there is not strategy routine.
So just kill the binary paths.
In addition this patch removes the setting of extra1
on directories. It doesn't look like the parport code
ever examines it, and it's bad sysctl form.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
drivers/parport/procfs.c | 38 +++++---------------------------------
1 files changed, 5 insertions(+), 33 deletions(-)
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index bdbdab9..ed82e41 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -237,7 +237,7 @@ static int do_hardware_modes (ctl_table *table, int write,
#define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \
.mode = 0555, .child = CHILD }
#define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD }
-#define PARPORT_DEVICES_ROOT_DIR { .ctl_name = DEV_PARPORT_DEVICES, .procname = "devices", \
+#define PARPORT_DEVICES_ROOT_DIR { .procname = "devices", \
.mode = 0555, .child = NULL }
static const unsigned long parport_min_timeslice_value =
@@ -266,7 +266,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.sysctl_header = NULL,
{
{
- .ctl_name = DEV_PARPORT_SPINTIME,
.procname = "spintime",
.data = NULL,
.maxlen = sizeof(int),
@@ -276,7 +275,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.extra2 = (void*) &parport_max_spintime_value
},
{
- .ctl_name = DEV_PARPORT_BASE_ADDR,
.procname = "base-addr",
.data = NULL,
.maxlen = 0,
@@ -284,7 +282,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_hardware_base_addr
},
{
- .ctl_name = DEV_PARPORT_IRQ,
.procname = "irq",
.data = NULL,
.maxlen = 0,
@@ -292,7 +289,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_hardware_irq
},
{
- .ctl_name = DEV_PARPORT_DMA,
.procname = "dma",
.data = NULL,
.maxlen = 0,
@@ -300,7 +296,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_hardware_dma
},
{
- .ctl_name = DEV_PARPORT_MODES,
.procname = "modes",
.data = NULL,
.maxlen = 0,
@@ -310,7 +305,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
PARPORT_DEVICES_ROOT_DIR,
#ifdef CONFIG_PARPORT_1284
{
- .ctl_name = DEV_PARPORT_AUTOPROBE,
.procname = "autoprobe",
.data = NULL,
.maxlen = 0,
@@ -318,7 +312,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_autoprobe
},
{
- .ctl_name = DEV_PARPORT_AUTOPROBE + 1,
.procname = "autoprobe0",
.data = NULL,
.maxlen = 0,
@@ -326,7 +319,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_autoprobe
},
{
- .ctl_name = DEV_PARPORT_AUTOPROBE + 2,
.procname = "autoprobe1",
.data = NULL,
.maxlen = 0,
@@ -334,7 +326,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_autoprobe
},
{
- .ctl_name = DEV_PARPORT_AUTOPROBE + 3,
.procname = "autoprobe2",
.data = NULL,
.maxlen = 0,
@@ -342,7 +333,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_autoprobe
},
{
- .ctl_name = DEV_PARPORT_AUTOPROBE + 4,
.procname = "autoprobe3",
.data = NULL,
.maxlen = 0,
@@ -354,7 +344,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
},
{
{
- .ctl_name = DEV_PARPORT_DEVICES_ACTIVE,
.procname = "active",
.data = NULL,
.maxlen = 0,
@@ -393,7 +382,6 @@ parport_device_sysctl_template = {
.sysctl_header = NULL,
{
{
- .ctl_name = DEV_PARPORT_DEVICE_TIMESLICE,
.procname = "timeslice",
.data = NULL,
.maxlen = sizeof(int),
@@ -449,7 +437,6 @@ parport_default_sysctl_table = {
.sysctl_header = NULL,
{
{
- .ctl_name = DEV_PARPORT_DEFAULT_TIMESLICE,
.procname = "timeslice",
.data = &parport_default_timeslice,
.maxlen = sizeof(parport_default_timeslice),
@@ -459,7 +446,6 @@ parport_default_sysctl_table = {
.extra2 = (void*) &parport_max_timeslice_value
},
{
- .ctl_name = DEV_PARPORT_DEFAULT_SPINTIME,
.procname = "spintime",
.data = &parport_default_spintime,
.maxlen = sizeof(parport_default_spintime),
@@ -502,7 +488,7 @@ int parport_proc_register(struct parport *port)
t->device_dir[0].extra1 = port;
- for (i = 0; i < 8; i++)
+ for (i = 0; i < 5; i++)
t->vars[i].extra1 = port;
t->vars[0].data = &port->spintime;
@@ -512,7 +498,7 @@ int parport_proc_register(struct parport *port)
t->vars[6 + i].extra2 = &port->probe_info[i];
t->port_dir[0].procname = port->name;
- t->port_dir[0].ctl_name = port->number + 1; /* nb 0 isn't legal here */
+ t->port_dir[0].ctl_name = 0;
t->port_dir[0].child = t->vars;
t->parport_dir[0].child = t->port_dir;
@@ -551,26 +537,12 @@ int parport_device_proc_register(struct pardevice *device)
t->dev_dir[0].child = t->parport_dir;
t->parport_dir[0].child = t->port_dir;
t->port_dir[0].procname = port->name;
- t->port_dir[0].ctl_name = port->number + 1; /* nb 0 isn't legal here */
+ t->port_dir[0].ctl_name = 0;
t->port_dir[0].child = t->devices_root_dir;
t->devices_root_dir[0].child = t->device_dir;
-#ifdef CONFIG_PARPORT_1284
-
- t->device_dir[0].ctl_name =
- parport_device_num(port->number, port->muxport,
- device->daisy)
- + 1; /* nb 0 isn't legal here */
-
-#else /* No IEEE 1284 support */
-
- /* parport_device_num isn't available. */
- t->device_dir[0].ctl_name = 1;
-
-#endif /* IEEE 1284 support or not */
-
+ t->device_dir[0].ctl_name = 0;
t->device_dir[0].procname = device->name;
- t->device_dir[0].extra1 = device;
t->device_dir[0].child = t->vars;
t->vars[0].data = &device->timeslice;
--
1.5.1.1.181.g2de0
^ permalink raw reply related
* Re: Driver writer hints (was [PATCH 3/4] Add ETHTOOL_[GS]PFLAGS sub-ioctls)
From: Rick Jones @ 2007-08-10 21:01 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, davem, LKML
In-Reply-To: <46BCCE57.1060802@garzik.org>
> If we are getting (retrieving) flags:
>
> 3) Userland issues ETHTOOL_GPFLAGS, to obtain a 32-bit bitmap
>
> 4) Userland prints out a tag returned from ETHTOOL_GSTRINGS
> for each bit set to one in the bitmap. If a bit is set,
> but there is no string to describe it, that bit is ignored.
> (i.e. a list of 5 strings is returned, but bit 24 is set)
Is that to enable "hidden" bits? If not I'd think that emitting some
sort of "UNKNOWN_FLAG" might help flush-out little oopses like
forgetting a string.
rick jones
^ permalink raw reply
* Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls
From: Jeff Garzik @ 2007-08-10 21:02 UTC (permalink / raw)
To: Auke Kok, netdev; +Cc: davem, LKML
In-Reply-To: <20070810202426.GA25050@havoc.gtf.org>
Jeff Garzik wrote:
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 4a616d7..559a4dc 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -341,6 +341,7 @@ struct net_device
> #define NETIF_F_GSO 2048 /* Enable software GSO. */
> #define NETIF_F_LLTX 4096 /* LockLess TX */
> #define NETIF_F_MULTI_QUEUE 16384 /* Has multiple TX/RX queues */
> +#define NETIF_F_LRO 32768 /* large receive offload */
>
> /* Segmentation offload features */
> #define NETIF_F_GSO_SHIFT 16
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index 2ab0a60..6e8563e 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -109,6 +109,32 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data)
> return 0;
> }
>
> +/* the following list of flags are the same as their associated
> + * NETIF_F_xxx values in include/linux/netdevice.h
> + */
> +static const u32 flags_dup_features =
> + ETH_FLAG_LRO;
> +
> +u32 ethtool_op_get_flags(struct net_device *dev)
> +{
> + /* in the future, this function will probably contain additional
> + * handling for flags which are not so easily handled
> + * by a simple masking operation
> + */
> +
> + return dev->features & flags_dup_features;
> +}
> +
> +int ethtool_op_set_flags(struct net_device *dev, u32 data)
> +{
> + if (data & ETH_FLAG_LRO)
> + dev->features |= NETIF_F_LRO;
> + else
> + dev->features &= ~NETIF_F_LRO;
> +
And, a side discussion:
This patch copies Auke in adding NETIF_F_LRO. Is that just for
temporary merging, or does the net core really not touch it at all?
Because, logically, if NETIF_F_LRO exists nowhere else but this patch,
we should not add it to dev->features. LRO knowledge can be contained
entirely within the driver, if the net core never tests NETIF_F_LRO.
I haven't reviewed the other NETIF_F_XXX flags, but, that logic can be
applied to any other NETIF_F_XXX flag: if the net stack isn't using it,
it's a piece of information specific to that driver.
Jeff
^ permalink raw reply
* Re: [PATCH 1/7] sysctl: Remove broken cdrom binary sysctls
From: Alan Cox @ 2007-08-10 21:10 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Andrew Morton, Gabriel C, Michal Piotrowski, linux-kernel, Netdev,
coreteam
In-Reply-To: <m1ps1vw1ey.fsf_-_@ebiederm.dsl.xmission.com>
On Fri, 10 Aug 2007 15:00:05 -0600
ebiederm@xmission.com (Eric W. Biederman) wrote:
>
> The binary interface for the cdrom sysctls can't possilby work.
> So remove the binary sysctls and reduce cdrom_sysctl_handler
> to it's essentials (to kill the uses of ctl_name).
>
> Since the last time this patch was posted I radically
> simplified cdrom_sysctl_helper to meet address Alan's objections.
>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Alan Cox <alan@redhat.com>
^ permalink raw reply
* [patch 01/18] revert "8139too: clean up I/O remapping"
From: akpm @ 2007-08-10 21:05 UTC (permalink / raw)
To: jeff; +Cc: netdev, akpm, michal.k.k.piotrowski
From: Andrew Morton <akpm@linux-foundation.org>
Revert git-netdev-all's 9ee6b32a47b9abc565466a9c3b127a5246b452e5. Michal was
getting oopses.
Cc: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/net/8139too.c | 50 +++++++++++++++++++++++-----------------
1 files changed, 29 insertions(+), 21 deletions(-)
diff -puN drivers/net/8139too.c~revert-8139too-clean-up-i-o-remapping drivers/net/8139too.c
--- a/drivers/net/8139too.c~revert-8139too-clean-up-i-o-remapping
+++ a/drivers/net/8139too.c
@@ -121,15 +121,8 @@
/* enable PIO instead of MMIO, if CONFIG_8139TOO_PIO is selected */
-enum rtl_bar_map_info {
- rtl_pio_bar = 0, /* PCI BAR #0: PIO */
- rtl_mmio_bar = 1, /* PCI BAR #1: MMIO */
-};
-
#ifdef CONFIG_8139TOO_PIO
-static int use_pio = 1;
-#else
-static int use_pio;
+#define USE_IO_OPS 1
#endif
/* define to 1, 2 or 3 to enable copious debugging info */
@@ -620,17 +613,14 @@ MODULE_DESCRIPTION ("RealTek RTL-8139 Fa
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
-module_param(multicast_filter_limit, int, 0444);
+module_param(multicast_filter_limit, int, 0);
module_param_array(media, int, NULL, 0);
module_param_array(full_duplex, int, NULL, 0);
-module_param(debug, int, 0444);
-module_param(use_pio, int, 0444);
-
+module_param(debug, int, 0);
+MODULE_PARM_DESC (debug, "8139too bitmapped message enable number");
MODULE_PARM_DESC (multicast_filter_limit, "8139too maximum number of filtered multicast addresses");
MODULE_PARM_DESC (media, "8139too: Bits 4+9: force full duplex, bit 5: 100Mbps");
MODULE_PARM_DESC (full_duplex, "8139too: Force full duplex for board(s) (1)");
-MODULE_PARM_DESC (debug, "8139too bitmapped message enable number");
-MODULE_PARM_DESC (use_pio, "Non-zero to enable PIO (rather than MMIO) register mapping");
static int read_eeprom (void __iomem *ioaddr, int location, int addr_len);
static int rtl8139_open (struct net_device *dev);
@@ -718,7 +708,13 @@ static void __rtl8139_cleanup_dev (struc
assert (tp->pci_dev != NULL);
pdev = tp->pci_dev;
- pci_iounmap (pdev, tp->mmio_addr);
+#ifdef USE_IO_OPS
+ if (tp->mmio_addr)
+ ioport_unmap (tp->mmio_addr);
+#else
+ if (tp->mmio_addr)
+ pci_iounmap (pdev, tp->mmio_addr);
+#endif /* USE_IO_OPS */
/* it's ok to call this even if we have no regions to free */
pci_release_regions (pdev);
@@ -794,32 +790,32 @@ static int __devinit rtl8139_init_board
DPRINTK("PIO region size == 0x%02X\n", pio_len);
DPRINTK("MMIO region size == 0x%02lX\n", mmio_len);
+#ifdef USE_IO_OPS
/* make sure PCI base addr 0 is PIO */
if (!(pio_flags & IORESOURCE_IO)) {
dev_err(&pdev->dev, "region #0 not a PIO resource, aborting\n");
rc = -ENODEV;
goto err_out;
}
-
/* check for weird/broken PCI region reporting */
if (pio_len < RTL_MIN_IO_SIZE) {
dev_err(&pdev->dev, "Invalid PCI I/O region size(s), aborting\n");
rc = -ENODEV;
goto err_out;
}
-
+#else
/* make sure PCI base addr 1 is MMIO */
if (!(mmio_flags & IORESOURCE_MEM)) {
dev_err(&pdev->dev, "region #1 not an MMIO resource, aborting\n");
rc = -ENODEV;
goto err_out;
}
-
if (mmio_len < RTL_MIN_IO_SIZE) {
dev_err(&pdev->dev, "Invalid PCI mem region size(s), aborting\n");
rc = -ENODEV;
goto err_out;
}
+#endif
rc = pci_request_regions (pdev, DRV_NAME);
if (rc)
@@ -829,16 +825,28 @@ static int __devinit rtl8139_init_board
/* enable PCI bus-mastering */
pci_set_master (pdev);
- /* iomap MMIO region */
- ioaddr = pci_iomap(pdev, use_pio ? rtl_pio_bar : rtl_mmio_bar, 0);
+#ifdef USE_IO_OPS
+ ioaddr = ioport_map(pio_start, pio_len);
+ if (!ioaddr) {
+ dev_err(&pdev->dev, "cannot map PIO, aborting\n");
+ rc = -EIO;
+ goto err_out;
+ }
+ dev->base_addr = pio_start;
+ tp->mmio_addr = ioaddr;
+ tp->regs_len = pio_len;
+#else
+ /* ioremap MMIO region */
+ ioaddr = pci_iomap(pdev, 1, 0);
if (ioaddr == NULL) {
- dev_err(&pdev->dev, "cannot map I/O regions, aborting\n");
+ dev_err(&pdev->dev, "cannot remap MMIO, aborting\n");
rc = -EIO;
goto err_out;
}
dev->base_addr = (long) ioaddr;
tp->mmio_addr = ioaddr;
tp->regs_len = mmio_len;
+#endif /* USE_IO_OPS */
/* Bring old chips out of low-power mode. */
RTL_W8 (HltClk, 'R');
_
^ permalink raw reply
* [patch 07/18] PCI-X/PCI-Express read control interfaces: use them in e1000
From: akpm @ 2007-08-10 21:05 UTC (permalink / raw)
To: jeff; +Cc: netdev, akpm, peter.oruba, auke-jan.h.kok, shemminger
From: "Peter Oruba" <peter.oruba@amd.com>
These driver changes incorporate the proposed PCI-X / PCI-Express read byte
count interface. Reading and setting those valuse doesn't take place
"manually", instead wrapping functions are called to allow quirks for some
PCI bridges.
Signed-off by: Peter Oruba <peter.oruba@amd.com>
Based on work by Stephen Hemminger <shemminger@linux-foundation.org>
Cc: Auke Kok <auke-jan.h.kok@intel.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/net/e1000/e1000_hw.c | 25 +++----------------------
drivers/net/e1000/e1000_hw.h | 2 ++
drivers/net/e1000/e1000_main.c | 14 ++++++++++++++
3 files changed, 19 insertions(+), 22 deletions(-)
diff -puN drivers/net/e1000/e1000_hw.c~pci-x-pci-express-read-control-interfaces-e1000 drivers/net/e1000/e1000_hw.c
--- a/drivers/net/e1000/e1000_hw.c~pci-x-pci-express-read-control-interfaces-e1000
+++ a/drivers/net/e1000/e1000_hw.c
@@ -865,10 +865,6 @@ e1000_init_hw(struct e1000_hw *hw)
uint32_t ctrl;
uint32_t i;
int32_t ret_val;
- uint16_t pcix_cmd_word;
- uint16_t pcix_stat_hi_word;
- uint16_t cmd_mmrbc;
- uint16_t stat_mmrbc;
uint32_t mta_size;
uint32_t reg_data;
uint32_t ctrl_ext;
@@ -958,24 +954,9 @@ e1000_init_hw(struct e1000_hw *hw)
break;
default:
/* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */
- if (hw->bus_type == e1000_bus_type_pcix) {
- e1000_read_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd_word);
- e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI,
- &pcix_stat_hi_word);
- cmd_mmrbc = (pcix_cmd_word & PCIX_COMMAND_MMRBC_MASK) >>
- PCIX_COMMAND_MMRBC_SHIFT;
- stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >>
- PCIX_STATUS_HI_MMRBC_SHIFT;
- if (stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K)
- stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K;
- if (cmd_mmrbc > stat_mmrbc) {
- pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK;
- pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT;
- e1000_write_pci_cfg(hw, PCIX_COMMAND_REGISTER,
- &pcix_cmd_word);
- }
- }
- break;
+ if (hw->bus_type == e1000_bus_type_pcix && e1000_pcix_get_mmrbc(hw) > 2048)
+ e1000_pcix_set_mmrbc(hw, 2048);
+ break;
}
/* More time needed for PHY to initialize */
diff -puN drivers/net/e1000/e1000_hw.h~pci-x-pci-express-read-control-interfaces-e1000 drivers/net/e1000/e1000_hw.h
--- a/drivers/net/e1000/e1000_hw.h~pci-x-pci-express-read-control-interfaces-e1000
+++ a/drivers/net/e1000/e1000_hw.h
@@ -424,6 +424,8 @@ void e1000_pci_clear_mwi(struct e1000_hw
void e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);
void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);
int32_t e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t *value);
+void e1000_pcix_set_mmrbc(struct e1000_hw *hw, int mmrbc);
+int e1000_pcix_get_mmrbc(struct e1000_hw *hw);
/* Port I/O is only supported on 82544 and newer */
void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value);
int32_t e1000_disable_pciex_master(struct e1000_hw *hw);
diff -puN drivers/net/e1000/e1000_main.c~pci-x-pci-express-read-control-interfaces-e1000 drivers/net/e1000/e1000_main.c
--- a/drivers/net/e1000/e1000_main.c~pci-x-pci-express-read-control-interfaces-e1000
+++ a/drivers/net/e1000/e1000_main.c
@@ -4906,6 +4906,20 @@ e1000_write_pci_cfg(struct e1000_hw *hw,
pci_write_config_word(adapter->pdev, reg, *value);
}
+int
+e1000_pcix_get_mmrbc(struct e1000_hw *hw)
+{
+ struct e1000_adapter *adapter = hw->back;
+ return pcix_get_mmrbc(adapter->pdev);
+}
+
+void
+e1000_pcix_set_mmrbc(struct e1000_hw *hw, int mmrbc)
+{
+ struct e1000_adapter *adapter = hw->back;
+ pcix_set_mmrbc(adapter->pdev, mmrbc);
+}
+
int32_t
e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t *value)
{
_
^ permalink raw reply
* [patch 02/18] sundance: PHY address form 0, only for device ID 0x0200 (IP100A) (20070605)
From: akpm @ 2007-08-10 21:05 UTC (permalink / raw)
To: jeff; +Cc: netdev, akpm, jesse
From: Jesse Huang <jesse@icplus.com.tw>
Search PHY address form 0, only for device ID 0x0200 (IP100A). Other
device are from PHY address 1.
Signed-off-by: Jesse Huang <jesse@icplus.com.tw>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/net/sundance.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletion(-)
diff -puN drivers/net/sundance.c~sundance-phy-address-form-0-only-for-device-id-0x0200 drivers/net/sundance.c
--- a/drivers/net/sundance.c~sundance-phy-address-form-0-only-for-device-id-0x0200
+++ a/drivers/net/sundance.c
@@ -559,7 +559,11 @@ static int __devinit sundance_probe1 (st
* It seems some phys doesn't deal well with address 0 being accessed
* first, so leave address zero to the end of the loop (32 & 31).
*/
- for (phy = 1; phy <= 32 && phy_idx < MII_CNT; phy++) {
+ if (sundance_pci_tbl[np->chip_id].device == 0x0200)
+ phy = 0;
+ else
+ phy = 1;
+ for (; phy <= 32 && phy_idx < MII_CNT; phy++) {
int phyx = phy & 0x1f;
int mii_status = mdio_read(dev, phyx, MII_BMSR);
if (mii_status != 0xffff && mii_status != 0x0000) {
_
^ permalink raw reply
* [patch 05/18] PHY fixed driver: rework release path and update phy_id notation
From: akpm @ 2007-08-10 21:05 UTC (permalink / raw)
To: jeff; +Cc: netdev, akpm, vitb
From: Vitaly Bordug <vitb@kernel.crashing.org>
device_bind_driver() error code returning has been fixed. release()
function has been written, so that to free resources in correct way; the
release path is now clean.
Before the rework, it used to cause
Device 'fixed@100:1' does not have a release() function, it is broken
and must be fixed.
BUG: at drivers/base/core.c:104 device_release()
Call Trace:
[<ffffffff802ec380>] kobject_cleanup+0x53/0x7e
[<ffffffff802ec3ab>] kobject_release+0x0/0x9
[<ffffffff802ecf3f>] kref_put+0x74/0x81
[<ffffffff8035493b>] fixed_mdio_register_device+0x230/0x265
[<ffffffff80564d31>] fixed_init+0x1f/0x35
[<ffffffff802071a4>] init+0x147/0x2fb
[<ffffffff80223b6e>] schedule_tail+0x36/0x92
[<ffffffff8020a678>] child_rip+0xa/0x12
[<ffffffff80311714>] acpi_ds_init_one_object+0x0/0x83
[<ffffffff8020705d>] init+0x0/0x2fb
[<ffffffff8020a66e>] child_rip+0x0/0x12
Also changed the notation of the fixed phy definition on
mdio bus to the form of <speed>+<duplex> to make it able to be used by
gianfar and ucc_geth that define phy_id strictly as "%d:%d" and cleaned up
the whitespace issues.
Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/net/phy/Kconfig | 14 +
drivers/net/phy/fixed.c | 310 ++++++++++++++++++------------------
include/linux/phy_fixed.h | 38 ++++
3 files changed, 207 insertions(+), 155 deletions(-)
diff -puN drivers/net/phy/Kconfig~phy-fixed-driver-rework-release-path-and-update drivers/net/phy/Kconfig
--- a/drivers/net/phy/Kconfig~phy-fixed-driver-rework-release-path-and-update
+++ a/drivers/net/phy/Kconfig
@@ -76,4 +76,18 @@ config FIXED_MII_100_FDX
bool "Emulation for 100M Fdx fixed PHY behavior"
depends on FIXED_PHY
+config FIXED_MII_1000_FDX
+ bool "Emulation for 1000M Fdx fixed PHY behavior"
+ depends on FIXED_PHY
+
+config FIXED_MII_AMNT
+ int "Number of emulated PHYs to allocate "
+ depends on FIXED_PHY
+ default "1"
+ ---help---
+ Sometimes it is required to have several independent emulated
+ PHYs on the bus (in case of multi-eth but phy-less HW for instance).
+ This control will have specified number allocated for each fixed
+ PHY type enabled.
+
endif # PHYLIB
diff -puN drivers/net/phy/fixed.c~phy-fixed-driver-rework-release-path-and-update drivers/net/phy/fixed.c
--- a/drivers/net/phy/fixed.c~phy-fixed-driver-rework-release-path-and-update
+++ a/drivers/net/phy/fixed.c
@@ -30,53 +30,31 @@
#include <linux/mii.h>
#include <linux/ethtool.h>
#include <linux/phy.h>
+#include <linux/phy_fixed.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
-#define MII_REGS_NUM 7
-
-/*
- The idea is to emulate normal phy behavior by responding with
- pre-defined values to mii BMCR read, so that read_status hook could
- take all the needed info.
-*/
-
-struct fixed_phy_status {
- u8 link;
- u16 speed;
- u8 duplex;
-};
-
-/*-----------------------------------------------------------------------------
- * Private information hoder for mii_bus
- *-----------------------------------------------------------------------------*/
-struct fixed_info {
- u16 *regs;
- u8 regs_num;
- struct fixed_phy_status phy_status;
- struct phy_device *phydev; /* pointer to the container */
- /* link & speed cb */
- int(*link_update)(struct net_device*, struct fixed_phy_status*);
-
-};
+/* we need to track the allocated pointers in order to free them on exit */
+static struct fixed_info *fixed_phy_ptrs[CONFIG_FIXED_MII_AMNT*MAX_PHY_AMNT];
/*-----------------------------------------------------------------------------
* If something weird is required to be done with link/speed,
* network driver is able to assign a function to implement this.
* May be useful for PHY's that need to be software-driven.
*-----------------------------------------------------------------------------*/
-int fixed_mdio_set_link_update(struct phy_device* phydev,
- int(*link_update)(struct net_device*, struct fixed_phy_status*))
+int fixed_mdio_set_link_update(struct phy_device *phydev,
+ int (*link_update) (struct net_device *,
+ struct fixed_phy_status *))
{
struct fixed_info *fixed;
- if(link_update == NULL)
+ if (link_update == NULL)
return -EINVAL;
- if(phydev) {
- if(phydev->bus) {
+ if (phydev) {
+ if (phydev->bus) {
fixed = phydev->bus->priv;
fixed->link_update = link_update;
return 0;
@@ -84,54 +62,64 @@ int fixed_mdio_set_link_update(struct ph
}
return -EINVAL;
}
+
EXPORT_SYMBOL(fixed_mdio_set_link_update);
+struct fixed_info *fixed_mdio_get_phydev (int phydev_ind)
+{
+ if (phydev_ind >= MAX_PHY_AMNT)
+ return NULL;
+ return fixed_phy_ptrs[phydev_ind];
+}
+
+EXPORT_SYMBOL(fixed_mdio_get_phydev);
+
/*-----------------------------------------------------------------------------
* This is used for updating internal mii regs from the status
*-----------------------------------------------------------------------------*/
-#if defined(CONFIG_FIXED_MII_100_FDX) || defined(CONFIG_FIXED_MII_10_FDX)
+#if defined(CONFIG_FIXED_MII_100_FDX) || defined(CONFIG_FIXED_MII_10_FDX) || defined(CONFIG_FIXED_MII_1000_FDX)
static int fixed_mdio_update_regs(struct fixed_info *fixed)
{
u16 *regs = fixed->regs;
u16 bmsr = 0;
u16 bmcr = 0;
- if(!regs) {
+ if (!regs) {
printk(KERN_ERR "%s: regs not set up", __FUNCTION__);
return -EINVAL;
}
- if(fixed->phy_status.link)
+ if (fixed->phy_status.link)
bmsr |= BMSR_LSTATUS;
- if(fixed->phy_status.duplex) {
+ if (fixed->phy_status.duplex) {
bmcr |= BMCR_FULLDPLX;
- switch ( fixed->phy_status.speed ) {
+ switch (fixed->phy_status.speed) {
case 100:
bmsr |= BMSR_100FULL;
bmcr |= BMCR_SPEED100;
- break;
+ break;
case 10:
bmsr |= BMSR_10FULL;
- break;
+ break;
}
} else {
- switch ( fixed->phy_status.speed ) {
+ switch (fixed->phy_status.speed) {
case 100:
bmsr |= BMSR_100HALF;
bmcr |= BMCR_SPEED100;
- break;
+ break;
case 10:
bmsr |= BMSR_100HALF;
- break;
+ break;
}
}
- regs[MII_BMCR] = bmcr;
- regs[MII_BMSR] = bmsr | 0x800; /*we are always capable of 10 hdx*/
+ regs[MII_BMCR] = bmcr;
+ regs[MII_BMSR] = bmsr | 0x800; /*we are always capable of 10 hdx */
return 0;
}
@@ -141,29 +129,30 @@ static int fixed_mii_read(struct mii_bus
struct fixed_info *fixed = bus->priv;
/* if user has registered link update callback, use it */
- if(fixed->phydev)
- if(fixed->phydev->attached_dev) {
- if(fixed->link_update) {
+ if (fixed->phydev)
+ if (fixed->phydev->attached_dev) {
+ if (fixed->link_update) {
fixed->link_update(fixed->phydev->attached_dev,
- &fixed->phy_status);
+ &fixed->phy_status);
fixed_mdio_update_regs(fixed);
}
- }
+ }
if ((unsigned int)location >= fixed->regs_num)
return -1;
return fixed->regs[location];
}
-static int fixed_mii_write(struct mii_bus *bus, int phy_id, int location, u16 val)
+static int fixed_mii_write(struct mii_bus *bus, int phy_id, int location,
+ u16 val)
{
- /* do nothing for now*/
+ /* do nothing for now */
return 0;
}
static int fixed_mii_reset(struct mii_bus *bus)
{
- /*nothing here - no way/need to reset it*/
+ /*nothing here - no way/need to reset it */
return 0;
}
#endif
@@ -171,8 +160,8 @@ static int fixed_mii_reset(struct mii_bu
static int fixed_config_aneg(struct phy_device *phydev)
{
/* :TODO:03/13/2006 09:45:37 PM::
- The full autoneg funcionality can be emulated,
- but no need to have anything here for now
+ The full autoneg funcionality can be emulated,
+ but no need to have anything here for now
*/
return 0;
}
@@ -182,59 +171,79 @@ static int fixed_config_aneg(struct phy_
* match will never return true...
*-----------------------------------------------------------------------------*/
static struct phy_driver fixed_mdio_driver = {
- .name = "Fixed PHY",
- .features = PHY_BASIC_FEATURES,
- .config_aneg = fixed_config_aneg,
- .read_status = genphy_read_status,
- .driver = { .owner = THIS_MODULE,},
+ .name = "Fixed PHY",
+#ifdef CONFIG_FIXED_MII_1000_FDX
+ .features = PHY_GBIT_FEATURES,
+#else
+ .features = PHY_BASIC_FEATURES,
+#endif
+ .config_aneg = fixed_config_aneg,
+ .read_status = genphy_read_status,
+ .driver = { .owner = THIS_MODULE, },
};
+static void fixed_mdio_release(struct device *dev)
+{
+ struct phy_device *phydev = container_of(dev, struct phy_device, dev);
+ struct mii_bus *bus = phydev->bus;
+ struct fixed_info *fixed = bus->priv;
+
+ kfree(phydev);
+ kfree(bus->dev);
+ kfree(bus);
+ kfree(fixed->regs);
+ kfree(fixed);
+}
+
/*-----------------------------------------------------------------------------
* This func is used to create all the necessary stuff, bind
* the fixed phy driver and register all it on the mdio_bus_type.
- * speed is either 10 or 100, duplex is boolean.
+ * speed is either 10 or 100 or 1000, duplex is boolean.
* number is used to create multiple fixed PHYs, so that several devices can
* utilize them simultaneously.
+ *
+ * The device on mdio bus will look like [bus_id]:[phy_id],
+ * bus_id = number
+ * phy_id = speed+duplex.
*-----------------------------------------------------------------------------*/
-#if defined(CONFIG_FIXED_MII_100_FDX) || defined(CONFIG_FIXED_MII_10_FDX)
-static int fixed_mdio_register_device(int number, int speed, int duplex)
+#if defined(CONFIG_FIXED_MII_100_FDX) || defined(CONFIG_FIXED_MII_10_FDX) || defined(CONFIG_FIXED_MII_1000_FDX)
+struct fixed_info *fixed_mdio_register_device(
+ int bus_id, int speed, int duplex, u8 phy_id)
{
struct mii_bus *new_bus;
struct fixed_info *fixed;
struct phy_device *phydev;
- int err = 0;
+ int err;
- struct device* dev = kzalloc(sizeof(struct device), GFP_KERNEL);
+ struct device *dev = kzalloc(sizeof(struct device), GFP_KERNEL);
- if (NULL == dev)
- return -ENOMEM;
+ if (dev == NULL)
+ goto err_dev_alloc;
new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL);
- if (NULL == new_bus) {
- kfree(dev);
- return -ENOMEM;
- }
+ if (new_bus == NULL)
+ goto err_bus_alloc;
+
fixed = kzalloc(sizeof(struct fixed_info), GFP_KERNEL);
- if (NULL == fixed) {
- kfree(dev);
- kfree(new_bus);
- return -ENOMEM;
- }
+ if (fixed == NULL)
+ goto err_fixed_alloc;
+
+ fixed->regs = kzalloc(MII_REGS_NUM * sizeof(int), GFP_KERNEL);
+ if (NULL == fixed->regs)
+ goto err_fixed_regs_alloc;
- fixed->regs = kzalloc(MII_REGS_NUM*sizeof(int), GFP_KERNEL);
fixed->regs_num = MII_REGS_NUM;
fixed->phy_status.speed = speed;
fixed->phy_status.duplex = duplex;
fixed->phy_status.link = 1;
- new_bus->name = "Fixed MII Bus",
- new_bus->read = &fixed_mii_read,
- new_bus->write = &fixed_mii_write,
- new_bus->reset = &fixed_mii_reset,
-
- /*set up workspace*/
+ new_bus->name = "Fixed MII Bus";
+ new_bus->read = &fixed_mii_read;
+ new_bus->write = &fixed_mii_write;
+ new_bus->reset = &fixed_mii_reset;
+ /*set up workspace */
fixed_mdio_update_regs(fixed);
new_bus->priv = fixed;
@@ -243,119 +252,110 @@ static int fixed_mdio_register_device(in
/* create phy_device and register it on the mdio bus */
phydev = phy_device_create(new_bus, 0, 0);
+ if (phydev == NULL)
+ goto err_phy_dev_create;
/*
- Put the phydev pointer into the fixed pack so that bus read/write code could
- be able to access for instance attached netdev. Well it doesn't have to do
- so, only in case of utilizing user-specified link-update...
+ * Put the phydev pointer into the fixed pack so that bus read/write
+ * code could be able to access for instance attached netdev. Well it
+ * doesn't have to do so, only in case of utilizing user-specified
+ * link-update...
*/
- fixed->phydev = phydev;
- if(NULL == phydev) {
- err = -ENOMEM;
- goto device_create_fail;
- }
+ fixed->phydev = phydev;
+ phydev->speed = speed;
+ phydev->duplex = duplex;
phydev->irq = PHY_IGNORE_INTERRUPT;
phydev->dev.bus = &mdio_bus_type;
- if(number)
- snprintf(phydev->dev.bus_id, BUS_ID_SIZE,
- "fixed_%d@%d:%d", number, speed, duplex);
- else
- snprintf(phydev->dev.bus_id, BUS_ID_SIZE,
- "fixed@%d:%d", speed, duplex);
- phydev->bus = new_bus;
+ snprintf(phydev->dev.bus_id, BUS_ID_SIZE,
+ PHY_ID_FMT, bus_id, phy_id);
- err = device_register(&phydev->dev);
- if(err) {
- printk(KERN_ERR "Phy %s failed to register\n",
- phydev->dev.bus_id);
- goto bus_register_fail;
- }
+ phydev->bus = new_bus;
- /*
- the mdio bus has phy_id match... In order not to do it
- artificially, we are binding the driver here by hand;
- it will be the same for all the fixed phys anyway.
- */
phydev->dev.driver = &fixed_mdio_driver.driver;
-
+ phydev->dev.release = fixed_mdio_release;
err = phydev->dev.driver->probe(&phydev->dev);
- if(err < 0) {
- printk(KERN_ERR "Phy %s: problems with fixed driver\n",phydev->dev.bus_id);
- goto probe_fail;
+ if (err < 0) {
+ printk(KERN_ERR "Phy %s: problems with fixed driver\n",
+ phydev->dev.bus_id);
+ goto err_out;
}
+ err = device_register(&phydev->dev);
+ if (err) {
+ printk(KERN_ERR "Phy %s failed to register\n",
+ phydev->dev.bus_id);
+ goto err_out;
+ }
+ //phydev->state = PHY_RUNNING; /* make phy go up quick, but in 10Mbit/HDX
+ return fixed;
- err = device_bind_driver(&phydev->dev);
- if (err)
- goto probe_fail;
-
- return 0;
-
-probe_fail:
- device_unregister(&phydev->dev);
-bus_register_fail:
+err_out:
kfree(phydev);
-device_create_fail:
- kfree(dev);
- kfree(new_bus);
+err_phy_dev_create:
+ kfree(fixed->regs);
+err_fixed_regs_alloc:
kfree(fixed);
+err_fixed_alloc:
+ kfree(new_bus);
+err_bus_alloc:
+ kfree(dev);
+err_dev_alloc:
+
+ return NULL;
- return err;
}
#endif
-
MODULE_DESCRIPTION("Fixed PHY device & driver for PAL");
MODULE_AUTHOR("Vitaly Bordug");
MODULE_LICENSE("GPL");
static int __init fixed_init(void)
{
-#if 0
- int ret;
- int duplex = 0;
-#endif
-
- /* register on the bus... Not expected to be matched with anything there... */
+ int cnt = 0;
+ int i;
+/* register on the bus... Not expected to be matched
+ * with anything there...
+ *
+ */
phy_driver_register(&fixed_mdio_driver);
- /* So let the fun begin...
- We will create several mdio devices here, and will bound the upper
- driver to them.
-
- Then the external software can lookup the phy bus by searching
- fixed@speed:duplex, e.g. fixed@100:1, to be connected to the
- virtual 100M Fdx phy.
-
- In case several virtual PHYs required, the bus_id will be in form
- fixed_<num>@<speed>:<duplex>, which make it able even to define
- driver-specific link control callback, if for instance PHY is completely
- SW-driven.
-
- */
-
-#ifdef CONFIG_FIXED_MII_DUPLEX
-#if 0
- duplex = 1;
-#endif
+/* We will create several mdio devices here, and will bound the upper
+ * driver to them.
+ *
+ * Then the external software can lookup the phy bus by searching
+ * for 0:101, to be connected to the virtual 100M Fdx phy.
+ *
+ * In case several virtual PHYs required, the bus_id will be in form
+ * [num]:[duplex]+[speed], which make it able even to define
+ * driver-specific link control callback, if for instance PHY is
+ * completely SW-driven.
+ */
+ for (i=1; i <= CONFIG_FIXED_MII_AMNT; i++) {
+#ifdef CONFIG_FIXED_MII_1000_FDX
+ fixed_phy_ptrs[cnt++] = fixed_mdio_register_device(0, 1000, 1, i);
#endif
-
#ifdef CONFIG_FIXED_MII_100_FDX
- fixed_mdio_register_device(0, 100, 1);
+ fixed_phy_ptrs[cnt++] = fixed_mdio_register_device(1, 100, 1, i);
#endif
-
#ifdef CONFIG_FIXED_MII_10_FDX
- fixed_mdio_register_device(0, 10, 1);
+ fixed_phy_ptrs[cnt++] = fixed_mdio_register_device(2, 10, 1, i);
#endif
+ }
+
return 0;
}
static void __exit fixed_exit(void)
{
+ int i;
+
phy_driver_unregister(&fixed_mdio_driver);
- /* :WARNING:02/18/2006 04:32:40 AM:: Cleanup all the created stuff */
+ for (i=0; i < MAX_PHY_AMNT; i++)
+ if ( fixed_phy_ptrs[i] )
+ device_unregister(&fixed_phy_ptrs[i]->phydev->dev);
}
module_init(fixed_init);
diff -puN /dev/null include/linux/phy_fixed.h
--- /dev/null
+++ a/include/linux/phy_fixed.h
@@ -0,0 +1,38 @@
+#ifndef __PHY_FIXED_H
+#define __PHY_FIXED_H
+
+#define MII_REGS_NUM 29
+
+/* max number of virtual phy stuff */
+#define MAX_PHY_AMNT 10
+/*
+ The idea is to emulate normal phy behavior by responding with
+ pre-defined values to mii BMCR read, so that read_status hook could
+ take all the needed info.
+*/
+
+struct fixed_phy_status {
+ u8 link;
+ u16 speed;
+ u8 duplex;
+};
+
+/*-----------------------------------------------------------------------------
+ * Private information hoder for mii_bus
+ *-----------------------------------------------------------------------------*/
+struct fixed_info {
+ u16 *regs;
+ u8 regs_num;
+ struct fixed_phy_status phy_status;
+ struct phy_device *phydev; /* pointer to the container */
+ /* link & speed cb */
+ int (*link_update) (struct net_device *, struct fixed_phy_status *);
+
+};
+
+
+int fixed_mdio_set_link_update(struct phy_device *,
+ int (*link_update) (struct net_device *, struct fixed_phy_status *));
+struct fixed_info *fixed_mdio_get_phydev (int phydev_ind);
+
+#endif /* __PHY_FIXED_H */
_
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox