Commit d6cae238 authored by Vladislav Zolotarov's avatar Vladislav Zolotarov Committed by David S. Miller

bnx2x: count statistic ramrods on EQ to prevent MC assert

This patch includes:
 - Counting statistics ramrods as EQ ramrods the way they should be. This
   accounting is meant to prevent MC asserts in case of software bugs.
 - Fixes in debug facilities which were added while working on one of such
   bugs.
Signed-off-by: default avatarDmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: default avatarVladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1cb0c788
...@@ -1671,11 +1671,12 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe) ...@@ -1671,11 +1671,12 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe)
switch (command) { switch (command) {
case (RAMROD_CMD_ID_ETH_CLIENT_UPDATE): case (RAMROD_CMD_ID_ETH_CLIENT_UPDATE):
DP(NETIF_MSG_IFUP, "got UPDATE ramrod. CID %d\n", cid); DP(BNX2X_MSG_SP, "got UPDATE ramrod. CID %d\n", cid);
drv_cmd = BNX2X_Q_CMD_UPDATE; drv_cmd = BNX2X_Q_CMD_UPDATE;
break; break;
case (RAMROD_CMD_ID_ETH_CLIENT_SETUP): case (RAMROD_CMD_ID_ETH_CLIENT_SETUP):
DP(NETIF_MSG_IFUP, "got MULTI[%d] setup ramrod\n", cid); DP(BNX2X_MSG_SP, "got MULTI[%d] setup ramrod\n", cid);
drv_cmd = BNX2X_Q_CMD_SETUP; drv_cmd = BNX2X_Q_CMD_SETUP;
break; break;
...@@ -1685,17 +1686,17 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe) ...@@ -1685,17 +1686,17 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe)
break; break;
case (RAMROD_CMD_ID_ETH_HALT): case (RAMROD_CMD_ID_ETH_HALT):
DP(NETIF_MSG_IFDOWN, "got MULTI[%d] halt ramrod\n", cid); DP(BNX2X_MSG_SP, "got MULTI[%d] halt ramrod\n", cid);
drv_cmd = BNX2X_Q_CMD_HALT; drv_cmd = BNX2X_Q_CMD_HALT;
break; break;
case (RAMROD_CMD_ID_ETH_TERMINATE): case (RAMROD_CMD_ID_ETH_TERMINATE):
DP(NETIF_MSG_IFDOWN, "got MULTI[%d] teminate ramrod\n", cid); DP(BNX2X_MSG_SP, "got MULTI[%d] teminate ramrod\n", cid);
drv_cmd = BNX2X_Q_CMD_TERMINATE; drv_cmd = BNX2X_Q_CMD_TERMINATE;
break; break;
case (RAMROD_CMD_ID_ETH_EMPTY): case (RAMROD_CMD_ID_ETH_EMPTY):
DP(NETIF_MSG_IFDOWN, "got MULTI[%d] empty ramrod\n", cid); DP(BNX2X_MSG_SP, "got MULTI[%d] empty ramrod\n", cid);
drv_cmd = BNX2X_Q_CMD_EMPTY; drv_cmd = BNX2X_Q_CMD_EMPTY;
break; break;
...@@ -1725,6 +1726,8 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe) ...@@ -1725,6 +1726,8 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe)
/* push the change in bp->spq_left and towards the memory */ /* push the change in bp->spq_left and towards the memory */
smp_mb__after_atomic_inc(); smp_mb__after_atomic_inc();
DP(BNX2X_MSG_SP, "bp->cq_spq_left %x\n", atomic_read(&bp->cq_spq_left));
return; return;
} }
...@@ -3089,8 +3092,6 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid, ...@@ -3089,8 +3092,6 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid,
spe->data.update_data_addr.hi = cpu_to_le32(data_hi); spe->data.update_data_addr.hi = cpu_to_le32(data_hi);
spe->data.update_data_addr.lo = cpu_to_le32(data_lo); spe->data.update_data_addr.lo = cpu_to_le32(data_lo);
/* stats ramrod has it's own slot on the spq */
if (command != RAMROD_CMD_ID_COMMON_STAT_QUERY) {
/* /*
* It's ok if the actual decrement is issued towards the memory * It's ok if the actual decrement is issued towards the memory
* somewhere between the spin_lock and spin_unlock. Thus no * somewhere between the spin_lock and spin_unlock. Thus no
...@@ -3100,15 +3101,14 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid, ...@@ -3100,15 +3101,14 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid,
atomic_dec(&bp->eq_spq_left); atomic_dec(&bp->eq_spq_left);
else else
atomic_dec(&bp->cq_spq_left); atomic_dec(&bp->cq_spq_left);
}
DP(BNX2X_MSG_SP/*NETIF_MSG_TIMER*/, DP(BNX2X_MSG_SP/*NETIF_MSG_TIMER*/,
"SPQE[%x] (%x:%x) command %d hw_cid %x data (%x:%x) " "SPQE[%x] (%x:%x) (cmd, common?) (%d,%d) hw_cid %x data (%x:%x) "
"type(0x%x) left (ETH, COMMON) (%x,%x)\n", "type(0x%x) left (CQ, EQ) (%x,%x)\n",
bp->spq_prod_idx, (u32)U64_HI(bp->spq_mapping), bp->spq_prod_idx, (u32)U64_HI(bp->spq_mapping),
(u32)(U64_LO(bp->spq_mapping) + (u32)(U64_LO(bp->spq_mapping) +
(void *)bp->spq_prod_bd - (void *)bp->spq), command, (void *)bp->spq_prod_bd - (void *)bp->spq), command, common,
HW_CID(bp, cid), data_hi, data_lo, type, HW_CID(bp, cid), data_hi, data_lo, type,
atomic_read(&bp->cq_spq_left), atomic_read(&bp->eq_spq_left)); atomic_read(&bp->cq_spq_left), atomic_read(&bp->eq_spq_left));
...@@ -3465,6 +3465,7 @@ static inline void bnx2x_attn_int_deasserted3(struct bnx2x *bp, u32 attn) ...@@ -3465,6 +3465,7 @@ static inline void bnx2x_attn_int_deasserted3(struct bnx2x *bp, u32 attn)
} else if (attn & BNX2X_MC_ASSERT_BITS) { } else if (attn & BNX2X_MC_ASSERT_BITS) {
BNX2X_ERR("MC assert!\n"); BNX2X_ERR("MC assert!\n");
bnx2x_mc_assert(bp);
REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_10, 0); REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_10, 0);
REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_9, 0); REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_9, 0);
REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_8, 0); REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_8, 0);
...@@ -4424,7 +4425,7 @@ static void bnx2x_eq_int(struct bnx2x *bp) ...@@ -4424,7 +4425,7 @@ static void bnx2x_eq_int(struct bnx2x *bp)
sw_cons = bp->eq_cons; sw_cons = bp->eq_cons;
sw_prod = bp->eq_prod; sw_prod = bp->eq_prod;
DP(BNX2X_MSG_SP, "EQ: hw_cons %u sw_cons %u bp->cq_spq_left %u\n", DP(BNX2X_MSG_SP, "EQ: hw_cons %u sw_cons %u bp->eq_spq_left %x\n",
hw_cons, sw_cons, atomic_read(&bp->eq_spq_left)); hw_cons, sw_cons, atomic_read(&bp->eq_spq_left));
for (; sw_cons != hw_cons; for (; sw_cons != hw_cons;
...@@ -4443,7 +4444,7 @@ static void bnx2x_eq_int(struct bnx2x *bp) ...@@ -4443,7 +4444,7 @@ static void bnx2x_eq_int(struct bnx2x *bp)
DP(NETIF_MSG_TIMER, "got statistics comp event %d\n", DP(NETIF_MSG_TIMER, "got statistics comp event %d\n",
bp->stats_comp++); bp->stats_comp++);
/* nothing to do with stats comp */ /* nothing to do with stats comp */
continue; goto next_spqe;
case EVENT_RING_OPCODE_CFC_DEL: case EVENT_RING_OPCODE_CFC_DEL:
/* handle according to cid range */ /* handle according to cid range */
...@@ -4451,7 +4452,7 @@ static void bnx2x_eq_int(struct bnx2x *bp) ...@@ -4451,7 +4452,7 @@ static void bnx2x_eq_int(struct bnx2x *bp)
* we may want to verify here that the bp state is * we may want to verify here that the bp state is
* HALTING * HALTING
*/ */
DP(NETIF_MSG_IFDOWN, DP(BNX2X_MSG_SP,
"got delete ramrod for MULTI[%d]\n", cid); "got delete ramrod for MULTI[%d]\n", cid);
#ifdef BCM_CNIC #ifdef BCM_CNIC
if (!bnx2x_cnic_handle_cfc_del(bp, cid, elem)) if (!bnx2x_cnic_handle_cfc_del(bp, cid, elem))
...@@ -4467,7 +4468,7 @@ static void bnx2x_eq_int(struct bnx2x *bp) ...@@ -4467,7 +4468,7 @@ static void bnx2x_eq_int(struct bnx2x *bp)
goto next_spqe; goto next_spqe;
case EVENT_RING_OPCODE_STOP_TRAFFIC: case EVENT_RING_OPCODE_STOP_TRAFFIC:
DP(NETIF_MSG_IFUP, "got STOP TRAFFIC\n"); DP(BNX2X_MSG_SP, "got STOP TRAFFIC\n");
if (f_obj->complete_cmd(bp, f_obj, if (f_obj->complete_cmd(bp, f_obj,
BNX2X_F_CMD_TX_STOP)) BNX2X_F_CMD_TX_STOP))
break; break;
...@@ -4475,21 +4476,21 @@ static void bnx2x_eq_int(struct bnx2x *bp) ...@@ -4475,21 +4476,21 @@ static void bnx2x_eq_int(struct bnx2x *bp)
goto next_spqe; goto next_spqe;
case EVENT_RING_OPCODE_START_TRAFFIC: case EVENT_RING_OPCODE_START_TRAFFIC:
DP(NETIF_MSG_IFUP, "got START TRAFFIC\n"); DP(BNX2X_MSG_SP, "got START TRAFFIC\n");
if (f_obj->complete_cmd(bp, f_obj, if (f_obj->complete_cmd(bp, f_obj,
BNX2X_F_CMD_TX_START)) BNX2X_F_CMD_TX_START))
break; break;
bnx2x_dcbx_set_params(bp, BNX2X_DCBX_STATE_TX_RELEASED); bnx2x_dcbx_set_params(bp, BNX2X_DCBX_STATE_TX_RELEASED);
goto next_spqe; goto next_spqe;
case EVENT_RING_OPCODE_FUNCTION_START: case EVENT_RING_OPCODE_FUNCTION_START:
DP(NETIF_MSG_IFUP, "got FUNC_START ramrod\n"); DP(BNX2X_MSG_SP, "got FUNC_START ramrod\n");
if (f_obj->complete_cmd(bp, f_obj, BNX2X_F_CMD_START)) if (f_obj->complete_cmd(bp, f_obj, BNX2X_F_CMD_START))
break; break;
goto next_spqe; goto next_spqe;
case EVENT_RING_OPCODE_FUNCTION_STOP: case EVENT_RING_OPCODE_FUNCTION_STOP:
DP(NETIF_MSG_IFDOWN, "got FUNC_STOP ramrod\n"); DP(BNX2X_MSG_SP, "got FUNC_STOP ramrod\n");
if (f_obj->complete_cmd(bp, f_obj, BNX2X_F_CMD_STOP)) if (f_obj->complete_cmd(bp, f_obj, BNX2X_F_CMD_STOP))
break; break;
...@@ -4503,7 +4504,7 @@ static void bnx2x_eq_int(struct bnx2x *bp) ...@@ -4503,7 +4504,7 @@ static void bnx2x_eq_int(struct bnx2x *bp)
BNX2X_STATE_OPENING_WAIT4_PORT): BNX2X_STATE_OPENING_WAIT4_PORT):
cid = elem->message.data.eth_event.echo & cid = elem->message.data.eth_event.echo &
BNX2X_SWCID_MASK; BNX2X_SWCID_MASK;
DP(NETIF_MSG_IFUP, "got RSS_UPDATE ramrod. CID %d\n", DP(BNX2X_MSG_SP, "got RSS_UPDATE ramrod. CID %d\n",
cid); cid);
rss_raw->clear_pending(rss_raw); rss_raw->clear_pending(rss_raw);
break; break;
...@@ -4518,7 +4519,7 @@ static void bnx2x_eq_int(struct bnx2x *bp) ...@@ -4518,7 +4519,7 @@ static void bnx2x_eq_int(struct bnx2x *bp)
BNX2X_STATE_DIAG): BNX2X_STATE_DIAG):
case (EVENT_RING_OPCODE_CLASSIFICATION_RULES | case (EVENT_RING_OPCODE_CLASSIFICATION_RULES |
BNX2X_STATE_CLOSING_WAIT4_HALT): BNX2X_STATE_CLOSING_WAIT4_HALT):
DP(NETIF_MSG_IFUP, "got (un)set mac ramrod\n"); DP(BNX2X_MSG_SP, "got (un)set mac ramrod\n");
bnx2x_handle_classification_eqe(bp, elem); bnx2x_handle_classification_eqe(bp, elem);
break; break;
...@@ -4528,7 +4529,7 @@ static void bnx2x_eq_int(struct bnx2x *bp) ...@@ -4528,7 +4529,7 @@ static void bnx2x_eq_int(struct bnx2x *bp)
BNX2X_STATE_DIAG): BNX2X_STATE_DIAG):
case (EVENT_RING_OPCODE_MULTICAST_RULES | case (EVENT_RING_OPCODE_MULTICAST_RULES |
BNX2X_STATE_CLOSING_WAIT4_HALT): BNX2X_STATE_CLOSING_WAIT4_HALT):
DP(NETIF_MSG_IFUP, "got mcast ramrod\n"); DP(BNX2X_MSG_SP, "got mcast ramrod\n");
bnx2x_handle_mcast_eqe(bp); bnx2x_handle_mcast_eqe(bp);
break; break;
...@@ -4538,7 +4539,7 @@ static void bnx2x_eq_int(struct bnx2x *bp) ...@@ -4538,7 +4539,7 @@ static void bnx2x_eq_int(struct bnx2x *bp)
BNX2X_STATE_DIAG): BNX2X_STATE_DIAG):
case (EVENT_RING_OPCODE_FILTERS_RULES | case (EVENT_RING_OPCODE_FILTERS_RULES |
BNX2X_STATE_CLOSING_WAIT4_HALT): BNX2X_STATE_CLOSING_WAIT4_HALT):
DP(NETIF_MSG_IFUP, "got rx_mode ramrod\n"); DP(BNX2X_MSG_SP, "got rx_mode ramrod\n");
bnx2x_handle_rx_mode_eqe(bp); bnx2x_handle_rx_mode_eqe(bp);
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment