Skip to contentSkip to conversation

igb: fix PHY config access on 82580

PATCH Applied Jeff Kirsher 2 participants 10 messages Jul 1, 2010 – Jul 2, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
index 86438b5..06251a9 100644
@@ -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
index 24d9be6..90bc29d 100644
@@ -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 */
#1 lore raw

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
index 3881918..e79689e 100644
@@ -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;
maintainer Applied
#2 lore raw

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

Applied.

#3 lore raw

PATCH 3/5 igb: Fix Tx hangs seen when loading igb with max_vfs > 7.

In reply to Jeff Kirsher

From: 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
index e79689e..d811462 100644
@@ -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());
maintainer Applied
#4 lore raw

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_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.

Applied.

#5 lore raw

PATCH 4/5 igb: correct link test not being run when link is down

In reply to Jeff Kirsher

From: 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
index f2ebf92..26bf6a1 100644
@@ -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;
maintainer Applied
#6 lore raw

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_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.

Applied.

#7 lore raw

PATCH 5/5 igb: Add comment

In reply to Jeff Kirsher

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.

---

 drivers/net/igb/igb_main.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/igb/igb_main.c +4 -0
index d811462..9cb04e2 100644
@@ -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;
 
maintainer Applied
#8 lore raw

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.

Applied.