Commit 6b2a541d authored by Dmitry Kravkov's avatar Dmitry Kravkov Committed by David S. Miller

cnic: Disable statistics initialization for eth clients that do not support statistics

Disable statistics initialization for eth clients that do not support
 statistics. This prevents memory corruption on bnx2x hw.
Signed-off-by: default avatarDmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
parent 06aeb78b
...@@ -3919,8 +3919,9 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev) ...@@ -3919,8 +3919,9 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev)
HC_INDEX_DEF_C_ETH_ISCSI_CQ_CONS; HC_INDEX_DEF_C_ETH_ISCSI_CQ_CONS;
context->cstorm_st_context.status_block_id = BNX2X_DEF_SB_ID; context->cstorm_st_context.status_block_id = BNX2X_DEF_SB_ID;
context->xstorm_st_context.statistics_data = (cli | if (cli < MAX_X_STAT_COUNTER_ID)
XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE); context->xstorm_st_context.statistics_data = cli |
XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE;
context->xstorm_ag_context.cdu_reserved = context->xstorm_ag_context.cdu_reserved =
CDU_RSRVD_VALUE_TYPE_A(BNX2X_HW_CID(BNX2X_ISCSI_L2_CID, func), CDU_RSRVD_VALUE_TYPE_A(BNX2X_HW_CID(BNX2X_ISCSI_L2_CID, func),
...@@ -3928,10 +3929,12 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev) ...@@ -3928,10 +3929,12 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev)
ETH_CONNECTION_TYPE); ETH_CONNECTION_TYPE);
/* reset xstorm per client statistics */ /* reset xstorm per client statistics */
val = BAR_XSTRORM_INTMEM + if (cli < MAX_X_STAT_COUNTER_ID) {
XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); val = BAR_XSTRORM_INTMEM +
for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++) XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli);
CNIC_WR(dev, val + i * 4, 0); for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++)
CNIC_WR(dev, val + i * 4, 0);
}
cp->tx_cons_ptr = cp->tx_cons_ptr =
&cp->bnx2x_def_status_blk->c_def_status_block.index_values[ &cp->bnx2x_def_status_blk->c_def_status_block.index_values[
...@@ -3978,9 +3981,11 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev) ...@@ -3978,9 +3981,11 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev)
BNX2X_ISCSI_RX_SB_INDEX_NUM; BNX2X_ISCSI_RX_SB_INDEX_NUM;
context->ustorm_st_context.common.clientId = cli; context->ustorm_st_context.common.clientId = cli;
context->ustorm_st_context.common.status_block_id = BNX2X_DEF_SB_ID; context->ustorm_st_context.common.status_block_id = BNX2X_DEF_SB_ID;
context->ustorm_st_context.common.flags = if (cli < MAX_U_STAT_COUNTER_ID) {
USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS; context->ustorm_st_context.common.flags =
context->ustorm_st_context.common.statistics_counter_id = cli; USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS;
context->ustorm_st_context.common.statistics_counter_id = cli;
}
context->ustorm_st_context.common.mc_alignment_log_size = 0; context->ustorm_st_context.common.mc_alignment_log_size = 0;
context->ustorm_st_context.common.bd_buff_size = context->ustorm_st_context.common.bd_buff_size =
cp->l2_single_buf_size; cp->l2_single_buf_size;
...@@ -4011,10 +4016,13 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev) ...@@ -4011,10 +4016,13 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev)
/* client tstorm info */ /* client tstorm info */
tstorm_client.mtu = cp->l2_single_buf_size - 14; tstorm_client.mtu = cp->l2_single_buf_size - 14;
tstorm_client.config_flags = tstorm_client.config_flags = TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE;
(TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE |
TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE); if (cli < MAX_T_STAT_COUNTER_ID) {
tstorm_client.statistics_counter_id = cli; tstorm_client.config_flags |=
TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE;
tstorm_client.statistics_counter_id = cli;
}
CNIC_WR(dev, BAR_TSTRORM_INTMEM + CNIC_WR(dev, BAR_TSTRORM_INTMEM +
TSTORM_CLIENT_CONFIG_OFFSET(port, cli), TSTORM_CLIENT_CONFIG_OFFSET(port, cli),
...@@ -4024,16 +4032,21 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev) ...@@ -4024,16 +4032,21 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev)
((u32 *)&tstorm_client)[1]); ((u32 *)&tstorm_client)[1]);
/* reset tstorm per client statistics */ /* reset tstorm per client statistics */
val = BAR_TSTRORM_INTMEM + if (cli < MAX_T_STAT_COUNTER_ID) {
TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli);
for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++) val = BAR_TSTRORM_INTMEM +
CNIC_WR(dev, val + i * 4, 0); TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli);
for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++)
CNIC_WR(dev, val + i * 4, 0);
}
/* reset ustorm per client statistics */ /* reset ustorm per client statistics */
val = BAR_USTRORM_INTMEM + if (cli < MAX_U_STAT_COUNTER_ID) {
USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); val = BAR_USTRORM_INTMEM +
for (i = 0; i < sizeof(struct ustorm_per_client_stats) / 4; i++) USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli);
CNIC_WR(dev, val + i * 4, 0); for (i = 0; i < sizeof(struct ustorm_per_client_stats) / 4; i++)
CNIC_WR(dev, val + i * 4, 0);
}
cp->rx_cons_ptr = cp->rx_cons_ptr =
&cp->bnx2x_def_status_blk->u_def_status_block.index_values[ &cp->bnx2x_def_status_blk->u_def_status_block.index_values[
......
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