Skip to contentSkip to conversation

bnx2x: enhancements patch series

PATCH In review Yuval Mintz 2 participants 8 messages Sep 28, 2013

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

cover bnx2x: enhancements patch series

Hi Dave,

This patch series contains several modifications to the driver in all areas; It also includes a patch which might be considered as bug fixes but since it fixes a benign issue we're posting it in this series.

Please consider applying these patches to `net-next'.

Thanks,
Yuval Mintz

#1 lore raw

PATCH 1/6 bnx2x: Test nvram when interface is down

Since submit 3fb43eb "bnx2x: Change to D3hot only on removal" nvram is accessible whenever the driver is loaded - Thus it is possible to test it during self-test even if the interface is down

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +10 -9
index 324de5f..120966c 100644
@@ -2900,9 +2900,16 @@ static void bnx2x_self_test(struct net_device *dev,
 
 	memset(buf, 0, sizeof(u64) * BNX2X_NUM_TESTS(bp));
 
+	if (bnx2x_test_nvram(bp) != 0) {
+		if (!IS_MF(bp))
+			buf[4] = 1;
+		else
+			buf[0] = 1;
+		etest->flags |= ETH_TEST_FL_FAILED;
+	}
+
 	if (!netif_running(dev)) {
-		DP(BNX2X_MSG_ETHTOOL,
-		   "Can't perform self-test when interface is down\n");
+		DP(BNX2X_MSG_ETHTOOL, "Interface is down\n");
 		return;
 	}
 
@@ -2964,13 +2971,7 @@ static void bnx2x_self_test(struct net_device *dev,
 		/* wait until link state is restored */
 		bnx2x_wait_for_link(bp, link_up, is_serdes);
 	}
-	if (bnx2x_test_nvram(bp) != 0) {
-		if (!IS_MF(bp))
-			buf[4] = 1;
-		else
-			buf[0] = 1;
-		etest->flags |= ETH_TEST_FL_FAILED;
-	}
+
 	if (bnx2x_test_intr(bp) != 0) {
 		if (!IS_MF(bp))
 			buf[5] = 1;
Signature · 1 line
1.8.1.227.g44fe835
#2 lore raw

PATCH 2/6 bnx2x: Correct VF driver info

In reply to Yuval Mintz

When running ethtool on VF interfaces, returning values should indicate that the interface does not support self-test or register dump.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h         | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 -1
index 97b3d32..a38d049 100644
@@ -2231,7 +2231,7 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,
 #define BNX2X_NUM_TESTS_SF		7
 #define BNX2X_NUM_TESTS_MF		3
 #define BNX2X_NUM_TESTS(bp)		(IS_MF(bp) ? BNX2X_NUM_TESTS_MF : \
-						     BNX2X_NUM_TESTS_SF)
+					     IS_VF(bp) ? 0 : BNX2X_NUM_TESTS_SF)
 
 #define BNX2X_PHY_LOOPBACK		0
 #define BNX2X_MAC_LOOPBACK		1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +3 -0
index 120966c..8213cc8 100644
@@ -639,6 +639,9 @@ static int bnx2x_get_regs_len(struct net_device *dev)
 	struct bnx2x *bp = netdev_priv(dev);
 	int regdump_len = 0;
 
+	if (IS_VF(bp))
+		return 0;
+
 	regdump_len = __bnx2x_get_regs_len(bp);
 	regdump_len *= 4;
 	regdump_len += sizeof(struct dump_header);
Signature · 1 line
1.8.1.227.g44fe835
#3 lore raw

PATCH 3/6 bnx2x: Don't disable/enable SR-IOV when loading

In reply to Yuval Mintz

From: Ariel Elior <[email protected]>

Current bnx2x implementation controls the number of VFs only by standard sysfs support, and will reject setting the number of VFs when the PF is not loaded.
As a result, there is no need to schedule a delayed work to enable SR-IOV when PF is loaded, as the number of VFs at that point must be 0.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c  |  2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 23 -----------------------
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h |  2 --
 3 files changed, 1 insertion(+), 26 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +1 -1
index a6704b5..467689f 100644
@@ -11740,7 +11740,7 @@ static int bnx2x_open(struct net_device *dev)
 	rc = bnx2x_nic_load(bp, LOAD_OPEN);
 	if (rc)
 		return rc;
-	return bnx2x_open_epilog(bp);
+	return 0;
 }
 
 /* called with rtnl_lock */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +0 -23
index 7991f10..03cfee1 100644
@@ -3635,29 +3635,6 @@ alloc_mem_err:
 	return -ENOMEM;
 }
 
-int bnx2x_open_epilog(struct bnx2x *bp)
-{
-	/* Enable sriov via delayed work. This must be done via delayed work
-	 * because it causes the probe of the vf devices to be run, which invoke
-	 * register_netdevice which must have rtnl lock taken. As we are holding
-	 * the lock right now, that could only work if the probe would not take
-	 * the lock. However, as the probe of the vf may be called from other
-	 * contexts as well (such as passthrough to vm fails) it can't assume
-	 * the lock is being held for it. Using delayed work here allows the
-	 * probe code to simply take the lock (i.e. wait for it to be released
-	 * if it is being held). We only want to do this if the number of VFs
-	 * was set before PF driver was loaded.
-	 */
-	if (IS_SRIOV(bp) && BNX2X_NR_VIRTFN(bp)) {
-		smp_mb__before_clear_bit();
-		set_bit(BNX2X_SP_RTNL_ENABLE_SRIOV, &bp->sp_rtnl_state);
-		smp_mb__after_clear_bit();
-		schedule_delayed_work(&bp->sp_rtnl_task, 0);
-	}
-
-	return 0;
-}
-
 void bnx2x_iov_channel_down(struct bnx2x *bp)
 {
 	int vf_idx;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +0 -2
index 059f0d4..1ff6a93 100644
@@ -782,7 +782,6 @@ static inline int bnx2x_vf_headroom(struct bnx2x *bp)
 void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp);
 int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs);
 void bnx2x_iov_channel_down(struct bnx2x *bp);
-int bnx2x_open_epilog(struct bnx2x *bp);
 
 #else /* CONFIG_BNX2X_SRIOV */
 
@@ -842,7 +841,6 @@ static inline int bnx2x_vf_pci_alloc(struct bnx2x *bp) {return 0; }
 static inline void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp) {}
 static inline int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs) {return 0; }
 static inline void bnx2x_iov_channel_down(struct bnx2x *bp) {}
-static inline int bnx2x_open_epilog(struct bnx2x *bp) {return 0; }
 
 #endif /* CONFIG_BNX2X_SRIOV */
 #endif /* bnx2x_sriov.h */
Signature · 1 line
1.8.1.227.g44fe835
#4 lore raw

PATCH 4/6 bnx2x: Change function prototype

In reply to Yuval Mintz

From: Yaniv Rosner <[email protected]>

Change bnx2x_bsc_read function prototype (more of a cosmetic change).

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +2 -3
index d60a2ea..92112e2 100644
@@ -3121,7 +3121,7 @@ static void bnx2x_bsc_module_sel(struct link_params *params)
 }
 
 static int bnx2x_bsc_read(struct link_params *params,
-			  struct bnx2x_phy *phy,
+			  struct bnx2x *bp,
 			  u8 sl_devid,
 			  u16 sl_addr,
 			  u8 lc_addr,
@@ -3130,7 +3130,6 @@ static int bnx2x_bsc_read(struct link_params *params,
 {
 	u32 val, i;
 	int rc = 0;
-	struct bnx2x *bp = params->bp;
 
 	if (xfer_cnt > 16) {
 		DP(NETIF_MSG_LINK, "invalid xfer_cnt %d. Max is 16 bytes\n",
@@ -7886,7 +7885,7 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy,
 			usleep_range(1000, 2000);
 			bnx2x_warpcore_power_module(params, 1);
 		}
-		rc = bnx2x_bsc_read(params, phy, dev_addr, addr32, 0, byte_cnt,
+		rc = bnx2x_bsc_read(params, bp, dev_addr, addr32, 0, byte_cnt,
 				    data_array);
 	} while ((rc != 0) && (++cnt < I2C_WA_RETRY_CNT));
 
Signature · 1 line
1.8.1.227.g44fe835
#5 lore raw

PATCH 5/6 bnx2x: Add support for EXTPHY2 LED mode

In reply to Yuval Mintz

From: Yaniv Rosner <[email protected]>

Add new LED mode for the BCM848xx to support new board type.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h  |  1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 20 +++++++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +1 -0
index 32767f6..cf1df8b 100644
@@ -172,6 +172,7 @@ struct shared_hw_cfg {			 /* NVRAM Offset */
 		#define SHARED_HW_CFG_LED_MAC4                       0x000c0000
 		#define SHARED_HW_CFG_LED_PHY8                       0x000d0000
 		#define SHARED_HW_CFG_LED_EXTPHY1                    0x000e0000
+		#define SHARED_HW_CFG_LED_EXTPHY2                    0x000f0000
 
 
 	#define SHARED_HW_CFG_AN_ENABLE_MASK                0x3f000000
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +17 -3
index 92112e2..c60cf43 100644
@@ -6344,9 +6344,15 @@ int bnx2x_set_led(struct link_params *params,
 			 * intended override.
 			 */
 			break;
-		} else
+		} else {
+			u32 nig_led_mode = ((params->hw_led_mode <<
+					     SHARED_HW_CFG_LED_MODE_SHIFT) ==
+					    SHARED_HW_CFG_LED_EXTPHY2) ?
+				(SHARED_HW_CFG_LED_PHY1 >>
+				 SHARED_HW_CFG_LED_MODE_SHIFT) : hw_led_mode;
 			REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4,
-			       hw_led_mode);
+			       nig_led_mode);
+		}
 
 		REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 + port*4, 0);
 		/* Set blinking rate to ~15.9Hz */
@@ -10608,10 +10614,18 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy,
 					 0x40);
 
 		} else {
+			/* EXTPHY2 LED mode indicate that the 100M/1G/10G LED
+			 * sources are all wired through LED1, rather than only
+			 * 10G in other modes.
+			 */
+			val = ((params->hw_led_mode <<
+				SHARED_HW_CFG_LED_MODE_SHIFT) ==
+			       SHARED_HW_CFG_LED_EXTPHY2) ? 0x98 : 0x80;
+
 			bnx2x_cl45_write(bp, phy,
 					 MDIO_PMA_DEVAD,
 					 MDIO_PMA_REG_8481_LED1_MASK,
-					 0x80);
+					 val);
 
 			/* Tell LED3 to blink on source */
 			bnx2x_cl45_read(bp, phy,
Signature · 1 line
1.8.1.227.g44fe835
#6 lore raw

PATCH 6/6 bnx2x: use pcie_get_minimum_link()

In reply to Yuval Mintz

Use common code for getting the pcie link speed/width for debug printing.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |  6 ----
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 45 +++++++-----------------
 2 files changed, 12 insertions(+), 39 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +0 -6
index a38d049..8fe4bcb 100644
@@ -2491,11 +2491,5 @@ enum {
 
 #define NUM_MACS	8
 
-enum bnx2x_pci_bus_speed {
-	BNX2X_PCI_LINK_SPEED_2500 = 2500,
-	BNX2X_PCI_LINK_SPEED_5000 = 5000,
-	BNX2X_PCI_LINK_SPEED_8000 = 8000
-};
-
 void bnx2x_set_local_cmng(struct bnx2x *bp);
 #endif /* bnx2x.h */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +12 -33

66 lines not on this page · raw message

Signature · 1 line
1.8.1.227.g44fe835
maintainer
#7 lore raw
In reply to Yuval Mintz

From: "Yuval Mintz" <[email protected]>
Date: Sat, 28 Sep 2013 08:46:06 +0300

Quoted 5 lines

This patch series contains several modifications to the driver in all areas; It also includes a patch which might be considered as bug fixes but since it fixes a benign issue we're posting it in this series.

Please consider applying these patches to `net-next'.

Series applied, thanks.