netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] bnx2x: bug fixes patch series
@ 2012-08-09 14:37 Yuval Mintz
  2012-08-09 14:37 ` [PATCH net 1/2] bnx2x: fix unload previous driver flow when flr-capable Yuval Mintz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yuval Mintz @ 2012-08-09 14:37 UTC (permalink / raw)
  To: davem, netdev; +Cc: eilong, Yuval Mintz

Hi Dave,

This series contains fixes for bnx2x's 'unload previous driver' flow
and its recovery flow.

Please consider applying these patches to 'net'.

Thanks,
Yuval Mintz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net 1/2] bnx2x: fix unload previous driver flow when flr-capable
  2012-08-09 14:37 [PATCH net 0/2] bnx2x: bug fixes patch series Yuval Mintz
@ 2012-08-09 14:37 ` Yuval Mintz
  2012-08-09 14:37 ` [PATCH net 2/2] bnx2x: Fix recovery flow cleanup during probe Yuval Mintz
  2012-08-09 23:20 ` [PATCH net 0/2] bnx2x: bug fixes patch series David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Yuval Mintz @ 2012-08-09 14:37 UTC (permalink / raw)
  To: davem, netdev; +Cc: eilong, Yuval Mintz, Ariel Elior

The existing previous driver unload flow is flawed, causing the probe of 
functions reaching the 'uncommon fork' in flr-capable devices to fail.

This patch resolves this, as well as fixing the flow for hypervisors which 
disable flr capabilities from functions as they pass them as PDA to VMs, 
as we cannot base the flow on the pci configuration space.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   55 +++++++++++-----------
 1 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index dd451c3..5384a6d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9384,32 +9384,24 @@ static int __devinit bnx2x_prev_mark_path(struct bnx2x *bp)
 	return rc;
 }
 
-static bool __devinit bnx2x_can_flr(struct bnx2x *bp)
-{
-	int pos;
-	u32 cap;
-	struct pci_dev *dev = bp->pdev;
-
-	pos = pci_pcie_cap(dev);
-	if (!pos)
-		return false;
-
-	pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP, &cap);
-	if (!(cap & PCI_EXP_DEVCAP_FLR))
-		return false;
-
-	return true;
-}
-
 static int __devinit bnx2x_do_flr(struct bnx2x *bp)
 {
 	int i, pos;
 	u16 status;
 	struct pci_dev *dev = bp->pdev;
 
-	/* probe the capability first */
-	if (bnx2x_can_flr(bp))
-		return -ENOTTY;
+
+	if (CHIP_IS_E1x(bp)) {
+		BNX2X_DEV_INFO("FLR not supported in E1/E1H\n");
+		return -EINVAL;
+	}
+
+	/* only bootcode REQ_BC_VER_4_INITIATE_FLR and onwards support flr */
+	if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) {
+		BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n",
+			  bp->common.bc_ver);
+		return -EINVAL;
+	}
 
 	pos = pci_pcie_cap(dev);
 	if (!pos)
@@ -9429,12 +9421,8 @@ static int __devinit bnx2x_do_flr(struct bnx2x *bp)
 		"transaction is not cleared; proceeding with reset anyway\n");
 
 clear:
-	if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) {
-		BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n",
-			  bp->common.bc_ver);
-		return -EINVAL;
-	}
 
+	BNX2X_DEV_INFO("Initiating FLR\n");
 	bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0);
 
 	return 0;
@@ -9454,8 +9442,21 @@ static int __devinit bnx2x_prev_unload_uncommon(struct bnx2x *bp)
 	 * the one required, then FLR will be sufficient to clean any residue
 	 * left by previous driver
 	 */
-	if (bnx2x_test_firmware_version(bp, false) && bnx2x_can_flr(bp))
-		return bnx2x_do_flr(bp);
+	rc = bnx2x_test_firmware_version(bp, false);
+
+	if (!rc) {
+		/* fw version is good */
+		BNX2X_DEV_INFO("FW version matches our own. Attempting FLR\n");
+		rc = bnx2x_do_flr(bp);
+	}
+
+	if (!rc) {
+		/* FLR was performed */
+		BNX2X_DEV_INFO("FLR successful\n");
+		return 0;
+	}
+
+	BNX2X_DEV_INFO("Could not FLR\n");
 
 	/* Close the MCP request, return failure*/
 	rc = bnx2x_prev_mcp_done(bp);
-- 
1.7.9.rc2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net 2/2] bnx2x: Fix recovery flow cleanup during probe
  2012-08-09 14:37 [PATCH net 0/2] bnx2x: bug fixes patch series Yuval Mintz
  2012-08-09 14:37 ` [PATCH net 1/2] bnx2x: fix unload previous driver flow when flr-capable Yuval Mintz
@ 2012-08-09 14:37 ` Yuval Mintz
  2012-08-09 23:20 ` [PATCH net 0/2] bnx2x: bug fixes patch series David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Yuval Mintz @ 2012-08-09 14:37 UTC (permalink / raw)
  To: davem, netdev; +Cc: eilong, Yuval Mintz, Ariel Elior

During probe, every function probed clears the recovery registers from
all functions on its path - thus signaling that given a future recovery
event, there will be no need to wait for those functions.

This is a flawed behaviour - each function should only be responsible
for its own bit.

Since this registers are handled during the load/unload routines,
this cleanup is removed altogether.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   17 -----------------
 1 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 5384a6d..02b5a34 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -4041,20 +4041,6 @@ static bool bnx2x_get_load_status(struct bnx2x *bp, int engine)
 	return val != 0;
 }
 
-/*
- * Reset the load status for the current engine.
- */
-static void bnx2x_clear_load_status(struct bnx2x *bp)
-{
-	u32 val;
-	u32 mask = (BP_PATH(bp) ? BNX2X_PATH1_LOAD_CNT_MASK :
-		    BNX2X_PATH0_LOAD_CNT_MASK);
-	bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_RECOVERY_REG);
-	val = REG_RD(bp, BNX2X_RECOVERY_GLOB_REG);
-	REG_WR(bp, BNX2X_RECOVERY_GLOB_REG, val & (~mask));
-	bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RECOVERY_REG);
-}
-
 static void _print_next_block(int idx, const char *blk)
 {
 	pr_cont("%s%s", idx ? ", " : "", blk);
@@ -11428,9 +11414,6 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
 	if (!chip_is_e1x)
 		REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ, 1);
 
-	/* Reset the load counter */
-	bnx2x_clear_load_status(bp);
-
 	dev->watchdog_timeo = TX_TIMEOUT;
 
 	dev->netdev_ops = &bnx2x_netdev_ops;
-- 
1.7.9.rc2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net 0/2] bnx2x: bug fixes patch series
  2012-08-09 14:37 [PATCH net 0/2] bnx2x: bug fixes patch series Yuval Mintz
  2012-08-09 14:37 ` [PATCH net 1/2] bnx2x: fix unload previous driver flow when flr-capable Yuval Mintz
  2012-08-09 14:37 ` [PATCH net 2/2] bnx2x: Fix recovery flow cleanup during probe Yuval Mintz
@ 2012-08-09 23:20 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-08-09 23:20 UTC (permalink / raw)
  To: yuvalmin; +Cc: netdev, eilong

From: "Yuval Mintz" <yuvalmin@broadcom.com>
Date: Thu, 9 Aug 2012 17:37:24 +0300

> This series contains fixes for bnx2x's 'unload previous driver' flow
> and its recovery flow.
> 
> Please consider applying these patches to 'net'.

Both patches applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-09 23:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-09 14:37 [PATCH net 0/2] bnx2x: bug fixes patch series Yuval Mintz
2012-08-09 14:37 ` [PATCH net 1/2] bnx2x: fix unload previous driver flow when flr-capable Yuval Mintz
2012-08-09 14:37 ` [PATCH net 2/2] bnx2x: Fix recovery flow cleanup during probe Yuval Mintz
2012-08-09 23:20 ` [PATCH net 0/2] bnx2x: bug fixes patch series David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).