Commit b015e3d1 authored by Eilon Greenstein's avatar Eilon Greenstein Committed by David S. Miller

bnx2x: Allowing 0 as initial fairness value

Value of zero was used to disable the fairness mechanism. Though the code
(driver and FW) allowed changing the value at run time, it did not allow to do
that if the mechanism was disabled to begin with.
Fixed the FW to allow turning on and off the mechanism at run time. Fixed the
code to read the value from the chip at the right sequence.
Without this fix, if the initial value was set to zero, traffic could not run on
the interface.
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 69dc2df3
...@@ -1259,8 +1259,8 @@ struct host_func_stats { ...@@ -1259,8 +1259,8 @@ struct host_func_stats {
#define BCM_5710_FW_MAJOR_VERSION 5 #define BCM_5710_FW_MAJOR_VERSION 5
#define BCM_5710_FW_MINOR_VERSION 0 #define BCM_5710_FW_MINOR_VERSION 2
#define BCM_5710_FW_REVISION_VERSION 21 #define BCM_5710_FW_REVISION_VERSION 7
#define BCM_5710_FW_ENGINEERING_VERSION 0 #define BCM_5710_FW_ENGINEERING_VERSION 0
#define BCM_5710_FW_COMPILE_FLAGS 1 #define BCM_5710_FW_COMPILE_FLAGS 1
......
...@@ -2333,8 +2333,14 @@ static void bnx2x_calc_vn_weight_sum(struct bnx2x *bp) ...@@ -2333,8 +2333,14 @@ static void bnx2x_calc_vn_weight_sum(struct bnx2x *bp)
} }
/* ... only if all min rates are zeros - disable fairness */ /* ... only if all min rates are zeros - disable fairness */
if (all_zero) if (all_zero) {
bp->vn_weight_sum = 0; bp->cmng.flags.cmng_enables &=
~CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
DP(NETIF_MSG_IFUP, "All MIN values are zeroes"
" fairness will be disabled\n");
} else
bp->cmng.flags.cmng_enables |=
CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
} }
static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func) static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func)
...@@ -2353,17 +2359,14 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func) ...@@ -2353,17 +2359,14 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func)
} else { } else {
vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >> vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >>
FUNC_MF_CFG_MIN_BW_SHIFT) * 100; FUNC_MF_CFG_MIN_BW_SHIFT) * 100;
/* If fairness is enabled (not all min rates are zeroes) and /* If min rate is zero - set it to 1 */
if current min rate is zero - set it to 1. if (!vn_min_rate)
This is a requirement of the algorithm. */
if (bp->vn_weight_sum && (vn_min_rate == 0))
vn_min_rate = DEF_MIN_RATE; vn_min_rate = DEF_MIN_RATE;
vn_max_rate = ((vn_cfg & FUNC_MF_CFG_MAX_BW_MASK) >> vn_max_rate = ((vn_cfg & FUNC_MF_CFG_MAX_BW_MASK) >>
FUNC_MF_CFG_MAX_BW_SHIFT) * 100; FUNC_MF_CFG_MAX_BW_SHIFT) * 100;
} }
DP(NETIF_MSG_IFUP, DP(NETIF_MSG_IFUP,
"func %d: vn_min_rate=%d vn_max_rate=%d vn_weight_sum=%d\n", "func %d: vn_min_rate %d vn_max_rate %d vn_weight_sum %d\n",
func, vn_min_rate, vn_max_rate, bp->vn_weight_sum); func, vn_min_rate, vn_max_rate, bp->vn_weight_sum);
memset(&m_rs_vn, 0, sizeof(struct rate_shaping_vars_per_vn)); memset(&m_rs_vn, 0, sizeof(struct rate_shaping_vars_per_vn));
...@@ -2490,7 +2493,6 @@ static void bnx2x__link_status_update(struct bnx2x *bp) ...@@ -2490,7 +2493,6 @@ static void bnx2x__link_status_update(struct bnx2x *bp)
else else
bnx2x_stats_handle(bp, STATS_EVENT_STOP); bnx2x_stats_handle(bp, STATS_EVENT_STOP);
bp->mf_config = SHMEM_RD(bp, mf_cfg.func_mf_config[func].config);
bnx2x_calc_vn_weight_sum(bp); bnx2x_calc_vn_weight_sum(bp);
/* indicate link status */ /* indicate link status */
...@@ -2634,10 +2636,7 @@ static void bnx2x_update_min_max(struct bnx2x *bp) ...@@ -2634,10 +2636,7 @@ static void bnx2x_update_min_max(struct bnx2x *bp)
static void bnx2x_dcc_event(struct bnx2x *bp, u32 dcc_event) static void bnx2x_dcc_event(struct bnx2x *bp, u32 dcc_event)
{ {
int func = BP_FUNC(bp);
DP(BNX2X_MSG_MCP, "dcc_event 0x%x\n", dcc_event); DP(BNX2X_MSG_MCP, "dcc_event 0x%x\n", dcc_event);
bp->mf_config = SHMEM_RD(bp, mf_cfg.func_mf_config[func].config);
if (dcc_event & DRV_STATUS_DCC_DISABLE_ENABLE_PF) { if (dcc_event & DRV_STATUS_DCC_DISABLE_ENABLE_PF) {
...@@ -3067,6 +3066,8 @@ static inline void bnx2x_attn_int_deasserted3(struct bnx2x *bp, u32 attn) ...@@ -3067,6 +3066,8 @@ static inline void bnx2x_attn_int_deasserted3(struct bnx2x *bp, u32 attn)
int func = BP_FUNC(bp); int func = BP_FUNC(bp);
REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_12 + func*4, 0); REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_12 + func*4, 0);
bp->mf_config = SHMEM_RD(bp,
mf_cfg.func_mf_config[func].config);
val = SHMEM_RD(bp, func_mb[func].drv_status); val = SHMEM_RD(bp, func_mb[func].drv_status);
if (val & DRV_STATUS_DCC_EVENT_MASK) if (val & DRV_STATUS_DCC_EVENT_MASK)
bnx2x_dcc_event(bp, bnx2x_dcc_event(bp,
...@@ -5559,20 +5560,18 @@ static void bnx2x_init_internal_func(struct bnx2x *bp) ...@@ -5559,20 +5560,18 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
bp->link_vars.line_speed = SPEED_10000; bp->link_vars.line_speed = SPEED_10000;
bnx2x_init_port_minmax(bp); bnx2x_init_port_minmax(bp);
if (!BP_NOMCP(bp))
bp->mf_config =
SHMEM_RD(bp, mf_cfg.func_mf_config[func].config);
bnx2x_calc_vn_weight_sum(bp); bnx2x_calc_vn_weight_sum(bp);
for (vn = VN_0; vn < E1HVN_MAX; vn++) for (vn = VN_0; vn < E1HVN_MAX; vn++)
bnx2x_init_vn_minmax(bp, 2*vn + port); bnx2x_init_vn_minmax(bp, 2*vn + port);
/* Enable rate shaping and fairness */ /* Enable rate shaping and fairness */
bp->cmng.flags.cmng_enables =
CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN;
if (bp->vn_weight_sum)
bp->cmng.flags.cmng_enables |= bp->cmng.flags.cmng_enables |=
CMNG_FLAGS_PER_PORT_FAIRNESS_VN; CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN;
else
DP(NETIF_MSG_IFUP, "All MIN values are zeroes"
" fairness will be disabled\n");
} else { } else {
/* rate shaping and fairness are disabled */ /* rate shaping and fairness are disabled */
DP(NETIF_MSG_IFUP, DP(NETIF_MSG_IFUP,
...@@ -9038,18 +9037,19 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -9038,18 +9037,19 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
if (netif_carrier_ok(dev)) { if (netif_carrier_ok(dev)) {
cmd->speed = bp->link_vars.line_speed; cmd->speed = bp->link_vars.line_speed;
cmd->duplex = bp->link_vars.duplex; cmd->duplex = bp->link_vars.duplex;
} else {
cmd->speed = bp->link_params.req_line_speed;
cmd->duplex = bp->link_params.req_duplex;
}
if (IS_E1HMF(bp)) { if (IS_E1HMF(bp)) {
u16 vn_max_rate; u16 vn_max_rate;
vn_max_rate = ((bp->mf_config & FUNC_MF_CFG_MAX_BW_MASK) >> vn_max_rate =
((bp->mf_config & FUNC_MF_CFG_MAX_BW_MASK) >>
FUNC_MF_CFG_MAX_BW_SHIFT) * 100; FUNC_MF_CFG_MAX_BW_SHIFT) * 100;
if (vn_max_rate < cmd->speed) if (vn_max_rate < cmd->speed)
cmd->speed = vn_max_rate; cmd->speed = vn_max_rate;
} }
} else {
cmd->speed = -1;
cmd->duplex = -1;
}
if (bp->link_params.switch_cfg == SWITCH_CFG_10G) { if (bp->link_params.switch_cfg == SWITCH_CFG_10G) {
u32 ext_phy_type = u32 ext_phy_type =
......
...@@ -32,7 +32,7 @@ fw-shipped-$(CONFIG_ADAPTEC_STARFIRE) += adaptec/starfire_rx.bin \ ...@@ -32,7 +32,7 @@ fw-shipped-$(CONFIG_ADAPTEC_STARFIRE) += adaptec/starfire_rx.bin \
adaptec/starfire_tx.bin adaptec/starfire_tx.bin
fw-shipped-$(CONFIG_ATARI_DSP56K) += dsp56k/bootstrap.bin fw-shipped-$(CONFIG_ATARI_DSP56K) += dsp56k/bootstrap.bin
fw-shipped-$(CONFIG_ATM_AMBASSADOR) += atmsar11.fw fw-shipped-$(CONFIG_ATM_AMBASSADOR) += atmsar11.fw
fw-shipped-$(CONFIG_BNX2X) += bnx2x-e1-5.0.21.0.fw bnx2x-e1h-5.0.21.0.fw fw-shipped-$(CONFIG_BNX2X) += bnx2x-e1-5.2.7.0.fw bnx2x-e1h-5.2.7.0.fw
fw-shipped-$(CONFIG_BNX2) += bnx2/bnx2-mips-09-5.0.0.j3.fw \ fw-shipped-$(CONFIG_BNX2) += bnx2/bnx2-mips-09-5.0.0.j3.fw \
bnx2/bnx2-rv2p-09-5.0.0.j3.fw \ bnx2/bnx2-rv2p-09-5.0.0.j3.fw \
bnx2/bnx2-rv2p-09ax-5.0.0.j3.fw \ bnx2/bnx2-rv2p-09ax-5.0.0.j3.fw \
......
...@@ -674,8 +674,8 @@ Found in hex form in kernel source. ...@@ -674,8 +674,8 @@ Found in hex form in kernel source.
Driver: bnx2x: Broadcom Everest Driver: bnx2x: Broadcom Everest
File: bnx2x-e1-4.8.53.0.fw.ihex File: bnx2x-e1-5.2.7.0.fw.ihex
File: bnx2x-e1h-4.8.53.0.fw.ihex File: bnx2x-e1h-5.2.7.0.fw.ihex
License: License:
Copyright (c) 2007-2009 Broadcom Corporation Copyright (c) 2007-2009 Broadcom Corporation
......
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