igb: switch to new dca API
Subsystems (2)
PATCH 1/8 igb: switch to new dca API
From: Maciej Sosnowski <[email protected]>
With the new DCA API, the driver should use dca3_get_tag() instead of the obsolete dca_get_tag().
---
drivers/net/igb/igb_main.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/igb/igb_main.c +4 -4
@@ -3648,11 +3648,11 @@ static void igb_update_rx_dca(struct igb_ring *rx_ring) dca_rxctrl =rd32 (E1000_DCA_RXCTRL (q));if (hw->mac.type == e1000_82576) { dca_rxctrl &= ~E1000_DCA_RXCTRL_CPUID_MASK_82576 ; - dca_rxctrl |=dca_get_tag (cpu) << + dca_rxctrl |=dca3_get_tag (&adapter->pdev->dev, cpu) <<E1000_DCA_RXCTRL_CPUID_SHIFT ; }else { dca_rxctrl &= ~E1000_DCA_RXCTRL_CPUID_MASK ; - dca_rxctrl |=dca_get_tag (cpu); + dca_rxctrl |=dca3_get_tag (&adapter->pdev->dev, cpu); } dca_rxctrl |=E1000_DCA_RXCTRL_DESC_DCA_EN ; dca_rxctrl |=E1000_DCA_RXCTRL_HEAD_DCA_EN ;
@@ -3675,11 +3675,11 @@ static void igb_update_tx_dca(struct igb_ring *tx_ring) dca_txctrl =rd32 (E1000_DCA_TXCTRL (q));if (hw->mac.type == e1000_82576) { dca_txctrl &= ~E1000_DCA_TXCTRL_CPUID_MASK_82576 ; - dca_txctrl |=dca_get_tag (cpu) << + dca_txctrl |=dca3_get_tag (&adapter->pdev->dev, cpu) <<E1000_DCA_TXCTRL_CPUID_SHIFT ; }else { dca_txctrl &= ~E1000_DCA_TXCTRL_CPUID_MASK ; - dca_txctrl |=dca_get_tag (cpu); + dca_txctrl |=dca3_get_tag (&adapter->pdev->dev, cpu); } dca_txctrl |=E1000_DCA_TXCTRL_DESC_DCA_EN ;wr32 (E1000_DCA_TXCTRL (q), dca_txctrl);
PATCH 2/8 igb: remove netif running call from igb_poll
From: Alexander Duyck <[email protected]>
The netif_running check in igb poll is a hold over from the use of fake netdevs to use multiple queues with NAPI prior to 2.6.24. It is no longer necessary to have the call there and it currently can cause errors if work_done == budget.
---
drivers/net/igb/igb_main.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/net/igb/igb_main.c +1 -2
@@ -4165,7 +4165,6 @@ static int igb_poll(struct napi_struct *napi, int budget) { struct igb_ring *rx_ring = container_of(napi, struct igb_ring, napi);struct igb_adapter *adapter = rx_ring->adapter; -struct net_device *netdev = adapter->netdev;int work_done =0 ;#ifdef CONFIG_IGB_DCA
@@ -4184,7 +4183,7 @@ static int igb_poll(struct napi_struct *napi, int budget) }/* If not enough Rx work done, exit the polling mode */ -if ((work_done < budget) || !netif_running (netdev)) { +if (work_done < budget) {napi_complete (napi);igb_rx_irq_enable (rx_ring); }
PATCH 3/8 igb: resolve warning of unused adapter struct
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
If DCA is undefined then the adapter struct becomes unnecessary. To resolve this issue the DCA calls can simply make a call to the adapter struct through the rx_ring adapter struct member.
---
drivers/net/igb/igb_main.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/net/igb/igb_main.c +2 -3
@@ -4164,18 +4164,17 @@ static inline void igb_rx_irq_enable(struct igb_ring *rx_ring)static int igb_poll (struct napi_struct *napi,int budget) { struct igb_ring *rx_ring = container_of(napi, struct igb_ring, napi); -struct igb_adapter *adapter = rx_ring->adapter;int work_done =0 ;#ifdef CONFIG_IGB_DCA -if (adapter->flags &IGB_FLAG_DCA_ENABLED ) +if (rx_ring->adapter->flags &IGB_FLAG_DCA_ENABLED )igb_update_rx_dca (rx_ring);#endif igb_clean_rx_irq_adv (rx_ring, &work_done, budget);if (rx_ring->buddy) {#ifdef CONFIG_IGB_DCA -if (adapter->flags &IGB_FLAG_DCA_ENABLED ) +if (rx_ring->adapter->flags &IGB_FLAG_DCA_ENABLED )igb_update_tx_dca (rx_ring->buddy);#endif if (!igb_clean_tx_irq (rx_ring->buddy))
PATCH 4/8 igb: support wol on second port
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
We need to support wol on the second port for situations such as when the lan ports are on the motherboard itself.
---
drivers/net/igb/e1000_defines.h | 1 + drivers/net/igb/igb_main.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/igb/e1000_defines.h +1 -0
@@ -512,6 +512,7 @@#define NVM_ID_LED_SETTINGS 0x0004/* For SERDES output amplitude adjustment. */ #define NVM_INIT_CONTROL2_REG 0x000F +#define NVM_INIT_CONTROL3_PORT_B 0x0014#define NVM_INIT_CONTROL3_PORT_A 0x0024#define NVM_ALT_MAC_ADDR_PTR 0x0037#define NVM_CHECKSUM_REG 0x003F
drivers/net/igb/igb_main.c +3 -2
@@ -1329,9 +1329,10 @@ static int __devinit igb_probe(struct pci_dev *pdev,* enable the ACPI Magic Packet filter */ -if (hw->bus.func ==0 || - hw->device_id ==E1000_DEV_ID_82575EB_COPPER ) +if (hw->bus.func ==0 ) hw->nvm.ops.read (hw,NVM_INIT_CONTROL3_PORT_A ,1 , &eeprom_data); +else if (hw->bus.func ==1 ) + hw->nvm.ops.read (hw,NVM_INIT_CONTROL3_PORT_B ,1 , &eeprom_data);if (eeprom_data & eeprom_apme_mask) adapter->eeprom_wol |=E1000_WUFC_MAG ;
PATCH 5/8 igb: add PF to pool
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Add Pf to pool if adding a VLVF register value and the VFTA bit is already set.
This patch addresses the unlikely situation that the PF adds a vlan entry when the vlvf is full, and a vf later adds the vlan to the vlvf.
---
drivers/net/igb/e1000_mac.c | 21 ++++++++++++++------- drivers/net/igb/e1000_mac.h | 2 +- drivers/net/igb/igb_main.c | 9 +++++++-- 3 files changed, 22 insertions(+), 10 deletions(-)
drivers/net/igb/e1000_mac.c +14 -7
@@ -126,19 +126,26 @@ void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)* Sets or clears a bit in the VLAN filter table array based on VLAN id * and if we are adding or removing the filter **/ -void igb_vfta_set (struct e1000_hw *hw,u32 vid,bool add) +s32 igb_vfta_set (struct e1000_hw *hw,u32 vid,bool add) {u32 index = (vid >>E1000_VFTA_ENTRY_SHIFT ) &E1000_VFTA_ENTRY_MASK ;u32 mask =1 < (vid &E1000_VFTA_ENTRY_BIT_SHIFT_MASK ); -u32 vfta; +u32 vfta =array_rd32 (E1000_VFTA , index); +s32 ret_val =0 ; - vfta =array_rd32 (E1000_VFTA , index); -if (add) - vfta |= mask; -else - vfta &= ~mask; +/* bit was set/cleared before we started */ +if ((!!(vfta & mask)) == add) { + ret_val = -E1000_ERR_CONFIG ; + }else { +if (add) + vfta |= mask; +else + vfta &= ~mask; + }igb_write_vfta (hw, index, vfta); + +return ret_val; }/**
drivers/net/igb/e1000_mac.h +1 -1
@@ -58,7 +58,7 @@ s32 igb_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg,void igb_clear_hw_cntrs_base (struct e1000_hw *hw);void igb_clear_vfta (struct e1000_hw *hw); -void igb_vfta_set (struct e1000_hw *hw,u32 vid,bool add); +s32 igb_vfta_set (struct e1000_hw *hw,u32 vid,bool add);void igb_config_collision_dist (struct e1000_hw *hw);void igb_mta_set (struct e1000_hw *hw,u32 hash_value);void igb_put_hw_semaphore (struct e1000_hw *hw);
drivers/net/igb/igb_main.c +7 -2
@@ -3873,10 +3873,15 @@ static s32 igb_vlvf_set(struct igb_adapter *adapter, u32 vid, bool add, u32 vf)/* if !enabled we need to set this up in vfta */ if (!(reg &E1000_VLVF_VLANID_ENABLE )) { -/* add VID to filter table */ -igb_vfta_set (hw, vid, true); +/* add VID to filter table, if bit already set +* PF must have added it outside of table */ +if (igb_vfta_set (hw, vid, true)) + reg |=1 << (E1000_VLVF_POOLSEL_SHIFT + + adapter->vfs_allocated_count); reg |=E1000_VLVF_VLANID_ENABLE ; } + reg &= ~E1000_VLVF_VLANID_MASK ; + reg |= vid;wr32 (E1000_VLVF (i), reg);return 0 ;
PATCH 6/8 igb: correct typo that was setting vfta mask to 1
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
This patch corrects a typo that was doing a less than comparison instead of a left shift due to the fact that I didn't get enough <'s in there.
This resolves an issue in which vlans were not functioning correctly.
---
drivers/net/igb/e1000_mac.c | 2 +- drivers/net/igb/igb_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/igb/e1000_mac.c +1 -1
@@ -129,7 +129,7 @@ void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)s32 igb_vfta_set (struct e1000_hw *hw,u32 vid,bool add) {u32 index = (vid >>E1000_VFTA_ENTRY_SHIFT ) &E1000_VFTA_ENTRY_MASK ; -u32 mask =1 < (vid &E1000_VFTA_ENTRY_BIT_SHIFT_MASK ); +u32 mask =1 << (vid &E1000_VFTA_ENTRY_BIT_SHIFT_MASK );u32 vfta =array_rd32 (E1000_VFTA , index);s32 ret_val =0 ;
drivers/net/igb/igb_main.c +1 -1
@@ -3806,7 +3806,7 @@ static void igb_restore_vf_multicasts(struct igb_adapter *adapter)for (i =0 ; i < adapter->vfs_allocated_count; i++) { vf_data = &adapter->vf_data[i]; -for (j =0 ; j < vf_data[i].num_vf_mc_hashes; j++) +for (j =0 ; j < vf_data->num_vf_mc_hashes; j++)igb_mta_set (hw, vf_data->vf_mc_hashes[j]); } }
PATCH 7/8 igb: add support for another dual port 82576 non-security nic
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Adding device id to support 82576NS dual port copper NIC.
---
drivers/net/igb/e1000_82575.c | 1 + drivers/net/igb/e1000_hw.h | 1 + drivers/net/igb/igb_main.c | 1 + 3 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/igb/e1000_82575.c +1 -0
@@ -80,6 +80,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) mac->type = e1000_82575;break ;case E1000_DEV_ID_82576 : +case E1000_DEV_ID_82576_NS :case E1000_DEV_ID_82576_FIBER :case E1000_DEV_ID_82576_SERDES : mac->type = e1000_82576;
drivers/net/igb/e1000_hw.h +1 -0
@@ -40,6 +40,7 @@ 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_NS 0x150A#define E1000_DEV_ID_82575EB_COPPER 0x10A7#define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9#define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6
drivers/net/igb/igb_main.c +1 -0
@@ -62,6 +62,7 @@ static const struct e1000_info *igb_info_tbl[] = {static struct pci_device_id igb_pci_tbl[] = { {PCI_VDEVICE (INTEL ,E1000_DEV_ID_82576 ), board_82575 }, + {PCI_VDEVICE (INTEL ,E1000_DEV_ID_82576_NS ), board_82575 }, {PCI_VDEVICE (INTEL ,E1000_DEV_ID_82576_FIBER ), board_82575 }, {PCI_VDEVICE (INTEL ,E1000_DEV_ID_82576_SERDES ), board_82575 }, {PCI_VDEVICE (INTEL ,E1000_DEV_ID_82575EB_COPPER ), board_82575 },
PATCH 8/8 igb: add support for 82576 quad copper adapter
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
Add support for 82576 copper adapter and necessary code to restrict wol for quad port adapter to first port.
---
drivers/net/igb/e1000_82575.c | 1 + drivers/net/igb/e1000_hw.h | 1 + drivers/net/igb/igb_ethtool.c | 9 +++++++++ drivers/net/igb/igb_main.c | 11 +++++++++++ 4 files changed, 22 insertions(+), 0 deletions(-)
drivers/net/igb/e1000_82575.c +1 -0
@@ -83,6 +83,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)case E1000_DEV_ID_82576_NS :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 :
drivers/net/igb/e1000_hw.h +1 -0
@@ -40,6 +40,7 @@ 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_82576_NS 0x150A#define E1000_DEV_ID_82575EB_COPPER 0x10A7#define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9
drivers/net/igb/igb_ethtool.c +9 -0
@@ -1779,6 +1779,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 +11 -0
@@ -65,6 +65,7 @@ static struct pci_device_id igb_pci_tbl[] = { { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_NS), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_FIBER), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES), board_82575 }, + { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_QUAD_COPPER), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_COPPER), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_FIBER_SERDES), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575GB_QUAD_COPPER), board_82575 },
@@ -1353,6 +1354,16 @@ static int __devinit igb_probe(struct pci_dev *pdev,if (rd32 (E1000_STATUS ) &E1000_STATUS_FUNC_1 ) adapter->eeprom_wol =0 ;break ; +case E1000_DEV_ID_82576_QUAD_COPPER : +/* if quad port adapter, disable WoL on all but port A */ +if (global_quad_port_a !=0 ) + adapter->eeprom_wol =0 ; +else + adapter->flags |=IGB_FLAG_QUAD_PORT_A ; +/* Reset for multiple quad port adapters */ +if (++global_quad_port_a ==4 ) + global_quad_port_a =0 ; +break ; }/* initialize the wol settings based on the eeprom settings */
David Miller
maintainerAll 8 patches applied.