igb: optomize/refactor receive path
Subsystems (2)
PATCH 1/26 igb: optomize/refactor receive path
From: Alexander Duyck <[email protected]>
While cleaning up the skb_over panic with small frames I found there was room for improvement in the ordering of operations within the rx receive flow. These changes will place the prefetch for the next descriptor to a point earlier in the rx path.
---
drivers/net/igb/igb_main.c | 44 ++++++++++++++++++++++---------------------- 1 files changed, 22 insertions(+), 22 deletions(-)
drivers/net/igb/igb_main.c +22 -22
@@ -3803,6 +3803,7 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,unsigned int total_bytes =0 , total_packets =0 ; i = rx_ring->next_to_clean; + buffer_info = &rx_ring->buffer_info[i]; rx_desc =E1000_RX_DESC_ADV (*rx_ring, i); staterr =le32_to_cpu (rx_desc->wb.upper.status_error);
@@ -3810,25 +3811,22 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,if (*work_done >= budget)break ; (*work_done)++; - buffer_info = &rx_ring->buffer_info[i]; -/* HW will not DMA in data larger than the given buffer, even -* if it parses the (NFS, of course) header to be larger. In -* that case, it fills the header buffer and spills the rest -* into the page. -*/ - hlen = (le16_to_cpu (rx_desc->wb.lower.lo_dword.hdr_info) & -E1000_RXDADV_HDRBUFLEN_MASK ) >>E1000_RXDADV_HDRBUFLEN_SHIFT ; -if (hlen > adapter->rx_ps_hdr_size) - hlen = adapter->rx_ps_hdr_size; + skb = buffer_info->skb; +prefetch (skb->data -NET_IP_ALIGN ); + buffer_info->skb =NULL ; + + i++; +if (i == rx_ring->count) + i =0 ; + next_rxd =E1000_RX_DESC_ADV (*rx_ring, i); +prefetch (next_rxd); + next_buffer = &rx_ring->buffer_info[i]; length =le16_to_cpu (rx_desc->wb.upper.length); cleaned = true; cleaned_count++; - skb = buffer_info->skb; -prefetch (skb->data -NET_IP_ALIGN ); - buffer_info->skb =NULL ;if (!adapter->rx_ps_hdr_size) { pci_unmap_single(pdev, buffer_info->dma, adapter->rx_buffer_len +
@@ -3838,6 +3836,16 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring, goto send_up; } +/* HW will not DMA in data larger than the given buffer, even +* if it parses the (NFS, of course) header to be larger. In +* that case, it fills the header buffer and spills the rest +* into the page. +*/ + hlen = (le16_to_cpu (rx_desc->wb.lower.lo_dword.hdr_info) & +E1000_RXDADV_HDRBUFLEN_MASK ) >>E1000_RXDADV_HDRBUFLEN_SHIFT ; +if (hlen > adapter->rx_ps_hdr_size) + hlen = adapter->rx_ps_hdr_size; +if (!skb_shinfo (skb)->nr_frags) { pci_unmap_single(pdev, buffer_info->dma, adapter->rx_ps_hdr_size +
@@ -3867,13 +3875,6 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring, skb->truesize += length; } -send_up: - i++; -if (i == rx_ring->count) - i =0 ; - next_rxd =E1000_RX_DESC_ADV (*rx_ring, i); -prefetch (next_rxd); - next_buffer = &rx_ring->buffer_info[i];if (!(staterr &E1000_RXD_STAT_EOP )) { buffer_info->skb = next_buffer->skb;
@@ -3882,7 +3883,7 @@ send_up: next_buffer->dma =0 ; goto next_desc; } - +send_up:if (staterr &E1000_RXDEXT_ERR_FRAME_ERR_MASK ) {dev_kfree_skb_irq (skb); goto next_desc;
@@ -3909,7 +3910,6 @@ next_desc:/* use prefetched values */ rx_desc = next_rxd; buffer_info = next_buffer; - staterr =le32_to_cpu (rx_desc->wb.upper.status_error); }
PATCH 2/26 igb: move setting of buffsz out of repeated path in alloc_rx_buffers
From: Alexander Duyck <[email protected]>
buffsz is being repeatedly set when allocaing buffers. Since this value should only need to be set once in the function I am moving it out of the looped portion of the path.
---
drivers/net/igb/igb_main.c | 19 ++++++++----------- 1 files changed, 8 insertions(+), 11 deletions(-)
drivers/net/igb/igb_main.c +8 -11
@@ -3943,10 +3943,17 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,struct igb_buffer *buffer_info;struct sk_buff *skb;unsigned int i; +int bufsz; i = rx_ring->next_to_use; buffer_info = &rx_ring->buffer_info[i]; +if (adapter->rx_ps_hdr_size) + bufsz = adapter->rx_ps_hdr_size; +else + bufsz = adapter->rx_buffer_len; + bufsz +=NET_IP_ALIGN ; +while (cleaned_count--) { rx_desc =E1000_RX_DESC_ADV (*rx_ring, i);
@@ -3962,23 +3969,14 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring, buffer_info->page_offset ^=PAGE_SIZE /2 ; } buffer_info->page_dma = -pci_map_page (pdev, - buffer_info->page, +pci_map_page (pdev, buffer_info->page, buffer_info->page_offset,PAGE_SIZE /2 ,PCI_DMA_FROMDEVICE ); }if (!buffer_info->skb) { -int bufsz; - -if (adapter->rx_ps_hdr_size) - bufsz = adapter->rx_ps_hdr_size; -else - bufsz = adapter->rx_buffer_len; - bufsz +=NET_IP_ALIGN ; skb =netdev_alloc_skb (netdev, bufsz); -if (!skb) { adapter->alloc_rx_buff_failed++; goto no_buffers;
@@ -3994,7 +3992,6 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring, buffer_info->dma =pci_map_single (pdev, skb->data, bufsz,PCI_DMA_FROMDEVICE ); - }/* Refresh the desc even if buffer_addrs didn't change because * each write-back erases this info. */
PATCH 3/26 igb: move initialization of number of queues into set_interrupt_capability
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This patch moves the initialization of the number of queues into set_interrupt_capability. This allows the number of queues to increase in the unlikely event that the system initially fails to allocate enough msi-x interrupts, does a suspend/resume, and then can allocate enough interrupts on resume.
---
drivers/net/igb/igb_main.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/igb/igb_main.c +5 -5
@@ -543,6 +543,11 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter)int err;int numvecs, i; +/* Number of supported queues. */ +/* Having more queues than CPUs doesn't make sense. */ + adapter->num_rx_queues =min_t (u32,IGB_MAX_RX_QUEUES ,num_online_cpus ()); + adapter->num_tx_queues =min_t (u32,IGB_MAX_TX_QUEUES ,num_online_cpus ()); + numvecs = adapter->num_tx_queues + adapter->num_rx_queues +1 ; adapter->msix_entries =kcalloc (numvecs,sizeof (struct msix_entry ),GFP_KERNEL );
@@ -1450,11 +1455,6 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter) adapter->max_frame_size = netdev->mtu +ETH_HLEN +ETH_FCS_LEN ; adapter->min_frame_size =ETH_ZLEN +ETH_FCS_LEN ; -/* Number of supported queues. */ -/* Having more queues than CPUs doesn't make sense. */ - adapter->num_rx_queues =min_t (u32,IGB_MAX_RX_QUEUES ,num_online_cpus ()); - adapter->num_tx_queues =min_t (u32,IGB_MAX_TX_QUEUES ,num_online_cpus ()); -/* This call may decrease the number of queues depending on * interrupt mode. */ igb_set_interrupt_capability (adapter);
PATCH 4/26 igb: remove check for needing an io port
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Since igb supports only pci-e nics and there is no plan to support any legacy pci parts in the driver there isn't really much need for checking to see if an io port is needed.
In the unlikely event that we do begin supporting legacy pci parts then we can see about adding this code back to the driver.
---
drivers/net/igb/igb.h | 4 ---- drivers/net/igb/igb_main.c | 50 +++++++++----------------------------------- 2 files changed, 10 insertions(+), 44 deletions(-)
drivers/net/igb/igb.h +0 -4
@@ -273,10 +273,6 @@ struct igb_adapter {unsigned int flags;u32 eeprom_wol; -/* for ioport free */ -int bars; -int need_ioport; -struct igb_ring *multi_tx_table[IGB_MAX_TX_QUEUES ];unsigned int tx_ring_count;unsigned int rx_ring_count;
drivers/net/igb/igb_main.c +10 -40
99 lines not on this page · raw message
PATCH 5/26 igb: add link check function
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Add a link check function to contain all activities related to verifying that the link is present. The current approach is a bit cludgy and needs to be cleaned up.
---
drivers/net/igb/igb_main.c | 59 +++++++++++++++++++++++++++++++------------- 1 files changed, 42 insertions(+), 17 deletions(-)
drivers/net/igb/igb_main.c +42 -17
@@ -2261,6 +2261,46 @@ static void igb_update_phy_info(unsigned long data) }/** +* igb_has_link - check shared code for link and determine up/down +* @adapter: pointer to driver private info +**/ +static bool igb_has_link (struct igb_adapter *adapter) +{ +struct e1000_hw *hw = &adapter->hw; +bool link_active = false; +s32 ret_val =0 ; + +/* get_link_status is set on LSC (link status) interrupt or +* rx sequence error interrupt. get_link_status will stay +* false until the e1000_check_for_link establishes link +* for copper adapters ONLY +*/ +switch (hw->phy.media_type) { +case e1000_media_type_copper: +if (hw->mac.get_link_status) { + ret_val = hw->mac.ops.check_for_link (hw); + link_active = !hw->mac.get_link_status; + }else { + link_active = true; + } +break ; +case e1000_media_type_fiber: + ret_val = hw->mac.ops.check_for_link (hw); + link_active = !!(rd32 (E1000_STATUS ) &E1000_STATUS_LU ); +break ; +case e1000_media_type_internal_serdes: + ret_val = hw->mac.ops.check_for_link (hw); + link_active = hw->mac.serdes_has_link; +break ; +default : +case e1000_media_type_unknown: +break ; + } + +return link_active; +} + +/** * igb_watchdog - Timer Call-back * @data: pointer to adapter cast into an unsigned long **/
@@ -2285,25 +2325,10 @@ static void igb_watchdog_task(struct work_struct *work)s32 ret_val;int i; -if ((netif_carrier_ok (netdev)) && - (rd32 (E1000_STATUS ) &E1000_STATUS_LU )) + link =igb_has_link (adapter); +if ((netif_carrier_ok (netdev)) && link) goto link_up; - ret_val = hw->mac.ops.check_for_link (&adapter->hw); -if ((ret_val ==E1000_ERR_PHY ) && - (hw->phy.type == e1000_phy_igp_3) && - (rd32 (E1000_CTRL ) & -E1000_PHY_CTRL_GBE_DISABLE )) -dev_info (&adapter->pdev->dev, -"Gigabit has been disabled, downgrading speed\n" ); - -if ((hw->phy.media_type == e1000_media_type_internal_serdes) && - !(rd32 (E1000_TXCW ) &E1000_TXCW_ANE )) - link = mac->serdes_has_link; -else - link =rd32 (E1000_STATUS ) & -E1000_STATUS_LU ; -if (link) {if (!netif_carrier_ok (netdev)) {u32 ctrl;
PATCH 6/26 igb: make dev_spec a union and remove dynamic allocation
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This patch makes dev_spec a union and simplifies it so that it does not require dynamic allocation and freeing in the driver.
---
drivers/net/igb/e1000_82575.c | 34 +++++----------------------------- drivers/net/igb/e1000_hw.h | 9 +++++++-- drivers/net/igb/e1000_mac.c | 13 ------------- drivers/net/igb/e1000_mac.h | 1 - drivers/net/igb/igb_main.c | 2 -- 5 files changed, 12 insertions(+), 47 deletions(-)
drivers/net/igb/e1000_82575.c +5 -29
@@ -62,17 +62,12 @@ static bool igb_sgmii_active_82575(struct e1000_hw *);static s32 igb_reset_init_script_82575 (struct e1000_hw *);static s32 igb_read_mac_addr_82575 (struct e1000_hw *); - -struct e1000_dev_spec_82575 { -bool sgmii_active; -}; -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; +struct e1000_dev_spec_82575 * dev_spec = &hw->dev_spec._82575;u32 eecd;s32 ret_val;u16 size;
@@ -94,17 +89,6 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)break ; } -/* MAC initialization */ - hw->dev_spec_size =sizeof (struct e1000_dev_spec_82575 ); - -/* Device-specific structure allocation */ - hw->dev_spec =kzalloc (hw->dev_spec_size,GFP_KERNEL ); - -if (!hw->dev_spec) -return -ENOMEM ; - - dev_spec = (struct e1000_dev_spec_82575 *)hw->dev_spec; -/* Set media type */ /* * The 82575 uses bits 22:23 for link mode. The mode can be changed
@@ -1234,20 +1218,12 @@ out:**/ static bool igb_sgmii_active_82575 (struct e1000_hw *hw) { -struct e1000_dev_spec_82575 *dev_spec; -bool ret_val; +struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; -if (hw->mac.type != e1000_82575) { - ret_val = false; - goto out; - } - - dev_spec = (struct e1000_dev_spec_82575 *)hw->dev_spec; +if (hw->mac.type != e1000_82575 && hw->mac.type != e1000_82576) +return false; - ret_val = dev_spec->sgmii_active; - -out: -return ret_val; +return dev_spec->sgmii_active; }/**
drivers/net/igb/e1000_hw.h +7 -2
@@ -565,9 +565,12 @@ struct e1000_fc_info {enum e1000_fc_type original_type; }; +struct e1000_dev_spec_82575 { +bool sgmii_active; +}; +struct e1000_hw {void *back; -void *dev_spec;u8 __iomem *hw_addr;u8 __iomem *flash_address;
@@ -580,7 +583,9 @@ struct e1000_hw {struct e1000_bus_info bus;struct e1000_host_mng_dhcp_cookie mng_cookie; -u32 dev_spec_size; +union { +struct e1000_dev_spec_82575 _82575; + } dev_spec;u16 device_id;u16 subsystem_vendor_id;
drivers/net/igb/e1000_mac.c +0 -13
@@ -37,19 +37,6 @@static s32 igb_set_default_fc (struct e1000_hw *hw);static s32 igb_set_fc_watermarks (struct e1000_hw *hw); -/** -* igb_remove_device - Free device specific structure -* @hw: pointer to the HW structure -* -* If a device specific structure was allocated, this function will -* free it. -**/ -void igb_remove_device (struct e1000_hw *hw) -{ -/* Freeing the dev_spec member of e1000_hw structure */ -kfree (hw->dev_spec); -} -static s32 igb_read_pcie_cap_reg (struct e1000_hw *hw,u32 reg,u16 *value) {struct igb_adapter *adapter = hw->back;
drivers/net/igb/e1000_mac.h +0 -1
@@ -63,7 +63,6 @@ void igb_mta_set(struct e1000_hw *hw, u32 hash_value);void igb_put_hw_semaphore (struct e1000_hw *hw);void igb_rar_set (struct e1000_hw *hw,u8 *addr,u32 index);s32 igb_check_alt_mac_addr (struct e1000_hw *hw); -void igb_remove_device (struct e1000_hw *hw);void igb_reset_adaptive (struct e1000_hw *hw);void igb_update_adaptive (struct e1000_hw *hw);void igb_write_vfta (struct e1000_hw *hw,u32 offset,u32 value);
drivers/net/igb/igb_main.c +0 -2
@@ -1329,7 +1329,6 @@ err_eeprom:if (hw->flash_address)iounmap (hw->flash_address); -igb_remove_device (hw);igb_free_queues (adapter); err_sw_init: err_hw_init:
@@ -1389,7 +1388,6 @@ static void __devexit igb_remove(struct pci_dev *pdev)if (!igb_check_reset_block (&adapter->hw))igb_reset_phy (&adapter->hw); -igb_remove_device (&adapter->hw);igb_reset_interrupt_capability (adapter);igb_free_queues (adapter);
PATCH 7/26 igb: read address from RAH/RAL instead of from EEPROM
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Instead of pulling the mac address from EEPROM it is easier to pull it from the RAL/RAH registers and then just copy it into the address structures.
---
drivers/net/igb/e1000_defines.h | 2 ++ drivers/net/igb/e1000_nvm.c | 28 +++++++++++----------------- 2 files changed, 13 insertions(+), 17 deletions(-)
drivers/net/igb/e1000_defines.h +2 -0
@@ -481,6 +481,8 @@* manageability enabled, allowing us room for 15 multicast addresses. */ #define E1000_RAH_AV 0x80000000/* Receive descriptor valid */ +#define E1000_RAL_MAC_ADDR_LEN 4 +#define E1000_RAH_MAC_ADDR_LEN 2/* Error Codes */ #define E1000_ERR_NVM 1
drivers/net/igb/e1000_nvm.c +11 -17
@@ -515,29 +515,23 @@ out:**/ s32 igb_read_mac_addr (struct e1000_hw *hw) { -s32 ret_val =0 ; -u16 offset, nvm_data, i; +u32 rar_high; +u32 rar_low; +u16 i; -for (i =0 ; i <ETH_ALEN ; i +=2 ) { - offset = i >>1 ; - ret_val = hw->nvm.ops.read_nvm (hw, offset,1 , &nvm_data); -if (ret_val) { -hw_dbg ("NVM Read Error\n" ); - goto out; - } - hw->mac.perm_addr[i] = (u8)(nvm_data &0xFF ); - hw->mac.perm_addr[i+1 ] = (u8)(nvm_data >>8 ); - } + rar_high =rd32 (E1000_RAH (0 )); + rar_low =rd32 (E1000_RAL (0 )); + +for (i =0 ; i <E1000_RAL_MAC_ADDR_LEN ; i++) + hw->mac.perm_addr[i] = (u8)(rar_low >> (i*8 )); -/* Flip last bit of mac address if we're on second port */ -if (hw->bus.func ==E1000_FUNC_1 ) - hw->mac.perm_addr[5 ] ^=1 ; +for (i =0 ; i <E1000_RAH_MAC_ADDR_LEN ; i++) + hw->mac.perm_addr[i+4 ] = (u8)(rar_high >> (i*8 ));for (i =0 ; i <ETH_ALEN ; i++) hw->mac.addr[i] = hw->mac.perm_addr[i]; -out: -return ret_val; +return 0 ; }/**
PATCH 8/26 igb: rename phy ops
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This patch renames write_phy_reg to write_reg and read_phy_reg to read_reg. It seems redundant to call out phy in an operation that is part of the phy_ops struct.
---
drivers/net/igb/e1000_82575.c | 38 ++-- drivers/net/igb/e1000_hw.h | 10 + drivers/net/igb/e1000_mac.c | 8 - drivers/net/igb/e1000_phy.c | 347 +++++++++++++++-------------------------- drivers/net/igb/e1000_phy.h | 1 drivers/net/igb/igb.h | 12 + 6 files changed, 162 insertions(+), 254 deletions(-)
drivers/net/igb/e1000_82575.c +19 -19
@@ -179,13 +179,13 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)/* PHY function pointers */ if (igb_sgmii_active_82575 (hw)) { - phy->ops.reset_phy = igb_phy_hw_reset_sgmii_82575; - phy->ops.read_phy_reg = igb_read_phy_reg_sgmii_82575; - phy->ops.write_phy_reg = igb_write_phy_reg_sgmii_82575; + phy->ops.reset = igb_phy_hw_reset_sgmii_82575; + phy->ops.read_reg = igb_read_phy_reg_sgmii_82575; + phy->ops.write_reg = igb_write_phy_reg_sgmii_82575; }else { - phy->ops.reset_phy = igb_phy_hw_reset; - phy->ops.read_phy_reg = igb_read_phy_reg_igp; - phy->ops.write_phy_reg = igb_write_phy_reg_igp; + phy->ops.reset = igb_phy_hw_reset; + phy->ops.read_reg = igb_read_phy_reg_igp; + phy->ops.write_reg = igb_write_phy_reg_igp; }/* Set phy->phy_addr and phy->id. */
@@ -435,7 +435,7 @@ static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *hw)* SFP documentation requires the following to configure the SPF module * to work on SGMII. No further documentation is given. */ - ret_val = hw->phy.ops.write_phy_reg (hw,0x1B ,0x8084 ); + ret_val = hw->phy.ops.write_reg (hw,0x1B ,0x8084 );if (ret_val) goto out;
@@ -464,28 +464,28 @@ static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active)s32 ret_val;u16 data; - ret_val = phy->ops.read_phy_reg (hw,IGP02E1000_PHY_POWER_MGMT , &data); + ret_val = phy->ops.read_reg (hw,IGP02E1000_PHY_POWER_MGMT , &data);if (ret_val) goto out;if (active) { data |=IGP02E1000_PM_D0_LPLU ; - ret_val = phy->ops.write_phy_reg (hw,IGP02E1000_PHY_POWER_MGMT , + ret_val = phy->ops.write_reg (hw,IGP02E1000_PHY_POWER_MGMT , data);if (ret_val) goto out;/* When LPLU is enabled, we should disable SmartSpeed */ - ret_val = phy->ops.read_phy_reg (hw,IGP01E1000_PHY_PORT_CONFIG , + ret_val = phy->ops.read_reg (hw,IGP01E1000_PHY_PORT_CONFIG , &data); data &= ~IGP01E1000_PSCFR_SMART_SPEED ; - ret_val = phy->ops.write_phy_reg (hw,IGP01E1000_PHY_PORT_CONFIG , + ret_val = phy->ops.write_reg (hw,IGP01E1000_PHY_PORT_CONFIG , data);if (ret_val) goto out; }else { data &= ~IGP02E1000_PM_D0_LPLU ; - ret_val = phy->ops.write_phy_reg (hw,IGP02E1000_PHY_POWER_MGMT , + ret_val = phy->ops.write_reg (hw,IGP02E1000_PHY_POWER_MGMT , data);/* * LPLU and SmartSpeed are mutually exclusive. LPLU is used
@@ -494,24 +494,24 @@ static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active)* SmartSpeed, so performance is maintained. */ if (phy->smart_speed == e1000_smart_speed_on) { - ret_val = phy->ops.read_phy_reg (hw, + ret_val = phy->ops.read_reg (hw,IGP01E1000_PHY_PORT_CONFIG , &data);if (ret_val) goto out; data |=IGP01E1000_PSCFR_SMART_SPEED ; - ret_val = phy->ops.write_phy_reg (hw, + ret_val = phy->ops.write_reg (hw,IGP01E1000_PHY_PORT_CONFIG , data);if (ret_val) goto out; }else if (phy->smart_speed == e1000_smart_speed_off) { - ret_val = phy->ops.read_phy_reg (hw, + ret_val = phy->ops.read_reg (hw,IGP01E1000_PHY_PORT_CONFIG , &data);if (ret_val) goto out; data &= ~IGP01E1000_PSCFR_SMART_SPEED ; - ret_val = phy->ops.write_phy_reg (hw, + ret_val = phy->ops.write_reg (hw,IGP01E1000_PHY_PORT_CONFIG , data);if (ret_val) goto out;
@@ -1035,7 +1035,7 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw)* depending on user settings. */ hw_dbg ("Forcing Speed and Duplex\n" ); - ret_val =igb_phy_force_speed_duplex (hw); + ret_val = hw->phy.ops.force_speed_duplex (hw);if (ret_val) {hw_dbg ("Error Forcing Speed and Duplex\n" ); goto out;
@@ -1423,9 +1423,9 @@ static struct e1000_mac_operations e1000_mac_ops_82575 = { };static struct e1000_phy_operations e1000_phy_ops_82575 = { - .acquire_phy = igb_acquire_phy_82575, + .acquire = igb_acquire_phy_82575, .get_cfg_done = igb_get_cfg_done_82575, - .release_phy = igb_release_phy_82575, + .release = igb_release_phy_82575, };static struct e1000_nvm_operations e1000_nvm_ops_82575 = {
drivers/net/igb/e1000_hw.h +5 -5
@@ -422,18 +422,18 @@ struct e1000_mac_operations { };struct e1000_phy_operations { -s32 (*acquire_phy)(struct e1000_hw *); +s32 (*acquire)(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 *);s32 (*get_phy_info)(struct e1000_hw *); -s32 (*read_phy_reg)(struct e1000_hw *,u32 ,u16 *); -void (*release_phy)(struct e1000_hw *); -s32 (*reset_phy)(struct e1000_hw *); +s32 (*read_reg)(struct e1000_hw *,u32 ,u16 *); +void (*release)(struct e1000_hw *); +s32 (*reset)(struct e1000_hw *);s32 (*set_d0_lplu_state)(struct e1000_hw *,bool );s32 (*set_d3_lplu_state)(struct e1000_hw *,bool ); -s32 (*write_phy_reg)(struct e1000_hw *,u32 ,u16 ); +s32 (*write_reg)(struct e1000_hw *,u32 ,u16 ); };struct e1000_nvm_operations {
drivers/net/igb/e1000_mac.c +4 -4
@@ -707,11 +707,11 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)* has completed. We read this twice because this reg has * some "sticky" (latched) bits. */ - ret_val = hw->phy.ops.read_phy_reg (hw,PHY_STATUS , + ret_val = hw->phy.ops.read_reg (hw,PHY_STATUS , &mii_status_reg);if (ret_val) goto out; - ret_val = hw->phy.ops.read_phy_reg (hw,PHY_STATUS , + ret_val = hw->phy.ops.read_reg (hw,PHY_STATUS , &mii_status_reg);if (ret_val) goto out;
@@ -729,11 +729,11 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)* Page Ability Register (Address 5) to determine how * flow control was negotiated. */ - ret_val = hw->phy.ops.read_phy_reg (hw,PHY_AUTONEG_ADV , + ret_val = hw->phy.ops.read_reg (hw,PHY_AUTONEG_ADV , &mii_nway_adv_reg);if (ret_val) goto out; - ret_val = hw->phy.ops.read_phy_reg (hw,PHY_LP_ABILITY , + ret_val = hw->phy.ops.read_reg (hw,PHY_LP_ABILITY , &mii_nway_lp_ability_reg);if (ret_val) goto out;
drivers/net/igb/e1000_phy.c +128 -219
827 lines not on this page · raw message
drivers/net/igb/e1000_phy.h +0 -1
@@ -44,7 +44,6 @@ enum e1000_smart_speed {s32 igb_check_downshift (struct e1000_hw *hw);s32 igb_check_reset_block (struct e1000_hw *hw);s32 igb_copper_link_autoneg (struct e1000_hw *hw); -s32 igb_phy_force_speed_duplex (struct e1000_hw *hw);s32 igb_copper_link_setup_igp (struct e1000_hw *hw);s32 igb_copper_link_setup_m88 (struct e1000_hw *hw);s32 igb_phy_force_speed_duplex_igp (struct e1000_hw *hw);
drivers/net/igb/igb.h +6 -6
@@ -313,24 +313,24 @@ extern void igb_set_ethtool_ops(struct net_device *);static inline s32 igb_reset_phy (struct e1000_hw *hw) { -if (hw->phy.ops.reset_phy) -return hw->phy.ops.reset_phy (hw); +if (hw->phy.ops.reset) +return hw->phy.ops.reset (hw);return 0 ; }static inline s32 igb_read_phy_reg (struct e1000_hw *hw,u32 offset,u16 *data) { -if (hw->phy.ops.read_phy_reg) -return hw->phy.ops.read_phy_reg (hw, offset, data); +if (hw->phy.ops.read_reg) +return hw->phy.ops.read_reg (hw, offset, data);return 0 ; }static inline s32 igb_write_phy_reg (struct e1000_hw *hw,u32 offset,u16 data) { -if (hw->phy.ops.write_phy_reg) -return hw->phy.ops.write_phy_reg (hw, offset, data); +if (hw->phy.ops.write_reg) +return hw->phy.ops.write_reg (hw, offset, data);return 0 ; }
PATCH 9/26 igb: rename nvm ops
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
All of the nvm ops have the tag _nvm added to the end which is redundant since all of the calls to the ops have to go through the nvm ops struct anyway.
---
drivers/net/igb/e1000_82575.c | 8 ++++---- drivers/net/igb/e1000_hw.h | 8 ++++---- drivers/net/igb/e1000_mac.c | 9 ++++----- drivers/net/igb/e1000_nvm.c | 14 +++++++------- drivers/net/igb/igb_ethtool.c | 14 +++++++------- drivers/net/igb/igb_main.c | 3 +-- 6 files changed, 27 insertions(+), 29 deletions(-)
drivers/net/igb/e1000_82575.c +4 -4
@@ -1429,10 +1429,10 @@ static struct e1000_phy_operations e1000_phy_ops_82575 = { };static struct e1000_nvm_operations e1000_nvm_ops_82575 = { - .acquire_nvm = igb_acquire_nvm_82575, - .read_nvm = igb_read_nvm_eerd, - .release_nvm = igb_release_nvm_82575, - .write_nvm = igb_write_nvm_spi, + .acquire = igb_acquire_nvm_82575, + .read = igb_read_nvm_eerd, + .release = igb_release_nvm_82575, + .write = igb_write_nvm_spi, };const struct e1000_info e1000_82575_info = {
drivers/net/igb/e1000_hw.h +4 -4
@@ -437,10 +437,10 @@ struct e1000_phy_operations { };struct e1000_nvm_operations { -s32 (*acquire_nvm)(struct e1000_hw *); -s32 (*read_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); -void (*release_nvm)(struct e1000_hw *); -s32 (*write_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); +s32 (*acquire)(struct e1000_hw *); +s32 (*read)(struct e1000_hw *,u16 ,u16 ,u16 *); +void (*release)(struct e1000_hw *); +s32 (*write)(struct e1000_hw *,u16 ,u16 ,u16 *); };struct e1000_info {
drivers/net/igb/e1000_mac.c +4 -5
@@ -135,7 +135,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)u16 offset, nvm_alt_mac_addr_offset, nvm_data;u8 alt_mac_addr[ETH_ALEN ]; - ret_val = hw->nvm.ops.read_nvm (hw,NVM_ALT_MAC_ADDR_PTR ,1 , + ret_val = hw->nvm.ops.read (hw,NVM_ALT_MAC_ADDR_PTR ,1 , &nvm_alt_mac_addr_offset);if (ret_val) {hw_dbg ("NVM Read Error\n" );
@@ -152,7 +152,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)for (i =0 ; i <ETH_ALEN ; i +=2 ) { offset = nvm_alt_mac_addr_offset + (i >>1 ); - ret_val = hw->nvm.ops.read_nvm (hw, offset,1 , &nvm_data); + ret_val = hw->nvm.ops.read (hw, offset,1 , &nvm_data);if (ret_val) {hw_dbg ("NVM Read Error\n" ); goto out;
@@ -575,8 +575,7 @@ static s32 igb_set_default_fc(struct e1000_hw *hw)* control setting, then the variable hw->fc will * be initialized based on a value in the EEPROM. */ - ret_val = hw->nvm.ops.read_nvm (hw,NVM_INIT_CONTROL2_REG ,1 , - &nvm_data); + ret_val = hw->nvm.ops.read (hw,NVM_INIT_CONTROL2_REG ,1 , &nvm_data);if (ret_val) {hw_dbg ("NVM Read Error\n" );
@@ -1028,7 +1027,7 @@ static s32 igb_valid_led_default(struct e1000_hw *hw, u16 *data) {s32 ret_val; - ret_val = hw->nvm.ops.read_nvm (hw,NVM_ID_LED_SETTINGS ,1 , data); + ret_val = hw->nvm.ops.read (hw,NVM_ID_LED_SETTINGS ,1 , data);if (ret_val) {hw_dbg ("NVM Read Error\n" ); goto out;
drivers/net/igb/e1000_nvm.c +7 -7
@@ -419,7 +419,7 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) goto out; } - ret_val = hw->nvm.ops.acquire_nvm (hw); + ret_val = hw->nvm.ops.acquire (hw);if (ret_val) goto out;
@@ -468,7 +468,7 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)msleep (10 ); release: - hw->nvm.ops.release_nvm (hw); + hw->nvm.ops.release (hw); out:return ret_val;
@@ -487,14 +487,14 @@ s32 igb_read_part_num(struct e1000_hw *hw, u32 *part_num)s32 ret_val;u16 nvm_data; - ret_val = hw->nvm.ops.read_nvm (hw,NVM_PBA_OFFSET_0 ,1 , &nvm_data); + ret_val = hw->nvm.ops.read (hw,NVM_PBA_OFFSET_0 ,1 , &nvm_data);if (ret_val) {hw_dbg ("NVM Read Error\n" ); goto out; } *part_num = (u32)(nvm_data <<16 ); - ret_val = hw->nvm.ops.read_nvm (hw,NVM_PBA_OFFSET_1 ,1 , &nvm_data); + ret_val = hw->nvm.ops.read (hw,NVM_PBA_OFFSET_1 ,1 , &nvm_data);if (ret_val) {hw_dbg ("NVM Read Error\n" ); goto out;
@@ -548,7 +548,7 @@ s32 igb_validate_nvm_checksum(struct e1000_hw *hw)u16 i, nvm_data;for (i =0 ; i < (NVM_CHECKSUM_REG +1 ); i++) { - ret_val = hw->nvm.ops.read_nvm (hw, i,1 , &nvm_data); + ret_val = hw->nvm.ops.read (hw, i,1 , &nvm_data);if (ret_val) {hw_dbg ("NVM Read Error\n" ); goto out;
@@ -581,7 +581,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw)u16 i, nvm_data;for (i =0 ; i <NVM_CHECKSUM_REG ; i++) { - ret_val = hw->nvm.ops.read_nvm (hw, i,1 , &nvm_data); + ret_val = hw->nvm.ops.read (hw, i,1 , &nvm_data);if (ret_val) {hw_dbg ("NVM Read Error while updating checksum.\n" ); goto out;
@@ -589,7 +589,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw) checksum += nvm_data; } checksum = (u16 )NVM_SUM - checksum; - ret_val = hw->nvm.ops.write_nvm (hw,NVM_CHECKSUM_REG ,1 , &checksum); + ret_val = hw->nvm.ops.write (hw,NVM_CHECKSUM_REG ,1 , &checksum);if (ret_val)hw_dbg ("NVM Write Error while updating checksum.\n" );
drivers/net/igb/igb_ethtool.c +7 -7
@@ -593,12 +593,12 @@ static int igb_get_eeprom(struct net_device *netdev,return -ENOMEM ;if (hw->nvm.type == e1000_nvm_eeprom_spi) - ret_val = hw->nvm.ops.read_nvm (hw, first_word, + ret_val = hw->nvm.ops.read (hw, first_word, last_word - first_word +1 , eeprom_buff);else {for (i =0 ; i < last_word - first_word +1 ; i++) { - ret_val = hw->nvm.ops.read_nvm (hw, first_word + i,1 , + ret_val = hw->nvm.ops.read (hw, first_word + i,1 , &eeprom_buff[i]);if (ret_val)break ;
@@ -645,14 +645,14 @@ static int igb_set_eeprom(struct net_device *netdev,if (eeprom->offset &1 ) {/* need read/modify/write of first changed EEPROM word */ /* only the second byte of the word is being modified */ - ret_val = hw->nvm.ops.read_nvm (hw, first_word,1 , + ret_val = hw->nvm.ops.read (hw, first_word,1 , &eeprom_buff[0 ]); ptr++; }if (((eeprom->offset + eeprom->len) &1 ) && (ret_val ==0 )) {/* need read/modify/write of last changed EEPROM word */ /* only the first byte of the word is being modified */ - ret_val = hw->nvm.ops.read_nvm (hw, last_word,1 , + ret_val = hw->nvm.ops.read (hw, last_word,1 , &eeprom_buff[last_word - first_word]); }
@@ -665,7 +665,7 @@ static int igb_set_eeprom(struct net_device *netdev,for (i =0 ; i < last_word - first_word +1 ; i++) eeprom_buff[i] =cpu_to_le16 (eeprom_buff[i]); - ret_val = hw->nvm.ops.write_nvm (hw, first_word, + ret_val = hw->nvm.ops.write (hw, first_word, last_word - first_word +1 , eeprom_buff);/* Update the checksum over the first part of the EEPROM if needed
@@ -689,7 +689,7 @@ static void igb_get_drvinfo(struct net_device *netdev,/* EEPROM image version # is reported as firmware version # for * 82575 controllers */ - adapter->hw.nvm.ops.read_nvm (&adapter->hw,5 ,1 , &eeprom_data); + adapter->hw.nvm.ops.read (&adapter->hw,5 ,1 , &eeprom_data); sprintf(firmware_version, "%d.%d-%d", (eeprom_data & 0xF000) >> 12, (eeprom_data & 0x0FF0) >> 4,
@@ -1056,7 +1056,7 @@ static int igb_eeprom_test(struct igb_adapter *adapter, u64 *data) *data =0 ;/* Read and add up the contents of the EEPROM */ for (i =0 ; i < (NVM_CHECKSUM_REG +1 ); i++) { -if ((adapter->hw.nvm.ops.read_nvm (&adapter->hw, i,1 , &temp)) +if ((adapter->hw.nvm.ops.read (&adapter->hw, i,1 , &temp)) <0 ) { *data =1 ;break ;
drivers/net/igb/igb_main.c +1 -2
@@ -1243,8 +1243,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,if (hw->bus.func ==0 || hw->device_id ==E1000_DEV_ID_82575EB_COPPER ) - hw->nvm.ops.read_nvm (hw,NVM_INIT_CONTROL3_PORT_A ,1 , - &eeprom_data); + hw->nvm.ops.read (hw,NVM_INIT_CONTROL3_PORT_A ,1 , &eeprom_data);if (eeprom_data & eeprom_apme_mask) adapter->eeprom_wol |=E1000_WUFC_MAG ;
PATCH 10/26 igb: remove unused rx_hdr_split statistic
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This statistic is not used and so it is safe to remove
---
drivers/net/igb/igb.h | 1 - drivers/net/igb/igb_ethtool.c | 1 - 2 files changed, 0 insertions(+), 2 deletions(-)
drivers/net/igb/igb.h +0 -1
@@ -238,7 +238,6 @@ struct igb_adapter {u64 hw_csum_err;u64 hw_csum_good; -u64 rx_hdr_split;u32 alloc_rx_buff_failed;bool rx_csum;u32 gorc;
drivers/net/igb/igb_ethtool.c +0 -1
@@ -88,7 +88,6 @@ static const struct igb_stats igb_gstrings_stats[] = { { "rx_long_byte_count", IGB_STAT(stats.gorc) }, { "rx_csum_offload_good", IGB_STAT(hw_csum_good) }, { "rx_csum_offload_errors", IGB_STAT(hw_csum_err) }, - { "rx_header_split", IGB_STAT(rx_hdr_split) }, { "alloc_rx_buff_failed", IGB_STAT(alloc_rx_buff_failed) }, { "tx_smbus", IGB_STAT(stats.mgptc) }, { "rx_smbus", IGB_STAT(stats.mgprc) },
PATCH 11/26 igb: update feature flags supported in ethtool
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This driver is currently using HW_CSUM which is not correct. Update this to use the IP_CSUM and IPV6_CSUM flags. In addition consolidate the TSO flag setting.
---
drivers/net/igb/igb_ethtool.c | 16 +++++++--------- drivers/net/igb/igb_main.c | 5 +++-- 2 files changed, 10 insertions(+), 11 deletions(-)
drivers/net/igb/igb_ethtool.c +7 -9
@@ -287,15 +287,15 @@ static int igb_set_rx_csum(struct net_device *netdev, u32 data)static u32 igb_get_tx_csum (struct net_device *netdev) { -return (netdev->features &NETIF_F_HW_CSUM ) !=0 ; +return (netdev->features &NETIF_F_IP_CSUM ) !=0 ; }static int igb_set_tx_csum (struct net_device *netdev,u32 data) {if (data) - netdev->features |=NETIF_F_HW_CSUM ; + netdev->features |= (NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM );else - netdev->features &= ~NETIF_F_HW_CSUM ; + netdev->features &= ~(NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM );return 0 ; }
@@ -304,15 +304,13 @@ static int igb_set_tso(struct net_device *netdev, u32 data) {struct igb_adapter *adapter =netdev_priv (netdev); -if (data) +if (data) { netdev->features |=NETIF_F_TSO ; -else - netdev->features &= ~NETIF_F_TSO ; - -if (data) netdev->features |=NETIF_F_TSO6 ; -else + }else { + netdev->features &= ~NETIF_F_TSO ; netdev->features &= ~NETIF_F_TSO6 ; + }dev_info (&adapter->pdev->dev,"TSO is %s\n" , data ?"Enabled" :"Disabled" );
drivers/net/igb/igb_main.c +3 -2
@@ -1158,11 +1158,12 @@ static int __devinit igb_probe(struct pci_dev *pdev, "PHY reset is blocked due to SOL/IDER session.\n"); netdev->features =NETIF_F_SG | -NETIF_F_HW_CSUM | +NETIF_F_IP_CSUM |NETIF_F_HW_VLAN_TX |NETIF_F_HW_VLAN_RX |NETIF_F_HW_VLAN_FILTER ; + netdev->features |=NETIF_F_IPV6_CSUM ; netdev->features |=NETIF_F_TSO ; netdev->features |=NETIF_F_TSO6 ;
@@ -1172,7 +1173,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, netdev->vlan_features |=NETIF_F_TSO ; netdev->vlan_features |=NETIF_F_TSO6 ; - netdev->vlan_features |=NETIF_F_HW_CSUM ; + netdev->vlan_features |=NETIF_F_IP_CSUM ; netdev->vlan_features |=NETIF_F_SG ;if (pci_using_dac)
PATCH 12/26 igb: update testing done by ethtool
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Most of the code for the testing has pretty much become stale at this point and is need of update. This update just streamlines most of the code, widens the range of interrupt testing.
---
drivers/net/igb/igb_ethtool.c | 87 +++++++++++++++++++++++++++++------------ 1 files changed, 61 insertions(+), 26 deletions(-)
drivers/net/igb/igb_ethtool.c +61 -26
@@ -855,23 +855,26 @@ static struct igb_reg_test reg_test_82576[] = { { E1000_RDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, { E1000_RDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, { E1000_RDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, - { E1000_RDBAL(4), 0x40, 8, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, - { E1000_RDBAH(4), 0x40, 8, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, - { E1000_RDLEN(4), 0x40, 8, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, -/* Enable all four RX queues before testing. */ - { E1000_RXDCTL(0), 0x100, 1, WRITE_NO_TEST, 0, E1000_RXDCTL_QUEUE_ENABLE }, + { E1000_RDBAL(4), 0x40, 12, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, + { E1000_RDBAH(4), 0x40, 12, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, + { E1000_RDLEN(4), 0x40, 12, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, +/* Enable all RX queues before testing. */ + { E1000_RXDCTL(0), 0x100, 4, WRITE_NO_TEST, 0, E1000_RXDCTL_QUEUE_ENABLE }, + { E1000_RXDCTL(4), 0x40, 12, WRITE_NO_TEST, 0, E1000_RXDCTL_QUEUE_ENABLE },/* RDH is read-only for 82576, only test RDT. */ { E1000_RDT(0), 0x100, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, + { E1000_RDT(4), 0x40, 12, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, { E1000_RXDCTL(0), 0x100, 4, WRITE_NO_TEST, 0, 0 }, + { E1000_RXDCTL(4), 0x40, 12, WRITE_NO_TEST, 0, 0 }, { E1000_FCRTH, 0x100, 1, PATTERN_TEST, 0x0000FFF0, 0x0000FFF0 }, { E1000_FCTTV, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, { E1000_TIPG, 0x100, 1, PATTERN_TEST, 0x3FFFFFFF, 0x3FFFFFFF }, { E1000_TDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, { E1000_TDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, { E1000_TDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, - { E1000_TDBAL(4), 0x40, 8, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, - { E1000_TDBAH(4), 0x40, 8, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, - { E1000_TDLEN(4), 0x40, 8, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, + { E1000_TDBAL(4), 0x40, 12, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, + { E1000_TDBAH(4), 0x40, 12, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, + { E1000_TDLEN(4), 0x40, 12, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, { E1000_RCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 }, { E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0x003FFFFB }, { E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0xFFFFFFFF },
@@ -918,12 +921,13 @@ static struct igb_reg_test reg_test_82575[] = {static bool reg_pattern_test (struct igb_adapter *adapter,u64 *data,int reg,u32 mask,u32 write) { +struct e1000_hw *hw = &adapter->hw;u32 pat, val;u32 _test[] = {0x5A5A5A5A ,0xA5A5A5A5 ,0x00000000 ,0xFFFFFFFF };for (pat =0 ; pat <ARRAY_SIZE (_test); pat++) { -writel ((_test[pat] & write), (adapter->hw.hw_addr + reg)); - val =readl (adapter->hw.hw_addr + reg); +wr32 (reg, (_test[pat] & write)); + val =rd32 (reg);if (val != (_test[pat] & write & mask)) { dev_err(&adapter->pdev->dev, "pattern test reg %04X " "failed: got 0x%08X expected 0x%08X\n",
@@ -938,9 +942,10 @@ static bool reg_pattern_test(struct igb_adapter *adapter, u64 *data,static bool reg_set_and_check (struct igb_adapter *adapter,u64 *data,int reg,u32 mask,u32 write) { +struct e1000_hw *hw = &adapter->hw;u32 val; -writel ((write & mask), (adapter->hw.hw_addr + reg)); - val =readl (adapter->hw.hw_addr + reg); +wr32 (reg, write & mask); + val =rd32 (reg);if ((write & mask) != (val & mask)) { dev_err(&adapter->pdev->dev, "set/check reg %04X test failed:" " got 0x%08X expected 0x%08X\n", reg,
@@ -1006,12 +1011,14 @@ static int igb_reg_test(struct igb_adapter *adapter, u64 *data)for (i =0 ; i < test->array_len; i++) {switch (test->test_type) {case PATTERN_TEST : -REG_PATTERN_TEST (test->reg + (i * test->reg_offset), +REG_PATTERN_TEST (test->reg + + (i * test->reg_offset), test->mask, test->write);break ;case SET_READ_TEST : -REG_SET_AND_CHECK (test->reg + (i * test->reg_offset), +REG_SET_AND_CHECK (test->reg + + (i * test->reg_offset), test->mask, test->write);break ;
@@ -1083,16 +1090,17 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data) {struct e1000_hw *hw = &adapter->hw;struct net_device *netdev = adapter->netdev; -u32 mask, i =0 , shared_int = true; +u32 mask, ics_mask, i =0 , shared_int = true;u32 irq = adapter->pdev->irq; *data =0 ;/* Hook up test interrupt handler just for this test */ -if (adapter->msix_entries) { +if (adapter->msix_entries)/* NOTE: we don't test MSI-X interrupts here, yet */ return 0 ; - }else if (adapter->flags &IGB_FLAG_HAS_MSI ) { + +if (adapter->flags &IGB_FLAG_HAS_MSI ) { shared_int = false;if (request_irq (irq, &igb_test_intr,0 , netdev->name, netdev)) { *data =1 ;
@@ -1108,16 +1116,31 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data) }dev_info (&adapter->pdev->dev,"testing %s interrupt\n" , (shared_int ?"shared" :"unshared" )); -/* Disable all the interrupts */ wr32 (E1000_IMC ,0xFFFFFFFF );msleep (10 ); +/* Define all writable bits for ICS */ +switch (hw->mac.type) { +case e1000_82575: + ics_mask =0x37F47EDD ; +break ; +case e1000_82576: + ics_mask =0x77D4FBFD ; +break ; +default : + ics_mask =0x7FFFFFFF ; +break ; + } +/* Test each interrupt */ -for (; i <10 ; i++) { +for (; i <31 ; i++) {/* Interrupt to test */ mask =1 << i; +if (!(mask & ics_mask)) +continue ; +if (!shared_int) {/* Disable the interrupt to be reported in * the cause register and then force the same
@@ -1126,8 +1149,12 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)* test failed. */ adapter->test_icr =0 ; -wr32 (E1000_IMC , ~mask &0x00007FFF ); -wr32 (E1000_ICS , ~mask &0x00007FFF ); + +/* Flush any pending interrupts */ +wr32 (E1000_ICR , ~0 ); + +wr32 (E1000_IMC , mask); +wr32 (E1000_ICS , mask);msleep (10 );if (adapter->test_icr & mask) {
@@ -1143,6 +1170,10 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)* test failed. */ adapter->test_icr =0 ; + +/* Flush any pending interrupts */ +wr32 (E1000_ICR , ~0 ); +wr32 (E1000_IMS , mask);wr32 (E1000_ICS , mask);msleep (10 );
@@ -1160,11 +1191,15 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)* test failed. */ adapter->test_icr =0 ; -wr32 (E1000_IMC , ~mask &0x00007FFF ); -wr32 (E1000_ICS , ~mask &0x00007FFF ); + +/* Flush any pending interrupts */ +wr32 (E1000_ICR , ~0 ); + +wr32 (E1000_IMC , ~mask); +wr32 (E1000_ICS , ~mask);msleep (10 ); -if (adapter->test_icr) { +if (adapter->test_icr & mask) { *data =5 ;break ; }
@@ -1172,7 +1207,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data) }/* Disable all the interrupts */ -wr32 (E1000_IMC ,0xFFFFFFFF ); +wr32 (E1000_IMC , ~0 );msleep (10 );/* Unhook test interrupt handler */
@@ -1450,7 +1485,7 @@ static int igb_setup_loopback_test(struct igb_adapter *adapter)E1000_CTRL_TFCE | E1000_CTRL_LRST); reg |=E1000_CTRL_SLU | -E1000_CTRL_FD ; +E1000_CTRL_FD ;wr32 (E1000_CTRL , reg);/* Unset switch control to serdes energy detect */
PATCH 13/26 igb: add counter for dma out of sync errors
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Add a counter for dma out of sync errors reported via interrupt.
---
drivers/net/igb/e1000_defines.h | 6 +++++- drivers/net/igb/e1000_hw.h | 1 + drivers/net/igb/igb_ethtool.c | 1 + drivers/net/igb/igb_main.c | 19 +++++++++++++++++-- 4 files changed, 24 insertions(+), 3 deletions(-)
drivers/net/igb/e1000_defines.h +5 -1
@@ -413,6 +413,7 @@/* LAN connected device generates an interrupt */ #define E1000_ICR_PHYINT 0x00001000#define E1000_ICR_EPRST 0x00100000/* ME handware reset occurs */ +#define E1000_ICR_DOUTSYNC 0x10000000/* NIC DMA out of sync */ /* Extended Interrupt Cause Read */ #define E1000_EICR_RX_QUEUE0 0x00000001/* Rx Queue 0 Interrupt */
@@ -441,7 +442,8 @@ E1000_IMS_TXDW | \ E1000_IMS_RXDMT0 | \ E1000_IMS_RXSEQ | \ - E1000_IMS_LSC) + E1000_IMS_LSC | \ + E1000_IMS_DOUTSYNC)/* Interrupt Mask Set */ #define E1000_IMS_TXDW E1000_ICR_TXDW/* Transmit desc written back */
@@ -449,6 +451,7 @@#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ/* rx sequence error */ #define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0/* rx desc min. threshold */ #define E1000_IMS_RXT0 E1000_ICR_RXT0/* rx timer intr */ +#define E1000_IMS_DOUTSYNC E1000_ICR_DOUTSYNC/* NIC DMA out of sync */ /* Extended Interrupt Mask Set */ #define E1000_EIMS_TCP_TIMER E1000_EICR_TCP_TIMER/* TCP Timer */
@@ -457,6 +460,7 @@/* Interrupt Cause Set */ #define E1000_ICS_LSC E1000_ICR_LSC/* Link Status Change */ #define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0/* rx desc min. threshold */ +#define E1000_ICS_DOUTSYNC E1000_ICR_DOUTSYNC/* NIC DMA out of sync */ /* Extended Interrupt Cause Set */
drivers/net/igb/e1000_hw.h +1 -0
@@ -359,6 +359,7 @@ struct e1000_hw_stats {u64 lenerrs;u64 scvpc;u64 hrmpc; +u64 doosync; };struct e1000_phy_stats {
drivers/net/igb/igb_ethtool.c +1 -0
@@ -88,6 +88,7 @@ static const struct igb_stats igb_gstrings_stats[] = { { "rx_long_byte_count", IGB_STAT(stats.gorc) }, { "rx_csum_offload_good", IGB_STAT(hw_csum_good) }, { "rx_csum_offload_errors", IGB_STAT(hw_csum_err) }, + { "tx_dma_out_of_sync", IGB_STAT(stats.doosync) }, { "alloc_rx_buff_failed", IGB_STAT(alloc_rx_buff_failed) }, { "tx_smbus", IGB_STAT(stats.mgptc) }, { "rx_smbus", IGB_STAT(stats.mgprc) },
drivers/net/igb/igb_main.c +17 -2
@@ -689,7 +689,7 @@ static void igb_irq_enable(struct igb_adapter *adapter)wr32 (E1000_EIAC , adapter->eims_enable_mask);wr32 (E1000_EIAM , adapter->eims_enable_mask);wr32 (E1000_EIMS , adapter->eims_enable_mask); -wr32 (E1000_IMS ,E1000_IMS_LSC ); +wr32 (E1000_IMS ,E1000_IMS_LSC |E1000_IMS_DOUTSYNC ); }else {wr32 (E1000_IMS ,IMS_ENABLE_MASK );wr32 (E1000_IAM ,IMS_ENABLE_MASK );
@@ -3287,6 +3287,11 @@ static irqreturn_t igb_msix_other(int irq, void *data)u32 icr =rd32 (E1000_ICR );/* reading ICR causes bit 31 of EICR to be cleared */ + +if (icr &E1000_ICR_DOUTSYNC ) { +/* HW is reporting DMA is out of sync */ + adapter->stats.doosync++; + }if (!(icr &E1000_ICR_LSC )) goto no_link_interrupt; hw->mac.get_link_status =1 ;
@@ -3295,7 +3300,7 @@ static irqreturn_t igb_msix_other(int irq, void *data)mod_timer (&adapter->watchdog_timer, jiffies +1 ); no_link_interrupt: -wr32 (E1000_IMS ,E1000_IMS_LSC ); +wr32 (E1000_IMS ,E1000_IMS_LSC |E1000_IMS_DOUTSYNC );wr32 (E1000_EIMS , adapter->eims_other);return IRQ_HANDLED ;
@@ -3499,6 +3504,11 @@ static irqreturn_t igb_intr_msi(int irq, void *data)igb_write_itr (adapter->rx_ring); +if (icr &E1000_ICR_DOUTSYNC ) { +/* HW is reporting DMA is out of sync */ + adapter->stats.doosync++; + } +if (icr & (E1000_ICR_RXSEQ |E1000_ICR_LSC )) { hw->mac.get_link_status =1 ;if (!test_bit (__IGB_DOWN, &adapter->state))
@@ -3534,6 +3544,11 @@ static irqreturn_t igb_intr(int irq, void *data)if (!(icr &E1000_ICR_INT_ASSERTED ))return IRQ_NONE ; +if (icr &E1000_ICR_DOUTSYNC ) { +/* HW is reporting DMA is out of sync */ + adapter->stats.doosync++; + } + eicr =rd32 (E1000_EICR );if (icr & (E1000_ICR_RXSEQ |E1000_ICR_LSC )) {
PATCH 14/26 igb: cleanup igb_netpoll to be more friendly with napi & GRO
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This patch cleans up igb_netpoll so that it is more friendly with both the current napi and newly introduced GRO features.
---
drivers/net/igb/igb.h | 5 ++--- drivers/net/igb/igb_main.c | 37 +++++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 19 deletions(-)
drivers/net/igb/igb.h +2 -3
@@ -280,9 +280,8 @@ struct igb_adapter {#define IGB_FLAG_HAS_MSI (1 << 0)#define IGB_FLAG_MSI_ENABLE (1 << 1)#define IGB_FLAG_DCA_ENABLED (1 << 2) -#define IGB_FLAG_IN_NETPOLL (1 << 3) -#define IGB_FLAG_QUAD_PORT_A (1 << 4) -#define IGB_FLAG_NEED_CTX_IDX (1 << 5) +#define IGB_FLAG_QUAD_PORT_A (1 << 3) +#define IGB_FLAG_NEED_CTX_IDX (1 << 4)enum e1000_state_t { __IGB_TESTING,
drivers/net/igb/igb_main.c +21 -16
@@ -404,7 +404,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)/* Turn on MSI-X capability first, or our settings * won't stick. And it will take days to debug. */ wr32 (E1000_GPIE ,E1000_GPIE_MSIX_MODE | -E1000_GPIE_PBA |E1000_GPIE_EIAME | +E1000_GPIE_PBA |E1000_GPIE_EIAME |E1000_GPIE_NSICR );for (i =0 ; i < adapter->num_tx_queues; i++) {
@@ -1629,7 +1629,7 @@ static int igb_setup_all_tx_resources(struct igb_adapter *adapter)for (i =0 ; i <IGB_MAX_TX_QUEUES ; i++) { r_idx = i % adapter->num_tx_queues; adapter->multi_tx_table[i] = &adapter->tx_ring[r_idx]; - } + }return err; }
@@ -3298,7 +3298,7 @@ static irqreturn_t igb_msix_other(int irq, void *data)/* guard against interrupt when we're going down */ if (!test_bit (__IGB_DOWN, &adapter->state))mod_timer (&adapter->watchdog_timer, jiffies +1 ); - + no_link_interrupt:wr32 (E1000_IMS ,E1000_IMS_LSC |E1000_IMS_DOUTSYNC );wr32 (E1000_EIMS , adapter->eims_other);
@@ -3751,7 +3751,7 @@ static bool igb_clean_tx_irq(struct igb_ring *tx_ring)/** * igb_receive_skb - helper function to handle rx indications -* @ring: pointer to receive ring receving this packet +* @ring: pointer to receive ring receving this packet * @status: descriptor status field as written by hardware * @vlan: descriptor vlan field as written by hardware (no le/be conversion) * @skb: pointer to sk_buff to be indicated to stack
@@ -4378,22 +4378,27 @@ static void igb_shutdown(struct pci_dev *pdev)static void igb_netpoll (struct net_device *netdev) {struct igb_adapter *adapter =netdev_priv (netdev); +struct e1000_hw *hw = &adapter->hw;int i; -int work_done =0 ; -igb_irq_disable (adapter); - adapter->flags |=IGB_FLAG_IN_NETPOLL ; - -for (i =0 ; i < adapter->num_tx_queues; i++) -igb_clean_tx_irq (&adapter->tx_ring[i]); +if (!adapter->msix_entries) { +igb_irq_disable (adapter); +napi_schedule (&adapter->rx_ring[0 ].napi); +return ; + } -for (i =0 ; i < adapter->num_rx_queues; i++) -igb_clean_rx_irq_adv (&adapter->rx_ring[i], - &work_done, - adapter->rx_ring[i].napi.weight); +for (i =0 ; i < adapter->num_tx_queues; i++) { +struct igb_ring *tx_ring = &adapter->tx_ring[i]; +wr32 (E1000_EIMC , tx_ring->eims_value); +igb_clean_tx_irq (tx_ring); +wr32 (E1000_EIMS , tx_ring->eims_value); + } - adapter->flags &= ~IGB_FLAG_IN_NETPOLL ; -igb_irq_enable (adapter); +for (i =0 ; i < adapter->num_rx_queues; i++) { +struct igb_ring *rx_ring = &adapter->rx_ring[i]; +wr32 (E1000_EIMC , rx_ring->eims_value); +napi_schedule (&rx_ring->napi); + } }#endif /* CONFIG_NET_POLL_CONTROLLER */
PATCH 15/26 igb: remove redundant timer updates and cleanup watchdog_task
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
The igb watchdog task is modifying the watchdog timer twice duing a single run. It only needs to be called once to reschedule itself for 2 seconds from the last time it ran.
In addition I removed the allocation of the mac_info structure since it is only called twice and is easier to access via the e1000_hw struct.
---
drivers/net/igb/igb_main.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/igb/igb_main.c +5 -5
@@ -2314,13 +2314,10 @@ static void igb_watchdog_task(struct work_struct *work)struct igb_adapter *adapter =container_of (work, struct igb_adapter, watchdog_task);struct e1000_hw *hw = &adapter->hw; -struct net_device *netdev = adapter->netdev;struct igb_ring *tx_ring = adapter->tx_ring; -struct e1000_mac_info *mac = &adapter->hw.mac;u32 link;u32 eics =0 ; -s32 ret_val;int i; link =igb_has_link (adapter);
@@ -2365,6 +2362,7 @@ static void igb_watchdog_task(struct work_struct *work)netif_carrier_on (netdev);netif_tx_wake_all_queues (netdev); +/* link state has changed, schedule phy info update */ if (!test_bit (__IGB_DOWN, &adapter->state))mod_timer (&adapter->phy_info_timer,round_jiffies (jiffies +2 *HZ ));
@@ -2378,6 +2376,8 @@ static void igb_watchdog_task(struct work_struct *work) netdev->name);netif_carrier_off (netdev);netif_tx_stop_all_queues (netdev); + +/* link state has changed, schedule phy info update */ if (!test_bit (__IGB_DOWN, &adapter->state))mod_timer (&adapter->phy_info_timer,round_jiffies (jiffies +2 *HZ ));
@@ -2387,9 +2387,9 @@ static void igb_watchdog_task(struct work_struct *work) link_up:igb_update_stats (adapter); - mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; + hw->mac.tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; adapter->tpt_old = adapter->stats.tpt; - mac->collision_delta = adapter->stats.colc - adapter->colc_old; + hw->mac.collision_delta = adapter->stats.colc - adapter->colc_old; adapter->colc_old = adapter->stats.colc; adapter->gorc = adapter->stats.gorc - adapter->gorc_old;
PATCH 16/26 igb: rename igb_update_mc_addr_list_82575 to not include the 82575
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
There isn't much point in having the _82575 hanging off the end of this function since there aren't any other version of this function running around within this driver. This also allows for a bit of whitespace cleanup due to a shorter function name.
---
drivers/net/igb/e1000_82575.c | 8 ++++---- drivers/net/igb/e1000_82575.h | 2 +- drivers/net/igb/igb_main.c | 7 +++---- 3 files changed, 8 insertions(+), 9 deletions(-)
drivers/net/igb/e1000_82575.c +4 -4
@@ -787,7 +787,7 @@ static void igb_init_rx_addrs_82575(struct e1000_hw *hw, u16 rar_count) }/** -* igb_update_mc_addr_list_82575 - Update Multicast addresses +* igb_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
@@ -799,9 +799,9 @@ static void igb_init_rx_addrs_82575(struct e1000_hw *hw, u16 rar_count)* 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) +void igb_update_mc_addr_list (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/igb/e1000_82575.h +1 -1
@@ -28,7 +28,7 @@#ifndef _E1000_82575_H_#define _E1000_82575_H_ -void igb_update_mc_addr_list_82575 (struct e1000_hw *,u8 *,u32 ,u32 ,u32 ); +void igb_update_mc_addr_list (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);
drivers/net/igb/igb_main.c +3 -4
@@ -2227,8 +2227,8 @@ static void igb_set_multi(struct net_device *netdev)if (!netdev->mc_count) {/* nothing to program, so clear mc list */ -igb_update_mc_addr_list_82575 (hw,NULL ,0 ,1 , - mac->rar_entry_count); +igb_update_mc_addr_list (hw,NULL ,0 ,1 , + mac->rar_entry_count);return ; }
@@ -2245,8 +2245,7 @@ static void igb_set_multi(struct net_device *netdev)memcpy (mta_list + (i*ETH_ALEN ), mc_ptr->dmi_addr,ETH_ALEN ); mc_ptr = mc_ptr->next; } -igb_update_mc_addr_list_82575 (hw, mta_list, i,1 , - mac->rar_entry_count); +igb_update_mc_addr_list (hw, mta_list, i,1 , mac->rar_entry_count);kfree (mta_list); }
PATCH 17/26 igb: remove unnecessary adapter->hw calls when just hw-> will do.
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
There were several spots in the code making calls to adapter->hw when they could have just been accessing hw-> directly. I cleaned up the spots where this was visibly apparent.
---
drivers/net/igb/igb_main.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)
drivers/net/igb/igb_main.c +10 -11
@@ -1096,8 +1096,8 @@ static int __devinit igb_probe(struct pci_dev *pdev, mmio_len =pci_resource_len (pdev,0 ); err = -EIO ; - adapter->hw.hw_addr =ioremap (mmio_start, mmio_len); -if (!adapter->hw.hw_addr) + hw->hw_addr =ioremap (mmio_start, mmio_len); +if (!hw->hw_addr) goto err_ioremap; netdev->netdev_ops = &igb_netdev_ops;
@@ -1357,9 +1357,7 @@ 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_IGB_DCA struct e1000_hw *hw = &adapter->hw; -#endif int err;/* flush_scheduled work may reschedule our watchdog task, so
@@ -1392,9 +1390,9 @@ static void __devexit igb_remove(struct pci_dev *pdev)igb_free_queues (adapter); -iounmap (adapter->hw.hw_addr); -if (adapter->hw.flash_address) -iounmap (adapter->hw.flash_address); +iounmap (hw->hw_addr); +if (hw->flash_address) +iounmap (hw->flash_address);pci_release_selected_regions (pdev,pci_select_bars (pdev,IORESOURCE_MEM ));
@@ -1784,7 +1782,7 @@ static void igb_setup_rctl(struct igb_adapter *adapter) rctl &= ~(E1000_RCTL_LBM_TCVR |E1000_RCTL_LBM_MAC ); rctl |=E1000_RCTL_EN |E1000_RCTL_BAM |E1000_RCTL_RDMTS_HALF | - (adapter->hw.mac.mc_filter_type <<E1000_RCTL_MO_SHIFT ); + (hw->mac.mc_filter_type <<E1000_RCTL_MO_SHIFT );/* * enable stripping of CRC. It's unlikely this will break BMC
@@ -2176,15 +2174,16 @@ static void igb_clean_all_rx_rings(struct igb_adapter *adapter)static int igb_set_mac (struct net_device *netdev,void *p) {struct igb_adapter *adapter =netdev_priv (netdev); +struct e1000_hw *hw = &adapter->hw;struct sockaddr *addr = p;if (!is_valid_ether_addr (addr->sa_data))return -EADDRNOTAVAIL ;memcpy (netdev->dev_addr, addr->sa_data, netdev->addr_len); -memcpy (adapter->hw.mac.addr, addr->sa_data, netdev->addr_len); +memcpy (hw->mac.addr, addr->sa_data, netdev->addr_len); - adapter->hw.mac.ops.rar_set (&adapter->hw, adapter->hw.mac.addr,0 ); + hw->mac.ops.rar_set (hw, hw->mac.addr,0 );return 0 ; }
@@ -4140,7 +4139,7 @@ static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)struct e1000_hw *hw = &adapter->hw;u32 vfta, index; -if ((adapter->hw.mng_cookie.status & +if ((hw->mng_cookie.status &E1000_MNG_DHCP_COOKIE_STATUS_VLAN ) && (vid == adapter->mng_vlan_id))return ;
PATCH 18/26 igb: don't read eicr when responding to legacy interrupts
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
The interrupt handler was reading eicr and then doing nothing with the result. I have removed the variable and the register read since they provide no value to the legacy interrupt handler.
---
drivers/net/igb/igb_main.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/net/igb/igb_main.c +1 -4
@@ -3519,7 +3519,7 @@ static irqreturn_t igb_intr_msi(int irq, void *data) }/** -* igb_intr - Interrupt Handler +* igb_intr - Legacy Interrupt Handler * @irq: interrupt number * @data: pointer to a network interface device structure **/
@@ -3531,7 +3531,6 @@ static irqreturn_t igb_intr(int irq, void *data)/* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No * need for the IMC write */ u32 icr =rd32 (E1000_ICR ); -u32 eicr =0 ;if (!icr)return IRQ_NONE ;/* Not our interrupt */
@@ -3547,8 +3546,6 @@ static irqreturn_t igb_intr(int irq, void *data) adapter->stats.doosync++; } - eicr =rd32 (E1000_EICR ); -if (icr & (E1000_ICR_RXSEQ |E1000_ICR_LSC )) { hw->mac.get_link_status =1 ;/* guard against interrupt when we're going down */
PATCH 19/26 igb: move get_hw_control within igb_resume.
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Move igb_get_hw_control up so that it is called just after the reset in igb_resume. This notifies the HW sooner that the driver is reassuming control of the device.
---
drivers/net/igb/igb_main.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/igb/igb_main.c +5 -4
@@ -4341,6 +4341,11 @@ static int igb_resume(struct pci_dev *pdev)/* e1000_power_up_phy(adapter); */ igb_reset (adapter); + +/* let the f/w know that the h/w is now under the control of the +* driver. */ +igb_get_hw_control (adapter); +wr32 (E1000_WUS , ~0 );if (netif_running (netdev)) {
@@ -4351,10 +4356,6 @@ static int igb_resume(struct pci_dev *pdev)netif_device_attach (netdev); -/* let the f/w know that the h/w is now under the control of the -* driver. */ -igb_get_hw_control (adapter); - return 0; }#endif
PATCH 20/26 igb: change pba size determination from if to switch statement
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
As additional hardware is added to the igb driver it is easier to support the expansion via switch statements instead of using nested ifs. For this reason I am changing this to a switch statement.
---
drivers/net/igb/igb_main.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/igb/igb_main.c +7 -4
@@ -888,11 +888,14 @@ void igb_reset(struct igb_adapter *adapter)/* Repartition Pba for greater than 9k mtu * To take effect CTRL.RST is required. */ -if (mac->type != e1000_82576) { - pba =E1000_PBA_34K ; - } -else { +switch (mac->type) { +case e1000_82576: pba =E1000_PBA_64K ; +break ; +case e1000_82575: +default : + pba =E1000_PBA_34K ; +break ; } if ((adapter->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN) &&
PATCH 21/26 igb: remove disable_av variable from mac_info struct
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
The disable_av variable is never used by the driver and provides no value as it is likely a leftover debugging variable. I have removed it and replaced the one spot that checked for it with a check for a valid address.
---
drivers/net/igb/e1000_hw.h | 1 - drivers/net/igb/e1000_mac.c | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/igb/e1000_hw.h +0 -1
@@ -484,7 +484,6 @@ struct e1000_mac_info {bool asf_firmware_present;bool autoneg;bool autoneg_failed; -bool disable_av;bool disable_hw_init_bits;bool get_link_status;bool ifs_params_forced;
drivers/net/igb/e1000_mac.c +2 -1
@@ -200,7 +200,8 @@ void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) rar_high = ((u32 ) addr[4 ] | ((u32 ) addr[5 ] <<8 )); -if (!hw->mac.disable_av) +/* If MAC address zero, no need to set the AV bit */ +if (rar_low || rar_high) rar_high |=E1000_RAH_AV ;wr32 (E1000_RAL (index), rar_low);
PATCH 22/26 igb: remove redundant count set and err_hw_init
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Remove the setting of ring->count variables from igb_probe as they are duplicating the same configuration that is done igb_alloc_queues.
Remove the err_hw_init tag as it can be replaced by err_sw_init.
---
drivers/net/igb/igb_main.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-)
drivers/net/igb/igb_main.c +4 -11
@@ -1016,7 +1016,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,struct pci_dev *us_dev;const struct e1000_info *ei = igb_info_tbl[ent->driver_data];unsigned long mmio_start, mmio_len; -int i, err, pci_using_dac, pos; +int err, pci_using_dac, pos;u16 eeprom_data =0 , state =0 ;u16 eeprom_apme_mask =IGB_EEPROM_APME ;u32 part_num;
@@ -1128,8 +1128,9 @@ static int __devinit igb_probe(struct pci_dev *pdev,/* Initialize skew-specific constants */ err = ei->get_invariants (hw);if (err) - goto err_hw_init; + goto err_sw_init; +/* setup the private structure */ err =igb_sw_init (adapter);if (err) goto err_sw_init;
@@ -1219,14 +1220,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,INIT_WORK (&adapter->reset_task, igb_reset_task);INIT_WORK (&adapter->watchdog_task, igb_watchdog_task); -/* Initialize link & ring properties that are user-changeable */ - adapter->tx_ring->count =256 ; -for (i =0 ; i < adapter->num_tx_queues; i++) - adapter->tx_ring[i].count = adapter->tx_ring->count; - adapter->rx_ring->count =256 ; -for (i =0 ; i < adapter->num_rx_queues; i++) - adapter->rx_ring[i].count = adapter->rx_ring->count; - +/* Initialize link properties that are user-changeable */ adapter->fc_autoneg = true; hw->mac.autoneg = true; hw->phy.autoneg_advertised =0x2f ;
@@ -1334,7 +1328,6 @@ err_eeprom:igb_free_queues (adapter); err_sw_init: -err_hw_init:iounmap (hw->hw_addr); err_ioremap:free_netdev (netdev);
PATCH 23/26 igb: update stats before doing reset in igb_down
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
It was seen with repeated interface up/down testing that there was a large stray between the stats reported by the queues and the stats reported by the HW. It was found to be an issue in that hw stats were being reset without first being recorded. This change records the stats before wiping them from the system via the reset.
---
drivers/net/igb/igb_main.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/igb/igb_main.c +4 -0
@@ -858,6 +858,10 @@ void igb_down(struct igb_adapter *adapter) netdev->tx_queue_len = adapter->tx_queue_len;netif_carrier_off (netdev); + +/* record the stats before reset*/ +igb_update_stats (adapter); + adapter->link_speed =0 ; adapter->link_duplex =0 ;
PATCH 24/26 igb: fix two minor items found during code review
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This patch addresses two minor items I found while cleaning up the igb driver for our sourceforge version.
The first clears the context index if we don't flag that we need it.
The second item is that eims_other should be used instead of bit defines when setting all of the EICS bits prior to reset.
---
drivers/net/igb/igb_main.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/igb/igb_main.c +4 -2
@@ -2771,6 +2771,8 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,if (adapter->flags &IGB_FLAG_NEED_CTX_IDX ) context_desc->mss_l4len_idx =cpu_to_le32 (tx_ring->queue_index <<4 ); +else + context_desc->mss_l4len_idx =0 ; buffer_info->time_stamp = jiffies; buffer_info->next_to_watch = i;
@@ -3040,8 +3042,8 @@ static void igb_tx_timeout(struct net_device *netdev)/* Do the reset outside of interrupt context */ adapter->tx_timeout_count++;schedule_work (&adapter->reset_task); -wr32 (E1000_EICS , adapter->eims_enable_mask & - ~(E1000_EIMS_TCP_TIMER |E1000_EIMS_OTHER )); +wr32 (E1000_EICS , + (adapter->eims_enable_mask & ~adapter->eims_other)); }static void igb_reset_task (struct work_struct *work)
PATCH 25/26 igb: update version number and copyright dates
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Update the version number to 1.3.16 and update copyright dates for 2009.
---
drivers/net/igb/Makefile | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_82575.h | 2 +- drivers/net/igb/e1000_defines.h | 2 +- drivers/net/igb/e1000_hw.h | 2 +- drivers/net/igb/e1000_mac.c | 2 +- drivers/net/igb/e1000_mac.h | 2 +- drivers/net/igb/e1000_nvm.c | 2 +- drivers/net/igb/e1000_phy.c | 2 +- drivers/net/igb/e1000_phy.h | 2 +- drivers/net/igb/e1000_regs.h | 2 +- drivers/net/igb/igb.h | 2 +- drivers/net/igb/igb_ethtool.c | 2 +- drivers/net/igb/igb_main.c | 6 +++--- 14 files changed, 16 insertions(+), 16 deletions(-)
drivers/net/igb/Makefile +1 -1
@@ -1,7 +1,7 @@ ################################################################################ # # Intel 82575 PCI-Express Ethernet Linux driver -# Copyright(c) 1999 - 2007 Intel Corporation. +# Copyright(c) 1999 - 2009 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/igb/e1000_82575.c +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 - 2008 Intel Corporation. +Copyright(c) 2007-2009 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/igb/e1000_82575.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 - 2008 Intel Corporation. +Copyright(c) 2007-2009 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/igb/e1000_defines.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 - 2008 Intel Corporation. +Copyright(c) 2007-2009 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/igb/e1000_hw.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 Intel Corporation. +Copyright(c) 2007-2009 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/igb/e1000_mac.c +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 Intel Corporation. +Copyright(c) 2007-2009 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/igb/e1000_mac.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 Intel Corporation. +Copyright(c) 2007-2009 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/igb/e1000_nvm.c +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 Intel Corporation. +Copyright(c) 2007-2009 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/igb/e1000_phy.c +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 Intel Corporation. +Copyright(c) 2007-2009 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/igb/e1000_phy.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 Intel Corporation. +Copyright(c) 2007-2009 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/igb/e1000_regs.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 Intel Corporation. +Copyright(c) 2007-2009 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/igb/igb.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 Intel Corporation. +Copyright(c) 2007-2009 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/igb/igb_ethtool.c +1 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 Intel Corporation. +Copyright(c) 2007-2009 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/igb/igb_main.c +3 -3
@@ -1,7 +1,7 @@/******************************************************************************* Intel(R) Gigabit Ethernet Linux driver -Copyright(c) 2007 Intel Corporation. +Copyright(c) 2007-2009 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,
@@ -48,12 +48,12 @@#endif #include "igb.h" -#define DRV_VERSION "1.2.45-k2" +#define DRV_VERSION "1.3.16-k2"char igb_driver_name[] ="igb" ;char igb_driver_version[] =DRV_VERSION ;static const char igb_driver_string[] ="Intel(R) Gigabit Ethernet Network Driver" ; -static const char igb_copyright[] ="Copyright (c) 2008 Intel Corporation." ; +static const char igb_copyright[] ="Copyright (c) 2007-2009 Intel Corporation." ;static const struct e1000_info *igb_info_tbl[] = { [board_82575] = &e1000_82575_info,
PATCH 26/26 igb: remove dead code in transmit routine
In reply to Jeff KirsherFrom: Jesse Brandeburg <[email protected]>
---
drivers/net/igb/igb_main.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/net/igb/igb_main.c +0 -3
@@ -2951,12 +2951,9 @@ static int igb_xmit_frame_ring_adv(struct sk_buff *skb,struct igb_adapter *adapter =netdev_priv (netdev);unsigned int first;unsigned int tx_flags =0 ; -unsigned int len;u8 hdr_len =0 ;int tso =0 ; - len =skb_headlen (skb); -if (test_bit (__IGB_DOWN, &adapter->state)) {dev_kfree_skb_any (skb);return NETDEV_TX_OK ;
David Miller
maintainerFrom: Jeff Kirsher <[email protected]>
Date: Sat, 07 Feb 2009 01:15:04 -0800
Quoted 7 lines
While cleaning up the
skb_overpanic with small frames I found there was room for improvement in the ordering of operations within the rx receive flow. These changes will place the prefetch for the next descriptor to a point earlier in the rx path.Signed-off-by Alexander Duyck <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
"Optomize"? Is that something like labotomize? :-)
Anyways, I fixed up that typo and applied all 26 patches to net-next-2.6
Thanks!