aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuval Mintz <yuvalmin@broadcom.com>2012-08-09 00:37:25 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-09 19:19:33 -0400
commit8eee694c3e667e6f0856d9c8525208058f9d42bf (patch)
tree76fa8941849402cb94764ca885c0933420d39861
parent66d1b9263a371abd15806c53f486f0645ef31a8f (diff)
bnx2x: fix unload previous driver flow when flr-capable
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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c55
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 dd451c3dd83d..5384a6dd155f 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)
9384 return rc; 9384 return rc;
9385} 9385}
9386 9386
9387static bool __devinit bnx2x_can_flr(struct bnx2x *bp)
9388{
9389 int pos;
9390 u32 cap;
9391 struct pci_dev *dev = bp->pdev;
9392
9393 pos = pci_pcie_cap(dev);
9394 if (!pos)
9395 return false;
9396
9397 pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP, &cap);
9398 if (!(cap & PCI_EXP_DEVCAP_FLR))
9399 return false;
9400
9401 return true;
9402}
9403
9404static int __devinit bnx2x_do_flr(struct bnx2x *bp) 9387static int __devinit bnx2x_do_flr(struct bnx2x *bp)
9405{ 9388{
9406 int i, pos; 9389 int i, pos;
9407 u16 status; 9390 u16 status;
9408 struct pci_dev *dev = bp->pdev; 9391 struct pci_dev *dev = bp->pdev;
9409 9392
9410 /* probe the capability first */ 9393
9411 if (bnx2x_can_flr(bp)) 9394 if (CHIP_IS_E1x(bp)) {
9412 return -ENOTTY; 9395 BNX2X_DEV_INFO("FLR not supported in E1/E1H\n");
9396 return -EINVAL;
9397 }
9398
9399 /* only bootcode REQ_BC_VER_4_INITIATE_FLR and onwards support flr */
9400 if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) {
9401 BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n",
9402 bp->common.bc_ver);
9403 return -EINVAL;
9404 }
9413 9405
9414 pos = pci_pcie_cap(dev); 9406 pos = pci_pcie_cap(dev);
9415 if (!pos) 9407 if (!pos)
@@ -9429,12 +9421,8 @@ static int __devinit bnx2x_do_flr(struct bnx2x *bp)
9429 "transaction is not cleared; proceeding with reset anyway\n"); 9421 "transaction is not cleared; proceeding with reset anyway\n");
9430 9422
9431clear: 9423clear:
9432 if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) {
9433 BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n",
9434 bp->common.bc_ver);
9435 return -EINVAL;
9436 }
9437 9424
9425 BNX2X_DEV_INFO("Initiating FLR\n");
9438 bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0); 9426 bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0);
9439 9427
9440 return 0; 9428 return 0;
@@ -9454,8 +9442,21 @@ static int __devinit bnx2x_prev_unload_uncommon(struct bnx2x *bp)
9454 * the one required, then FLR will be sufficient to clean any residue 9442 * the one required, then FLR will be sufficient to clean any residue
9455 * left by previous driver 9443 * left by previous driver
9456 */ 9444 */
9457 if (bnx2x_test_firmware_version(bp, false) && bnx2x_can_flr(bp)) 9445 rc = bnx2x_test_firmware_version(bp, false);
9458 return bnx2x_do_flr(bp); 9446
9447 if (!rc) {
9448 /* fw version is good */
9449 BNX2X_DEV_INFO("FW version matches our own. Attempting FLR\n");
9450 rc = bnx2x_do_flr(bp);
9451 }
9452
9453 if (!rc) {
9454 /* FLR was performed */
9455 BNX2X_DEV_INFO("FLR successful\n");
9456 return 0;
9457 }
9458
9459 BNX2X_DEV_INFO("Could not FLR\n");
9459 9460
9460 /* Close the MCP request, return failure*/ 9461 /* Close the MCP request, return failure*/
9461 rc = bnx2x_prev_mcp_done(bp); 9462 rc = bnx2x_prev_mcp_done(bp);