igb update for net-next
Subsystems (2)
cover igb update for net-next
Here is the a resubmit of patches 8-18 from Davem's latest net-next tree. Patches had to be updated with the changes made from Patrick McHardy's VLAN patches.
In addition, 2 additional patches have been added to correct a un-used variable warning and to improve multiqueue AIM support.
---
Summary:
Alexander Duyck <[email protected]>:
igb: update ethtool stats to support multiqueue
igb: add 82576 MAC support
igb: Add support for quad port WOL and feature flags
igb: add page recycling support
igb: add support for in kernel LRO
net: add netif_napi_del function to allow for removal of napistructs
igb: update suspend resume
[new] igb: unused variable warning in igb remove
[new] igb: Improve multiqueue AIM support
Auke Kok <[email protected]>:
igb: reenable CRC stripping in hardware
igb: Increment driver version
Jeb Cramer <[email protected]>:
igb: add DCA support
Peter P Waskiewicz Jr <[email protected]>:
igb: Introduce multiple TX queues with infrastructure
--- drivers/net/Kconfig | 9 drivers/net/igb/e1000_82575.c | 208 +++++++ drivers/net/igb/e1000_82575.h | 22 drivers/net/igb/e1000_defines.h | 10 drivers/net/igb/e1000_hw.h | 8 drivers/net/igb/e1000_mac.c | 3 drivers/net/igb/e1000_mac.h | 1 drivers/net/igb/e1000_regs.h | 9 drivers/net/igb/igb.h | 53 + drivers/net/igb/igb_ethtool.c | 205 +++++-- drivers/net/igb/igb_main.c | 1076 ++++++++++++++++++++++++++++------------ include/linux/netdevice.h | 13 12 files changed, 1243 insertions(+), 374 deletions(-)
Signature · 2 lines
Cheers, Jeff
PATCH RESEND 8/20 igb: Introduce multiple TX queues with infrastructure
From: Peter P Waskiewicz Jr <[email protected]>
This code adds multiple Tx queue infrastructure much like we previously did in ixgbe. The MSI-X vector mapping is the bulk of the change.
IAM can now be safely enabled and we've verified that it does work correctly. We can also eliminate the tx ring lock.
---
drivers/net/igb/igb.h | 7 +- drivers/net/igb/igb_main.c | 160 ++++++++++++++++++++++++++++++-------------- 2 files changed, 114 insertions(+), 53 deletions(-)
drivers/net/igb/igb.h +5 -2
@@ -62,6 +62,7 @@ struct igb_adapter;/* Transmit and receive queues */ #define IGB_MAX_RX_QUEUES 4 +#define IGB_MAX_TX_QUEUES 4/* RX descriptor control thresholds. * PTHRESH - MAC will consider prefetch if it has fewer than this number of
@@ -157,8 +158,6 @@ struct igb_ring {union {/* TX */ struct { -spinlock_t tx_clean_lock; -spinlock_t tx_lock;bool detect_tx_hung; };/* RX */
@@ -277,6 +276,10 @@ struct igb_adapter {/* for ioport free */ int bars;int need_ioport; + +#ifdef CONFIG_NETDEVICES_MULTIQUEUE +struct igb_ring *multi_tx_table[IGB_MAX_TX_QUEUES ]; +#endif /* CONFIG_NETDEVICES_MULTIQUEUE */ };enum e1000_state_t {
drivers/net/igb/igb_main.c +109 -51
375 lines not on this page · raw message
PATCH RESEND 9/20 igb: update ethtool stats to support multiqueue
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Addesses problems seen earlier with igb driver not correctly reporting rx and tx stats.
---
drivers/net/igb/igb.h | 1 + drivers/net/igb/igb_ethtool.c | 13 +++++++++---- drivers/net/igb/igb_main.c | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/net/igb/igb.h +1 -0
@@ -158,6 +158,7 @@ struct igb_ring {union {/* TX */ struct { +struct igb_queue_stats tx_stats;bool detect_tx_hung; };/* RX */
drivers/net/igb/igb_ethtool.c +9 -4
@@ -96,10 +96,8 @@ static const struct igb_stats igb_gstrings_stats[] = { };#define IGB_QUEUE_STATS_LEN \ - ((((((struct igb_adapter *)netdev->priv)->num_rx_queues > 1) ? \ - ((struct igb_adapter *)netdev->priv)->num_rx_queues : 0) + \ - (((((struct igb_adapter *)netdev->priv)->num_tx_queues > 1) ? \ - ((struct igb_adapter *)netdev->priv)->num_tx_queues : 0))) * \ + ((((struct igb_adapter *)netdev->priv)->num_rx_queues + \ + ((struct igb_adapter *)netdev->priv)->num_tx_queues) * \ (sizeof(struct igb_queue_stats) / sizeof(u64)))#define IGB_GLOBAL_STATS_LEN \ sizeof(igb_gstrings_stats) / sizeof(struct igb_stats)
@@ -1842,6 +1840,13 @@ static void igb_get_ethtool_stats(struct net_device *netdev, data[i] = (igb_gstrings_stats[i].sizeof_stat ==sizeof (u64)) ? *(u64 *)p : *(u32 *)p; } +for (j =0 ; j < adapter->num_tx_queues; j++) { +int k; + queue_stat = (u64 *)&adapter->tx_ring[j].tx_stats; +for (k =0 ; k < stat_count; k++) + data[i + k] = queue_stat[k]; + i += k; + }for (j =0 ; j < adapter->num_rx_queues; j++) {int k; queue_stat = (u64 *)&adapter->rx_ring[j].rx_stats;
drivers/net/igb/igb_main.c +2 -0
@@ -3431,6 +3431,8 @@ done_cleaning: } tx_ring->total_bytes += total_bytes; tx_ring->total_packets += total_packets; + tx_ring->tx_stats.bytes += total_bytes; + tx_ring->tx_stats.packets += total_packets; adapter->net_stats.tx_bytes += total_bytes; adapter->net_stats.tx_packets += total_packets;return retval;
PATCH RESEND 10/20 igb: add DCA support
In reply to Jeff KirsherFrom: Jeb Cramer <[email protected]>
Add DCA support in the similar method that it was added to the ixgbe driver recently. DCA allows the network device to put data in the CPU cache and notify the chipset of that event. This reduces cache misses during receives.
---
drivers/net/igb/e1000_82575.h | 11 +++ drivers/net/igb/e1000_regs.h | 2 drivers/net/igb/igb.h | 4 + drivers/net/igb/igb_main.c | 174 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 187 insertions(+), 4 deletions(-)
drivers/net/igb/e1000_82575.h +11 -0
@@ -144,9 +144,20 @@ struct e1000_adv_tx_context_desc {#define E1000_RXDCTL_QUEUE_ENABLE 0x02000000/* Enable specific Rx Queue */ /* Direct Cache Access (DCA) definitions */ +#define E1000_DCA_CTRL_DCA_ENABLE 0x00000000/* DCA Enable */ +#define E1000_DCA_CTRL_DCA_DISABLE 0x00000001/* DCA Disable */ +#define E1000_DCA_CTRL_DCA_MODE_CB1 0x00/* DCA Mode CB1 */ +#define E1000_DCA_CTRL_DCA_MODE_CB2 0x02/* DCA Mode CB2 */ +#define E1000_DCA_RXCTRL_CPUID_MASK 0x0000001F/* Rx CPUID Mask */ +#define E1000_DCA_RXCTRL_DESC_DCA_EN (1 << 5)/* DCA Rx Desc enable */ +#define E1000_DCA_RXCTRL_HEAD_DCA_EN (1 << 6)/* DCA Rx Desc header enable */ +#define E1000_DCA_RXCTRL_DATA_DCA_EN (1 << 7)/* DCA Rx Desc payload enable */ +#define E1000_DCA_TXCTRL_CPUID_MASK 0x0000001F/* Tx CPUID Mask */ +#define E1000_DCA_TXCTRL_DESC_DCA_EN (1 << 5)/* DCA Tx Desc enable */ #define E1000_DCA_TXCTRL_TX_WB_RO_EN (1 << 11)/* Tx Desc writeback RO bit */ +#endif
drivers/net/igb/e1000_regs.h +2 -0
@@ -235,6 +235,8 @@#define E1000_FACTPS 0x05B30/* Function Active and Power State to MNG */ #define E1000_SWSM 0x05B50/* SW Semaphore */ #define E1000_FWSM 0x05B54/* FW Semaphore */ +#define E1000_DCA_ID 0x05B70/* DCA Requester ID Information - RO */ +#define E1000_DCA_CTRL 0x05B74/* DCA Control - RW */ #define E1000_HICR 0x08F00/* Host Inteface Control */ /* RSS registers */
drivers/net/igb/igb.h +3 -1
@@ -271,7 +271,9 @@ struct igb_adapter {/* to not mess up cache alignment, always add to the bottom */ unsigned long state;unsigned int msi_enabled; - +#ifdef CONFIG_DCA +unsigned int dca_enabled; +#endif u32 eeprom_wol;/* for ioport free */
drivers/net/igb/igb_main.c +171 -3
249 lines not on this page · raw message
PATCH RESEND 11/20 igb: reenable CRC stripping in hardware
In reply to Jeff KirsherFrom: Auke Kok <[email protected]>
We can remove a clunky workaround for not having the hardware strip the CRC. 82575 silicon as well as the older PCI Express e1000e hardware all work OK in this respect.
---
drivers/net/igb/igb_main.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/igb/igb_main.c +5 -4
@@ -1664,10 +1664,12 @@ static void igb_setup_rctl(struct igb_adapter *adapter)E1000_RCTL_LBM_NO |E1000_RCTL_RDMTS_HALF | (adapter->hw.mac.mc_filter_type <<E1000_RCTL_MO_SHIFT ); -/* disable the stripping of CRC because it breaks -* BMC firmware connected over SMBUS -rctl |= E1000_RCTL_SECRC; +/* +* enable stripping of CRC. It's unlikely this will break BMC +* redirection as it did with e1000. Newer features require +* that the HW strips the CRC. */ + rctl |=E1000_RCTL_SECRC ; rctl &= ~E1000_RCTL_SBP ;
@@ -3743,7 +3745,6 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring, } } send_up: -pskb_trim (skb, skb->len -4 ); i++;if (i == rx_ring->count) i =0 ;
PATCH RESEND 12/20 igb: Increment driver version
In reply to Jeff KirsherFrom: Auke Kok <[email protected]>
---
drivers/net/igb/igb_main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/igb/igb_main.c +1 -1
@@ -46,7 +46,7 @@#endif #include "igb.h" -#define DRV_VERSION "1.0.8-k2" +#define DRV_VERSION "1.2.45-k2"char igb_driver_name[] ="igb" ;char igb_driver_version[] =DRV_VERSION ; static const char igb_driver_string[] =
PATCH RESEND 13/20 igb: add 82576 MAC support
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
---
drivers/net/igb/e1000_82575.c | 208 +++++++++++++++++++++++++++++++++++++-- drivers/net/igb/e1000_82575.h | 9 ++ drivers/net/igb/e1000_defines.h | 10 ++ drivers/net/igb/e1000_hw.h | 8 ++ drivers/net/igb/e1000_mac.c | 3 - drivers/net/igb/e1000_mac.h | 1 drivers/net/igb/e1000_regs.h | 7 + drivers/net/igb/igb_ethtool.c | 146 +++++++++++++++++++++------ drivers/net/igb/igb_main.c | 170 +++++++++++++++++++++++++------- 9 files changed, 476 insertions(+), 86 deletions(-)
drivers/net/igb/e1000_82575.c +195 -13
@@ -31,6 +31,7 @@#include <linux/types.h> #include <linux/slab.h> +#include <linux/if_ether.h> #include "e1000_mac.h" #include "e1000_82575.h"
@@ -45,7 +46,6 @@ static s32 igb_get_cfg_done_82575(struct e1000_hw *);static s32 igb_init_hw_82575 (struct e1000_hw *);static s32 igb_phy_hw_reset_sgmii_82575 (struct e1000_hw *);static s32 igb_read_phy_reg_sgmii_82575 (struct e1000_hw *,u32 ,u16 *); -static void igb_rar_set_82575 (struct e1000_hw *,u8 *,u32 );static s32 igb_reset_hw_82575 (struct e1000_hw *);static s32 igb_set_d0_lplu_state_82575 (struct e1000_hw *,bool );static s32 igb_setup_copper_link_82575 (struct e1000_hw *);
@@ -84,6 +84,12 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)case E1000_DEV_ID_82575GB_QUAD_COPPER : mac->type = e1000_82575;break ; +case E1000_DEV_ID_82576 : +case E1000_DEV_ID_82576_FIBER : +case E1000_DEV_ID_82576_SERDES : +case E1000_DEV_ID_82576_QUAD_COPPER : + mac->type = e1000_82576; +break ;default :return -E1000_ERR_MAC_INIT ;break ;
@@ -128,6 +134,8 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) mac->mta_reg_count =128 ;/* Set rar entry count */ mac->rar_entry_count =E1000_RAR_ENTRIES_82575 ; +if (mac->type == e1000_82576) + mac->rar_entry_count =E1000_RAR_ENTRIES_82576 ;/* Set if part includes ASF firmware */ mac->asf_firmware_present = true;/* Set if manageability features are enabled. */
@@ -694,13 +702,12 @@ static s32 igb_check_for_link_82575(struct e1000_hw *hw)if ((hw->phy.media_type != e1000_media_type_copper) || (igb_sgmii_active_82575 (hw))) ret_val =igb_get_pcs_speed_and_duplex_82575 (hw, &speed, - &duplex); + &duplex);else ret_val =igb_check_for_copper_link (hw);return ret_val; } -/** * igb_get_pcs_speed_and_duplex_82575 - Retrieve current speed/duplex * @hw: pointer to the HW structure
@@ -757,18 +764,129 @@ static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, }/** -* igb_rar_set_82575 - Set receive address register +* igb_init_rx_addrs_82575 - Initialize receive address's +* @hw: pointer to the HW structure +* @rar_count: receive address registers +* +* Setups the receive address registers by setting the base receive address +* register to the devices MAC address and clearing all the other receive +* address registers to 0. +**/ +static void igb_init_rx_addrs_82575 (struct e1000_hw *hw,u16 rar_count) +{ +u32 i; +u8 addr[6 ] = {0 ,0 ,0 ,0 ,0 ,0 }; +/* +* This function is essentially the same as that of +* e1000_init_rx_addrs_generic. However it also takes care +* of the special case where the register offset of the +* second set of RARs begins elsewhere. This is implicitly taken care by +* function e1000_rar_set_generic. +*/ + +hw_dbg ("e1000_init_rx_addrs_82575" ); + +/* Setup the receive address */ +hw_dbg ("Programming MAC Address into RAR[0]\n" ); + hw->mac.ops.rar_set (hw, hw->mac.addr,0 ); + +/* Zero out the other (rar_entry_count - 1) receive addresses */ +hw_dbg ("Clearing RAR[1-%u]\n" , rar_count-1 ); +for (i =1 ; i < rar_count; i++) + hw->mac.ops.rar_set (hw, addr, i); +} + +/** +* igb_update_mc_addr_list_82575 - 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 +* @rar_used_count: the first RAR register free to program +* @rar_count: total number of supported Receive Address Registers +* +* Updates the Receive Address Registers and Multicast Table Array. +* The caller must have a packed mc_addr_list of multicast addresses. +* The parameter rar_count will usually be hw->mac.rar_entry_count +* unless there are workarounds that change this. +**/ +void igb_update_mc_addr_list_82575 (struct e1000_hw *hw, +u8 *mc_addr_list,u32 mc_addr_count, +u32 rar_used_count,u32 rar_count) +{ +u32 hash_value; +u32 i; +u8 addr[6 ] = {0 ,0 ,0 ,0 ,0 ,0 }; +/* +* This function is essentially the same as that of +* igb_update_mc_addr_list_generic. However it also takes care +* of the special case where the register offset of the +* second set of RARs begins elsewhere. This is implicitly taken care by +* function e1000_rar_set_generic. +*/ + +/* +* Load the first set of multicast addresses into the exact +* filters (RAR). If there are not enough to fill the RAR +* array, clear the filters. +*/ +for (i = rar_used_count; i < rar_count; i++) { +if (mc_addr_count) { +igb_rar_set (hw, mc_addr_list, i); + mc_addr_count--; + mc_addr_list +=ETH_ALEN ; + }else { +igb_rar_set (hw, addr, i); + } + } + +/* Clear the old settings from the MTA */ +hw_dbg ("Clearing MTA\n" ); +for (i =0 ; i < hw->mac.mta_reg_count; i++) { +array_wr32 (E1000_MTA , i,0 ); +wrfl (); + } + +/* Load any remaining multicast addresses into the hash table. */ +for (; mc_addr_count >0 ; mc_addr_count--) { + hash_value =igb_hash_mc_addr (hw, mc_addr_list); +hw_dbg ("Hash value = 0x%03X\n" , hash_value); + hw->mac.ops.mta_set (hw, hash_value); + mc_addr_list +=ETH_ALEN ; + } +} + +/** +* igb_shutdown_fiber_serdes_link_82575 - Remove link during power down * @hw: pointer to the HW structure -* @addr: pointer to the receive address -* @index: receive address array register * -* Sets the receive address array register at index to the address passed -* in by addr. +* In the case of fiber serdes, shut down optics and PCS on driver unload +* when management pass thru is not enabled. **/ -static void igb_rar_set_82575 (struct e1000_hw *hw,u8 *addr,u32 index) +void igb_shutdown_fiber_serdes_link_82575 (struct e1000_hw *hw) { -if (index <E1000_RAR_ENTRIES_82575 ) -igb_rar_set (hw, addr, index); +u32 reg; + +if (hw->mac.type != e1000_82576 || + (hw->phy.media_type != e1000_media_type_fiber && + hw->phy.media_type != e1000_media_type_internal_serdes)) +return ; + +/* if the management interface is not enabled, then power down */ +if (!igb_enable_mng_pass_thru (hw)) { +/* Disable PCS to turn off link */ + reg =rd32 (E1000_PCS_CFG0 ); + reg &= ~E1000_PCS_CFG_PCS_EN ; +wr32 (E1000_PCS_CFG0 , reg); + +/* shutdown the laser */ + reg =rd32 (E1000_CTRL_EXT ); + reg |=E1000_CTRL_EXT_SDP7_DATA ; +wr32 (E1000_CTRL_EXT , reg); + +/* flush the write to verify completion */ +wrfl (); +msleep (1 ); + }return ; }
@@ -854,7 +972,7 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)igb_clear_vfta (hw);/* Setup the receive address */ -igb_init_rx_addrs (hw, rar_count); +igb_init_rx_addrs_82575 (hw, rar_count);/* Zero out the Multicast HASH table */ hw_dbg ("Zeroing the MTA\n" );for (i =0 ; i < mac->mta_reg_count; i++)
@@ -1114,6 +1232,70 @@ out: }/** +* igb_translate_register_82576 - Translate the proper register offset +* @reg: e1000 register to be read +* +* Registers in 82576 are located in different offsets than other adapters +* even though they function in the same manner. This function takes in +* the name of the register to read and returns the correct offset for +* 82576 silicon. +**/ +u32 igb_translate_register_82576 (u32 reg) +{ +/* +* Some of the Kawela registers are located at different +* offsets than they are in older adapters. +* Despite the difference in location, the registers +* function in the same manner. +*/ +switch (reg) { +case E1000_TDBAL (0 ): + reg =0x0E000 ; +break ; +case E1000_TDBAH (0 ): + reg =0x0E004 ; +break ; +case E1000_TDLEN (0 ): + reg =0x0E008 ; +break ; +case E1000_TDH (0 ): + reg =0x0E010 ; +break ; +case E1000_TDT (0 ): + reg =0x0E018 ; +break ; +case E1000_TXDCTL (0 ): + reg =0x0E028 ; +break ; +case E1000_RDBAL (0 ): + reg =0x0C000 ; +break ; +case E1000_RDBAH (0 ): + reg =0x0C004 ; +break ; +case E1000_RDLEN (0 ): + reg =0x0C008 ; +break ; +case E1000_RDH (0 ): + reg =0x0C010 ; +break ; +case E1000_RDT (0 ): + reg =0x0C018 ; +break ; +case E1000_RXDCTL (0 ): + reg =0x0C028 ; +break ; +case E1000_SRRCTL (0 ): + reg =0x0C00C ; +break ; +default : +break ; + } + +return reg; +} + +/** * igb_reset_init_script_82575 - Inits HW defaults after reset * @hw: pointer to the HW structure *
@@ -1304,7 +1486,7 @@ static struct e1000_mac_operations e1000_mac_ops_82575 = { .reset_hw = igb_reset_hw_82575, .init_hw = igb_init_hw_82575, .check_for_link = igb_check_for_link_82575, - .rar_set = igb_rar_set_82575, + .rar_set = igb_rar_set, .read_mac_addr = igb_read_mac_addr_82575, .get_speed_and_duplex = igb_get_speed_and_duplex_copper, };
drivers/net/igb/e1000_82575.h +9 -0
@@ -28,9 +28,13 @@#ifndef _E1000_82575_H_#define _E1000_82575_H_ +u32 igb_translate_register_82576 (u32 reg); +void igb_update_mc_addr_list_82575 (struct e1000_hw *,u8 *,u32 ,u32 ,u32 ); +extern void igb_shutdown_fiber_serdes_link_82575 (struct e1000_hw *hw);extern void igb_rx_fifo_flush_82575 (struct e1000_hw *hw);#define E1000_RAR_ENTRIES_82575 16 +#define E1000_RAR_ENTRIES_82576 24/* SRRCTL bit definitions */ #define E1000_SRRCTL_BSIZEPKT_SHIFT 10/* Shift _right_ */
@@ -159,5 +163,10 @@ struct e1000_adv_tx_context_desc {#define E1000_DCA_TXCTRL_DESC_DCA_EN (1 << 5)/* DCA Tx Desc enable */ #define E1000_DCA_TXCTRL_TX_WB_RO_EN (1 << 11)/* Tx Desc writeback RO bit */ +/* Additional DCA related definitions, note change in position of CPUID */ +#define E1000_DCA_TXCTRL_CPUID_MASK_82576 0xFF000000/* Tx CPUID Mask */ +#define E1000_DCA_RXCTRL_CPUID_MASK_82576 0xFF000000/* Rx CPUID Mask */ +#define E1000_DCA_TXCTRL_CPUID_SHIFT 24/* Tx CPUID now in the last byte */ +#define E1000_DCA_RXCTRL_CPUID_SHIFT 24/* Rx CPUID now in the last byte */ #endif
drivers/net/igb/e1000_defines.h +10 -0
@@ -90,6 +90,11 @@#define E1000_I2CCMD_ERROR 0x80000000#define E1000_MAX_SGMII_PHY_REG_ADDR 255#define E1000_I2CCMD_PHY_TIMEOUT 200 +#define E1000_IVAR_VALID 0x80 +#define E1000_GPIE_NSICR 0x00000001 +#define E1000_GPIE_MSIX_MODE 0x00000010 +#define E1000_GPIE_EIAME 0x40000000 +#define E1000_GPIE_PBA 0x80000000/* Receive Descriptor bit definitions */ #define E1000_RXD_STAT_DD 0x01/* Descriptor Done */
@@ -213,6 +218,7 @@/* Device Control */ #define E1000_CTRL_FD 0x00000001/* Full duplex.0=half; 1=full */ #define E1000_CTRL_GIO_MASTER_DISABLE 0x00000004/*Blocks new Master requests */ +#define E1000_CTRL_LRST 0x00000008/* Link reset. 0=normal,1=reset */ #define E1000_CTRL_ASDE 0x00000020/* Auto-speed detect enable */ #define E1000_CTRL_SLU 0x00000040/* Set link up (Force Link) */ #define E1000_CTRL_ILOS 0x00000080/* Invert Loss-Of Signal */
@@ -244,6 +250,7 @@*/ #define E1000_CONNSW_ENRGSRC 0x4 +#define E1000_PCS_CFG_PCS_EN 8#define E1000_PCS_LCTL_FLV_LINK_UP 1#define E1000_PCS_LCTL_FSV_100 2#define E1000_PCS_LCTL_FSV_1000 4
@@ -253,6 +260,7 @@#define E1000_PCS_LCTL_AN_ENABLE 0x10000#define E1000_PCS_LCTL_AN_RESTART 0x20000#define E1000_PCS_LCTL_AN_TIMEOUT 0x40000 +#define E1000_ENABLE_SERDES_LOOPBACK 0x0410#define E1000_PCS_LSTS_LINK_OK 1#define E1000_PCS_LSTS_SPEED_100 2
@@ -360,6 +368,7 @@#define E1000_PBA_16K 0x0010/* 16KB, default TX allocation */ #define E1000_PBA_24K 0x0018#define E1000_PBA_34K 0x0022 +#define E1000_PBA_64K 0x0040/* 64KB */ #define IFS_MAX 80#define IFS_MIN 40
@@ -528,6 +537,7 @@/* PHY Control Register */ #define MII_CR_FULL_DUPLEX 0x0100/* FDX =1, half duplex =0 */ #define MII_CR_RESTART_AUTO_NEG 0x0200/* Restart auto negotiation */ +#define MII_CR_POWER_DOWN 0x0800/* Power down */ #define MII_CR_AUTO_NEG_EN 0x1000/* Auto Neg Enable */ #define MII_CR_LOOPBACK 0x4000/* 0 = normal, 1 = loopback */ #define MII_CR_RESET 0x8000/* 0 = normal, 1 = PHY reset */
drivers/net/igb/e1000_hw.h +8 -0
@@ -38,6 +38,10 @@struct e1000_hw ; +#define E1000_DEV_ID_82576 0x10C9 +#define E1000_DEV_ID_82576_FIBER 0x10E6 +#define E1000_DEV_ID_82576_SERDES 0x10E7 +#define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8#define E1000_DEV_ID_82575EB_COPPER 0x10A7#define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9#define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6
@@ -50,6 +54,7 @@ struct e1000_hw;enum e1000_mac_type { e1000_undefined =0 , e1000_82575, + e1000_82576, e1000_num_macs/* List is 1-based, so subtract 1 for true count. */ };
@@ -410,14 +415,17 @@ struct e1000_mac_operations {s32 (*check_for_link)(struct e1000_hw *);s32 (*reset_hw)(struct e1000_hw *);s32 (*init_hw)(struct e1000_hw *); +bool (*check_mng_mode)(struct e1000_hw *);s32 (*setup_physical_interface)(struct e1000_hw *);void (*rar_set)(struct e1000_hw *,u8 *,u32 );s32 (*read_mac_addr)(struct e1000_hw *);s32 (*get_speed_and_duplex)(struct e1000_hw *,u16 *,u16 *); +void (*mta_set)(struct e1000_hw *,u32 ); };struct e1000_phy_operations {s32 (*acquire_phy)(struct e1000_hw *); +s32 (*check_reset_block)(struct e1000_hw *);s32 (*force_speed_duplex)(struct e1000_hw *);s32 (*get_cfg_done)(struct e1000_hw *hw);s32 (*get_cable_length)(struct e1000_hw *);
drivers/net/igb/e1000_mac.c +1 -2
@@ -36,7 +36,6 @@static s32 igb_set_default_fc (struct e1000_hw *hw);static s32 igb_set_fc_watermarks (struct e1000_hw *hw); -static u32 igb_hash_mc_addr (struct e1000_hw *hw,u8 *mc_addr);/** * igb_remove_device - Free device specific structure
@@ -360,7 +359,7 @@ void igb_update_mc_addr_list(struct e1000_hw *hw,* the multicast filter table array address and new table value. See * igb_mta_set() **/ -static u32 igb_hash_mc_addr (struct e1000_hw *hw,u8 *mc_addr) +u32 igb_hash_mc_addr (struct e1000_hw *hw,u8 *mc_addr) {u32 hash_value, hash_mask;u8 bit_shift =0 ;
drivers/net/igb/e1000_mac.h +1 -0
@@ -94,5 +94,6 @@ enum e1000_mng_mode {#define E1000_HICR_C 0x02extern void e1000_init_function_pointers_82575 (struct e1000_hw *hw); +extern u32 igb_hash_mc_addr (struct e1000_hw *hw,u8 *mc_addr);#endif
drivers/net/igb/e1000_regs.h +6 -1
@@ -56,6 +56,9 @@#define E1000_EIMC 0x01528/* Ext. Interrupt Mask Clear - WO */ #define E1000_EIAC 0x0152C/* Ext. Interrupt Auto Clear - RW */ #define E1000_EIAM 0x01530/* Ext. Interrupt Ack Auto Clear Mask - RW */ +#define E1000_GPIE 0x01514/* General Purpose Interrupt Enable - RW */ +#define E1000_IVAR0 0x01700/* Interrupt Vector Allocation (array) - RW */ +#define E1000_IVAR_MISC 0x01740/* IVAR for "other" causes - RW */ #define E1000_TCTL 0x00400/* TX Control - RW */ #define E1000_TCTL_EXT 0x00404/* Extended TX Control - RW */ #define E1000_TIPG 0x00410/* TX Inter-packet gap -RW */
@@ -217,6 +220,7 @@#define E1000_RFCTL 0x05008/* Receive Filter Control*/ #define E1000_MTA 0x05200/* Multicast Table Array - RW Array */ #define E1000_RA 0x05400/* Receive Address - RW Array */ +#define E1000_RA2 0x054E0/* 2nd half of receive address array - RW Array */ #define E1000_VFTA 0x05600/* VLAN Filter Table Array - RW Array */ #define E1000_VMD_CTL 0x0581C/* VMDq Control - RW */ #define E1000_WUC 0x05800/* Wakeup Control - RW */
@@ -258,7 +262,8 @@#define E1000_RETA (_i) (0x05C00 + ((_i) * 4))#define E1000_RSSRK (_i) (0x05C80 + ((_i) * 4))/* RSS Random Key - RW Array */ -#define E1000_REGISTER (a, reg) reg +#define E1000_REGISTER (a, reg) (((a)->mac.type < e1000_82576) \ + ? reg : e1000_translate_register_82576(reg))#define wr32 (reg, value) (writel(value, hw->hw_addr + reg))#define rd32 (reg) (readl(hw->hw_addr + reg))
drivers/net/igb/igb_ethtool.c +111 -35
202 lines not on this page · raw message
drivers/net/igb/igb_main.c +135 -35
321 lines not on this page · raw message
PATCH RESEND 14/20 igb: Add support for quad port WOL and feature flags
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Change igb from using a series of boolean operators to using a single flags value that contains a number of different bit flags for all the different features of the adapter.
This patch also adds WOL support for quad port adapters.
---
drivers/net/igb/igb.h | 13 ++++-- drivers/net/igb/igb_ethtool.c | 12 ++++- drivers/net/igb/igb_main.c | 92 ++++++++++++++++++++++++++++------------- 3 files changed, 81 insertions(+), 36 deletions(-)
drivers/net/igb/igb.h +9 -4
@@ -270,10 +270,7 @@ struct igb_adapter {/* to not mess up cache alignment, always add to the bottom */ unsigned long state; -unsigned int msi_enabled; -#ifdef CONFIG_DCA -unsigned int dca_enabled; -#endif +unsigned int flags;u32 eeprom_wol;/* for ioport free */
@@ -285,6 +282,14 @@ struct igb_adapter {#endif /* CONFIG_NETDEVICES_MULTIQUEUE */ }; +#define IGB_FLAG_HAS_MSI (1 << 0) +#define IGB_FLAG_MSI_ENABLE (1 << 1) +#define IGB_FLAG_HAS_DCA (1 << 2) +#define IGB_FLAG_DCA_ENABLED (1 << 3) +#define IGB_FLAG_IN_NETPOLL (1 << 5) +#define IGB_FLAG_QUAD_PORT_A (1 << 6) +#define IGB_FLAG_NEED_CTX_IDX (1 << 7) +enum e1000_state_t { __IGB_TESTING, __IGB_RESETTING,
drivers/net/igb/igb_ethtool.c +10 -2
@@ -1097,7 +1097,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)if (adapter->msix_entries) {/* NOTE: we don't test MSI-X interrupts here, yet */ return 0 ; - }else if (adapter->msi_enabled) { + }else if (adapter->flags &IGB_FLAG_HAS_MSI ) { shared_int = false;if (request_irq (irq, &igb_test_intr,0 , netdev->name, netdev)) { *data =1 ;
@@ -1727,7 +1727,6 @@ static int igb_wol_exclusion(struct igb_adapter *adapter,switch (hw->device_id) {case E1000_DEV_ID_82575GB_QUAD_COPPER : -case E1000_DEV_ID_82576_QUAD_COPPER :/* WoL not supported */ wol->supported =0 ;break ;
@@ -1742,6 +1741,15 @@ static int igb_wol_exclusion(struct igb_adapter *adapter,/* return success for non excluded adapter ports */ retval =0 ;break ; +case E1000_DEV_ID_82576_QUAD_COPPER : +/* quad port adapters only support WoL on port A */ +if (!(adapter->flags &IGB_FLAG_QUAD_PORT_A )) { + wol->supported =0 ; +break ; + } +/* return success for non excluded adapter ports */ + retval =0 ; +break ;default :/* dual port cards only support WoL on port A from now on * unless it was enabled in the eeprom for port B
drivers/net/igb/igb_main.c +62 -30
267 lines not on this page · raw message
PATCH RESEND 15/20 igb: add page recycling support
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This patch adds support for page recycling by splitting the page into two usable portions and tracking the reference count.
---
drivers/net/igb/igb.h | 4 - drivers/net/igb/igb_main.c | 138 ++++++++++++++++++++------------------------ 2 files changed, 63 insertions(+), 79 deletions(-)
drivers/net/igb/igb.h +1 -3
@@ -125,6 +125,7 @@ struct igb_buffer {struct {struct page *page;u64 page_dma; +unsigned int page_offset; }; }; };
@@ -163,9 +164,6 @@ struct igb_ring { };/* RX */ struct { -/* arrays of page information for packet split */ -struct sk_buff *pending_skb; -int pending_skb_page;int no_itr_adjust;struct igb_queue_stats rx_stats;struct napi_struct napi;
drivers/net/igb/igb_main.c +62 -76
218 lines not on this page · raw message
PATCH RESEND 16/20 igb: add support for in kernel LRO
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This patch adds support for the use of the inet_lro module to provide software LRO support.
---
drivers/net/Kconfig | 9 +++ drivers/net/igb/e1000_82575.h | 2 + drivers/net/igb/igb.h | 16 ++++++ drivers/net/igb/igb_ethtool.c | 17 ++++++ drivers/net/igb/igb_main.c | 112 ++++++++++++++++++++++++++++++++++++++--- 5 files changed, 147 insertions(+), 9 deletions(-)
drivers/net/Kconfig +9 -0
@@ -2037,6 +2037,15 @@ config IGB To compile this driver as a module, choose M here. The module will be called igb. +config IGB_LRO + bool "Use software LRO" + depends on IGB && INET + select INET_LRO + ---help--- + Say Y here if you want to use large receive offload. + + If in doubt, say N. + source "drivers/net/ixp2000/Kconfig" config MYRI_SBUS
drivers/net/igb/e1000_82575.h +2 -0
@@ -99,6 +99,8 @@ union e1000_adv_rx_desc {/* RSS Hash results */ /* RSS Packet Types as indicated in the receive descriptor */ +#define E1000_RXDADV_PKTTYPE_IPV4 0x00000010/* IPV4 hdr present */ +#define E1000_RXDADV_PKTTYPE_TCP 0x00000100/* TCP hdr present */ /* Transmit Descriptor - Advanced */ union e1000_adv_tx_desc {
drivers/net/igb/igb.h +16 -0
@@ -36,6 +36,12 @@struct igb_adapter ; +#ifdef CONFIG_IGB_LRO +#include <linux/inet_lro.h> +#define MAX_LRO_AGGR 32 +#define MAX_LRO_DESCRIPTORS 8 +#endif +/* Interrupt defines */ #define IGB_MAX_TX_CLEAN 72
@@ -167,6 +173,10 @@ struct igb_ring {int no_itr_adjust;struct igb_queue_stats rx_stats;struct napi_struct napi; +#ifdef CONFIG_IGB_LRO +struct net_lro_mgr lro_mgr; +bool lro_used; +#endif }; };
@@ -278,6 +288,12 @@ struct igb_adapter {#ifdef CONFIG_NETDEVICES_MULTIQUEUE struct igb_ring *multi_tx_table[IGB_MAX_TX_QUEUES ];#endif /* CONFIG_NETDEVICES_MULTIQUEUE */ +#ifdef CONFIG_IGB_LRO +unsigned int lro_max_aggr; +unsigned int lro_aggregated; +unsigned int lro_flushed; +unsigned int lro_no_desc; +#endif };#define IGB_FLAG_HAS_MSI (1 << 0)
drivers/net/igb/igb_ethtool.c +17 -0
@@ -93,6 +93,11 @@ static const struct igb_stats igb_gstrings_stats[] = { { "tx_smbus", IGB_STAT(stats.mgptc) }, { "rx_smbus", IGB_STAT(stats.mgprc) }, { "dropped_smbus", IGB_STAT(stats.mgpdc) }, +#ifdef CONFIG_IGB_LRO + { "lro_aggregated", IGB_STAT(lro_aggregated) }, + { "lro_flushed", IGB_STAT(lro_flushed) }, + { "lro_no_desc", IGB_STAT(lro_no_desc) }, +#endif };#define IGB_QUEUE_STATS_LEN \
@@ -1917,6 +1922,18 @@ static void igb_get_ethtool_stats(struct net_device *netdev,int stat_count =sizeof (struct igb_queue_stats ) /sizeof (u64);int j;int i; +#ifdef CONFIG_IGB_LRO +int aggregated =0 , flushed =0 , no_desc =0 ; + +for (i =0 ; i < adapter->num_rx_queues; i++) { + aggregated += adapter->rx_ring[i].lro_mgr.stats.aggregated; + flushed += adapter->rx_ring[i].lro_mgr.stats.flushed; + no_desc += adapter->rx_ring[i].lro_mgr.stats.no_desc; + } + adapter->lro_aggregated = aggregated; + adapter->lro_flushed = flushed; + adapter->lro_no_desc = no_desc; +#endif igb_update_stats (adapter);for (i =0 ; i <IGB_GLOBAL_STATS_LEN ; i++) {
drivers/net/igb/igb_main.c +103 -9
174 lines not on this page · raw message
PATCH RESEND 17/20 net: add netif_napi_del function to allow for removal of napistructs
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Adds netif_napi_del function which is used to remove the napi struct from the netdev napi_list in cases where CONFIG_NETPOLL was enabled. The motivation for adding this is to handle the case in which the number of queues on a device changes due to a configuration change. Previously the napi structs for each queue would be left in the list until the netdev was freed.
---
include/linux/netdevice.h | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/netdevice.h +13 -0
@@ -832,6 +832,19 @@ static inline void netif_napi_add(struct net_device *dev,set_bit (NAPI_STATE_SCHED , &napi->state); } +/** +* netif_napi_del - remove a napi context +* @napi: napi context +* +* netif_napi_del() removes a napi context from the network device napi list +*/ +static inline void netif_napi_del (struct napi_struct *napi) +{ +#ifdef CONFIG_NETPOLL +list_del (&napi->dev_list); +#endif +} +struct packet_type {__be16 type;/* This is really htons(ether_type). */ struct net_device *dev;/* NULL is wildcarded here */
PATCH RESEND 18/20 igb: update suspend resume
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Updates the suspend and resume to better handle the possibility of MSIX vector changes.
---
drivers/net/igb/igb_main.c | 46 ++++++++++++++++++++++++++++---------------- 1 files changed, 29 insertions(+), 17 deletions(-)
drivers/net/igb/igb_main.c +29 -17
@@ -272,6 +272,17 @@ static int igb_alloc_queues(struct igb_adapter *adapter)return 0 ; } +static void igb_free_queues (struct igb_adapter *adapter) +{ +int i; + +for (i =0 ; i < adapter->num_rx_queues; i++) +netif_napi_del (&adapter->rx_ring[i].napi); + +kfree (adapter->tx_ring); +kfree (adapter->rx_ring); +} +#define IGB_N0_QUEUE -1static void igb_assign_vector (struct igb_adapter *adapter,int rx_queue,int tx_queue,int msix_vector)
@@ -1322,8 +1333,7 @@ err_eeprom:iounmap (hw->flash_address);igb_remove_device (hw); -kfree (adapter->tx_ring); -kfree (adapter->rx_ring); +igb_free_queues (adapter); err_sw_init: err_hw_init:iounmap (hw->hw_addr);
@@ -1381,8 +1391,7 @@ static void __devexit igb_remove(struct pci_dev *pdev)igb_remove_device (&adapter->hw);igb_reset_interrupt_capability (adapter); -kfree (adapter->tx_ring); -kfree (adapter->rx_ring); +igb_free_queues (adapter);iounmap (adapter->hw.hw_addr);if (adapter->hw.flash_address)
@@ -4324,11 +4333,12 @@ static int igb_suspend(struct pci_dev *pdev, pm_message_t state)netif_device_detach (netdev); -if (netif_running (netdev)) { -WARN_ON (test_bit (__IGB_RESETTING, &adapter->state)); -igb_down (adapter); -igb_free_irq (adapter); - } +if (netif_running (netdev)) +igb_close (netdev); + +igb_reset_interrupt_capability (adapter); + +igb_free_queues (adapter);#ifdef CONFIG_PM retval =pci_save_state (pdev);
@@ -4415,10 +4425,11 @@ static int igb_resume(struct pci_dev *pdev)pci_enable_wake (pdev, PCI_D3hot,0 );pci_enable_wake (pdev, PCI_D3cold,0 ); -if (netif_running (netdev)) { - err =igb_request_irq (adapter); -if (err) -return err; +igb_set_interrupt_capability (adapter); + +if (igb_alloc_queues (adapter)) { +dev_err (&pdev->dev,"Unable to allocate memory for queues\n" ); +return -ENOMEM ; }/* e1000_power_up_phy(adapter); */
@@ -4426,10 +4437,11 @@ static int igb_resume(struct pci_dev *pdev)igb_reset (adapter);wr32 (E1000_WUS , ~0 ); -igb_init_manageability (adapter); - -if (netif_running (netdev)) -igb_up (adapter); +if (netif_running (netdev)) { + err =igb_open (netdev); +if (err) +return err; + }netif_device_attach (netdev);
PATCH 19/20 igb: unused variable warning in igb remove
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Wrap hw variable declaration in DCA flags to prevent unused variable warning during compilation.
---
drivers/net/igb/igb_main.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/igb/igb_main.c +2 -0
@@ -1360,7 +1360,9 @@ static void __devexit igb_remove(struct pci_dev *pdev) {struct net_device *netdev =pci_get_drvdata (pdev);struct igb_adapter *adapter =netdev_priv (netdev); +#ifdef CONFIG_DCA struct e1000_hw *hw = &adapter->hw; +#endif /* flush_scheduled work may reschedule our watchdog task, so * explicitly disable watchdog tasks from being rescheduled */
PATCH 20/20 igb: Improve multiqueue AIM support
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Improve multiqueue performance
Change itr_val to reflect ITR timer value instead of ints/sec Cleaned up AIM algorithms in general
Based on work by Mitch Williams
---
drivers/net/igb/igb.h | 8 +- drivers/net/igb/igb_ethtool.c | 17 +++- drivers/net/igb/igb_main.c | 169 ++++++++++++++++++++++++----------------- 3 files changed, 113 insertions(+), 81 deletions(-)
drivers/net/igb/igb.h +5 -3
@@ -47,7 +47,9 @@ struct igb_adapter;#define IGB_MIN_DYN_ITR 3000#define IGB_MAX_DYN_ITR 96000 -#define IGB_START_ITR 6000 + +/* ((1000000000ns / (6000ints/s * 1024ns)) << 2 = 648 */ +#define IGB_START_ITR 648#define IGB_DYN_ITR_PACKET_THRESHOLD 2#define IGB_DYN_ITR_LENGTH_LOW 200
@@ -170,9 +172,10 @@ struct igb_ring { };/* RX */ struct { -int no_itr_adjust;struct igb_queue_stats rx_stats;struct napi_struct napi; +int set_itr; +struct igb_ring *buddy;#ifdef CONFIG_IGB_LRO struct net_lro_mgr lro_mgr;bool lro_used;
@@ -219,7 +222,6 @@ struct igb_adapter {u32 itr_setting;u16 tx_itr;u16 rx_itr; -int set_itr;struct work_struct reset_task;struct work_struct watchdog_task;
drivers/net/igb/igb_ethtool.c +11 -6
@@ -1861,6 +1861,8 @@ static int igb_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec) {struct igb_adapter *adapter =netdev_priv (netdev); +struct e1000_hw *hw = &adapter->hw; +int i; if ((ec->rx_coalesce_usecs > IGB_MAX_ITR_USECS) || ((ec->rx_coalesce_usecs > 3) &&
@@ -1869,13 +1871,16 @@ static int igb_set_coalesce(struct net_device *netdev,return -EINVAL ;/* convert to rate of irq's per second */ -if (ec->rx_coalesce_usecs <=3 ) +if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <=3 ) { adapter->itr_setting = ec->rx_coalesce_usecs; -else - adapter->itr_setting = (1000000 / ec->rx_coalesce_usecs); + adapter->itr =IGB_START_ITR ; + }else { + adapter->itr_setting = ec->rx_coalesce_usecs <<2 ; + adapter->itr = adapter->itr_setting; + } -if (netif_running (netdev)) -igb_reinit_locked (adapter); +for (i =0 ; i < adapter->num_rx_queues; i++) +wr32 (adapter->rx_ring[i].itr_register, adapter->itr);return 0 ; }
@@ -1888,7 +1893,7 @@ static int igb_get_coalesce(struct net_device *netdev,if (adapter->itr_setting <=3 ) ec->rx_coalesce_usecs = adapter->itr_setting;else - ec->rx_coalesce_usecs =1000000 / adapter->itr_setting; + ec->rx_coalesce_usecs = adapter->itr_setting >>2 ;return 0 ; }
drivers/net/igb/igb_main.c +97 -72
310 lines not on this page · raw message
Re: [RESEND NET-NEXT PATCH 08/20] igb: Introduce multiple TX queues with infrastructure
In reply to Jeff KirsherQuoted 9 lines · Jeff Kirsher
From: Peter P Waskiewicz Jr <[email protected]>
This code adds multiple Tx queue infrastructure much like we previously did in ixgbe. The MSI-X vector mapping is the bulk of the change.
IAM can now be safely enabled and we've verified that it does work correctly. We can also eliminate the tx ring lock.
Quoted 8 lines
Signed-off-by Peter P Waskiewicz Jr <[email protected]>Signed-off-by Mitch Williams <[email protected]>Signed-off-by Auke Kok <[email protected]>---
drivers/net/igb/igb.h | 7 +- drivers/net/igb/igb_main.c | 160 ++++++++++++++++++++++++++++++-------------- 2 files changed, 114 insertions(+), 53 deletions(-)
applied 8-20