aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEilon Greenstein <eilong@broadcom.com>2009-10-15 03:18:27 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-15 03:18:27 -0400
commitc4ff7cbf88be8bb0e3f942089f0ef0a40d98d654 (patch)
treef0117805606dbf9acb4bc9488975a380a63751cc /drivers
parentf34d28ea0174df63253dc20a95de0b48e3d8145a (diff)
bnx2x: Adding FW mailbox mutex
DCC commands are not protected with the RTNL lock, so a mutex should be added Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/bnx2x.h3
-rw-r--r--drivers/net/bnx2x_main.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index 185a6bab2227..c3b32f71e024 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -1023,6 +1023,9 @@ struct bnx2x {
1023 /* used to synchronize dmae accesses */ 1023 /* used to synchronize dmae accesses */
1024 struct mutex dmae_mutex; 1024 struct mutex dmae_mutex;
1025 1025
1026 /* used to protect the FW mail box */
1027 struct mutex fw_mb_mutex;
1028
1026 /* used to synchronize stats collecting */ 1029 /* used to synchronize stats collecting */
1027 int stats_state; 1030 int stats_state;
1028 /* used by dmae command loader */ 1031 /* used by dmae command loader */
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index e7b3b27d16b6..7c5c3000bbb4 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -2528,6 +2528,7 @@ u32 bnx2x_fw_command(struct bnx2x *bp, u32 command)
2528 u32 cnt = 1; 2528 u32 cnt = 1;
2529 u8 delay = CHIP_REV_IS_SLOW(bp) ? 100 : 10; 2529 u8 delay = CHIP_REV_IS_SLOW(bp) ? 100 : 10;
2530 2530
2531 mutex_lock(&bp->fw_mb_mutex);
2531 SHMEM_WR(bp, func_mb[func].drv_mb_header, (command | seq)); 2532 SHMEM_WR(bp, func_mb[func].drv_mb_header, (command | seq));
2532 DP(BNX2X_MSG_MCP, "wrote command (%x) to FW MB\n", (command | seq)); 2533 DP(BNX2X_MSG_MCP, "wrote command (%x) to FW MB\n", (command | seq));
2533 2534
@@ -2537,8 +2538,8 @@ u32 bnx2x_fw_command(struct bnx2x *bp, u32 command)
2537 2538
2538 rc = SHMEM_RD(bp, func_mb[func].fw_mb_header); 2539 rc = SHMEM_RD(bp, func_mb[func].fw_mb_header);
2539 2540
2540 /* Give the FW up to 2 second (200*10ms) */ 2541 /* Give the FW up to 5 second (500*10ms) */
2541 } while ((seq != (rc & FW_MSG_SEQ_NUMBER_MASK)) && (cnt++ < 200)); 2542 } while ((seq != (rc & FW_MSG_SEQ_NUMBER_MASK)) && (cnt++ < 500));
2542 2543
2543 DP(BNX2X_MSG_MCP, "[after %d ms] read (%x) seq is (%x) from FW MB\n", 2544 DP(BNX2X_MSG_MCP, "[after %d ms] read (%x) seq is (%x) from FW MB\n",
2544 cnt*delay, rc, seq); 2545 cnt*delay, rc, seq);
@@ -2552,6 +2553,7 @@ u32 bnx2x_fw_command(struct bnx2x *bp, u32 command)
2552 bnx2x_fw_dump(bp); 2553 bnx2x_fw_dump(bp);
2553 rc = 0; 2554 rc = 0;
2554 } 2555 }
2556 mutex_unlock(&bp->fw_mb_mutex);
2555 2557
2556 return rc; 2558 return rc;
2557} 2559}
@@ -8956,6 +8958,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
8956 smp_wmb(); /* Ensure that bp->intr_sem update is SMP-safe */ 8958 smp_wmb(); /* Ensure that bp->intr_sem update is SMP-safe */
8957 8959
8958 mutex_init(&bp->port.phy_mutex); 8960 mutex_init(&bp->port.phy_mutex);
8961 mutex_init(&bp->fw_mb_mutex);
8959#ifdef BCM_CNIC 8962#ifdef BCM_CNIC
8960 mutex_init(&bp->cnic_mutex); 8963 mutex_init(&bp->cnic_mutex);
8961#endif 8964#endif