igb: fix PHY config access on 82580
Subsystems (2)
PATCH 1/5 igb: fix PHY config access on 82580
From: Nick Nunley <[email protected]>
82580 NICs can have up to 4 functions. This fixes phy accesses to use the correct locks for functions 2 and 3.
---
drivers/net/igb/e1000_82575.c | 8 ++++++++ drivers/net/igb/e1000_defines.h | 2 ++ 2 files changed, 10 insertions(+), 0 deletions(-)
drivers/net/igb/e1000_82575.c +8 -0
@@ -295,6 +295,10 @@ static s32 igb_acquire_phy_82575(struct e1000_hw *hw)if (hw->bus.func ==E1000_FUNC_1 ) mask =E1000_SWFW_PHY1_SM ; +else if (hw->bus.func ==E1000_FUNC_2 ) + mask =E1000_SWFW_PHY2_SM ; +else if (hw->bus.func ==E1000_FUNC_3 ) + mask =E1000_SWFW_PHY3_SM ;return igb_acquire_swfw_sync_82575 (hw, mask); }
@@ -312,6 +316,10 @@ static void igb_release_phy_82575(struct e1000_hw *hw)if (hw->bus.func ==E1000_FUNC_1 ) mask =E1000_SWFW_PHY1_SM ; +else if (hw->bus.func ==E1000_FUNC_2 ) + mask =E1000_SWFW_PHY2_SM ; +else if (hw->bus.func ==E1000_FUNC_3 ) + mask =E1000_SWFW_PHY3_SM ;igb_release_swfw_sync_82575 (hw, mask); }
drivers/net/igb/e1000_defines.h +2 -0
@@ -164,6 +164,8 @@#define E1000_SWFW_EEP_SM 0x1#define E1000_SWFW_PHY0_SM 0x2#define E1000_SWFW_PHY1_SM 0x4 +#define E1000_SWFW_PHY2_SM 0x20 +#define E1000_SWFW_PHY3_SM 0x40/* FACTPS Definitions */ /* Device Control */
PATCH 2/5 igb: Use only a single Tx queue in SR-IOV mode
From: Greg Rose <[email protected]>
The 82576 expects the second rx queue in any pool to receive L2 switch loop back packets sent from the second tx queue in another pool. The 82576 VF driver does not enable the second rx queue so if the PF driver sends packets destined to a VF from its second tx queue then the VF driver will never see them. In SR-IOV mode limit the number of tx queues used by the PF driver to one. This patch fixes a bug reported in which the PF cannot communciate with the VF and should be considered for 2.6.34 stable.
---
drivers/net/igb/igb_main.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/igb/igb_main.c +4 -4
@@ -630,9 +630,6 @@ static void igb_cache_ring_register(struct igb_adapter *adapter)for (; i < adapter->rss_queues; i++) adapter->rx_ring[i]->reg_idx = rbase_offset +Q_IDX_82576 (i); -for (; j < adapter->rss_queues; j++) - adapter->tx_ring[j]->reg_idx = rbase_offset + -Q_IDX_82576 (j); }case e1000_82575:case e1000_82580:
@@ -996,7 +993,10 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter)/* Number of supported queues. */ adapter->num_rx_queues = adapter->rss_queues; - adapter->num_tx_queues = adapter->rss_queues; +if (adapter->vfs_allocated_count) + adapter->num_tx_queues =1 ; +else + adapter->num_tx_queues = adapter->rss_queues;/* start with one vector for every rx queue */ numvecs = adapter->num_rx_queues;
Re: [net-next-2.6 PATCH 2/5] igb: Use only a single Tx queue in SR-IOV mode
From: Jeff Kirsher <[email protected]>
Date: Thu, 01 Jul 2010 16:38:16 -0700
Quoted 11 lines
From: Greg Rose <[email protected]>
The 82576 expects the second rx queue in any pool to receive L2 switch loop back packets sent from the second tx queue in another pool. The 82576 VF driver does not enable the second rx queue so if the PF driver sends packets destined to a VF from its second tx queue then the VF driver will never see them. In SR-IOV mode limit the number of tx queues used by the PF driver to one. This patch fixes a bug reported in which the PF cannot communciate with the VF and should be considered for 2.6.34 stable.
Quoted 4 lines
Signed-off-by Greg Rose <[email protected]>Tested-by Jeff Pieper <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 3/5 igb: Fix Tx hangs seen when loading igb with max_vfs > 7.
In reply to Jeff KirsherFrom: Emil Tantilov <[email protected]>
Check the value of max_vfs at the time of assignment of vfs_allocated_count.
The previous check in igb_probe_vfs was too late as by that time the rx/tx rings were initialized with the wrong offset.
---
drivers/net/igb/igb_main.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/net/igb/igb_main.c +1 -4
@@ -2091,9 +2091,6 @@ static void __devinit igb_probe_vfs(struct igb_adapter * adapter)#ifdef CONFIG_PCI_IOV struct pci_dev *pdev = adapter->pdev; -if (adapter->vfs_allocated_count >7 ) - adapter->vfs_allocated_count =7 ; -if (adapter->vfs_allocated_count) { adapter->vf_data = kcalloc(adapter->vfs_allocated_count, sizeof(struct vf_data_storage),
@@ -2258,7 +2255,7 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)#ifdef CONFIG_PCI_IOV if (hw->mac.type == e1000_82576) - adapter->vfs_allocated_count = max_vfs; + adapter->vfs_allocated_count = (max_vfs >7 ) ?7 : max_vfs;#endif /* CONFIG_PCI_IOV */ adapter->rss_queues =min_t (u32,IGB_MAX_RX_QUEUES ,num_online_cpus ());
Re: [net-next-2.6 PATCH 3/5] igb: Fix Tx hangs seen when loading igb with max_vfs > 7.
From: Jeff Kirsher <[email protected]>
Date: Thu, 01 Jul 2010 16:38:40 -0700
Quoted 10 lines
From: Emil Tantilov <[email protected]>
Check the value of
max_vfsat the time of assignment ofvfs_allocated_count.The previous check in
igb_probe_vfswas too late as by that time the rx/tx rings were initialized with the wrong offset.Signed-off-by Emil Tantilov <[email protected]>Tested-by Jeff Pieper <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 4/5 igb: correct link test not being run when link is down
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
The igb online link test was always reporting pass because instead of checking for if_running it was checking for netif_carrier_ok.
This change corrects the test so that it is run if the interface is running instead of checking for netif carrier ok.
---
drivers/net/igb/igb_ethtool.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/net/igb/igb_ethtool.c +3 -5
@@ -1823,12 +1823,10 @@ static void igb_diag_test(struct net_device *netdev,dev_info (&adapter->pdev->dev,"online testing starting\n" );/* PHY is powered down when interface is down */ -if (!netif_carrier_ok (netdev)) { +if (if_running &&igb_link_test (adapter, &data[4 ])) + eth_test->flags |=ETH_TEST_FL_FAILED ; +else data[4 ] =0 ; - }else { -if (igb_link_test (adapter, &data[4 ])) - eth_test->flags |=ETH_TEST_FL_FAILED ; - }/* Online tests aren't run; pass by default */ data[0 ] =0 ;
Re: [net-next-2.6 PATCH 4/5] igb: correct link test not being run when link is down
From: Jeff Kirsher <[email protected]>
Date: Thu, 01 Jul 2010 16:39:01 -0700
Quoted 11 lines
From: Alexander Duyck <[email protected]>
The igb online link test was always reporting pass because instead of checking for
if_runningit was checking fornetif_carrier_ok.This change corrects the test so that it is run if the interface is running instead of checking for netif carrier ok.
Signed-off-by Alexander Duyck <[email protected]>Tested-by Emil Tantilov <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 5/5 igb: Add comment
In reply to Jeff KirsherFrom: Greg Rose <[email protected]>
Add explanatory comment to avoid confusion when a pointer is set to the second word of an array instead of the customary cast of a pointer to the beginning of the array.
---
drivers/net/igb/igb_main.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/igb/igb_main.c +4 -0
@@ -4974,6 +4974,10 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf)static int igb_set_vf_mac_addr (struct igb_adapter *adapter,u32 *msg,int vf) { +/* +* The VF MAC Address is stored in a packed array of bytes +* starting at the second 32 bit word of the msg array +*/ unsigned char *addr = (char *)&msg[1 ];int err =-1 ;
Re: [net-next-2.6 PATCH 5/5] igb: Add comment
From: Jeff Kirsher <[email protected]>
Date: Thu, 01 Jul 2010 16:39:23 -0700
Quoted 8 lines
From: Greg Rose <[email protected]>
Add explanatory comment to avoid confusion when a pointer is set to the second word of an array instead of the customary cast of a pointer to the beginning of the array.
Signed-off-by Greg Rose <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
From: Jeff Kirsher <[email protected]>
Date: Thu, 01 Jul 2010 16:37:54 -0700
Quoted 8 lines
From: Nick Nunley <[email protected]>
82580 NICs can have up to 4 functions. This fixes phy accesses to use the correct locks for functions 2 and 3.
Signed-off-by Nicholas Nunley <[email protected]>Tested-by Jeff Pieper <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.