Intel Wired LAN Driver Updates 2013.02.15
Subsystems (3)
This series contains updates to igb and ixgbe. Most of the changes are against igb, except for one patch against ixgbe.
There are 3 igb fixes from Carolyn which were reported by Dan Carpenter which resolve issues found in the get_i2c_client(). Alex does some cleanup of the igb driver to match similar functionality in ixgbe on transmit. Alex also makes it so that we can enable the use of build_skb for cases where jumbo frames are disabled. The advantage to this is that we do not have to perform a memcpy to populate the header and as a result we see a significant performance improvement.
Akeem provides 4 patches to initialize function pointers and do a re-factoring of the function pointers in igb_get_variants() to assist with driver debugging.
The ixgbe patch comes from Emil to reshuffle the switch/case structure of the flag assignment to allow for the flags to be set for each MAC type separately. This is needed for new hardware that does not have feature parity with older hardware.
v2: updated patches 4 & 5 based on feedback from Ben Hutchings and Eric
Dumazet
The following are changes since commit 9754e293491e3a4e6c1ac020d25140b1ed3d9cd2:
net: Don't write to current task flags on every packet received.
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master
Akeem G. Abodunrin (4):
igb: Initialize PHY function pointers
igb: Initialize NVM function pointers
igb: Intialize MAC function pointers
igb: Refractoring function pointers in igb_get_invariants function
Alexander Duyck (2):
igb: Support using build_skb in the case that jumbo frames are
disabled
igb: Update igb to use a path similar to ixgbe to determine when to
stop Tx
Carolyn Wyborny (3):
igb: Fix for improper exit in igb_get_i2c_client
igb: Fix for improper allocation flag in igb_get_i2c_client
igb: Refix sparse warning in igb_get_i2c_client
Emil Tantilov (1):
ixgbe: refactor initialization of feature flags
drivers/net/ethernet/intel/igb/e1000_82575.c | 488 ++++++++++++++------------ drivers/net/ethernet/intel/igb/igb.h | 21 +- drivers/net/ethernet/intel/igb/igb_main.c | 228 +++++++++--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 58 +-- 4 files changed, 495 insertions(+), 300 deletions(-)
Signature · 1 line
1.7.11.7
PATCH 1/10 igb: Support using build_skb in the case that jumbo frames are disabled
From: Alexander Duyck <[email protected]>
This change makes it so that we can enable the use of build_skb for cases where jumbo frames are disabled. The advantage to this is that we do not have to perform a memcpy to populate the header and as a result we see a significant performance improvement.
--- drivers/net/ethernet/intel/igb/igb.h | 8 ++ drivers/net/ethernet/intel/igb/igb_main.c | 187 ++++++++++++++++++++++++------ 2 files changed, 161 insertions(+), 34 deletions(-)
drivers/net/ethernet/intel/igb/igb.h +8 -0
@@ -275,10 +275,18 @@ struct igb_q_vector {enum e1000_ring_flags_t {IGB_RING_FLAG_RX_SCTP_CSUM ,IGB_RING_FLAG_RX_LB_VLAN_BSWAP , +IGB_RING_FLAG_RX_BUILD_SKB_ENABLED ,IGB_RING_FLAG_TX_CTX_IDX ,IGB_RING_FLAG_TX_DETECT_HANG }; +#define ring_uses_build_skb (ring) \ + test_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) +#define set_ring_build_skb_enabled (ring) \ + set_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) +#define clear_ring_build_skb_enabled (ring) \ + clear_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) +#define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS)#define IGB_RX_DESC (R , i) \
drivers/net/ethernet/intel/igb/igb_main.c +153 -34
251 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 2/10 igb: Fix for improper exit in igb_get_i2c_client
In reply to Jeff KirsherFrom: Carolyn Wyborny <[email protected]>
This patch fixes an issue where we check for irq's disabled then exit after explicitly disabling them with spin_lock_irqsave.
--- drivers/net/ethernet/intel/igb/igb_main.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +1 -6
@@ -7750,12 +7750,7 @@ igb_get_i2c_client(struct igb_adapter *adapter, u8 dev_addr) } } -/* no client_list found, create a new one as long as -* irqs are not disabled -*/ -if (unlikely (irqs_disabled ())) - goto exit; - +/* no client_list found, create a new one */ client_list =kzalloc (sizeof (*client_list),GFP_KERNEL );if (client_list ==NULL ) goto exit;
Signature · 1 line
1.7.11.7
PATCH v2 4/10 igb: Refix sparse warning in igb_get_i2c_client
In reply to Jeff KirsherFrom: Carolyn Wyborny <[email protected]>
This patch correctly resolves the sparse warnings found with this function.
v2: revise the fix based on feedback from Ben Hutchings
--- drivers/net/ethernet/intel/igb/igb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_main.c +1 -1
@@ -7727,7 +7727,7 @@ static DEFINE_SPINLOCK(i2c_clients_lock);* @adapter: adapter struct * @dev_addr: device address of i2c needed. */ -struct i2c_client * +static struct i2c_client *igb_get_i2c_client (struct igb_adapter *adapter,u8 dev_addr) {ulong flags;
Signature · 1 line
1.7.11.7
PATCH v2 5/10 igb: Update igb to use a path similar to ixgbe to determine when to stop Tx
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
After reviewing the igb and ixgbe code I realized there are a few issues in how the code is structured. Specifically we are not checking the size of the buffers being used in transmits and we are not using the same value to determine when to stop or start a Tx queue. As such the code is prone to be buggy.
This patch makes it so that we have one value DESC_NEEDED that we will use for starting and stopping the queue. In addition we will check the size of buffers being used when setting up a transmit so as to avoid a possible buffer overrun if we were to receive a frame with a block of data larger than 32K in skb->data.
v2: Update to use NETDEV_FRAG_PAGE_MAX_SIZE instead of PAGE_SIZE based
on feedback from Eric Dumazet
--- drivers/net/ethernet/intel/igb/igb.h | 13 +++++++++++-- drivers/net/ethernet/intel/igb/igb_main.c | 30 +++++++++++++++++------------- 2 files changed, 28 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/igb/igb.h +11 -2
@@ -139,8 +139,6 @@ struct vf_data_storage {#define IGB_RX_HDR_LEN IGB_RXBUFFER_256#define IGB_RX_BUFSZ IGB_RXBUFFER_2048 -/* How many Tx Descriptors do we need to call netif_wake_queue ? */ -#define IGB_TX_QUEUE_WAKE 16/* How many Rx Buffers do we bundle into one write to the hardware ? */ #define IGB_RX_BUFFER_WRITE 16/* Must be power of 2 */
@@ -169,6 +167,17 @@ enum igb_tx_flags {#define IGB_TX_FLAGS_VLAN_MASK 0xffff0000#define IGB_TX_FLAGS_VLAN_SHIFT 16 +/* +* The largest size we can write to the descriptor is 65535. In order to +* maintain a power of two alignment we have to limit ourselves to 32K. +*/ +#define IGB_MAX_TXD_PWR 15 +#define IGB_MAX_DATA_PER_TXD (1 << IGB_MAX_TXD_PWR) + +/* Tx Descriptors needed, worst case */ +#define TXD_USE_COUNT (S ) DIV_ROUND_UP((S), IGB_MAX_DATA_PER_TXD) +#define DESC_NEEDED (MAX_SKB_FRAGS + 4) +/* wrapper around a pointer to a socket buffer, * so a DMA handle can be stored along with the buffer */ struct igb_tx_buffer {
drivers/net/ethernet/intel/igb/igb_main.c +17 -13
@@ -4434,13 +4434,6 @@ static void igb_tx_olinfo_status(struct igb_ring *tx_ring, tx_desc->read.olinfo_status =cpu_to_le32 (olinfo_status); } -/* -* The largest size we can write to the descriptor is 65535. In order to -* maintain a power of two alignment we have to limit ourselves to 32K. -*/ -#define IGB_MAX_TXD_PWR 15 -#define IGB_MAX_DATA_PER_TXD (1<<IGB_MAX_TXD_PWR) -static void igb_tx_map (struct igb_ring *tx_ring,struct igb_tx_buffer *first,const u8 hdr_len)
@@ -4609,15 +4602,25 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,struct igb_tx_buffer *first;int tso;u32 tx_flags =0 ; +u16 count =TXD_USE_COUNT (skb_headlen (skb));__be16 protocol =vlan_get_protocol (skb);u8 hdr_len =0 ; -/* need: 1 descriptor per page, +/* need: 1 descriptor per page * PAGE_SIZE/IGB_MAX_DATA_PER_TXD, +* + 1 desc for skb_headlen/IGB_MAX_DATA_PER_TXD, * + 2 desc gap to keep tail from touching head, -* + 1 desc for skb->data, * + 1 desc for context descriptor, -* otherwise try next time */ -if (igb_maybe_stop_tx (tx_ring,skb_shinfo (skb)->nr_frags +4 )) { +* otherwise try next time +*/ +if (NETDEV_FRAG_PAGE_MAX_SIZE >IGB_MAX_DATA_PER_TXD ) { +unsigned short f; +for (f =0 ; f <skb_shinfo (skb)->nr_frags; f++) + count +=TXD_USE_COUNT (skb_shinfo (skb)->frags[f].size); + }else { + count +=skb_shinfo (skb)->nr_frags; + } + +if (igb_maybe_stop_tx (tx_ring, count +3 )) {/* this is a hard error */ return NETDEV_TX_BUSY ; }
@@ -4659,7 +4662,7 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,igb_tx_map (tx_ring, first, hdr_len);/* Make sure there is space in the ring for the next send. */ -igb_maybe_stop_tx (tx_ring,MAX_SKB_FRAGS +4 ); +igb_maybe_stop_tx (tx_ring,DESC_NEEDED );return NETDEV_TX_OK ;
@@ -6063,9 +6066,10 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) } } +#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)if (unlikely (total_packets &&netif_carrier_ok (tx_ring->netdev) && -igb_desc_unused (tx_ring) >=IGB_TX_QUEUE_WAKE )) { +igb_desc_unused (tx_ring) >=TX_WAKE_THRESHOLD )) {/* Make sure that anybody stopping the queue after this * sees the new next_to_clean. */
Signature · 1 line
1.7.11.7
PATCH 3/10 igb: Fix for improper allocation flag in igb_get_i2c_client
In reply to Jeff KirsherFrom: Carolyn Wyborny <[email protected]>
This patch fixes the allocation function in igb_get_i2c_client to use GFP_ATOMIC instead of GFP_KERNEL because we have a spinlock.
--- drivers/net/ethernet/intel/igb/igb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_main.c +1 -1
@@ -7751,7 +7751,7 @@ igb_get_i2c_client(struct igb_adapter *adapter, u8 dev_addr) }/* no client_list found, create a new one */ - client_list =kzalloc (sizeof (*client_list),GFP_KERNEL ); + client_list =kzalloc (sizeof (*client_list),GFP_ATOMIC );if (client_list ==NULL ) goto exit;
Signature · 1 line
1.7.11.7
PATCH 6/10 igb: Initialize PHY function pointers
In reply to Jeff KirsherFrom: "Akeem G. Abodunrin" <[email protected]>
This patch initializes PHY function pointers for device configuration.
--- drivers/net/ethernet/intel/igb/e1000_82575.c | 112 +++++++++++++++++++++++++++ 1 file changed, 112 insertions(+)
drivers/net/ethernet/intel/igb/e1000_82575.c +112 -0
@@ -111,6 +111,118 @@ static bool igb_sgmii_uses_mdio_82575(struct e1000_hw *hw)return ext_mdio; } +/** +* igb_init_phy_params_82575 - Init PHY func ptrs. +* @hw: pointer to the HW structure +**/ +static s32 igb_init_phy_params_82575 (struct e1000_hw *hw) +{ +struct e1000_phy_info *phy = &hw->phy; +s32 ret_val =0 ; +u32 ctrl_ext; + +if (hw->phy.media_type != e1000_media_type_copper) { + phy->type = e1000_phy_none; + goto out; + } + + phy->autoneg_mask =AUTONEG_ADVERTISE_SPEED_DEFAULT ; + phy->reset_delay_us =100 ; + + ctrl_ext =rd32 (E1000_CTRL_EXT ); + +if (igb_sgmii_active_82575 (hw)) { + phy->ops.reset = igb_phy_hw_reset_sgmii_82575; + ctrl_ext |=E1000_CTRL_I2C_ENA ; + }else { + phy->ops.reset = igb_phy_hw_reset; + ctrl_ext &= ~E1000_CTRL_I2C_ENA ; + } + +wr32 (E1000_CTRL_EXT , ctrl_ext); +igb_reset_mdicnfg_82580 (hw); + +if (igb_sgmii_active_82575 (hw) && !igb_sgmii_uses_mdio_82575 (hw)) { + phy->ops.read_reg = igb_read_phy_reg_sgmii_82575; + phy->ops.write_reg = igb_write_phy_reg_sgmii_82575; + }else { +switch (hw->mac.type) { +case e1000_82580: +case e1000_i350: + phy->ops.read_reg = igb_read_phy_reg_82580; + phy->ops.write_reg = igb_write_phy_reg_82580; +break ; +case e1000_i210: +case e1000_i211: + phy->ops.read_reg = igb_read_phy_reg_gs40g; + phy->ops.write_reg = igb_write_phy_reg_gs40g; +break ; +default : + phy->ops.read_reg = igb_read_phy_reg_igp; + phy->ops.write_reg = igb_write_phy_reg_igp; + } + } + +/* set lan id */ + hw->bus.func = (rd32 (E1000_STATUS ) &E1000_STATUS_FUNC_MASK ) >> +E1000_STATUS_FUNC_SHIFT ; + +/* Set phy->phy_addr and phy->id. */ + ret_val =igb_get_phy_id_82575 (hw); +if (ret_val) +return ret_val; + +/* Verify phy id and set remaining function pointers */ +switch (phy->id) { +case I347AT4_E_PHY_ID : +case M88E1112_E_PHY_ID : +case M88E1111_I_PHY_ID : + phy->type = e1000_phy_m88; + phy->ops.get_phy_info = igb_get_phy_info_m88; +if (phy->id ==I347AT4_E_PHY_ID || + phy->id ==M88E1112_E_PHY_ID ) + phy->ops.get_cable_length = + igb_get_cable_length_m88_gen2; +else + phy->ops.get_cable_length = igb_get_cable_length_m88; + phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_m88; +break ; +case IGP03E1000_E_PHY_ID : + phy->type = e1000_phy_igp_3; + phy->ops.get_phy_info = igb_get_phy_info_igp; + phy->ops.get_cable_length = igb_get_cable_length_igp_2; + phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_igp; + phy->ops.set_d0_lplu_state = igb_set_d0_lplu_state_82575; + phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state; +break ; +case I82580_I_PHY_ID : +case I350_I_PHY_ID : + phy->type = e1000_phy_82580; + phy->ops.force_speed_duplex = + igb_phy_force_speed_duplex_82580; + phy->ops.get_cable_length = igb_get_cable_length_82580; + phy->ops.get_phy_info = igb_get_phy_info_82580; + phy->ops.set_d0_lplu_state = igb_set_d0_lplu_state_82580; + phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state_82580; +break ; +case I210_I_PHY_ID : + phy->type = e1000_phy_i210; + phy->ops.check_polarity = igb_check_polarity_m88; + phy->ops.get_phy_info = igb_get_phy_info_m88; + phy->ops.get_cable_length = igb_get_cable_length_m88_gen2; + phy->ops.set_d0_lplu_state = igb_set_d0_lplu_state_82580; + phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state_82580; + phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_m88; +break ; +default : + ret_val = -E1000_ERR_PHY ; + goto out; + } + +out: +return ret_val; +} +static s32 igb_get_invariants_82575 (struct e1000_hw *hw) {struct e1000_phy_info *phy = &hw->phy;
Signature · 1 line
1.7.11.7
PATCH 7/10 igb: Initialize NVM function pointers
In reply to Jeff KirsherFrom: "Akeem G. Abodunrin" <[email protected]>
This patch initializes NVM function pointers for device configuration.
--- drivers/net/ethernet/intel/igb/e1000_82575.c | 109 +++++++++++++++++++++++++++ 1 file changed, 109 insertions(+)
drivers/net/ethernet/intel/igb/e1000_82575.c +109 -0
@@ -223,6 +223,115 @@ out:return ret_val; } +/** +* igb_init_nvm_params_82575 - Init NVM func ptrs. +* @hw: pointer to the HW structure +**/ +s32 igb_init_nvm_params_82575 (struct e1000_hw *hw) +{ +struct e1000_nvm_info *nvm = &hw->nvm; +u32 eecd =rd32 (E1000_EECD ); +u16 size; + + size = (u16)((eecd &E1000_EECD_SIZE_EX_MASK ) >> +E1000_EECD_SIZE_EX_SHIFT ); +/* Added to a constant, "size" becomes the left-shift value +* for setting word_size. +*/ + size +=NVM_WORD_SIZE_BASE_SHIFT ; + +/* Just in case size is out of range, cap it to the largest +* EEPROM size supported +*/ +if (size >15 ) + size =15 ; + + nvm->word_size =1 << size; +if (hw->mac.type < e1000_i210) { + nvm->opcode_bits =8 ; + nvm->delay_usec =1 ; + +switch (nvm->override) { +case e1000_nvm_override_spi_large: + nvm->page_size =32 ; + nvm->address_bits =16 ; +break ; +case e1000_nvm_override_spi_small: + nvm->page_size =8 ; + nvm->address_bits =8 ; +break ; +default : + nvm->page_size = eecd &E1000_EECD_ADDR_BITS ?32 :8 ; + nvm->address_bits = eecd &E1000_EECD_ADDR_BITS ? +16 :8 ; +break ; + } +if (nvm->word_size == (1 <<15 )) + nvm->page_size =128 ; + + nvm->type = e1000_nvm_eeprom_spi; + }else { + nvm->type = e1000_nvm_flash_hw; + } + +/* NVM Function Pointers */ +switch (hw->mac.type) { +case e1000_82580: + nvm->ops.validate = igb_validate_nvm_checksum_82580; + nvm->ops.update = igb_update_nvm_checksum_82580; + nvm->ops.acquire = igb_acquire_nvm_82575; + nvm->ops.release = igb_release_nvm_82575; +if (nvm->word_size < (1 <<15 )) + nvm->ops.read = igb_read_nvm_eerd; +else + nvm->ops.read = igb_read_nvm_spi; + nvm->ops.write = igb_write_nvm_spi; +break ; +case e1000_i350: + nvm->ops.validate = igb_validate_nvm_checksum_i350; + nvm->ops.update = igb_update_nvm_checksum_i350; + nvm->ops.acquire = igb_acquire_nvm_82575; + nvm->ops.release = igb_release_nvm_82575; +if (nvm->word_size < (1 <<15 )) + nvm->ops.read = igb_read_nvm_eerd; +else + nvm->ops.read = igb_read_nvm_spi; + nvm->ops.write = igb_write_nvm_spi; +break ; +case e1000_i210: + nvm->ops.validate = igb_validate_nvm_checksum_i210; + nvm->ops.update = igb_update_nvm_checksum_i210; + nvm->ops.acquire = igb_acquire_nvm_i210; + nvm->ops.release = igb_release_nvm_i210; + nvm->ops.read = igb_read_nvm_srrd_i210; + nvm->ops.write = igb_write_nvm_srwr_i210; + nvm->ops.valid_led_default = igb_valid_led_default_i210; +break ; +case e1000_i211: + nvm->ops.acquire = igb_acquire_nvm_i210; + nvm->ops.release = igb_release_nvm_i210; + nvm->ops.read = igb_read_nvm_i211; + nvm->ops.valid_led_default = igb_valid_led_default_i210; + nvm->ops.validate =NULL ; + nvm->ops.update =NULL ; + nvm->ops.write =NULL ; +break ; +default : + nvm->ops.validate = igb_validate_nvm_checksum; + nvm->ops.update = igb_update_nvm_checksum; + nvm->ops.acquire = igb_acquire_nvm_82575; + nvm->ops.release = igb_release_nvm_82575; +if (nvm->word_size < (1 <<15 )) + nvm->ops.read = igb_read_nvm_eerd; +else + nvm->ops.read = igb_read_nvm_spi; + nvm->ops.write = igb_write_nvm_spi; +break ; + } + +return 0 ; +} +static s32 igb_get_invariants_82575 (struct e1000_hw *hw) {struct e1000_phy_info *phy = &hw->phy;
Signature · 1 line
1.7.11.7
PATCH 8/10 igb: Intialize MAC function pointers
In reply to Jeff KirsherFrom: "Akeem G. Abodunrin" <[email protected]>
This patch initializes MAC function pointers for device configuration.
--- drivers/net/ethernet/intel/igb/e1000_82575.c | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
drivers/net/ethernet/intel/igb/e1000_82575.c +61 -0
@@ -332,6 +332,67 @@ s32 igb_init_nvm_params_82575(struct e1000_hw *hw)return 0 ; } +/** +* igb_init_mac_params_82575 - Init MAC func ptrs. +* @hw: pointer to the HW structure +**/ +static s32 igb_init_mac_params_82575 (struct e1000_hw *hw) +{ +struct e1000_mac_info *mac = &hw->mac; +struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; + +/* Set mta register count */ + mac->mta_reg_count =128 ; +/* Set rar entry count */ +switch (mac->type) { +case e1000_82576: + mac->rar_entry_count =E1000_RAR_ENTRIES_82576 ; +break ; +case e1000_82580: + mac->rar_entry_count =E1000_RAR_ENTRIES_82580 ; +break ; +case e1000_i350: + mac->rar_entry_count =E1000_RAR_ENTRIES_I350 ; +break ; +default : + mac->rar_entry_count =E1000_RAR_ENTRIES_82575 ; +break ; + } +/* reset */ +if (mac->type >= e1000_82580) + mac->ops.reset_hw = igb_reset_hw_82580; +else + mac->ops.reset_hw = igb_reset_hw_82575; + +if (mac->type >= e1000_i210) { + mac->ops.acquire_swfw_sync = igb_acquire_swfw_sync_i210; + mac->ops.release_swfw_sync = igb_release_swfw_sync_i210; + + }else { + mac->ops.acquire_swfw_sync = igb_acquire_swfw_sync_82575; + mac->ops.release_swfw_sync = igb_release_swfw_sync_82575; + } + +/* Set if part includes ASF firmware */ + mac->asf_firmware_present = true; +/* Set if manageability features are enabled. */ + mac->arc_subsystem_valid = + (rd32 (E1000_FWSM ) &E1000_FWSM_MODE_MASK ) + ? true : false; +/* enable EEE on i350 parts and later parts */ +if (mac->type >= e1000_i350) + dev_spec->eee_disable = false; +else + dev_spec->eee_disable = true; +/* physical interface link setup */ + mac->ops.setup_physical_interface = + (hw->phy.media_type == e1000_media_type_copper) + ? igb_setup_copper_link_82575 + : igb_setup_serdes_link_82575; + +return 0 ; +} +static s32 igb_get_invariants_82575 (struct e1000_hw *hw) {struct e1000_phy_info *phy = &hw->phy;
Signature · 1 line
1.7.11.7
PATCH 9/10 igb: Refractoring function pointers in igb_get_invariants function
In reply to Jeff KirsherFrom: "Akeem G. Abodunrin" <[email protected]>
This patch simplifies igb_get_invariants function by moving all implemented function pointers in this function to individual separate functions, based on their functionalities, this would make debugging much easier.
--- drivers/net/ethernet/intel/igb/e1000_82575.c | 262 ++------------------------- 1 file changed, 11 insertions(+), 251 deletions(-)
drivers/net/ethernet/intel/igb/e1000_82575.c +11 -251
@@ -395,13 +395,9 @@ static s32 igb_init_mac_params_82575(struct e1000_hw *hw)static s32 igb_get_invariants_82575 (struct e1000_hw *hw) { -struct e1000_phy_info *phy = &hw->phy; -struct e1000_nvm_info *nvm = &hw->nvm;struct e1000_mac_info *mac = &hw->mac;struct e1000_dev_spec_82575 * dev_spec = &hw->dev_spec._82575; -u32 eecd;s32 ret_val; -u16 size;u32 ctrl_ext =0 ;switch (hw->device_id) {
@@ -462,7 +458,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)* SerDes mode on the 82575. There can be an external PHY attached * on the SGMII interface. For this, we'll set sgmii_active to true. */ - phy->media_type = e1000_media_type_copper; + hw->phy.media_type = e1000_media_type_copper; dev_spec->sgmii_active = false; ctrl_ext =rd32 (E1000_CTRL_EXT );
@@ -478,154 +474,15 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)break ; } -/* Set mta register count */ - mac->mta_reg_count =128 ; -/* Set rar entry count */ -switch (mac->type) { -case e1000_82576: - mac->rar_entry_count =E1000_RAR_ENTRIES_82576 ; -break ; -case e1000_82580: - mac->rar_entry_count =E1000_RAR_ENTRIES_82580 ; -break ; -case e1000_i350: - mac->rar_entry_count =E1000_RAR_ENTRIES_I350 ; -break ; -default : - mac->rar_entry_count =E1000_RAR_ENTRIES_82575 ; -break ; - } -/* reset */ -if (mac->type >= e1000_82580) - mac->ops.reset_hw = igb_reset_hw_82580; -else - mac->ops.reset_hw = igb_reset_hw_82575; - -if (mac->type >= e1000_i210) { - mac->ops.acquire_swfw_sync = igb_acquire_swfw_sync_i210; - mac->ops.release_swfw_sync = igb_release_swfw_sync_i210; - }else { - mac->ops.acquire_swfw_sync = igb_acquire_swfw_sync_82575; - mac->ops.release_swfw_sync = igb_release_swfw_sync_82575; - } - -/* Set if part includes ASF firmware */ - mac->asf_firmware_present = true; -/* Set if manageability features are enabled. */ - mac->arc_subsystem_valid = - (rd32 (E1000_FWSM ) &E1000_FWSM_MODE_MASK ) - ? true : false; -/* enable EEE on i350 parts and later parts */ -if (mac->type >= e1000_i350) - dev_spec->eee_disable = false; -else - dev_spec->eee_disable = true; -/* physical interface link setup */ - mac->ops.setup_physical_interface = - (hw->phy.media_type == e1000_media_type_copper) - ? igb_setup_copper_link_82575 - : igb_setup_serdes_link_82575; +/* mac initialization and operations */ + ret_val =igb_init_mac_params_82575 (hw); +if (ret_val) + goto out;/* NVM initialization */ - eecd =rd32 (E1000_EECD ); - size = (u16)((eecd &E1000_EECD_SIZE_EX_MASK ) >> -E1000_EECD_SIZE_EX_SHIFT ); - -/* -* Added to a constant, "size" becomes the left-shift value -* for setting word_size. -*/ - size +=NVM_WORD_SIZE_BASE_SHIFT ; - -/* -* Check for invalid size -*/ -if ((hw->mac.type == e1000_82576) && (size >15 )) { -pr_notice ("The NVM size is not valid, defaulting to 32K\n" ); - size =15 ; - } - - nvm->word_size =1 << size; -if (hw->mac.type < e1000_i210) { - nvm->opcode_bits =8 ; - nvm->delay_usec =1 ; -switch (nvm->override) { -case e1000_nvm_override_spi_large: - nvm->page_size =32 ; - nvm->address_bits =16 ; -break ; -case e1000_nvm_override_spi_small: - nvm->page_size =8 ; - nvm->address_bits =8 ; -break ; -default : - nvm->page_size = eecd - &E1000_EECD_ADDR_BITS ?32 :8 ; - nvm->address_bits = eecd - &E1000_EECD_ADDR_BITS ?16 :8 ; -break ; - } -if (nvm->word_size == (1 <<15 )) - nvm->page_size =128 ; - - nvm->type = e1000_nvm_eeprom_spi; - }else - nvm->type = e1000_nvm_flash_hw; - -/* NVM Function Pointers */ -switch (hw->mac.type) { -case e1000_82580: - nvm->ops.validate = igb_validate_nvm_checksum_82580; - nvm->ops.update = igb_update_nvm_checksum_82580; - nvm->ops.acquire = igb_acquire_nvm_82575; - nvm->ops.release = igb_release_nvm_82575; -if (nvm->word_size < (1 <<15 )) - nvm->ops.read = igb_read_nvm_eerd; -else - nvm->ops.read = igb_read_nvm_spi; - nvm->ops.write = igb_write_nvm_spi; -break ; -case e1000_i350: - nvm->ops.validate = igb_validate_nvm_checksum_i350; - nvm->ops.update = igb_update_nvm_checksum_i350; - nvm->ops.acquire = igb_acquire_nvm_82575; - nvm->ops.release = igb_release_nvm_82575; -if (nvm->word_size < (1 <<15 )) - nvm->ops.read = igb_read_nvm_eerd; -else - nvm->ops.read = igb_read_nvm_spi; - nvm->ops.write = igb_write_nvm_spi; -break ; -case e1000_i210: - nvm->ops.validate = igb_validate_nvm_checksum_i210; - nvm->ops.update = igb_update_nvm_checksum_i210; - nvm->ops.acquire = igb_acquire_nvm_i210; - nvm->ops.release = igb_release_nvm_i210; - nvm->ops.read = igb_read_nvm_srrd_i210; - nvm->ops.write = igb_write_nvm_srwr_i210; - nvm->ops.valid_led_default = igb_valid_led_default_i210; -break ; -case e1000_i211: - nvm->ops.acquire = igb_acquire_nvm_i210; - nvm->ops.release = igb_release_nvm_i210; - nvm->ops.read = igb_read_nvm_i211; - nvm->ops.valid_led_default = igb_valid_led_default_i210; - nvm->ops.validate =NULL ; - nvm->ops.update =NULL ; - nvm->ops.write =NULL ; -break ; -default : - nvm->ops.validate = igb_validate_nvm_checksum; - nvm->ops.update = igb_update_nvm_checksum; - nvm->ops.acquire = igb_acquire_nvm_82575; - nvm->ops.release = igb_release_nvm_82575; -if (nvm->word_size < (1 <<15 )) - nvm->ops.read = igb_read_nvm_eerd; -else - nvm->ops.read = igb_read_nvm_spi; - nvm->ops.write = igb_write_nvm_spi; -break ; - } + ret_val =igb_init_nvm_params_82575 (hw); +if (ret_val) + goto out;/* if part supports SR-IOV then initialize mailbox parameters */ switch (mac->type) {
@@ -638,107 +495,10 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) }/* setup PHY parameters */ -if (phy->media_type != e1000_media_type_copper) { - phy->type = e1000_phy_none; -return 0 ; - } - - phy->autoneg_mask =AUTONEG_ADVERTISE_SPEED_DEFAULT ; - phy->reset_delay_us =100 ; - - ctrl_ext =rd32 (E1000_CTRL_EXT ); - -/* PHY function pointers */ -if (igb_sgmii_active_82575 (hw)) { - phy->ops.reset = igb_phy_hw_reset_sgmii_82575; - ctrl_ext |=E1000_CTRL_I2C_ENA ; - }else { - phy->ops.reset = igb_phy_hw_reset; - ctrl_ext &= ~E1000_CTRL_I2C_ENA ; - } - -wr32 (E1000_CTRL_EXT , ctrl_ext); -igb_reset_mdicnfg_82580 (hw); - -if (igb_sgmii_active_82575 (hw) && !igb_sgmii_uses_mdio_82575 (hw)) { - phy->ops.read_reg = igb_read_phy_reg_sgmii_82575; - phy->ops.write_reg = igb_write_phy_reg_sgmii_82575; - }else if ((hw->mac.type == e1000_82580) - || (hw->mac.type == e1000_i350)) { - phy->ops.read_reg = igb_read_phy_reg_82580; - phy->ops.write_reg = igb_write_phy_reg_82580; - }else if (hw->phy.type >= e1000_phy_i210) { - phy->ops.read_reg = igb_read_phy_reg_gs40g; - phy->ops.write_reg = igb_write_phy_reg_gs40g; - }else { - phy->ops.read_reg = igb_read_phy_reg_igp; - phy->ops.write_reg = igb_write_phy_reg_igp; - } - -/* set lan id */ - hw->bus.func = (rd32 (E1000_STATUS ) &E1000_STATUS_FUNC_MASK ) >> -E1000_STATUS_FUNC_SHIFT ; + ret_val =igb_init_phy_params_82575 (hw); -/* Set phy->phy_addr and phy->id. */ - ret_val =igb_get_phy_id_82575 (hw); -if (ret_val) -return ret_val; - -/* Verify phy id and set remaining function pointers */ -switch (phy->id) { -case I347AT4_E_PHY_ID : -case M88E1112_E_PHY_ID : -case M88E1111_I_PHY_ID : - phy->type = e1000_phy_m88; - phy->ops.get_phy_info = igb_get_phy_info_m88; - -if (phy->id ==I347AT4_E_PHY_ID || - phy->id ==M88E1112_E_PHY_ID ) - phy->ops.get_cable_length = igb_get_cable_length_m88_gen2; -else - phy->ops.get_cable_length = igb_get_cable_length_m88; - -if (phy->id ==I210_I_PHY_ID ) { - phy->ops.get_cable_length = - igb_get_cable_length_m88_gen2; - phy->ops.set_d0_lplu_state = - igb_set_d0_lplu_state_82580; - phy->ops.set_d3_lplu_state = - igb_set_d3_lplu_state_82580; - } - phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_m88; -break ; -case IGP03E1000_E_PHY_ID : - phy->type = e1000_phy_igp_3; - phy->ops.get_phy_info = igb_get_phy_info_igp; - phy->ops.get_cable_length = igb_get_cable_length_igp_2; - phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_igp; - phy->ops.set_d0_lplu_state = igb_set_d0_lplu_state_82575; - phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state; -break ; -case I82580_I_PHY_ID : -case I350_I_PHY_ID : - phy->type = e1000_phy_82580; - phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_82580; - phy->ops.get_cable_length = igb_get_cable_length_82580; - phy->ops.get_phy_info = igb_get_phy_info_82580; - phy->ops.set_d0_lplu_state = igb_set_d0_lplu_state_82580; - phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state_82580; -break ; -case I210_I_PHY_ID : - phy->type = e1000_phy_i210; - phy->ops.get_phy_info = igb_get_phy_info_m88; - phy->ops.check_polarity = igb_check_polarity_m88; - phy->ops.get_cable_length = igb_get_cable_length_m88_gen2; - phy->ops.set_d0_lplu_state = igb_set_d0_lplu_state_82580; - phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state_82580; - phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_m88; -break ; -default : -return -E1000_ERR_PHY ; - } - -return 0 ; +out: +return ret_val; }/**
Signature · 1 line
1.7.11.7
PATCH 10/10 ixgbe: refactor initialization of feature flags
In reply to Jeff KirsherFrom: Emil Tantilov <[email protected]>
This patch reshuffles the switch/case structure of the flag assignment to allow for the flags to be set for each MAC type separately. This is needed for new HW that does not have feature parity with older HW.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 58 ++++++++++++++++++--------- 1 file changed, 38 insertions(+), 20 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +38 -20
@@ -4480,38 +4480,56 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter) hw->subsystem_vendor_id = pdev->subsystem_vendor; hw->subsystem_device_id = pdev->subsystem_device; -/* Set capability flags */ +/* Set common capability flags and settings */ rss =min_t (int,IXGBE_MAX_RSS_INDICES ,num_online_cpus ()); adapter->ring_feature[RING_F_RSS ].limit = rss; + adapter->flags2 |=IXGBE_FLAG2_RSC_CAPABLE ; + adapter->flags2 |=IXGBE_FLAG2_RSC_ENABLED ; + adapter->ring_feature[RING_F_FDIR ].limit =IXGBE_MAX_FDIR_INDICES ; + adapter->max_q_vectors =MAX_Q_VECTORS_82599 ; + adapter->atr_sample_rate =20 ; + adapter->fdir_pballoc =IXGBE_FDIR_PBALLOC_64K ; +#ifdef CONFIG_IXGBE_DCA + adapter->flags |=IXGBE_FLAG_DCA_CAPABLE ; +#endif +#ifdef IXGBE_FCOE + adapter->flags |=IXGBE_FLAG_FCOE_CAPABLE ; + adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED ; +#ifdef CONFIG_IXGBE_DCB +/* Default traffic class to use for FCoE */ + adapter->fcoe.up =IXGBE_FCOE_DEFTC ; +#endif /* CONFIG_IXGBE_DCB */ +#endif /* IXGBE_FCOE */ + +/* Set MAC specific capability flags and exceptions */ switch (hw->mac.type) {case ixgbe_mac_82598EB: + adapter->flags2 &= ~IXGBE_FLAG2_RSC_CAPABLE ; + adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED ; +if (hw->device_id ==IXGBE_DEV_ID_82598AT ) adapter->flags |=IXGBE_FLAG_FAN_FAIL_CAPABLE ; + adapter->max_q_vectors =MAX_Q_VECTORS_82598 ; + adapter->ring_feature[RING_F_FDIR ].limit =0 ; + adapter->atr_sample_rate =0 ; + adapter->fdir_pballoc =0 ; +#ifdef IXGBE_FCOE + adapter->flags &= ~IXGBE_FLAG_FCOE_CAPABLE ; + adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED ; +#ifdef CONFIG_IXGBE_DCB + adapter->fcoe.up =0 ; +#endif /* IXGBE_DCB */ +#endif /* IXGBE_FCOE */ +break ; +case ixgbe_mac_82599EB: +if (hw->device_id ==IXGBE_DEV_ID_82599_T3_LOM ) + adapter->flags2 |=IXGBE_FLAG2_TEMP_SENSOR_CAPABLE ;break ;case ixgbe_mac_X540: fwsm =IXGBE_READ_REG (hw,IXGBE_FWSM );if (fwsm &IXGBE_FWSM_TS_ENABLED ) adapter->flags2 |=IXGBE_FLAG2_TEMP_SENSOR_CAPABLE ; -case ixgbe_mac_82599EB: - adapter->max_q_vectors =MAX_Q_VECTORS_82599 ; - adapter->flags2 |=IXGBE_FLAG2_RSC_CAPABLE ; - adapter->flags2 |=IXGBE_FLAG2_RSC_ENABLED ; -if (hw->device_id ==IXGBE_DEV_ID_82599_T3_LOM ) - adapter->flags2 |=IXGBE_FLAG2_TEMP_SENSOR_CAPABLE ; -/* Flow Director hash filters enabled */ - adapter->atr_sample_rate =20 ; - adapter->ring_feature[RING_F_FDIR ].limit = -IXGBE_MAX_FDIR_INDICES ; - adapter->fdir_pballoc =IXGBE_FDIR_PBALLOC_64K ; -#ifdef IXGBE_FCOE - adapter->flags |=IXGBE_FLAG_FCOE_CAPABLE ; - adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED ; -#ifdef CONFIG_IXGBE_DCB -/* Default traffic class to use for FCoE */ - adapter->fcoe.up =IXGBE_FCOE_DEFTC ; -#endif -#endif /* IXGBE_FCOE */ break ;default :break ;
Signature · 1 line
1.7.11.7
David Miller
maintainerFrom: Jeff Kirsher <[email protected]>
Date: Fri, 15 Feb 2013 02:03:59 -0800
Quoted 20 lines
This series contains updates to igb and ixgbe. Most of the changes are against igb, except for one patch against ixgbe.
There are 3 igb fixes from Carolyn which were reported by Dan Carpenter which resolve issues found in the
get_i2c_client(). Alex does some cleanup of the igb driver to match similar functionality in ixgbe on transmit. Alex also makes it so that we can enable the use ofbuild_skbfor cases where jumbo frames are disabled. The advantage to this is that we do not have to perform a memcpy to populate the header and as a result we see a significant performance improvement.Akeem provides 4 patches to initialize function pointers and do a re-factoring of the function pointers in
igb_get_variants()to assist with driver debugging.The ixgbe patch comes from Emil to reshuffle the switch/case structure of the flag assignment to allow for the flags to be set for each MAC type separately. This is needed for new hardware that does not have feature parity with older hardware.
Quoted 7 lines
v2: updated patches 4 & 5 based on feedback from Ben Hutchings and Eric
DumazetThe following are changes since commit
9754e293491e3a4e6c1ac020d25140b1ed3d9cd2:
net: Don't write to current task flags on every packet received.
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-nextmaster
Pulled, thanks Jeff.