e1000e: reformat comment blocks, cosmetic changes only
Subsystems (2)
PATCH 1/8 e1000e: reformat comment blocks, cosmetic changes only
From: Bruce Allan <[email protected]>
Adjusting the comment blocks here to be code-style compliant. no code changes.
Changed some copyright dates to 2008.
Indentation fixes.
---
drivers/net/e1000e/82571.c | 105 +++++++--- drivers/net/e1000e/Makefile | 2 drivers/net/e1000e/defines.h | 109 ++++++----- drivers/net/e1000e/e1000.h | 16 +- drivers/net/e1000e/es2lan.c | 89 +++++---- drivers/net/e1000e/ethtool.c | 97 ++++++---- drivers/net/e1000e/hw.h | 145 +++++++------- drivers/net/e1000e/ich8lan.c | 262 ++++++++++++++++---------- drivers/net/e1000e/lib.c | 213 +++++++++++++-------- drivers/net/e1000e/netdev.c | 428 +++++++++++++++++++++++++++--------------- drivers/net/e1000e/param.c | 33 ++- drivers/net/e1000e/phy.c | 152 ++++++++++----- 12 files changed, 1009 insertions(+), 642 deletions(-)
drivers/net/e1000e/82571.c +67 -38
@@ -1,7 +1,7 @@/******************************************************************************* Intel PRO/1000 Linux driver -Copyright(c) 1999 - 2007 Intel Corporation. +Copyright(c) 1999 - 2008 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License,
@@ -29,6 +29,9 @@/* * 82571EB Gigabit Ethernet Controller * 82571EB Gigabit Ethernet Controller (Fiber) +* 82571EB Dual Port Gigabit Mezzanine Adapter +* 82571EB Quad Port Gigabit Mezzanine Adapter +* 82571PT Gigabit PT Quad Port Server ExpressModule * 82572EI Gigabit Ethernet Controller (Copper) * 82572EI Gigabit Ethernet Controller (Fiber) * 82572EI Gigabit Ethernet Controller
@@ -150,7 +153,8 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)if (((eecd >>15 ) &0x3 ) ==0x3 ) { nvm->type = e1000_nvm_flash_hw; nvm->word_size =2048 ; -/* Autonomous Flash update bit must be cleared due +/* +* Autonomous Flash update bit must be cleared due * to Flash update issue. */ eecd &= ~E1000_EECD_AUPDEN ;
@@ -159,10 +163,11 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) }/* Fall Through */ default : - nvm->type = e1000_nvm_eeprom_spi; + nvm->type = e1000_nvm_eeprom_spi; size = (u16)((eecd &E1000_EECD_SIZE_EX_MASK ) >>E1000_EECD_SIZE_EX_SHIFT ); -/* Added to a constant, "size" becomes the left-shift value +/* +* Added to a constant, "size" becomes the left-shift value * for setting word_size. */ size +=NVM_WORD_SIZE_BASE_SHIFT ;
@@ -208,8 +213,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)/* Set rar entry count */ mac->rar_entry_count =E1000_RAR_ENTRIES ;/* Set if manageability features are enabled. */ - mac->arc_subsystem_valid = - (er32 (FWSM ) &E1000_FWSM_MODE_MASK ) ?1 :0 ; + mac->arc_subsystem_valid = (er32 (FWSM ) &E1000_FWSM_MODE_MASK ) ?1 :0 ;/* check for link */ switch (hw->media_type) {
@@ -219,14 +223,18 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) 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->setup_physical_interface = + e1000_setup_fiber_serdes_link_82571; func->check_for_link = e1000e_check_for_fiber_link; - func->get_link_up_info = e1000e_get_speed_and_duplex_fiber_serdes; + func->get_link_up_info = + e1000e_get_speed_and_duplex_fiber_serdes;break ;case e1000_media_type_internal_serdes: - func->setup_physical_interface = e1000_setup_fiber_serdes_link_82571; + func->setup_physical_interface = + e1000_setup_fiber_serdes_link_82571; func->check_for_link = e1000e_check_for_serdes_link; - func->get_link_up_info = e1000e_get_speed_and_duplex_fiber_serdes; + func->get_link_up_info = + e1000e_get_speed_and_duplex_fiber_serdes;break ;default :return -E1000_ERR_CONFIG ;
@@ -322,10 +330,12 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)switch (hw->mac.type) {case e1000_82571:case e1000_82572: -/* The 82571 firmware may still be configuring the PHY. +/* +* The 82571 firmware may still be configuring the PHY. * In this case, we cannot access the PHY until the * configuration is done. So we explicitly set the -* PHY ID. */ +* PHY ID. +*/ phy->id =IGP01E1000_I_PHY_ID ;break ;case e1000_82573:
@@ -479,8 +489,10 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)if (ret_val)return ret_val; -/* If our nvm is an EEPROM, then we're done -* otherwise, commit the checksum to the flash NVM. */ +/* +* If our nvm is an EEPROM, then we're done +* otherwise, commit the checksum to the flash NVM. +*/ if (hw->nvm.type != e1000_nvm_flash_hw)return ret_val;
@@ -496,7 +508,8 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)/* Reset the firmware if using STM opcode. */ if ((er32 (FLOP ) &0xFF00 ) ==E1000_STM_OPCODE ) { -/* The enabling of and the actual reset must be done +/* +* The enabling of and the actual reset must be done * in two write cycles. */ ew32 (HICR ,E1000_HICR_FW_RESET_ENABLE );
@@ -557,8 +570,10 @@ static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,u32 eewr =0 ;s32 ret_val =0 ; -/* A check for invalid values: offset too large, too many words, -* and not enough words. */ +/* +* A check for invalid values: offset too large, too many words, +* and not enough words. +*/ if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || (words ==0 )) {hw_dbg (hw,"nvm parameter(s) out of bounds\n" );
@@ -645,30 +660,32 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) }else { data &= ~IGP02E1000_PM_D0_LPLU ; ret_val =e1e_wphy (hw,IGP02E1000_PHY_POWER_MGMT , data); -/* LPLU and SmartSpeed are mutually exclusive. LPLU is used +/* +* LPLU and SmartSpeed are mutually exclusive. LPLU is used * during Dx states where the power conservation is most * important. During driver activity we should enable -* SmartSpeed, so performance is maintained. */ +* SmartSpeed, so performance is maintained. +*/ if (phy->smart_speed == e1000_smart_speed_on) { ret_val =e1e_rphy (hw,IGP01E1000_PHY_PORT_CONFIG , - &data); + &data);if (ret_val)return ret_val; data |=IGP01E1000_PSCFR_SMART_SPEED ; ret_val =e1e_wphy (hw,IGP01E1000_PHY_PORT_CONFIG , - data); + data);if (ret_val)return ret_val; }else if (phy->smart_speed == e1000_smart_speed_off) { ret_val =e1e_rphy (hw,IGP01E1000_PHY_PORT_CONFIG , - &data); + &data);if (ret_val)return ret_val; data &= ~IGP01E1000_PSCFR_SMART_SPEED ; ret_val =e1e_wphy (hw,IGP01E1000_PHY_PORT_CONFIG , - data); + data);if (ret_val)return ret_val; }
@@ -693,7 +710,8 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)s32 ret_val;u16 i =0 ; -/* Prevent the PCI-E bus from sticking if there is no TLP connection +/* +* Prevent the PCI-E bus from sticking if there is no TLP connection * on the last TLP read/write transaction when MAC is reset. */ ret_val =e1000e_disable_pcie_master (hw);
@@ -709,8 +727,10 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)msleep (10 ); -/* Must acquire the MDIO ownership before MAC reset. -* Ownership defaults to firmware after a reset. */ +/* +* Must acquire the MDIO ownership before MAC reset. +* Ownership defaults to firmware after a reset. +*/ if (hw->mac.type == e1000_82573) { extcnf_ctrl =er32 (EXTCNF_CTRL ); extcnf_ctrl |=E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP ;
@@ -747,7 +767,8 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)/* We don't want to continue accessing MAC registers. */ return ret_val; -/* Phy configuration from NVM just starts after EECD_AUTO_RD is set. +/* +* Phy configuration from NVM just starts after EECD_AUTO_RD is set. * Need to wait for Phy configuration completion before accessing * NVM and Phy. */
@@ -793,7 +814,8 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)e1000e_clear_vfta (hw);/* Setup the receive address. */ -/* If, however, a locally administered address was assigned to the +/* +* If, however, a locally administered address was assigned to the * 82571, we must reserve a RAR for it to work around an issue where * resetting one port will reload the MAC on the other port. */
@@ -830,7 +852,8 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)ew32 (GCR , reg_data); } -/* Clear all of the statistics registers (clear on read). It is +/* +* Clear all of the statistics registers (clear on read). It is * important that we do this after we have tried to establish link * because the symbol error count will increment wildly if there * is no link.
@@ -922,7 +945,8 @@ void e1000e_clear_vfta(struct e1000_hw *hw)if (hw->mac.type == e1000_82573) {if (hw->mng_cookie.vlan_id !=0 ) { -/* The VFTA is a 4096b bit-field, each identifying +/* +* The VFTA is a 4096b bit-field, each identifying * a single VLAN ID. The following operations * determine which 32b entry (i.e. offset) into the * array we want to set the VLAN ID (i.e. bit) of
@@ -936,7 +960,8 @@ void e1000e_clear_vfta(struct e1000_hw *hw) } }for (offset =0 ; offset <E1000_VLAN_FILTER_TBL_SIZE ; offset++) { -/* If the offset we want to clear is the same offset of the +/* +* If the offset we want to clear is the same offset of the * manageability VLAN ID, then clear all bits except that of * the manageability unit. */
@@ -984,7 +1009,8 @@ static void e1000_mc_addr_list_update_82571(struct e1000_hw *hw,**/ static s32 e1000_setup_link_82571 (struct e1000_hw *hw) { -/* 82573 does not have a word in the NVM to determine +/* +* 82573 does not have a word in the NVM to determine * the default flow control setting, so we explicitly * set it to full. */
@@ -1050,14 +1076,14 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw)switch (hw->mac.type) {case e1000_82571:case e1000_82572: -/* If SerDes loopback mode is entered, there is no form +/* +* If SerDes loopback mode is entered, there is no form * of reset to take the adapter out of that mode. So we * have to explicitly take the adapter out of loopback * mode. This prevents drivers from twiddling their thumbs * if another tool failed to take it out of loopback mode. */ -ew32 (SCTL , -E1000_SCTL_DISABLE_SERDES_LOOPBACK ); +ew32 (SCTL ,E1000_SCTL_DISABLE_SERDES_LOOPBACK );break ;default :break ;
@@ -1124,7 +1150,8 @@ void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state)/* If workaround is activated... */ if (state) -/* Hold a copy of the LAA in RAR[14] This is done so that +/* +* Hold a copy of the LAA in RAR[14] This is done so that * between the time RAR[0] gets clobbered and the time it * gets fixed, the actual LAA is in one of the RARs and no * incoming packets directed to this port are dropped.
@@ -1152,7 +1179,8 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw)if (nvm->type != e1000_nvm_flash_hw)return 0 ; -/* Check bit 4 of word 10h. If it is 0, firmware is done updating +/* +* Check bit 4 of word 10h. If it is 0, firmware is done updating * 10h-12h. Checksum may need to be fixed. */ ret_val =e1000_read_nvm (hw,0x10 ,1 , &data);
@@ -1160,7 +1188,8 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw)return ret_val;if (!(data &0x10 )) { -/* Read 0x23 and check bit 15. This bit is a 1 +/* +* Read 0x23 and check bit 15. This bit is a 1 * when the checksum has already been fixed. If * the checksum is still wrong and this bit is a * 1, we need to return bad checksum. Otherwise,
drivers/net/e1000e/Makefile +1 -1
@@ -1,7 +1,7 @@ ################################################################################ # # Intel PRO/1000 Linux driver -# Copyright(c) 1999 - 2007 Intel Corporation. +# Copyright(c) 1999 - 2008 Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License,
drivers/net/e1000e/defines.h +58 -51
221 lines not on this page · raw message
drivers/net/e1000e/e1000.h +8 -8
@@ -1,7 +1,7 @@/******************************************************************************* Intel PRO/1000 Linux driver -Copyright(c) 1999 - 2007 Intel Corporation. +Copyright(c) 1999 - 2008 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License,
@@ -61,7 +61,7 @@ struct e1000_info; ndev_printk(KERN_NOTICE , netdev, format, ## arg) -/* TX/RX descriptor defines */ +/* Tx/Rx descriptor defines */ #define E1000_DEFAULT_TXD 256 #define E1000_MAX_TXD 4096 #define E1000_MIN_TXD 80
@@ -114,13 +114,13 @@ struct e1000_buffer {dma_addr_t dma;struct sk_buff *skb;union { -/* TX */ +/* Tx */ struct {unsigned long time_stamp;u16 length;u16 next_to_watch; }; -/* RX */ +/* Rx */ /* arrays of page information for packet split */ struct e1000_ps_page *ps_pages; };
@@ -177,7 +177,7 @@ struct e1000_adapter {u16 rx_itr;/* -* TX +* Tx */ struct e1000_ring *tx_ring/* One per active queue */ ____cacheline_aligned_in_smp ;
@@ -199,7 +199,7 @@ struct e1000_adapter {unsigned int total_rx_bytes;unsigned int total_rx_packets; -/* TX stats */ +/* Tx stats */ u64 tpt_old;u64 colc_old;u64 gotcl_old;
@@ -211,7 +211,7 @@ struct e1000_adapter {u32 tx_dma_failed;/* -* RX +* Rx */ bool (*clean_rx) (struct e1000_adapter *adapter,int *work_done,int work_to_do)
@@ -223,7 +223,7 @@ struct e1000_adapter {u32 rx_int_delay;u32 rx_abs_int_delay; -/* RX stats */ +/* Rx stats */ u64 hw_csum_err;u64 hw_csum_good;u64 rx_hdr_split;
drivers/net/e1000e/es2lan.c +52 -37
238 lines not on this page · raw message
drivers/net/e1000e/ethtool.c +62 -35
229 lines not on this page · raw message
drivers/net/e1000e/hw.h +72 -73
198 lines not on this page · raw message
drivers/net/e1000e/ich8lan.c +158 -104
598 lines not on this page · raw message
drivers/net/e1000e/lib.c +134 -79
580 lines not on this page · raw message
drivers/net/e1000e/netdev.c +279 -149
591 lines not on this page · raw message
drivers/net/e1000e/phy.c +97 -55
152 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
PATCH 2/8 e1000e: rename mc_addr_list_update
From: Jeff Kirsher <[email protected]>
Rename this function to be consistent with function naming (verb first)
---
drivers/net/e1000e/82571.c | 10 +++++----- drivers/net/e1000e/e1000.h | 8 +++++--- drivers/net/e1000e/es2lan.c | 2 +- drivers/net/e1000e/hw.h | 2 +- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/e1000e/lib.c | 8 ++++---- drivers/net/e1000e/netdev.c | 15 +++++++-------- 7 files changed, 24 insertions(+), 23 deletions(-)
drivers/net/e1000e/82571.c +5 -5
@@ -972,7 +972,7 @@ void e1000e_clear_vfta(struct e1000_hw *hw) }/** -* e1000_mc_addr_list_update_82571 - Update Multicast addresses +* e1000_update_mc_addr_list_82571 - Update Multicast addresses * @hw: pointer to the HW structure * @mc_addr_list: array of multicast addresses to program * @mc_addr_count: number of multicast addresses to program
@@ -984,7 +984,7 @@ void e1000e_clear_vfta(struct e1000_hw *hw)* The parameter rar_count will usually be hw->mac.rar_entry_count * unless there are workarounds that change this. **/ -static void e1000_mc_addr_list_update_82571(struct e1000_hw *hw, +static void e1000_update_mc_addr_list_82571(struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count, u32 rar_used_count,
@@ -993,8 +993,8 @@ static void e1000_mc_addr_list_update_82571(struct e1000_hw *hw,if (e1000e_get_laa_state_82571 (hw)) rar_count--; -e1000e_mc_addr_list_update_generic (hw, mc_addr_list, mc_addr_count, - rar_used_count, rar_count); +e1000e_update_mc_addr_list_generic (hw, mc_addr_list, mc_addr_count, + rar_used_count, rar_count); }/**
@@ -1269,7 +1269,7 @@ static struct e1000_mac_operations e82571_mac_ops = {/* .get_link_up_info: media type dependent */ .led_on = e1000e_led_on_generic, .led_off = e1000e_led_off_generic, - .mc_addr_list_update = e1000_mc_addr_list_update_82571, + .update_mc_addr_list = e1000_update_mc_addr_list_82571, .reset_hw = e1000_reset_hw_82571, .init_hw = e1000_init_hw_82571, .setup_link = e1000_setup_link_82571,
drivers/net/e1000e/e1000.h +5 -3
@@ -387,9 +387,11 @@ 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 e1000e_update_mc_addr_list_generic (struct e1000_hw *hw, +u8 *mc_addr_list, +u32 mc_addr_count, +u32 rar_used_count, +u32 rar_count);extern void e1000e_rar_set (struct e1000_hw *hw,u8 *addr,u32 index);extern s32 e1000e_set_fc_watermarks (struct e1000_hw *hw);extern void e1000e_set_pcie_no_snoop (struct e1000_hw *hw,u32 no_snoop);
drivers/net/e1000e/es2lan.c +1 -1
@@ -1190,7 +1190,7 @@ static struct e1000_mac_operations es2_mac_ops = { .get_link_up_info = e1000_get_link_up_info_80003es2lan, .led_on = e1000e_led_on_generic, .led_off = e1000e_led_off_generic, - .mc_addr_list_update = e1000e_mc_addr_list_update_generic, + .update_mc_addr_list = e1000e_update_mc_addr_list_generic, .reset_hw = e1000_reset_hw_80003es2lan, .init_hw = e1000_init_hw_80003es2lan, .setup_link = e1000e_setup_link,
drivers/net/e1000e/hw.h +1 -1
@@ -685,7 +685,7 @@ struct e1000_mac_operations {s32 (*get_link_up_info)(struct e1000_hw *,u16 *,u16 *);s32 (*led_on)(struct e1000_hw *);s32 (*led_off)(struct e1000_hw *); -void (*mc_addr_list_update)(struct e1000_hw *,u8 *,u32 ,u32 ,u32 ); +void (*update_mc_addr_list)(struct e1000_hw *,u8 *,u32 ,u32 ,u32 );s32 (*reset_hw)(struct e1000_hw *);s32 (*init_hw)(struct e1000_hw *);s32 (*setup_link)(struct e1000_hw *);
drivers/net/e1000e/ich8lan.c +1 -1
@@ -2212,7 +2212,7 @@ static struct e1000_mac_operations ich8_mac_ops = { .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 = e1000e_mc_addr_list_update_generic, + .update_mc_addr_list = e1000e_update_mc_addr_list_generic, .reset_hw = e1000_reset_hw_ich8lan, .init_hw = e1000_init_hw_ich8lan, .setup_link = e1000_setup_link_ich8lan,
drivers/net/e1000e/lib.c +4 -4
@@ -265,7 +265,7 @@ static u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) }/** -* e1000e_mc_addr_list_update_generic - Update Multicast addresses +* e1000e_update_mc_addr_list_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
@@ -277,9 +277,9 @@ 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 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) +void e1000e_update_mc_addr_list_generic (struct e1000_hw *hw, +u8 *mc_addr_list,u32 mc_addr_count, +u32 rar_used_count,u32 rar_count) {u32 hash_value;u32 i;
drivers/net/e1000e/netdev.c +7 -8
@@ -1889,7 +1889,7 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) }/** -* e1000_mc_addr_list_update - Update Multicast addresses +* e1000_update_mc_addr_list - 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
@@ -1903,11 +1903,11 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)* exists and all implementations are handled in the generic version of this * function. **/ -static void e1000_mc_addr_list_update (struct e1000_hw *hw,u8 *mc_addr_list, -u32 mc_addr_count,u32 rar_used_count, -u32 rar_count) +static void e1000_update_mc_addr_list (struct e1000_hw *hw,u8 *mc_addr_list, +u32 mc_addr_count,u32 rar_used_count, +u32 rar_count) { - hw->mac.ops.mc_addr_list_update (hw, mc_addr_list, mc_addr_count, + hw->mac.ops.update_mc_addr_list (hw, mc_addr_list, mc_addr_count, rar_used_count, rar_count); }
@@ -1961,7 +1961,7 @@ static void e1000_set_multi(struct net_device *netdev) mc_ptr = mc_ptr->next; } -e1000_mc_addr_list_update (hw, mta_list, i,1 , +e1000_update_mc_addr_list (hw, mta_list, i,1 , mac->rar_entry_count);kfree (mta_list); }else {
@@ -1969,8 +1969,7 @@ static void e1000_set_multi(struct net_device *netdev)* if we're called from probe, we might not have * anything to do here, so clear out the list */ -e1000_mc_addr_list_update (hw,NULL ,0 ,1 , - mac->rar_entry_count); +e1000_update_mc_addr_list (hw,NULL ,0 ,1 , mac->rar_entry_count); } }
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
PATCH 3/8 e1000e: reorganize PHY and flow control interface
In reply to Auke KokFrom: Jeff Kirsher <[email protected]>
This reorganization moves the PHY status into a separate struct. Flow Control setup is moved into this struct as well and frame size away from here into the adapter struct where its inly use is.
The post-link-up code is now a separate function and moved out of the watchdog function itself. This allows us to track the es2lan restart issue a bit easier.
---
drivers/net/e1000e/82571.c | 12 ++- drivers/net/e1000e/e1000.h | 5 + drivers/net/e1000e/es2lan.c | 14 ++-- drivers/net/e1000e/ethtool.c | 64 +++++++++--------- drivers/net/e1000e/hw.h | 26 ++++--- drivers/net/e1000e/ich8lan.c | 15 ++-- drivers/net/e1000e/lib.c | 65 +++++++++--------- drivers/net/e1000e/netdev.c | 151 +++++++++++++++++++++++++++--------------- drivers/net/e1000e/phy.c | 12 ++- 9 files changed, 205 insertions(+), 159 deletions(-)
drivers/net/e1000e/82571.c +6 -6
@@ -75,7 +75,7 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)struct e1000_phy_info *phy = &hw->phy;s32 ret_val; -if (hw->media_type != e1000_media_type_copper) { +if (hw->phy.media_type != e1000_media_type_copper) { phy->type = e1000_phy_none;return 0 ; }
@@ -195,16 +195,16 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)case E1000_DEV_ID_82571EB_FIBER :case E1000_DEV_ID_82572EI_FIBER :case E1000_DEV_ID_82571EB_QUAD_FIBER : - hw->media_type = e1000_media_type_fiber; + hw->phy.media_type = e1000_media_type_fiber;break ;case E1000_DEV_ID_82571EB_SERDES :case E1000_DEV_ID_82572EI_SERDES :case E1000_DEV_ID_82571EB_SERDES_DUAL :case E1000_DEV_ID_82571EB_SERDES_QUAD : - hw->media_type = e1000_media_type_internal_serdes; + hw->phy.media_type = e1000_media_type_internal_serdes;break ;default : - hw->media_type = e1000_media_type_copper; + hw->phy.media_type = e1000_media_type_copper;break ; }
@@ -216,7 +216,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) mac->arc_subsystem_valid = (er32 (FWSM ) &E1000_FWSM_MODE_MASK ) ?1 :0 ;/* check for link */ -switch (hw->media_type) { +switch (hw->phy.media_type) {case e1000_media_type_copper: func->setup_physical_interface = e1000_setup_copper_link_82571; func->check_for_link = e1000e_check_for_copper_link;
@@ -1015,7 +1015,7 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw)* set it to full. */ if (hw->mac.type == e1000_82573) - hw->mac.fc = e1000_fc_full; + hw->fc.type = e1000_fc_full;return e1000e_setup_link (hw); }
drivers/net/e1000e/e1000.h +4 -1
@@ -234,6 +234,8 @@ struct e1000_adapter {unsigned int rx_ps_pages;u16 rx_ps_bsize0; +u32 max_frame_size; +u32 min_frame_size;/* OS defined structs */ struct net_device *netdev;
@@ -258,7 +260,7 @@ struct e1000_adapter {u32 wol;u32 pba; -u8 fc_autoneg; +bool fc_autoneg;unsigned long led_status;
@@ -305,6 +307,7 @@ struct e1000_info {#define FLAG_MSI_ENABLED (1 << 27)#define FLAG_RX_CSUM_ENABLED (1 << 28)#define FLAG_TSO_FORCE (1 << 29) +#define FLAG_RX_RESTART_NOW (1 << 30)#define E1000_RX_DESC_PS (R , i) \ (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
drivers/net/e1000e/es2lan.c +7 -7
@@ -119,7 +119,7 @@ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw)struct e1000_phy_info *phy = &hw->phy;s32 ret_val; -if (hw->media_type != e1000_media_type_copper) { +if (hw->phy.media_type != e1000_media_type_copper) { phy->type = e1000_phy_none;return 0 ; }
@@ -198,10 +198,10 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)/* Set media type */ switch (adapter->pdev->device) {case E1000_DEV_ID_80003ES2LAN_SERDES_DPT : - hw->media_type = e1000_media_type_internal_serdes; + hw->phy.media_type = e1000_media_type_internal_serdes;break ;default : - hw->media_type = e1000_media_type_copper; + hw->phy.media_type = e1000_media_type_copper;break ; }
@@ -213,7 +213,7 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) mac->arc_subsystem_valid = (er32 (FWSM ) &E1000_FWSM_MODE_MASK ) ?1 :0 ;/* check for link */ -switch (hw->media_type) { +switch (hw->phy.media_type) {case e1000_media_type_copper: func->setup_physical_interface = e1000_setup_copper_link_80003es2lan; func->check_for_link = e1000e_check_for_copper_link;
@@ -591,7 +591,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)udelay (1 ); -if (hw->phy.wait_for_link) { +if (hw->phy.autoneg_wait_to_complete) {hw_dbg (hw,"Waiting for forced speed/duplex link " "on GG82563 phy.\n" );
@@ -682,7 +682,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) { +if (hw->phy.media_type == e1000_media_type_copper) { ret_val =e1000e_get_speed_and_duplex_copper (hw, speed, duplex);
@@ -854,7 +854,7 @@ static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw)/* Transmit Arbitration Control 0 */ reg =er32 (TARC0 ); reg &= ~(0xF <<27 );/* 30:27 */ -if (hw->media_type != e1000_media_type_copper) +if (hw->phy.media_type != e1000_media_type_copper) reg &= ~(1 <<20 );ew32 (TARC0 , reg);
drivers/net/e1000e/ethtool.c +33 -31
186 lines not on this page · raw message
drivers/net/e1000e/hw.h +15 -11
@@ -400,7 +400,7 @@ enum e1000_rev_polarity{ e1000_rev_polarity_undefined =0xFF }; -enum e1000_fc_mode { +enum e1000_fc_type { e1000_fc_none =0 , e1000_fc_rx_pause, e1000_fc_tx_pause,
@@ -727,16 +727,12 @@ struct e1000_mac_info {u8 perm_addr[6 ];enum e1000_mac_type type; -enum e1000_fc_mode fc; -enum e1000_fc_mode original_fc;u32 collision_delta;u32 ledctl_default;u32 ledctl_mode1;u32 ledctl_mode2; -u32 max_frame_size;u32 mc_filter_type; -u32 min_frame_size;u32 tx_packet_delta;u32 txcw;
@@ -747,9 +743,6 @@ struct e1000_mac_info {u16 ifs_step_size;u16 mta_reg_count;u16 rar_entry_count; -u16 fc_high_water; -u16 fc_low_water; -u16 fc_pause_time;u8 forced_speed_duplex;
@@ -779,6 +772,8 @@ struct e1000_phy_info {u32 reset_delay_us;/* in usec */ u32 revision; +enum e1000_media_type media_type; +u16 autoneg_advertised;u16 autoneg_mask;u16 cable_length;
@@ -791,7 +786,7 @@ struct e1000_phy_info {bool is_mdix;bool polarity_correction;bool speed_downgraded; -bool wait_for_link; +bool autoneg_wait_to_complete; };struct e1000_nvm_info {
@@ -816,6 +811,16 @@ struct e1000_bus_info {u16 func; }; +struct e1000_fc_info { +u32 high_water;/* Flow control high-water mark */ +u32 low_water;/* Flow control low-water mark */ +u16 pause_time;/* Flow control pause timer */ +bool send_xon;/* Flow control send XON */ +bool strict_ieee;/* Strict IEEE mode */ +enum e1000_fc_type type;/* Type of flow control */ +enum e1000_fc_type original_type; +}; +struct e1000_dev_spec_82571 {bool laa_is_present;bool alt_mac_addr_is_present;
@@ -840,6 +845,7 @@ struct e1000_hw {u8 __iomem *flash_address;struct e1000_mac_info mac; +struct e1000_fc_info fc;struct e1000_phy_info phy;struct e1000_nvm_info nvm;struct e1000_bus_info bus;
@@ -849,8 +855,6 @@ struct e1000_hw {struct e1000_dev_spec_82571 e82571;struct e1000_dev_spec_ich8lan ich8lan; } dev_spec; - -enum e1000_media_type media_type; };#ifdef DEBUG
drivers/net/e1000e/ich8lan.c +7 -8
@@ -298,7 +298,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)struct e1000_mac_info *mac = &hw->mac;/* Set media type function pointer */ - hw->media_type = e1000_media_type_copper; + hw->phy.media_type = e1000_media_type_copper;/* Set mta register count */ mac->mta_reg_count =32 ;
@@ -453,7 +453,7 @@ static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw)udelay (1 ); -if (phy->wait_for_link) { +if (phy->autoneg_wait_to_complete) {hw_dbg (hw,"Waiting for forced speed/duplex link on IFE phy.\n" ); ret_val = e1000e_phy_has_link_generic(hw,
@@ -1852,7 +1852,6 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw)**/ static s32 e1000_setup_link_ich8lan (struct e1000_hw *hw) { -struct e1000_mac_info *mac = &hw->mac;s32 ret_val;if (e1000_check_reset_block (hw))
@@ -1863,19 +1862,19 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)* the default flow control setting, so we explicitly * set it to full. */ -if (mac->fc == e1000_fc_default) - mac->fc = e1000_fc_full; +if (hw->fc.type == e1000_fc_default) + hw->fc.type = e1000_fc_full; - mac->original_fc = mac->fc; + hw->fc.original_type = hw->fc.type; -hw_dbg (hw,"After fix-ups FlowControl is now = %x\n" , mac->fc); +hw_dbg (hw,"After fix-ups FlowControl is now = %x\n" , hw->fc.type);/* Continue to configure the copper link. */ ret_val =e1000_setup_copper_link_ich8lan (hw);if (ret_val)return ret_val; -ew32 (FCTTV , mac->fc_pause_time); +ew32 (FCTTV , hw->fc.pause_time);return e1000e_set_fc_watermarks (hw); }
drivers/net/e1000e/lib.c +31 -34
211 lines not on this page · raw message
drivers/net/e1000e/netdev.c +96 -55
305 lines not on this page · raw message
drivers/net/e1000e/phy.c +6 -6
@@ -714,7 +714,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)* other: No software override. The flow control configuration * in the EEPROM is used. */ -switch (hw->mac.fc) { +switch (hw->fc.type) {case e1000_fc_none:/* * Flow control (Rx & Tx) is completely disabled by a
@@ -822,7 +822,7 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)* Does the user want to wait for Auto-Neg to complete here, or * check at a later time (for example, callback routine). */ -if (phy->wait_for_link) { +if (phy->autoneg_wait_to_complete) { ret_val =e1000_wait_autoneg (hw);if (ret_val) { hw_dbg(hw, "Error while waiting for "
@@ -937,7 +937,7 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw)udelay (1 ); -if (phy->wait_for_link) { +if (phy->autoneg_wait_to_complete) {hw_dbg (hw,"Waiting for forced speed/duplex link on IGP phy.\n" ); ret_val = e1000e_phy_has_link_generic(hw,
@@ -1009,7 +1009,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)udelay (1 ); -if (phy->wait_for_link) { +if (phy->autoneg_wait_to_complete) {hw_dbg (hw,"Waiting for forced speed/duplex link on M88 phy.\n" ); ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
@@ -1084,7 +1084,7 @@ void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)u32 ctrl;/* Turn off flow control when forcing speed/duplex */ - mac->fc = e1000_fc_none; + hw->fc.type = e1000_fc_none;/* Force speed/duplex on the mac */ ctrl =er32 (CTRL );
@@ -1508,7 +1508,7 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw)u16 phy_data;bool link; -if (hw->media_type != e1000_media_type_copper) { +if (hw->phy.media_type != e1000_media_type_copper) {hw_dbg (hw,"Phy info is only valid for copper media\n" );return -E1000_ERR_CONFIG ; }
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
PATCH 4/8 e1000e: limit EEPROM size accesses
In reply to Auke KokFrom: Jeff Kirsher <[email protected]>
---
drivers/net/e1000e/82571.c | 4 ++++ drivers/net/e1000e/es2lan.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)
drivers/net/e1000e/82571.c +4 -0
@@ -171,6 +171,10 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)* for setting word_size. */ size +=NVM_WORD_SIZE_BASE_SHIFT ; + +/* EEPROM access above 16k is unsupported */ +if (size >14 ) + size =14 ; nvm->word_size =1 << size;break ; }
drivers/net/e1000e/es2lan.c +4 -0
@@ -178,6 +178,10 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw)* for setting word_size. */ size +=NVM_WORD_SIZE_BASE_SHIFT ; + +/* EEPROM access above 16k is unsupported */ +if (size >14 ) + size =14 ; nvm->word_size =1 << size;return 0 ;
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Re: [PATCH 4/8] e1000e: limit EEPROM size accesses
Quoted 30 lines · Auke Kok
From: Jeff Kirsher <[email protected]>
Signed-off-by Jeff Kirsher <[email protected]>Signed-off-by Auke Kok <[email protected]>---
drivers/net/e1000e/82571.c | 4 ++++ drivers/net/e1000e/es2lan.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)drivers/net/e1000e/82571.c +4
-0@@ -171,6 +171,10 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)* for setting word_size. */ size +=NVM_WORD_SIZE_BASE_SHIFT ; + +/* EEPROM access above 16k is unsupported */ +if (size >14 ) + size =14 ; nvm->word_size =1 << size;break ; }drivers/net/e1000e/es2lan.c +0
-0
drivers/net/e1000e/es2lan.c static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) · line 185
Quoted 8 lines
drivers/net/e1000e/es2lan.c +4
-0@@ -178,6 +178,10 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw)* for setting word_size. */ size +=NVM_WORD_SIZE_BASE_SHIFT ; + +/* EEPROM access above 16k is unsupported */ +if (size >14 ) + size =14 ; nvm->word_size =1 << size;
Is this 2.6.25-rc material?
Re: [PATCH 4/8] e1000e: limit EEPROM size accesses
Quoted 35 lines · Jeff Garzik
Quoted 34 lines · Auke Kok
From: Jeff Kirsher <[email protected]>
Signed-off-by Jeff Kirsher <[email protected]>Signed-off-by Auke Kok <[email protected]>---
drivers/net/e1000e/82571.c | 4 ++++ drivers/net/e1000e/es2lan.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)drivers/net/e1000e/82571.c +4
-0@@ -171,6 +171,10 @@ static s32 e1000_init_nvm_params_82571(structe1000_hw *hw) * for setting word_size. */ size +=NVM_WORD_SIZE_BASE_SHIFT ; + +/* EEPROM access above 16k is unsupported */ +if (size >14 ) + size =14 ; nvm->word_size =1 << size;break ;}drivers/net/e1000e/es2lan.c +0
-0@@ -178,6 +178,10 @@ static s32e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) * for setting word_size. */
Quoted 8 lines
drivers/net/e1000e/es2lan.c static s32 · line 186
Quoted 6 lines
drivers/net/e1000e/es2lan.c +4
-0size +=NVM_WORD_SIZE_BASE_SHIFT ; + +/* EEPROM access above 16k is unsupported */ +if (size >14 ) + size =14 ; nvm->word_size =1 << size;Is this 2.6.25-rc material?
hardly, there are no known bugs again us reading too far in the eeprom. 2.6.26+ is fine.
Auke
PATCH 5/8 e1000e: Make arrays out of these Rx/Tx registers
In reply to Auke KokFrom: Jeff Kirsher <[email protected]>
With multiple queues coming into the code these base control registers need to be made into arrays.
---
drivers/net/e1000e/82571.c | 24 ++++++++++++------------ drivers/net/e1000e/es2lan.c | 24 ++++++++++++------------ drivers/net/e1000e/hw.h | 10 ++++++---- drivers/net/e1000e/ich8lan.c | 24 ++++++++++++------------ drivers/net/e1000e/netdev.c | 16 ++++++++-------- 5 files changed, 50 insertions(+), 48 deletions(-)
drivers/net/e1000e/82571.c +12 -12
@@ -836,19 +836,19 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) ret_val =e1000_setup_link_82571 (hw);/* Set the transmit descriptor write-back policy */ - reg_data =er32 (TXDCTL ); + reg_data =er32 (TXDCTL (0 )); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH ) |E1000_TXDCTL_FULL_TX_DESC_WB |E1000_TXDCTL_COUNT_DESC ; -ew32 (TXDCTL , reg_data); +ew32 (TXDCTL (0 ), reg_data);/* ...for both queues. */ if (mac->type != e1000_82573) { - reg_data =er32 (TXDCTL1 ); + reg_data =er32 (TXDCTL (1 )); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH ) |E1000_TXDCTL_FULL_TX_DESC_WB |E1000_TXDCTL_COUNT_DESC ; -ew32 (TXDCTL1 , reg_data); +ew32 (TXDCTL (1 ), reg_data); }else {e1000e_enable_tx_pkt_filtering (hw); reg_data =er32 (GCR );
@@ -878,17 +878,17 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)u32 reg;/* Transmit Descriptor Control 0 */ - reg =er32 (TXDCTL ); + reg =er32 (TXDCTL (0 )); reg |= (1 <<22 ); -ew32 (TXDCTL , reg); +ew32 (TXDCTL (0 ), reg);/* Transmit Descriptor Control 1 */ - reg =er32 (TXDCTL1 ); + reg =er32 (TXDCTL (1 )); reg |= (1 <<22 ); -ew32 (TXDCTL1 , reg); +ew32 (TXDCTL (1 ), reg);/* Transmit Arbitration Control 0 */ - reg =er32 (TARC0 ); + reg =er32 (TARC (0 )); reg &= ~(0xF <<27 );/* 30:27 */ switch (hw->mac.type) {case e1000_82571:
@@ -898,10 +898,10 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)default :break ; } -ew32 (TARC0 , reg); +ew32 (TARC (0 ), reg);/* Transmit Arbitration Control 1 */ - reg =er32 (TARC1 ); + reg =er32 (TARC (1 ));switch (hw->mac.type) {case e1000_82571:case e1000_82572:
@@ -911,7 +911,7 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw) reg &= ~(1 <<28 ); else reg |= (1 << 28); -ew32 (TARC1 , reg); +ew32 (TARC (1 ), reg);break ;default :break ;
drivers/net/e1000e/es2lan.c +12 -12
@@ -792,16 +792,16 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) ret_val =e1000e_setup_link (hw);/* Set the transmit descriptor write-back policy */ - reg_data =er32 (TXDCTL ); + reg_data =er32 (TXDCTL (0 )); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH ) |E1000_TXDCTL_FULL_TX_DESC_WB |E1000_TXDCTL_COUNT_DESC ; -ew32 (TXDCTL , reg_data); +ew32 (TXDCTL (0 ), reg_data);/* ...for both queues. */ - reg_data =er32 (TXDCTL1 ); + reg_data =er32 (TXDCTL (1 )); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH ) |E1000_TXDCTL_FULL_TX_DESC_WB |E1000_TXDCTL_COUNT_DESC ; -ew32 (TXDCTL1 , reg_data); +ew32 (TXDCTL (1 ), reg_data);/* Enable retransmit on late collisions */ reg_data =er32 (TCTL );
@@ -846,29 +846,29 @@ static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw)u32 reg;/* Transmit Descriptor Control 0 */ - reg =er32 (TXDCTL ); + reg =er32 (TXDCTL (0 )); reg |= (1 <<22 ); -ew32 (TXDCTL , reg); +ew32 (TXDCTL (0 ), reg);/* Transmit Descriptor Control 1 */ - reg =er32 (TXDCTL1 ); + reg =er32 (TXDCTL (1 )); reg |= (1 <<22 ); -ew32 (TXDCTL1 , reg); +ew32 (TXDCTL (1 ), reg);/* Transmit Arbitration Control 0 */ - reg =er32 (TARC0 ); + reg =er32 (TARC (0 )); reg &= ~(0xF <<27 );/* 30:27 */ if (hw->phy.media_type != e1000_media_type_copper) reg &= ~(1 <<20 ); -ew32 (TARC0 , reg); +ew32 (TARC (0 ), reg);/* Transmit Arbitration Control 1 */ - reg =er32 (TARC1 ); + reg =er32 (TARC (1 ));if (er32 (TCTL ) &E1000_TCTL_MULR ) reg &= ~(1 <<28 );else reg |= (1 <<28 ); -ew32 (TARC1 , reg); +ew32 (TARC (1 ), reg); }/**
drivers/net/e1000e/hw.h +6 -4
@@ -93,6 +93,8 @@ enum e1e_registers {E1000_RDH =0x02810 ,/* Rx Descriptor Head - RW */ E1000_RDT =0x02818 ,/* Rx Descriptor Tail - RW */ E1000_RDTR =0x02820 ,/* Rx Delay Timer - RW */ +E1000_RXDCTL_BASE =0x02828 ,/* Rx Descriptor Control - RW */ +#define E1000_RXDCTL(_n) (E1000_RXDCTL_BASE + (_n << 8)) E1000_RADV = 0x0282C, /* RX Interrupt Absolute Delay Timer - RW *//* Convenience macros
@@ -111,11 +113,11 @@ enum e1e_registers {E1000_TDH =0x03810 ,/* Tx Descriptor Head - RW */ E1000_TDT =0x03818 ,/* Tx Descriptor Tail - RW */ E1000_TIDV =0x03820 ,/* Tx Interrupt Delay Value - RW */ -E1000_TXDCTL =0x03828 ,/* Tx Descriptor Control - RW */ +E1000_TXDCTL_BASE =0x03828 ,/* Tx Descriptor Control - RW */ +#define E1000_TXDCTL(_n) (E1000_TXDCTL_BASE + (_n << 8))E1000_TADV =0x0382C ,/* Tx Interrupt Absolute Delay Val - RW */ -E1000_TARC0 =0x03840 ,/* Tx Arbitration Count (0) */ -E1000_TXDCTL1 =0x03928 ,/* Tx Descriptor Control (1) - RW */ -E1000_TARC1 =0x03940 ,/* Tx Arbitration Count (1) */ +E1000_TARC_BASE =0x03840 ,/* Tx Arbitration Count (0) */ +#define E1000_TARC(_n) (E1000_TARC_BASE + (_n << 8))E1000_CRCERRS =0x04000 ,/* CRC Error Count - R/clr */ E1000_ALGNERRC =0x04004 ,/* Alignment Error Count - R/clr */ E1000_SYMERRS = 0x04008, /* Symbol Error Count - R/clr */
drivers/net/e1000e/ich8lan.c +12 -12
@@ -1753,18 +1753,18 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) ret_val =e1000_setup_link_ich8lan (hw);/* Set the transmit descriptor write-back policy for both queues */ - txdctl =er32 (TXDCTL ); + txdctl =er32 (TXDCTL (0 )); txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH ) |E1000_TXDCTL_FULL_TX_DESC_WB ; txdctl = (txdctl & ~E1000_TXDCTL_PTHRESH ) |E1000_TXDCTL_MAX_TX_DESC_PREFETCH ; -ew32 (TXDCTL , txdctl); - txdctl =er32 (TXDCTL1 ); +ew32 (TXDCTL (0 ), txdctl); + txdctl =er32 (TXDCTL (1 )); txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH ) |E1000_TXDCTL_FULL_TX_DESC_WB ; txdctl = (txdctl & ~E1000_TXDCTL_PTHRESH ) |E1000_TXDCTL_MAX_TX_DESC_PREFETCH ; -ew32 (TXDCTL1 , txdctl); +ew32 (TXDCTL (1 ), txdctl);/* * ICH8 has opposite polarity of no_snoop bits.
@@ -1807,30 +1807,30 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw)ew32 (CTRL_EXT , reg);/* Transmit Descriptor Control 0 */ - reg =er32 (TXDCTL ); + reg =er32 (TXDCTL (0 )); reg |= (1 <<22 ); -ew32 (TXDCTL , reg); +ew32 (TXDCTL (0 ), reg);/* Transmit Descriptor Control 1 */ - reg =er32 (TXDCTL1 ); + reg =er32 (TXDCTL (1 )); reg |= (1 <<22 ); -ew32 (TXDCTL1 , reg); +ew32 (TXDCTL (1 ), reg);/* Transmit Arbitration Control 0 */ - reg =er32 (TARC0 ); + reg =er32 (TARC (0 ));if (hw->mac.type == e1000_ich8lan) reg |= (1 <<28 ) | (1 <<29 ); reg |= (1 <<23 ) | (1 <<24 ) | (1 <<26 ) | (1 <<27 ); -ew32 (TARC0 , reg); +ew32 (TARC (0 ), reg);/* Transmit Arbitration Control 1 */ - reg =er32 (TARC1 ); + reg =er32 (TARC (1 ));if (er32 (TCTL ) &E1000_TCTL_MULR ) reg &= ~(1 <<28 );else reg |= (1 <<28 ); reg |= (1 <<24 ) | (1 <<26 ) | (1 <<30 ); -ew32 (TARC1 , reg); +ew32 (TARC (1 ), reg);/* Device Status */ if (hw->mac.type == e1000_ich8lan) {
drivers/net/e1000e/netdev.c +8 -8
@@ -1639,24 +1639,24 @@ static void e1000_configure_tx(struct e1000_adapter *adapter) (E1000_COLLISION_THRESHOLD <<E1000_CT_SHIFT );if (adapter->flags &FLAG_TARC_SPEED_MODE_BIT ) { - tarc =er32 (TARC0 ); + tarc =er32 (TARC (0 ));/* * set the speed mode bit, we'll clear it if we're not at * gigabit link later */ #define SPEED_MODE_BIT (1 << 21) tarc |=SPEED_MODE_BIT ; -ew32 (TARC0 , tarc); +ew32 (TARC (0 ), tarc); }/* errata: program both queues to unweighted RR */ if (adapter->flags &FLAG_TARC_SET_BIT_ZERO ) { - tarc =er32 (TARC0 ); + tarc =er32 (TARC (0 )); tarc |=1 ; -ew32 (TARC0 , tarc); - tarc =er32 (TARC1 ); +ew32 (TARC (0 ), tarc); + tarc =er32 (TARC (1 )); tarc |=1 ; -ew32 (TARC1 , tarc); +ew32 (TARC (1 ), tarc); }e1000e_config_collision_dist (hw);
@@ -2775,9 +2775,9 @@ static void e1000_watchdog_task(struct work_struct *work)if ((adapter->flags &FLAG_TARC_SPEED_MODE_BIT ) && !txb2b) {u32 tarc0; - tarc0 =er32 (TARC0 ); + tarc0 =er32 (TARC (0 )); tarc0 &= ~SPEED_MODE_BIT ; -ew32 (TARC0 , tarc0); +ew32 (TARC (0 ), tarc0); }/*
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
PATCH 6/8 e1000e: convert ndev_ printks to something smaller
In reply to Auke KokFrom: Bruce Allan <[email protected]>
The ndev_* printk's are too lenghty and we don't need to specify the adapter/netdev struct at all, making this a lot more readable.
---
drivers/net/e1000e/e1000.h | 27 ++++---- drivers/net/e1000e/ethtool.c | 38 +++++------ drivers/net/e1000e/netdev.c | 148 +++++++++++++++++++----------------------- drivers/net/e1000e/param.c | 31 +++------ 4 files changed, 108 insertions(+), 136 deletions(-)
drivers/net/e1000e/e1000.h +14 -13
@@ -41,24 +41,25 @@struct e1000_info ; -#define ndev_printk(level, netdev, format, arg...) \ - printk(level "%s: " format, (netdev)->name, ## arg) +#define e_printk(level, adapter, format, arg...) \ + printk(level "%s: %s: " format, pci_name(adapter->pdev), \ + adapter->netdev->name, ## arg)#ifdef DEBUG -#define ndev_dbg(netdev, format, arg...) \ - ndev_printk(KERN_DEBUG , netdev, format, ## arg) +#define e_dbg(format, arg...) \ + e_printk(KERN_DEBUG , adapter, format, ## arg)#else -#define ndev_dbg(netdev, format, arg...) do { (void)(netdev); } while (0) +#define e_dbg(format, arg...) do { (void)(adapter); } while (0)#endif -#define ndev_err(netdev, format, arg...) \ - ndev_printk(KERN_ERR , netdev, format, ## arg) -#define ndev_info(netdev, format, arg...) \ - ndev_printk(KERN_INFO , netdev, format, ## arg) -#define ndev_warn(netdev, format, arg...) \ - ndev_printk(KERN_WARNING , netdev, format, ## arg) -#define ndev_notice(netdev, format, arg...) \ - ndev_printk(KERN_NOTICE , netdev, format, ## arg) +#define e_err(format, arg...) \ + e_printk(KERN_ERR, adapter, format, ## arg) +#define e_info(format, arg...) \ + e_printk(KERN_INFO, adapter, format, ## arg) +#define e_warn(format, arg...) \ + e_printk(KERN_WARNING, adapter, format, ## arg) +#define e_notice(format, arg...) \ + e_printk(KERN_NOTICE, adapter, format, ## arg)/* Tx/Rx descriptor defines */
drivers/net/e1000e/ethtool.c +16 -22
@@ -189,8 +189,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)/* Fiber NICs only allow 1000 gbps Full duplex */ if ((adapter->hw.phy.media_type == e1000_media_type_fiber) && spddplx != (SPEED_1000 +DUPLEX_FULL )) { -ndev_err (adapter->netdev,"Unsupported Speed/Duplex " -"configuration\n" ); +e_err ("Unsupported Speed/Duplex configuration\n" );return -EINVAL ; }
@@ -213,8 +212,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)break ;case SPEED_1000 +DUPLEX_HALF :/* not supported */ default : -ndev_err (adapter->netdev,"Unsupported Speed/Duplex " -"configuration\n" ); +e_err ("Unsupported Speed/Duplex configuration\n" );return -EINVAL ; }return 0 ;
@@ -231,8 +229,8 @@ static int e1000_set_settings(struct net_device *netdev,* cannot be changed */ if (e1000_check_reset_block (hw)) { -ndev_err (netdev,"Cannot change link " -"characteristics when SoL/IDER is active.\n" ); +e_err ("Cannot change link characteristics when SoL/IDER" +" is active.\n" );return -EINVAL ; }
@@ -380,8 +378,7 @@ static int e1000_set_tso(struct net_device *netdev, u32 data) netdev->features &= ~NETIF_F_TSO6 ; } -ndev_info (netdev,"TSO is %s\n" , - data ?"Enabled" :"Disabled" ); +e_info ("TSO is %s\n" , data ?"Enabled" :"Disabled" ); adapter->flags |=FLAG_TSO_FORCE ;return 0 ; }
@@ -712,8 +709,8 @@ static bool reg_pattern_test_array(struct e1000_adapter *adapter, u64 *data, (test[i] & write)); read =E1000_READ_REG_ARRAY (&adapter->hw, reg, offset);if (read != (test[i] & write & mask)) { -ndev_err (adapter->netdev,"pattern test reg %04X " -"failed: got 0x%08X expected 0x%08X\n" , +e_err ("pattern test reg %04X failed: got " +"0x%08X expected 0x%08X\n" , reg + offset, read, (test[i] & write & mask)); *data = reg;
@@ -730,8 +727,8 @@ static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data,__ew32 (&adapter->hw, reg, write & mask); read =__er32 (&adapter->hw, reg);if ((write & mask) != (read & mask)) { -ndev_err (adapter->netdev,"set/check reg %04X test failed: " -"got 0x%08X expected 0x%08X\n" , reg, (read & mask), +e_err ("set/check reg %04X test failed: got 0x%08X" +"expected 0x%08X\n" , reg, (read & mask), (write & mask)); *data = reg;return true;
@@ -761,7 +758,6 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data) {struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &adapter->hw.mac; -struct net_device *netdev = adapter->netdev;u32 value;u32 before;u32 after;
@@ -794,7 +790,7 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)ew32 (STATUS , toggle); after =er32 (STATUS ) & toggle;if (value != after) { -ndev_err (netdev,"failed STATUS register test got: " +e_err ("failed STATUS register test got: " "0x%08X expected: 0x%08X\n" , after, value); *data =1 ;return 1 ;
@@ -901,8 +897,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data) *data =1 ;return -1 ; } -ndev_info (netdev,"testing %s interrupt\n" , - (shared_int ?"shared" :"unshared" )); +e_info ("testing %s interrupt\n" , (shared_int ?"shared" :"unshared" ));/* Disable all the interrupts */ ew32 (IMC ,0xFFFFFFFF );
@@ -1502,8 +1497,7 @@ static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data)* sessions are active */ if (e1000_check_reset_block (&adapter->hw)) { -ndev_err (adapter->netdev,"Cannot do PHY loopback test " -"when SoL/IDER is active.\n" ); +e_err ("Cannot do PHY loopback test when SoL/IDER is active.\n" ); *data =0 ; goto out; }
@@ -1588,7 +1582,7 @@ static void e1000_diag_test(struct net_device *netdev, forced_speed_duplex = adapter->hw.mac.forced_speed_duplex; autoneg = adapter->hw.mac.autoneg; -ndev_info (netdev,"offline testing starting\n" ); +e_info ("offline testing starting\n" );/* * Link test performed before hardware reset so autoneg doesn't
@@ -1634,7 +1628,7 @@ static void e1000_diag_test(struct net_device *netdev,if (if_running)dev_open (netdev); }else { -ndev_info (netdev,"online testing starting\n" ); +e_info ("online testing starting\n" );/* Online tests */ if (e1000_link_test (adapter, &data[4 ])) eth_test->flags |=ETH_TEST_FL_FAILED ;
@@ -1670,8 +1664,8 @@ static void e1000_get_wol(struct net_device *netdev, wol->supported &= ~WAKE_UCAST ;if (adapter->wol &E1000_WUFC_EX ) -ndev_err (netdev,"Interface does not support " -"directed (unicast) frame wake-up packets\n" ); +e_err ("Interface does not support directed (unicast)" +" frame wake-up packets\n" ); }if (adapter->wol &E1000_WUFC_EX )
drivers/net/e1000e/netdev.c +66 -82
296 lines not on this page · raw message
drivers/net/e1000e/param.c +12 -19
@@ -27,6 +27,7 @@*******************************************************************************/ #include <linux/netdevice.h> +#include <linux/pci.h> #include "e1000.h"
@@ -162,17 +163,16 @@ static int __devinit e1000_validate_option(unsigned int *value,case enable_option:switch (*value) {case OPTION_ENABLED : -ndev_info (adapter->netdev,"%s Enabled\n" , opt->name); +e_info ("%s Enabled\n" , opt->name);return 0 ;case OPTION_DISABLED : -ndev_info (adapter->netdev,"%s Disabled\n" , opt->name); +e_info ("%s Disabled\n" , opt->name);return 0 ; }break ;case range_option:if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { -ndev_info (adapter->netdev, -"%s set to %i\n" , opt->name, *value); +e_info ("%s set to %i\n" , opt->name, *value);return 0 ; }break ;
@@ -184,8 +184,7 @@ static int __devinit e1000_validate_option(unsigned int *value, ent = &opt->arg.l.p[i];if (*value == ent->i) {if (ent->str[0 ] !='\0' ) -ndev_info (adapter->netdev,"%s\n" , - ent->str); +e_info ("%s\n" , ent->str);return 0 ; } }
@@ -195,8 +194,8 @@ static int __devinit e1000_validate_option(unsigned int *value,BUG (); } -ndev_info (adapter->netdev,"Invalid %s value specified (%i) %s\n" , - opt->name, *value, opt->err); +e_info ("Invalid %s value specified (%i) %s\n" , opt->name, *value, + opt->err); *value = opt->def;return -1 ; }
@@ -213,13 +212,11 @@ static int __devinit e1000_validate_option(unsigned int *value,void __devinit e1000e_check_options (struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw; -struct net_device *netdev = adapter->netdev;int bd = adapter->bd_number;if (bd >=E1000_MAX_NIC ) { -ndev_notice (netdev, -"Warning: no configuration for board #%i\n" , bd); -ndev_notice (netdev,"Using defaults for all values\n" ); +e_notice ("Warning: no configuration for board #%i\n" , bd); +e_notice ("Using defaults for all values\n" ); } {/* Transmit Interrupt Delay */
@@ -313,19 +310,15 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) adapter->itr = InterruptThrottleRate[bd];switch (adapter->itr) {case 0 : -ndev_info (netdev,"%s turned off\n" , - opt.name); +e_info ("%s turned off\n" , opt.name);break ;case 1 : -ndev_info (netdev, -"%s set to dynamic mode\n" , - opt.name); +e_info ("%s set to dynamic mode\n" , opt.name); adapter->itr_setting = adapter->itr; adapter->itr =20000 ;break ;case 3 : -ndev_info (netdev, -"%s set to dynamic conservative mode\n" , +e_info ("%s set to dynamic conservative mode\n" , opt.name); adapter->itr_setting = adapter->itr; adapter->itr =20000 ;
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Re: [PATCH 6/8] e1000e: convert ndev_ printks to something smaller
Quoted 7 lines · Auke Kok
From: Bruce Allan <[email protected]>
The ndev_* printk's are too lenghty and we don't need to specify the adapter/netdev struct at all, making this a lot more readable.
Signed-off-by Bruce Allan <[email protected]>Signed-off-by Auke Kok <[email protected]>
Quoted 7 lines
---
drivers/net/e1000e/e1000.h | 27 ++++---- drivers/net/e1000e/ethtool.c | 38 +++++------ drivers/net/e1000e/netdev.c | 148 +++++++++++++++++++----------------------- drivers/net/e1000e/param.c | 31 +++------ 4 files changed, 108 insertions(+), 136 deletions(-)
This stuff should just be removed.
Either the code should be outputting "ethX: blahblah" via printk(), or the code should be outputting the standard dev_printk() prefix [driver name, PCI device info].
Also, it is recommended to use the NETIF_MSG_xxx bits to permit fine-grained control over which messages are output, on a per-port basis (controlled via ethtool). grep around for 'msg_enable'
Jeff
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Re: [PATCH 6/8] e1000e: convert ndev_ printks to something smaller
Quoted 18 lines · Jeff Garzik
Quoted 7 lines · Auke Kok
From: Bruce Allan <[email protected]>
The ndev_* printk's are too lenghty and we don't need to specify the adapter/netdev struct at all, making this a lot more readable.
Signed-off-by Bruce Allan <[email protected]>Signed-off-by Auke Kok <[email protected]>Quoted 7 lines
---
drivers/net/e1000e/e1000.h | 27 ++++---- drivers/net/e1000e/ethtool.c | 38 +++++------ drivers/net/e1000e/netdev.c | 148 +++++++++++++++++++----------------------- drivers/net/e1000e/param.c | 31 +++------ 4 files changed, 108 insertions(+), 136 deletions(-)This stuff should just be removed.
Quoted 7 lines
Either the code should be outputting "ethX: blahblah" via
printk(), or the code should be outputting the standarddev_printk()prefix [driver name, PCI device info].Also, it is recommended to use the
NETIF_MSG_xxxbits to permit fine-grained control over which messages are output, on a per-port basis (controlled via ethtool). grep around for 'msg_enable'
yes and I even tried pushing for a generic netdev printk that incorporates the msg_enable bits properly
I also got absolutely unwelcome responses to that, if not none :)
once we get such a thing, we can incorporate this into e1000 with this patch by changing 2 lines. so I think this patch is still a good thing, and it certainly removes a lot of wrapped lines.
Auke
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Re: [PATCH 6/8] e1000e: convert ndev_ printks to something smaller
Quoted 4 lines · Auke
yes and I even tried pushing for a generic netdev printk that incorporates the
msg_enablebits properlyI also got absolutely unwelcome responses to that, if not none :)
http://www.mail-archive.com/[email protected]/msg40070.html
It still makes sense to me.
I think the overall amount of churn is low, readability would improve, existing errors in msg_enable would be eliminated during the churn and the newly introduced error rate would be lower.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Re: [E1000-devel] [PATCH 6/8] e1000e: convert ndev_ printks to something smaller
In reply to Kok, AukeQuoted 26 lines · Auke
Quoted 17 lines · Jeff Garzik
Quoted 7 lines · Auke Kok
From: Bruce Allan <[email protected]>
The ndev_* printk's are too lenghty and we don't need to specify the adapter/netdev struct at all, making this a lot more readable.
Signed-off-by Bruce Allan <[email protected]>Signed-off-by Auke Kok <[email protected]>Quoted 7 lines
---
drivers/net/e1000e/e1000.h | 27 ++++---- drivers/net/e1000e/ethtool.c | 38 +++++------ drivers/net/e1000e/netdev.c | 148 +++++++++++++++++++----------------------- drivers/net/e1000e/param.c | 31 +++------ 4 files changed, 108 insertions(+), 136 deletions(-)This stuff should just be removed.
Quoted 7 lines
Either the code should be outputting "ethX: blahblah" via
printk(), or the code should be outputting the standarddev_printk()prefix [driver name, PCI device info].Also, it is recommended to use the
NETIF_MSG_xxxbits to permit fine-grained control over which messages are output, on a per-port basis (controlled via ethtool). grep around for 'msg_enable'
Quoted 8 lines
yes and I even tried pushing for a generic netdev printk that incorporates the
msg_enablebits properlyI also got absolutely unwelcome responses to that, if not none :)
once we get such a thing, we can incorporate this into e1000 with this patch by changing 2 lines. so I think this patch is still a good thing, and it certainly removes a lot of wrapped lines.
Jeff,
I'm not sure how to proceed with this mess cleanup so I'm removing that patch from the series I sent, and I will revisit this issue later.
I'm resending the ones I have sent once but are on hold pending this discussion. They are all meant for #upstream and should apply OK.
thanks,
Auke
PATCH 7/8 e1000e: rename a few functions
In reply to Auke KokFrom: Jeff Kirsher <[email protected]>
Several minor cosmetic function renames.
---
drivers/net/e1000e/82571.c | 8 ++++---- drivers/net/e1000e/e1000.h | 4 ++-- drivers/net/e1000e/es2lan.c | 4 ++-- drivers/net/e1000e/ich8lan.c | 6 +++--- drivers/net/e1000e/lib.c | 6 +++--- drivers/net/e1000e/netdev.c | 8 ++++---- 6 files changed, 18 insertions(+), 18 deletions(-)
drivers/net/e1000e/82571.c +4 -4
@@ -248,7 +248,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)return 0 ; } -static s32 e1000_get_invariants_82571 (struct e1000_adapter *adapter) +static s32 e1000_get_variants_82571 (struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;static int global_quad_port_a;/* global port a indication */
@@ -1337,7 +1337,7 @@ struct e1000_info e1000_82571_info = { | FLAG_TARC_SPEED_MODE_BIT /* errata */ | FLAG_APME_CHECK_PORT_B, .pba = 38, - .get_invariants = e1000_get_invariants_82571, + .get_variants = e1000_get_variants_82571, .mac_ops = &e82571_mac_ops, .phy_ops = &e82_phy_ops_igp, .nvm_ops = &e82571_nvm_ops,
@@ -1355,7 +1355,7 @@ struct e1000_info e1000_82572_info = { | FLAG_HAS_STATS_ICR_ICT | FLAG_TARC_SPEED_MODE_BIT, /* errata */ .pba = 38, - .get_invariants = e1000_get_invariants_82571, + .get_variants = e1000_get_variants_82571, .mac_ops = &e82571_mac_ops, .phy_ops = &e82_phy_ops_igp, .nvm_ops = &e82571_nvm_ops,
@@ -1375,7 +1375,7 @@ struct e1000_info e1000_82573_info = { | FLAG_HAS_ERT | FLAG_HAS_SWSM_ON_LOAD, .pba = 20, - .get_invariants = e1000_get_invariants_82571, + .get_variants = e1000_get_variants_82571, .mac_ops = &e82571_mac_ops, .phy_ops = &e82_phy_ops_m88, .nvm_ops = &e82571_nvm_ops,
drivers/net/e1000e/e1000.h +2 -2
@@ -272,7 +272,7 @@ struct e1000_info {enum e1000_mac_type mac;unsigned int flags;u32 pba; -s32 (*get_invariants)(struct e1000_adapter *); +s32 (*get_variants)(struct e1000_adapter *);struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops;
@@ -358,7 +358,7 @@ extern struct e1000_info e1000_ich8_info;extern struct e1000_info e1000_ich9_info;extern struct e1000_info e1000_es2_info; -extern s32 e1000e_read_part_num (struct e1000_hw *hw,u32 *part_num); +extern s32 e1000e_read_pba_num (struct e1000_hw *hw,u32 *pba_num);extern s32 e1000e_commit_phy (struct e1000_hw *hw);
drivers/net/e1000e/es2lan.c +2 -2
@@ -238,7 +238,7 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)return 0 ; } -static s32 e1000_get_invariants_80003es2lan (struct e1000_adapter *adapter) +static s32 e1000_get_variants_80003es2lan (struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;s32 rc;
@@ -1243,7 +1243,7 @@ struct e1000_info e1000_es2_info = { | FLAG_DISABLE_FC_PAUSE_TIME /* errata */ | FLAG_TIPG_MEDIUM_FOR_80003ESLAN, .pba = 38, - .get_invariants = e1000_get_invariants_80003es2lan, + .get_variants = e1000_get_variants_80003es2lan, .mac_ops = &es2_mac_ops, .phy_ops = &es2_phy_ops, .nvm_ops = &es2_nvm_ops,
drivers/net/e1000e/ich8lan.c +3 -3
@@ -316,7 +316,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)return 0 ; } -static s32 e1000_get_invariants_ich8lan (struct e1000_adapter *adapter) +static s32 e1000_get_variants_ich8lan (struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;s32 rc;
@@ -2253,7 +2253,7 @@ struct e1000_info e1000_ich8_info = { | FLAG_HAS_FLASH | FLAG_APME_IN_WUC, .pba = 8, - .get_invariants = e1000_get_invariants_ich8lan, + .get_variants = e1000_get_variants_ich8lan, .mac_ops = &ich8_mac_ops, .phy_ops = &ich8_phy_ops, .nvm_ops = &ich8_nvm_ops,
@@ -2270,7 +2270,7 @@ struct e1000_info e1000_ich9_info = { | FLAG_HAS_FLASH | FLAG_APME_IN_WUC, .pba = 10, - .get_invariants = e1000_get_invariants_ich8lan, + .get_variants = e1000_get_variants_ich8lan, .mac_ops = &ich8_mac_ops, .phy_ops = &ich8_phy_ops, .nvm_ops = &ich8_nvm_ops,
drivers/net/e1000e/lib.c +3 -3
@@ -2477,7 +2477,7 @@ bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw)return ret_val; } -s32 e1000e_read_part_num (struct e1000_hw *hw,u32 *part_num) +s32 e1000e_read_pba_num (struct e1000_hw *hw,u32 *pba_num) {s32 ret_val;u16 nvm_data;
@@ -2487,14 +2487,14 @@ s32 e1000e_read_part_num(struct e1000_hw *hw, u32 *part_num)hw_dbg (hw,"NVM Read Error\n" );return ret_val; } - *part_num = (u32)(nvm_data <<16 ); + *pba_num = (u32)(nvm_data <<16 ); ret_val =e1000_read_nvm (hw,NVM_PBA_OFFSET_1 ,1 , &nvm_data);if (ret_val) {hw_dbg (hw,"NVM Read Error\n" );return ret_val; } - *part_num |= nvm_data; + *pba_num |= nvm_data;return 0 ; }
drivers/net/e1000e/netdev.c +4 -4
@@ -3812,7 +3812,7 @@ static void e1000_print_device_info(struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;struct net_device *netdev = adapter->netdev; -u32 part_num; +u32 pba_num;/* print bus type/speed/width info */ e_info("(PCI Express:2.5GB/s:%s) %02x:%02x:%02x:%02x:%02x:%02x\n",
@@ -3825,10 +3825,10 @@ static void e1000_print_device_info(struct e1000_adapter *adapter) netdev->dev_addr[4], netdev->dev_addr[5]);e_info ("Intel(R) PRO/%s Network Connection\n" , (hw->phy.type == e1000_phy_ife) ?"10/100" :"1000" ); -e1000e_read_part_num (hw, &part_num); +e1000e_read_pba_num (hw, &pba_num);e_info ("MAC: %d, PHY: %d, PBA No: %06x-%03x\n" , hw->mac.type, hw->phy.type, - (part_num >>8 ), (part_num &0xff )); + (pba_num >>8 ), (pba_num &0xff )); }/**
@@ -3960,7 +3960,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,memcpy (&hw->nvm.ops, ei->nvm_ops,sizeof (hw->nvm.ops));memcpy (&hw->phy.ops, ei->phy_ops,sizeof (hw->phy.ops)); - err = ei->get_invariants (adapter); + err = ei->get_variants (adapter);if (err) goto err_hw_init;
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
PATCH 8/8 e1000e: reformat register test code, fix some minor initialization
In reply to Auke KokFrom: Bruce Allan <[email protected]>
The register tests should be run with all the proper flags enabled to maximize the test coverage code and make sure we are as close as we can get to testing regular traffic.
Reformat the code for readability. Minor cleanups in the descriptor ring setup.
---
drivers/net/e1000e/ethtool.c | 126 +++++++++++++++++++++--------------------- 1 files changed, 64 insertions(+), 62 deletions(-)
drivers/net/e1000e/ethtool.c +64 -62
@@ -638,10 +638,17 @@ static int e1000_set_ringparam(struct net_device *netdev, tx_ring =kzalloc (sizeof (struct e1000_ring ),GFP_KERNEL );if (!tx_ring) goto err_alloc_tx; +/* +* use a memcpy to save any previously configured +* items like napi structs from having to be +* reinitialized +*/ +memcpy (tx_ring, tx_old,sizeof (struct e1000_ring )); rx_ring =kzalloc (sizeof (struct e1000_ring ),GFP_KERNEL );if (!rx_ring) goto err_alloc_rx; +memcpy (rx_ring, rx_old,sizeof (struct e1000_ring )); adapter->tx_ring = tx_ring; adapter->rx_ring = rx_ring;
@@ -697,61 +704,54 @@ err_setup:return err; } -static bool reg_pattern_test_array (struct e1000_adapter *adapter,u64 *data, -int reg,int offset,u32 mask,u32 write) +static bool reg_pattern_test (struct e1000_adapter *adapter,u64 *data, +int reg,int offset,u32 mask,u32 write) { -int i; -u32 read; +u32 pat, val;static const u32 test[] = {0x5A5A5A5A ,0xA5A5A5A5 ,0x00000000 ,0xFFFFFFFF }; -for (i =0 ; i <ARRAY_SIZE (test); i++) { +for (pat =0 ; pat <ARRAY_SIZE (test); pat++) {E1000_WRITE_REG_ARRAY (&adapter->hw, reg, offset, - (test[i] & write)); - read =E1000_READ_REG_ARRAY (&adapter->hw, reg, offset); -if (read != (test[i] & write & mask)) { + (test[pat] & write)); + val =E1000_READ_REG_ARRAY (&adapter->hw, reg, offset); +if (val != (test[pat] & write & mask)) {e_err ("pattern test reg %04X failed: got " "0x%08X expected 0x%08X\n" , - reg + offset, - read, (test[i] & write & mask)); + reg + offset, + val, (test[pat] & write & mask)); *data = reg; -return true; +return 1 ; } } -return false; +return 0 ; }static bool reg_set_and_check (struct e1000_adapter *adapter,u64 *data,int reg,u32 mask,u32 write) { -u32 read; +u32 val;__ew32 (&adapter->hw, reg, write & mask); - read =__er32 (&adapter->hw, reg); -if ((write & mask) != (read & mask)) { + val =__er32 (&adapter->hw, reg); +if ((write & mask) != (val & mask)) {e_err ("set/check reg %04X test failed: got 0x%08X" -"expected 0x%08X\n" , reg, (read & mask), - (write & mask)); +"expected 0x%08X\n" , reg, (val & mask), (write & mask)); *data = reg; -return true; +return 1 ; } -return false; +return 0 ; } - -#define REG_PATTERN_TEST (R ,M ,W ) \ - do { \ - if (reg_pattern_test_array(adapter, data, R, 0, M, W)) \ - return 1; \ +#define REG_PATTERN_TEST_ARRAY (reg, offset, mask, write) \ + do { \ + if (reg_pattern_test(adapter, data, reg, offset, mask, write)) \ + return 1; \ } while (0) +#define REG_PATTERN_TEST (reg, mask, write) \ + REG_PATTERN_TEST_ARRAY(reg, 0, mask, write) -#define REG_PATTERN_TEST_ARRAY (R , offset,M ,W ) \ - do { \ - if (reg_pattern_test_array(adapter, data, R, offset, M, W)) \ - return 1; \ - } while (0) - -#define REG_SET_AND_CHECK (R ,M ,W ) \ - do { \ - if (reg_set_and_check(adapter, data, R, M, W)) \ - return 1; \ +#define REG_SET_AND_CHECK (reg, mask, write) \ + do { \ + if (reg_set_and_check(adapter, data, reg, mask, write)) \ + return 1; \ } while (0)static int e1000_reg_test (struct e1000_adapter *adapter,u64 *data)
@@ -1033,7 +1033,6 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)struct pci_dev *pdev = adapter->pdev;struct e1000_hw *hw = &adapter->hw;u32 rctl; -int size;int i;int ret_val;
@@ -1042,13 +1041,13 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)if (!tx_ring->count) tx_ring->count =E1000_DEFAULT_TXD ; - size = tx_ring->count *sizeof (struct e1000_buffer ); - tx_ring->buffer_info =kmalloc (size,GFP_KERNEL ); -if (!tx_ring->buffer_info) { + tx_ring->buffer_info =kcalloc (tx_ring->count, +sizeof (struct e1000_buffer ), +GFP_KERNEL ); +if (!(tx_ring->buffer_info)) { ret_val =1 ; goto err_nomem; } -memset (tx_ring->buffer_info,0 , size); tx_ring->size = tx_ring->count *sizeof (struct e1000_tx_desc ); tx_ring->size =ALIGN (tx_ring->size,4096 );
@@ -1058,21 +1057,17 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) ret_val =2 ; goto err_nomem; } -memset (tx_ring->desc,0 , tx_ring->size); tx_ring->next_to_use =0 ; tx_ring->next_to_clean =0 ; -ew32 (TDBAL , - ((u64 ) tx_ring->dma &0x00000000FFFFFFFF )); +ew32 (TDBAL , ((u64 ) tx_ring->dma &0x00000000FFFFFFFF ));ew32 (TDBAH , ((u64 ) tx_ring->dma >>32 )); -ew32 (TDLEN , - tx_ring->count *sizeof (struct e1000_tx_desc )); +ew32 (TDLEN , tx_ring->count *sizeof (struct e1000_tx_desc ));ew32 (TDH ,0 );ew32 (TDT ,0 ); -ew32 (TCTL , -E1000_TCTL_PSP |E1000_TCTL_EN | -E1000_COLLISION_THRESHOLD <<E1000_CT_SHIFT | -E1000_COLLISION_DISTANCE <<E1000_COLD_SHIFT ); +ew32 (TCTL ,E1000_TCTL_PSP |E1000_TCTL_EN |E1000_TCTL_MULR | +E1000_COLLISION_THRESHOLD <<E1000_CT_SHIFT | +E1000_COLLISION_DISTANCE <<E1000_COLD_SHIFT );for (i =0 ; i < tx_ring->count; i++) {struct e1000_tx_desc *tx_desc =E1000_TX_DESC (*tx_ring, i);
@@ -1094,12 +1089,11 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) ret_val =4 ; goto err_nomem; } - tx_desc->buffer_addr =cpu_to_le64 ( - tx_ring->buffer_info[i].dma); + tx_desc->buffer_addr =cpu_to_le64 (tx_ring->buffer_info[i].dma); tx_desc->lower.data =cpu_to_le32 (skb->len); tx_desc->lower.data |=cpu_to_le32 (E1000_TXD_CMD_EOP |E1000_TXD_CMD_IFCS | -E1000_TXD_CMD_RPS ); +E1000_TXD_CMD_RS ); tx_desc->upper.data =0 ; }
@@ -1108,13 +1102,13 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)if (!rx_ring->count) rx_ring->count =E1000_DEFAULT_RXD ; - size = rx_ring->count *sizeof (struct e1000_buffer ); - rx_ring->buffer_info =kmalloc (size,GFP_KERNEL ); -if (!rx_ring->buffer_info) { + rx_ring->buffer_info =kcalloc (rx_ring->count, +sizeof (struct e1000_buffer ), +GFP_KERNEL ); +if (!(rx_ring->buffer_info)) { ret_val =5 ; goto err_nomem; } -memset (rx_ring->buffer_info,0 , size); rx_ring->size = rx_ring->count *sizeof (struct e1000_rx_desc ); rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size,
@@ -1123,7 +1117,6 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) ret_val =6 ; goto err_nomem; } -memset (rx_ring->desc,0 , rx_ring->size); rx_ring->next_to_use =0 ; rx_ring->next_to_clean =0 ;
@@ -1135,6 +1128,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)ew32 (RDH ,0 );ew32 (RDT ,0 ); rctl =E1000_RCTL_EN |E1000_RCTL_BAM |E1000_RCTL_SZ_2048 | +E1000_RCTL_UPE |E1000_RCTL_MPE |E1000_RCTL_LPE | +E1000_RCTL_SBP |E1000_RCTL_SECRC |E1000_RCTL_LBM_NO |E1000_RCTL_RDMTS_HALF | (adapter->hw.mac.mc_filter_type <<E1000_RCTL_MO_SHIFT );ew32 (RCTL , rctl);
@@ -1198,7 +1193,8 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) ctrl_reg =er32 (CTRL ); -if (hw->phy.type == e1000_phy_ife) { +switch (hw->phy.type) { +case e1000_phy_ife:/* force 100, set loopback */ e1e_wphy (hw,PHY_CONTROL ,0x6100 );
@@ -1208,9 +1204,11 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)E1000_CTRL_FRCDPX |/* Set the Force Duplex Bit */ E1000_CTRL_SPD_100 |/* Force Speed to 100 */ E1000_CTRL_FD); /* Force Duplex to FULL */ - }else { +break ; +default :/* force 1000, set loopback */ e1e_wphy (hw,PHY_CONTROL ,0x4140 ); +mdelay (250 );/* Now set up the MAC to the same speed/duplex as the PHY. */ ctrl_reg =er32 (CTRL );
@@ -1219,6 +1217,10 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)E1000_CTRL_FRCDPX |/* Set the Force Duplex Bit */ E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */ E1000_CTRL_FD); /* Force Duplex to FULL */ + +if ((adapter->hw.mac.type == e1000_ich8lan) || + (adapter->hw.mac.type == e1000_ich9lan)) + ctrl_reg |=E1000_CTRL_SLU ;/* Set Link Up */ } if (hw->phy.media_type == e1000_media_type_copper &&
@@ -1320,7 +1322,7 @@ static int e1000_set_es2lan_mac_loopback(struct e1000_adapter *adapter)#define KMRNCTRLSTA_OPMODE (0x1F << 16)#define KMRNCTRLSTA_OPMODE_1GB_FD_GMII 0x0582ew32 (KMRNCTRLSTA , - (KMRNCTRLSTA_OPMODE |KMRNCTRLSTA_OPMODE_1GB_FD_GMII )); + (KMRNCTRLSTA_OPMODE |KMRNCTRLSTA_OPMODE_1GB_FD_GMII ));return 0 ; }
@@ -1446,8 +1448,8 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter) l =0 ;for (j =0 ; j <= lc; j++) {/* loop count loop */ for (i =0 ; i <64 ; i++) {/* send the packets */ -e1000_create_lbtest_frame ( - tx_ring->buffer_info[i].skb,1024 ); +e1000_create_lbtest_frame (tx_ring->buffer_info[k].skb, +1024 ); pci_dma_sync_single_for_device(pdev, tx_ring->buffer_info[k].dma, tx_ring->buffer_info[k].length,
@@ -1482,7 +1484,7 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter) ret_val =13 ;/* ret_val is the same as mis-compare */ break ; } -if (jiffies >= (time +2 )) { +if (jiffies >= (time +20 )) { ret_val =14 ;/* error code for time out error */ break ; }
Quoted 13 lines · Auke Kok
From: Bruce Allan <[email protected]>
Adjusting the comment blocks here to be code-style compliant. no code changes.
Changed some copyright dates to 2008.
Indentation fixes.
Signed-off-by Bruce Allan <[email protected]>Signed-off-by Auke Kok <[email protected]>---
Quoted 13 lines
drivers/net/e1000e/82571.c | 105 +++++++--- drivers/net/e1000e/Makefile | 2 drivers/net/e1000e/defines.h | 109 ++++++----- drivers/net/e1000e/e1000.h | 16 +- drivers/net/e1000e/es2lan.c | 89 +++++---- drivers/net/e1000e/ethtool.c | 97 ++++++---- drivers/net/e1000e/hw.h | 145 +++++++------- drivers/net/e1000e/ich8lan.c | 262 ++++++++++++++++---------- drivers/net/e1000e/lib.c | 213 +++++++++++++-------- drivers/net/e1000e/netdev.c | 428 +++++++++++++++++++++++++++--------------- drivers/net/e1000e/param.c | 33 ++- drivers/net/e1000e/phy.c | 152 ++++++++++----- 12 files changed, 1009 insertions(+), 642 deletions(-)
applied 1-3 of 8 (waiting on responses, for the others)
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace