aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x_main.c
diff options
context:
space:
mode:
authorEilon Greenstein <eilong@broadcom.com>2009-10-15 03:17:20 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-15 03:17:20 -0400
commitb015e3d112cab1880d262c56655c3ff60e179ceb (patch)
tree5d3d2c780e4ac8cfdd88e921c36fbcf447d585ad /drivers/net/bnx2x_main.c
parent69dc2df3aaee2ce5e875b14b7271436559be9a95 (diff)
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: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x_main.c')
-rw-r--r--drivers/net/bnx2x_main.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index b4e9c6ebac54..691cf1541892 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -2333,8 +2333,14 @@ static void bnx2x_calc_vn_weight_sum(struct bnx2x *bp)
2333 } 2333 }
2334 2334
2335 /* ... only if all min rates are zeros - disable fairness */ 2335 /* ... only if all min rates are zeros - disable fairness */
2336 if (all_zero) 2336 if (all_zero) {
2337 bp->vn_weight_sum = 0; 2337 bp->cmng.flags.cmng_enables &=
2338 ~CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
2339 DP(NETIF_MSG_IFUP, "All MIN values are zeroes"
2340 " fairness will be disabled\n");
2341 } else
2342 bp->cmng.flags.cmng_enables |=
2343 CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
2338} 2344}
2339 2345
2340static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func) 2346static 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 } else { 2359 } else {
2354 vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >> 2360 vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >>
2355 FUNC_MF_CFG_MIN_BW_SHIFT) * 100; 2361 FUNC_MF_CFG_MIN_BW_SHIFT) * 100;
2356 /* If fairness is enabled (not all min rates are zeroes) and 2362 /* If min rate is zero - set it to 1 */
2357 if current min rate is zero - set it to 1. 2363 if (!vn_min_rate)
2358 This is a requirement of the algorithm. */
2359 if (bp->vn_weight_sum && (vn_min_rate == 0))
2360 vn_min_rate = DEF_MIN_RATE; 2364 vn_min_rate = DEF_MIN_RATE;
2361 vn_max_rate = ((vn_cfg & FUNC_MF_CFG_MAX_BW_MASK) >> 2365 vn_max_rate = ((vn_cfg & FUNC_MF_CFG_MAX_BW_MASK) >>
2362 FUNC_MF_CFG_MAX_BW_SHIFT) * 100; 2366 FUNC_MF_CFG_MAX_BW_SHIFT) * 100;
2363 } 2367 }
2364
2365 DP(NETIF_MSG_IFUP, 2368 DP(NETIF_MSG_IFUP,
2366 "func %d: vn_min_rate=%d vn_max_rate=%d vn_weight_sum=%d\n", 2369 "func %d: vn_min_rate %d vn_max_rate %d vn_weight_sum %d\n",
2367 func, vn_min_rate, vn_max_rate, bp->vn_weight_sum); 2370 func, vn_min_rate, vn_max_rate, bp->vn_weight_sum);
2368 2371
2369 memset(&m_rs_vn, 0, sizeof(struct rate_shaping_vars_per_vn)); 2372 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 else 2493 else
2491 bnx2x_stats_handle(bp, STATS_EVENT_STOP); 2494 bnx2x_stats_handle(bp, STATS_EVENT_STOP);
2492 2495
2493 bp->mf_config = SHMEM_RD(bp, mf_cfg.func_mf_config[func].config);
2494 bnx2x_calc_vn_weight_sum(bp); 2496 bnx2x_calc_vn_weight_sum(bp);
2495 2497
2496 /* indicate link status */ 2498 /* indicate link status */
@@ -2634,10 +2636,7 @@ static void bnx2x_update_min_max(struct bnx2x *bp)
2634 2636
2635static void bnx2x_dcc_event(struct bnx2x *bp, u32 dcc_event) 2637static void bnx2x_dcc_event(struct bnx2x *bp, u32 dcc_event)
2636{ 2638{
2637 int func = BP_FUNC(bp);
2638
2639 DP(BNX2X_MSG_MCP, "dcc_event 0x%x\n", dcc_event); 2639 DP(BNX2X_MSG_MCP, "dcc_event 0x%x\n", dcc_event);
2640 bp->mf_config = SHMEM_RD(bp, mf_cfg.func_mf_config[func].config);
2641 2640
2642 if (dcc_event & DRV_STATUS_DCC_DISABLE_ENABLE_PF) { 2641 if (dcc_event & DRV_STATUS_DCC_DISABLE_ENABLE_PF) {
2643 2642
@@ -3067,6 +3066,8 @@ static inline void bnx2x_attn_int_deasserted3(struct bnx2x *bp, u32 attn)
3067 int func = BP_FUNC(bp); 3066 int func = BP_FUNC(bp);
3068 3067
3069 REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_12 + func*4, 0); 3068 REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_12 + func*4, 0);
3069 bp->mf_config = SHMEM_RD(bp,
3070 mf_cfg.func_mf_config[func].config);
3070 val = SHMEM_RD(bp, func_mb[func].drv_status); 3071 val = SHMEM_RD(bp, func_mb[func].drv_status);
3071 if (val & DRV_STATUS_DCC_EVENT_MASK) 3072 if (val & DRV_STATUS_DCC_EVENT_MASK)
3072 bnx2x_dcc_event(bp, 3073 bnx2x_dcc_event(bp,
@@ -5559,20 +5560,18 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
5559 bp->link_vars.line_speed = SPEED_10000; 5560 bp->link_vars.line_speed = SPEED_10000;
5560 bnx2x_init_port_minmax(bp); 5561 bnx2x_init_port_minmax(bp);
5561 5562
5563 if (!BP_NOMCP(bp))
5564 bp->mf_config =
5565 SHMEM_RD(bp, mf_cfg.func_mf_config[func].config);
5562 bnx2x_calc_vn_weight_sum(bp); 5566 bnx2x_calc_vn_weight_sum(bp);
5563 5567
5564 for (vn = VN_0; vn < E1HVN_MAX; vn++) 5568 for (vn = VN_0; vn < E1HVN_MAX; vn++)
5565 bnx2x_init_vn_minmax(bp, 2*vn + port); 5569 bnx2x_init_vn_minmax(bp, 2*vn + port);
5566 5570
5567 /* Enable rate shaping and fairness */ 5571 /* Enable rate shaping and fairness */
5568 bp->cmng.flags.cmng_enables = 5572 bp->cmng.flags.cmng_enables |=
5569 CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN; 5573 CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN;
5570 if (bp->vn_weight_sum) 5574
5571 bp->cmng.flags.cmng_enables |=
5572 CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
5573 else
5574 DP(NETIF_MSG_IFUP, "All MIN values are zeroes"
5575 " fairness will be disabled\n");
5576 } else { 5575 } else {
5577 /* rate shaping and fairness are disabled */ 5576 /* rate shaping and fairness are disabled */
5578 DP(NETIF_MSG_IFUP, 5577 DP(NETIF_MSG_IFUP,
@@ -9038,17 +9037,18 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
9038 if (netif_carrier_ok(dev)) { 9037 if (netif_carrier_ok(dev)) {
9039 cmd->speed = bp->link_vars.line_speed; 9038 cmd->speed = bp->link_vars.line_speed;
9040 cmd->duplex = bp->link_vars.duplex; 9039 cmd->duplex = bp->link_vars.duplex;
9041 } else { 9040 if (IS_E1HMF(bp)) {
9042 cmd->speed = bp->link_params.req_line_speed; 9041 u16 vn_max_rate;
9043 cmd->duplex = bp->link_params.req_duplex;
9044 }
9045 if (IS_E1HMF(bp)) {
9046 u16 vn_max_rate;
9047 9042
9048 vn_max_rate = ((bp->mf_config & FUNC_MF_CFG_MAX_BW_MASK) >> 9043 vn_max_rate =
9044 ((bp->mf_config & FUNC_MF_CFG_MAX_BW_MASK) >>
9049 FUNC_MF_CFG_MAX_BW_SHIFT) * 100; 9045 FUNC_MF_CFG_MAX_BW_SHIFT) * 100;
9050 if (vn_max_rate < cmd->speed) 9046 if (vn_max_rate < cmd->speed)
9051 cmd->speed = vn_max_rate; 9047 cmd->speed = vn_max_rate;
9048 }
9049 } else {
9050 cmd->speed = -1;
9051 cmd->duplex = -1;
9052 } 9052 }
9053 9053
9054 if (bp->link_params.switch_cfg == SWITCH_CFG_10G) { 9054 if (bp->link_params.switch_cfg == SWITCH_CFG_10G) {