aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bnx2x/bnx2x.h2
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c17
-rw-r--r--drivers/net/bnx2x/bnx2x_stats.c5
3 files changed, 11 insertions, 13 deletions
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index d7b24f9e7939..09fb7ff811d8 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -860,7 +860,7 @@ struct bnx2x {
860 struct eth_spe *spq_prod_bd; 860 struct eth_spe *spq_prod_bd;
861 struct eth_spe *spq_last_bd; 861 struct eth_spe *spq_last_bd;
862 __le16 *dsb_sp_prod; 862 __le16 *dsb_sp_prod;
863 u16 spq_left; /* serialize spq */ 863 atomic_t spq_left; /* serialize spq */
864 /* used to synchronize spq accesses */ 864 /* used to synchronize spq accesses */
865 spinlock_t spq_lock; 865 spinlock_t spq_lock;
866 866
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 238e38f051fb..2c04b97f85a9 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -1161,8 +1161,8 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp,
1161 break; 1161 break;
1162 } 1162 }
1163 1163
1164 bp->spq_left++; 1164 smp_mb__before_atomic_inc();
1165 1165 atomic_inc(&bp->spq_left);
1166 /* push the change in fp->state and towards the memory */ 1166 /* push the change in fp->state and towards the memory */
1167 smp_wmb(); 1167 smp_wmb();
1168 1168
@@ -2432,7 +2432,7 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid,
2432 2432
2433 spin_lock_bh(&bp->spq_lock); 2433 spin_lock_bh(&bp->spq_lock);
2434 2434
2435 if (!bp->spq_left) { 2435 if (!atomic_read(&bp->spq_left)) {
2436 BNX2X_ERR("BUG! SPQ ring full!\n"); 2436 BNX2X_ERR("BUG! SPQ ring full!\n");
2437 spin_unlock_bh(&bp->spq_lock); 2437 spin_unlock_bh(&bp->spq_lock);
2438 bnx2x_panic(); 2438 bnx2x_panic();
@@ -2472,7 +2472,7 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid,
2472 * somewhere between the spin_lock and spin_unlock. Thus no 2472 * somewhere between the spin_lock and spin_unlock. Thus no
2473 * more explict memory barrier is needed. 2473 * more explict memory barrier is needed.
2474 */ 2474 */
2475 bp->spq_left--; 2475 atomic_dec(&bp->spq_left);
2476 2476
2477 DP(BNX2X_MSG_SP/*NETIF_MSG_TIMER*/, 2477 DP(BNX2X_MSG_SP/*NETIF_MSG_TIMER*/,
2478 "SPQE[%x] (%x:%x) command %d hw_cid %x data (%x:%x) " 2478 "SPQE[%x] (%x:%x) command %d hw_cid %x data (%x:%x) "
@@ -2480,7 +2480,7 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid,
2480 bp->spq_prod_idx, (u32)U64_HI(bp->spq_mapping), 2480 bp->spq_prod_idx, (u32)U64_HI(bp->spq_mapping),
2481 (u32)(U64_LO(bp->spq_mapping) + 2481 (u32)(U64_LO(bp->spq_mapping) +
2482 (void *)bp->spq_prod_bd - (void *)bp->spq), command, 2482 (void *)bp->spq_prod_bd - (void *)bp->spq), command,
2483 HW_CID(bp, cid), data_hi, data_lo, type, bp->spq_left); 2483 HW_CID(bp, cid), data_hi, data_lo, type, atomic_read(&bp->spq_left));
2484 2484
2485 bnx2x_sp_prod_update(bp); 2485 bnx2x_sp_prod_update(bp);
2486 spin_unlock_bh(&bp->spq_lock); 2486 spin_unlock_bh(&bp->spq_lock);
@@ -3290,7 +3290,7 @@ static void bnx2x_eq_int(struct bnx2x *bp)
3290 sw_prod = bp->eq_prod; 3290 sw_prod = bp->eq_prod;
3291 3291
3292 DP(BNX2X_MSG_SP, "EQ: hw_cons %u sw_cons %u bp->spq_left %u\n", 3292 DP(BNX2X_MSG_SP, "EQ: hw_cons %u sw_cons %u bp->spq_left %u\n",
3293 hw_cons, sw_cons, bp->spq_left); 3293 hw_cons, sw_cons, atomic_read(&bp->spq_left));
3294 3294
3295 for (; sw_cons != hw_cons; 3295 for (; sw_cons != hw_cons;
3296 sw_prod = NEXT_EQ_IDX(sw_prod), sw_cons = NEXT_EQ_IDX(sw_cons)) { 3296 sw_prod = NEXT_EQ_IDX(sw_prod), sw_cons = NEXT_EQ_IDX(sw_cons)) {
@@ -3360,7 +3360,8 @@ next_spqe:
3360 spqe_cnt++; 3360 spqe_cnt++;
3361 } /* for */ 3361 } /* for */
3362 3362
3363 bp->spq_left++; 3363 smp_mb__before_atomic_inc();
3364 atomic_add(spqe_cnt, &bp->spq_left);
3364 3365
3365 bp->eq_cons = sw_cons; 3366 bp->eq_cons = sw_cons;
3366 bp->eq_prod = sw_prod; 3367 bp->eq_prod = sw_prod;
@@ -3737,8 +3738,8 @@ void bnx2x_update_coalesce(struct bnx2x *bp)
3737static void bnx2x_init_sp_ring(struct bnx2x *bp) 3738static void bnx2x_init_sp_ring(struct bnx2x *bp)
3738{ 3739{
3739 spin_lock_init(&bp->spq_lock); 3740 spin_lock_init(&bp->spq_lock);
3741 atomic_set(&bp->spq_left, MAX_SPQ_PENDING);
3740 3742
3741 bp->spq_left = MAX_SPQ_PENDING;
3742 bp->spq_prod_idx = 0; 3743 bp->spq_prod_idx = 0;
3743 bp->dsb_sp_prod = BNX2X_SP_DSB_INDEX; 3744 bp->dsb_sp_prod = BNX2X_SP_DSB_INDEX;
3744 bp->spq_prod_bd = bp->spq; 3745 bp->spq_prod_bd = bp->spq;
diff --git a/drivers/net/bnx2x/bnx2x_stats.c b/drivers/net/bnx2x/bnx2x_stats.c
index c271fc52613d..32b6b1033a3b 100644
--- a/drivers/net/bnx2x/bnx2x_stats.c
+++ b/drivers/net/bnx2x/bnx2x_stats.c
@@ -166,11 +166,8 @@ static void bnx2x_storm_stats_post(struct bnx2x *bp)
166 rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_STAT_QUERY, 0, 166 rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_STAT_QUERY, 0,
167 ((u32 *)&ramrod_data)[1], 167 ((u32 *)&ramrod_data)[1],
168 ((u32 *)&ramrod_data)[0], 1); 168 ((u32 *)&ramrod_data)[0], 1);
169 if (rc == 0) { 169 if (rc == 0)
170 /* stats ramrod has it's own slot on the spq */
171 bp->spq_left++;
172 bp->stats_pending = 1; 170 bp->stats_pending = 1;
173 }
174 171
175 spin_unlock_bh(&bp->stats_lock); 172 spin_unlock_bh(&bp->stats_lock);
176 } 173 }