bnx2x: Allowing 0 as initial fairness value
authorEilon Greenstein <eilong@broadcom.com>
Thu, 15 Oct 2009 07:17:20 +0000 (00:17 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 15 Oct 2009 07:17:20 +0000 (00:17 -0700)
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>
drivers/net/bnx2x_hsi.h
drivers/net/bnx2x_main.c
firmware/Makefile
firmware/WHENCE

index 994743d892ea3dae20f9b79f652e3a31b5f22635..dc2f8ed5fd071f0305b65f5a9de11337c167417a 100644 (file)
@@ -1259,8 +1259,8 @@ struct host_func_stats {
 
 
 #define BCM_5710_FW_MAJOR_VERSION                      5
-#define BCM_5710_FW_MINOR_VERSION                      0
-#define BCM_5710_FW_REVISION_VERSION                   21
+#define BCM_5710_FW_MINOR_VERSION                      2
+#define BCM_5710_FW_REVISION_VERSION                   7
 #define BCM_5710_FW_ENGINEERING_VERSION                0
 #define BCM_5710_FW_COMPILE_FLAGS                      1
 
index b4e9c6ebac54ae0f397eee67fb8ace6afedde599..691cf15418924966a2d294c597c82bfefc13ea58 100644 (file)
@@ -2333,8 +2333,14 @@ static void bnx2x_calc_vn_weight_sum(struct bnx2x *bp)
        }
 
        /* ... only if all min rates are zeros - disable fairness */
-       if (all_zero)
-               bp->vn_weight_sum = 0;
+       if (all_zero) {
+               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)
@@ -2353,17 +2359,14 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func)
        } else {
                vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >>
                                FUNC_MF_CFG_MIN_BW_SHIFT) * 100;
-               /* If fairness is enabled (not all min rates are zeroes) and
-                  if current min rate is zero - set it to 1.
-                  This is a requirement of the algorithm. */
-               if (bp->vn_weight_sum && (vn_min_rate == 0))
+               /* If min rate is zero - set it to 1 */
+               if (!vn_min_rate)
                        vn_min_rate = DEF_MIN_RATE;
                vn_max_rate = ((vn_cfg & FUNC_MF_CFG_MAX_BW_MASK) >>
                                FUNC_MF_CFG_MAX_BW_SHIFT) * 100;
        }
-
        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);
 
        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)
        else
                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);
 
        /* indicate link status */
@@ -2634,10 +2636,7 @@ static void bnx2x_update_min_max(struct bnx2x *bp)
 
 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);
-       bp->mf_config = SHMEM_RD(bp, mf_cfg.func_mf_config[func].config);
 
        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)
                        int func = BP_FUNC(bp);
 
                        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);
                        if (val & DRV_STATUS_DCC_EVENT_MASK)
                                bnx2x_dcc_event(bp,
@@ -5559,20 +5560,18 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
                bp->link_vars.line_speed = SPEED_10000;
                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);
 
                for (vn = VN_0; vn < E1HVN_MAX; vn++)
                        bnx2x_init_vn_minmax(bp, 2*vn + port);
 
                /* Enable rate shaping and fairness */
-               bp->cmng.flags.cmng_enables =
+               bp->cmng.flags.cmng_enables |=
                                        CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN;
-               if (bp->vn_weight_sum)
-                       bp->cmng.flags.cmng_enables |=
-                                       CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
-               else
-                       DP(NETIF_MSG_IFUP, "All MIN values are zeroes"
-                          "  fairness will be disabled\n");
+
        } else {
                /* rate shaping and fairness are disabled */
                DP(NETIF_MSG_IFUP,
@@ -9038,17 +9037,18 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        if (netif_carrier_ok(dev)) {
                cmd->speed = bp->link_vars.line_speed;
                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)) {
-               u16 vn_max_rate;
+               if (IS_E1HMF(bp)) {
+                       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;
-               if (vn_max_rate < cmd->speed)
-                       cmd->speed = vn_max_rate;
+                       if (vn_max_rate < cmd->speed)
+                               cmd->speed = vn_max_rate;
+               }
+       } else {
+               cmd->speed = -1;
+               cmd->duplex = -1;
        }
 
        if (bp->link_params.switch_cfg == SWITCH_CFG_10G) {
index a6c7c3e47e420c24ab45ecc7f69719be05954cca..45c04660a44d260eee76b37f615d2248de276f00 100644 (file)
@@ -32,7 +32,7 @@ fw-shipped-$(CONFIG_ADAPTEC_STARFIRE) += adaptec/starfire_rx.bin \
                                         adaptec/starfire_tx.bin
 fw-shipped-$(CONFIG_ATARI_DSP56K) += dsp56k/bootstrap.bin
 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 \
                             bnx2/bnx2-rv2p-09-5.0.0.j3.fw \
                             bnx2/bnx2-rv2p-09ax-5.0.0.j3.fw \
index c437e14f0b11ef72c73c771d1f52a0e635d10619..a07aede9fcc3c6d9b3c887bffc93098b266bbeef 100644 (file)
@@ -674,8 +674,8 @@ Found in hex form in kernel source.
 
 Driver: bnx2x: Broadcom Everest
 
-File: bnx2x-e1-4.8.53.0.fw.ihex
-File: bnx2x-e1h-4.8.53.0.fw.ihex
+File: bnx2x-e1-5.2.7.0.fw.ihex
+File: bnx2x-e1h-5.2.7.0.fw.ihex
 
 License:
   Copyright (c) 2007-2009 Broadcom Corporation