bnx2x: Wait for MCP validity during AER
authorYuval Mintz <yuvalmin@broadcom.com>
Wed, 22 May 2013 21:21:51 +0000 (21:21 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 May 2013 01:49:30 +0000 (18:49 -0700)
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.

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>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

index 649880d2bb1b74d0b02ae33848c917e651c68cca..7ed9cdfa115ee10c1d4817e064e5acf680eecd55 100644 (file)
@@ -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;