diff options
author | Dmitry Kravkov <dmitry@broadcom.com> | 2010-06-23 14:57:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-23 14:57:09 -0400 |
commit | 6b2a541db58dba5860ccbcfaf36caee064b8a9fd (patch) | |
tree | c461ffb8fe6758ceda236e7e01f80fc85242af9b /drivers/net/cnic.c | |
parent | 06aeb78b85d8c04af03eb37353aa0df98d3db170 (diff) |
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: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r-- | drivers/net/cnic.c | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index fe925663d39a..80471269977a 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -3919,8 +3919,9 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev) | |||
3919 | HC_INDEX_DEF_C_ETH_ISCSI_CQ_CONS; | 3919 | HC_INDEX_DEF_C_ETH_ISCSI_CQ_CONS; |
3920 | context->cstorm_st_context.status_block_id = BNX2X_DEF_SB_ID; | 3920 | context->cstorm_st_context.status_block_id = BNX2X_DEF_SB_ID; |
3921 | 3921 | ||
3922 | context->xstorm_st_context.statistics_data = (cli | | 3922 | if (cli < MAX_X_STAT_COUNTER_ID) |
3923 | XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE); | 3923 | context->xstorm_st_context.statistics_data = cli | |
3924 | XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE; | ||
3924 | 3925 | ||
3925 | context->xstorm_ag_context.cdu_reserved = | 3926 | context->xstorm_ag_context.cdu_reserved = |
3926 | CDU_RSRVD_VALUE_TYPE_A(BNX2X_HW_CID(BNX2X_ISCSI_L2_CID, func), | 3927 | 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 | ETH_CONNECTION_TYPE); | 3929 | ETH_CONNECTION_TYPE); |
3929 | 3930 | ||
3930 | /* reset xstorm per client statistics */ | 3931 | /* reset xstorm per client statistics */ |
3931 | val = BAR_XSTRORM_INTMEM + | 3932 | if (cli < MAX_X_STAT_COUNTER_ID) { |
3932 | XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); | 3933 | val = BAR_XSTRORM_INTMEM + |
3933 | for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++) | 3934 | XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); |
3934 | CNIC_WR(dev, val + i * 4, 0); | 3935 | for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++) |
3936 | CNIC_WR(dev, val + i * 4, 0); | ||
3937 | } | ||
3935 | 3938 | ||
3936 | cp->tx_cons_ptr = | 3939 | cp->tx_cons_ptr = |
3937 | &cp->bnx2x_def_status_blk->c_def_status_block.index_values[ | 3940 | &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 | BNX2X_ISCSI_RX_SB_INDEX_NUM; | 3981 | BNX2X_ISCSI_RX_SB_INDEX_NUM; |
3979 | context->ustorm_st_context.common.clientId = cli; | 3982 | context->ustorm_st_context.common.clientId = cli; |
3980 | context->ustorm_st_context.common.status_block_id = BNX2X_DEF_SB_ID; | 3983 | context->ustorm_st_context.common.status_block_id = BNX2X_DEF_SB_ID; |
3981 | context->ustorm_st_context.common.flags = | 3984 | if (cli < MAX_U_STAT_COUNTER_ID) { |
3982 | USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS; | 3985 | context->ustorm_st_context.common.flags = |
3983 | context->ustorm_st_context.common.statistics_counter_id = cli; | 3986 | USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS; |
3987 | context->ustorm_st_context.common.statistics_counter_id = cli; | ||
3988 | } | ||
3984 | context->ustorm_st_context.common.mc_alignment_log_size = 0; | 3989 | context->ustorm_st_context.common.mc_alignment_log_size = 0; |
3985 | context->ustorm_st_context.common.bd_buff_size = | 3990 | context->ustorm_st_context.common.bd_buff_size = |
3986 | cp->l2_single_buf_size; | 3991 | cp->l2_single_buf_size; |
@@ -4011,10 +4016,13 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev) | |||
4011 | 4016 | ||
4012 | /* client tstorm info */ | 4017 | /* client tstorm info */ |
4013 | tstorm_client.mtu = cp->l2_single_buf_size - 14; | 4018 | tstorm_client.mtu = cp->l2_single_buf_size - 14; |
4014 | tstorm_client.config_flags = | 4019 | tstorm_client.config_flags = TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE; |
4015 | (TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE | | 4020 | |
4016 | TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE); | 4021 | if (cli < MAX_T_STAT_COUNTER_ID) { |
4017 | tstorm_client.statistics_counter_id = cli; | 4022 | tstorm_client.config_flags |= |
4023 | TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE; | ||
4024 | tstorm_client.statistics_counter_id = cli; | ||
4025 | } | ||
4018 | 4026 | ||
4019 | CNIC_WR(dev, BAR_TSTRORM_INTMEM + | 4027 | CNIC_WR(dev, BAR_TSTRORM_INTMEM + |
4020 | TSTORM_CLIENT_CONFIG_OFFSET(port, cli), | 4028 | TSTORM_CLIENT_CONFIG_OFFSET(port, cli), |
@@ -4024,16 +4032,21 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev) | |||
4024 | ((u32 *)&tstorm_client)[1]); | 4032 | ((u32 *)&tstorm_client)[1]); |
4025 | 4033 | ||
4026 | /* reset tstorm per client statistics */ | 4034 | /* reset tstorm per client statistics */ |
4027 | val = BAR_TSTRORM_INTMEM + | 4035 | if (cli < MAX_T_STAT_COUNTER_ID) { |
4028 | TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); | 4036 | |
4029 | for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++) | 4037 | val = BAR_TSTRORM_INTMEM + |
4030 | CNIC_WR(dev, val + i * 4, 0); | 4038 | TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); |
4039 | for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++) | ||
4040 | CNIC_WR(dev, val + i * 4, 0); | ||
4041 | } | ||
4031 | 4042 | ||
4032 | /* reset ustorm per client statistics */ | 4043 | /* reset ustorm per client statistics */ |
4033 | val = BAR_USTRORM_INTMEM + | 4044 | if (cli < MAX_U_STAT_COUNTER_ID) { |
4034 | USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); | 4045 | val = BAR_USTRORM_INTMEM + |
4035 | for (i = 0; i < sizeof(struct ustorm_per_client_stats) / 4; i++) | 4046 | USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); |
4036 | CNIC_WR(dev, val + i * 4, 0); | 4047 | for (i = 0; i < sizeof(struct ustorm_per_client_stats) / 4; i++) |
4048 | CNIC_WR(dev, val + i * 4, 0); | ||
4049 | } | ||
4037 | 4050 | ||
4038 | cp->rx_cons_ptr = | 4051 | cp->rx_cons_ptr = |
4039 | &cp->bnx2x_def_status_blk->u_def_status_block.index_values[ | 4052 | &cp->bnx2x_def_status_blk->u_def_status_block.index_values[ |