Skip to contentSkip to conversation

bnx2x: Enhancement patch series

PATCH In review Yuval Mintz 3 participants 7 messages May 23, 2013 – May 24, 2013

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

v2 cover bnx2x: Enhancement patch series

Hi Dave,

This series contain several small enhancements - chief among those are the implementation of ethtool's private flags callback to share information about the storage offload capabilities of its network interfaces, and the prevention of a link flap when booting from storage area networks.

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

Changes from V1:
- Patch 1, removed trailing whitespaces from private flag strings.

Thanks,
Yuval Mintz

#1 lore raw

PATCH v2 1/4 bnx2x: Add Private Flags Support

Utilize ethtool's callback `get_priv_flags' - shed more light on the feasibility of devices as storage interfaces.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h        |  2 +
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    | 49 ++++++++++++++++++----
 2 files changed, 44 insertions(+), 7 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +2 -0
index 3dba2a7..3f42910 100644
@@ -2137,6 +2137,8 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,
 #define ATTN_HARD_WIRED_MASK		0xff00
 #define ATTENTION_ID			4
 
+#define IS_MF_STORAGE_ONLY(bp) (IS_MF_STORAGE_SD(bp) || \
+				 IS_MF_FCOE_AFEX(bp))
 
 /* stuff added to make the code fit 80Col */
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +42 -7

92 lines not on this page · raw message

Signature · 1 line
1.8.1.227.g44fe835
Acked-by on v2 1/4
#2 lore raw

Re: [PATCH v2 net-next 1/4] bnx2x: Add Private Flags Support

Quoted 7 lines · Yuval Mintz

Utilize ethtool's callback `get_priv_flags' - shed more light on the feasibility of devices as storage interfaces.

[...]

This appears to implement the API correctly.

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#3 lore raw

PATCH v2 2/4 bnx2x: Link-flap avoidance in switch dependent mode

In reply to Yuval Mintz

From: Dmitry Kravkov <[email protected]>

As part of the previous unload flow, probed devices will reset the chip in order to clean the remains of the UNDI driver.
As a result, it's possible for the FW to toggle the link.

This toggling can prove fatal, as long periods without link can cause the filesystem mount to fail as the storage protocol timeouts. This has been observed against particular switches with long link re-establishment time.

This patch informs FW during the reset period that the link should not be toggled - the FW will keep it alive until some interface will load and claim the link as its own.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |  2 ++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  | 10 ++++++++--
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h  |  2 ++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 19 ++++++++++++++++---
 4 files changed, 28 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +2 -0
index 3f42910..946450d 100644
@@ -1937,6 +1937,8 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid,
 void bnx2x_update_coalesce(struct bnx2x *bp);
 int bnx2x_get_cur_phy_idx(struct bnx2x *bp);
 
+bool bnx2x_port_after_undi(struct bnx2x *bp);
+
 static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 			   int wait)
 {
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +8 -2
index b8fbe26..925d205 100644
@@ -2183,6 +2183,8 @@ alloc_mem_err:
 /* send load request to mcp and analyze response */
 static int bnx2x_nic_load_request(struct bnx2x *bp, u32 *load_code)
 {
+	u32 param;
+
 	/* init fw_seq */
 	bp->fw_seq =
 		(SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) &
@@ -2195,9 +2197,13 @@ static int bnx2x_nic_load_request(struct bnx2x *bp, u32 *load_code)
 		 DRV_PULSE_SEQ_MASK);
 	BNX2X_DEV_INFO("drv_pulse 0x%x\n", bp->fw_drv_pulse_wr_seq);
 
+	param = DRV_MSG_CODE_LOAD_REQ_WITH_LFA;
+
+	if (IS_MF_SD(bp) && bnx2x_port_after_undi(bp))
+		param |= DRV_MSG_CODE_LOAD_REQ_FORCE_LFA;
+
 	/* load request */
-	(*load_code) = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ,
-					DRV_MSG_CODE_LOAD_REQ_WITH_LFA);
+	(*load_code) = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ, param);
 
 	/* if mcp fails to respond we must abort */
 	if (!(*load_code)) {
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +2 -0
index 12f00a4..5ef3f96 100644
@@ -1323,6 +1323,8 @@ struct drv_func_mb {
 	#define DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET     0x00000002
 
 	#define DRV_MSG_CODE_LOAD_REQ_WITH_LFA          0x0000100a
+	#define DRV_MSG_CODE_LOAD_REQ_FORCE_LFA         0x00002000
+
 	u32 fw_mb_header;
 	#define FW_MSG_CODE_MASK                        0xffff0000
 	#define FW_MSG_CODE_DRV_LOAD_COMMON             0x10100000
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +16 -3
index b4c9dea..649880d 100644
@@ -9780,6 +9780,21 @@ static bool bnx2x_prev_is_path_marked(struct bnx2x *bp)
 	return rc;
 }
 
+bool bnx2x_port_after_undi(struct bnx2x *bp)
+{
+	struct bnx2x_prev_path_list *entry;
+	bool val;
+
+	down(&bnx2x_prev_sem);
+
+	entry = bnx2x_prev_path_get_entry(bp);
+	val = !!(entry && (entry->undi & (1 << BP_PORT(bp))));
+
+	up(&bnx2x_prev_sem);
+
+	return val;
+}
+
 static int bnx2x_prev_mark_path(struct bnx2x *bp, bool after_undi)
 {
 	struct bnx2x_prev_path_list *tmp_list;
@@ -10036,7 +10051,6 @@ static int bnx2x_prev_unload(struct bnx2x *bp)
 {
 	int time_counter = 10;
 	u32 rc, fw, hw_lock_reg, hw_lock_val;
-	struct bnx2x_prev_path_list *prev_list;
 	BNX2X_DEV_INFO("Entering Previous Unload Flow\n");
 
 	/* clear hw from errors which may have resulted from an interrupted
@@ -10107,8 +10121,7 @@ static int bnx2x_prev_unload(struct bnx2x *bp)
 	}
 
 	/* Mark function if its port was used to boot from SAN */
-	prev_list = bnx2x_prev_path_get_entry(bp);
-	if (prev_list && (prev_list->undi & (1 << BP_PORT(bp))))
+	if (bnx2x_port_after_undi(bp))
 		bp->link_params.feature_config_flags |=
 			FEATURE_CONFIG_BOOT_FROM_SAN;
 
Signature · 1 line
1.8.1.227.g44fe835
#4 lore raw

PATCH v2 3/4 bnx2x: Wait for MCP validity during AER

In reply to Yuval Mintz

During PCIe advanced error recovery, the secondary bus reset will cause FW to reset; This will cause the shared memory between it and the driver to be invalidated.

During the driver's recovery flow, the driver should not make any assumption on the validity of that memory and instead re-initialize it.

This also removes a redundant re-initialization of a previously initialized mutex.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +4 -15
index 649880d..7ed9cdf 100644
@@ -12760,19 +12760,6 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
 	return 0;
 }
 
-static void bnx2x_eeh_recover(struct bnx2x *bp)
-{
-	u32 val;
-
-	mutex_init(&bp->port.phy_mutex);
-
-
-	val = SHMEM_RD(bp, validity_map[BP_PORT(bp)]);
-	if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
-		!= (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
-		BNX2X_ERR("BAD MCP validity signature\n");
-}
-
 /**
  * bnx2x_io_error_detected - called when PCI error is detected
  * @pdev: Pointer to PCI device
@@ -12841,6 +12828,10 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev)
 
 	if (netif_running(dev)) {
 		BNX2X_ERR("IO slot reset --> driver unload\n");
+
+		/* MCP should have been reset; Need to wait for validity */
+		bnx2x_init_shmem(bp);
+
 		if (IS_PF(bp) && SHMEM2_HAS(bp, drv_capabilities_flag)) {
 			u32 v;
 
@@ -12899,8 +12890,6 @@ static void bnx2x_io_resume(struct pci_dev *pdev)
 
 	rtnl_lock();
 
-	bnx2x_eeh_recover(bp);
-
 	bp->fw_seq = SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) &
 							DRV_MSG_SEQ_NUMBER_MASK;
 
Signature · 1 line
1.8.1.227.g44fe835
#5 lore raw

PATCH v2 4/4 bnx2x: Enable `set_phys_id' for all functions

In reply to Yuval Mintz

From: Yaniv Rosner <[email protected]>

In Multi-function mode, all functions should be able to utilize said function; There's no reason why only the link owner should be able to do so.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +0 -5
index da23aea..5bd6b24 100644
@@ -3146,11 +3146,6 @@ static int bnx2x_set_phys_id(struct net_device *dev,
 		return -EAGAIN;
 	}
 
-	if (!bp->port.pmf) {
-		DP(BNX2X_MSG_ETHTOOL, "Interface is not pmf\n");
-		return -EOPNOTSUPP;
-	}
-
 	switch (state) {
 	case ETHTOOL_ID_ACTIVE:
 		return 1;	/* cycle on/off once per second */
Signature · 1 line
1.8.1.227.g44fe835
maintainer
#6 lore raw
In reply to Yuval Mintz

From: "Yuval Mintz" <[email protected]>
Date: Thu, 23 May 2013 10:21:48 +0300

Quoted 9 lines

This series contain several small enhancements - chief among those are the implementation of ethtool's private flags callback to share information about the storage offload capabilities of its network interfaces, and the prevention of a link flap when booting from storage area networks.

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

Changes from V1:
- Patch 1, removed trailing whitespaces from private flag strings.

Series applied, thanks.