bnx2x: PFC fix
authorYaniv Rosner <yanivr@broadcom.com>
Wed, 4 Apr 2012 01:28:54 +0000 (01:28 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Apr 2012 22:24:22 +0000 (18:24 -0400)
Fix a problem in which PFC frames are not honored, due to incorrect link
attributes synchronization following PMF migration, and verify PFC XON is not
stuck from previous link change.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h

index efa557b76ac75e60235bf5fac8c828ef0588cbff..7e2ebbad75874a5abeb58956dc1c370b56582633 100644 (file)
@@ -1371,7 +1371,14 @@ static void bnx2x_update_pfc_xmac(struct link_params *params,
                pfc1_val |= XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN |
                        XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN |
                        XMAC_PFC_CTRL_HI_REG_RX_PFC_EN |
-                       XMAC_PFC_CTRL_HI_REG_TX_PFC_EN;
+                       XMAC_PFC_CTRL_HI_REG_TX_PFC_EN |
+                       XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON;
+               /* Write pause and PFC registers */
+               REG_WR(bp, xmac_base + XMAC_REG_PAUSE_CTRL, pause_val);
+               REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL, pfc0_val);
+               REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI, pfc1_val);
+               pfc1_val &= ~XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON;
+
        }
 
        /* Write pause and PFC registers */
@@ -6843,6 +6850,12 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars)
                          SINGLE_MEDIA_DIRECT(params)) &&
                         (phy_vars[active_external_phy].fault_detected == 0));
 
+       /* Update the PFC configuration in case it was changed */
+       if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED)
+               vars->link_status |= LINK_STATUS_PFC_ENABLED;
+       else
+               vars->link_status &= ~LINK_STATUS_PFC_ENABLED;
+
        if (vars->link_up)
                rc = bnx2x_update_link_up(params, vars, link_10g_plus);
        else
@@ -12049,6 +12062,9 @@ int bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
 
        bnx2x_emac_init(params, vars);
 
+       if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED)
+               vars->link_status |= LINK_STATUS_PFC_ENABLED;
+
        if (params->num_phys == 0) {
                DP(NETIF_MSG_LINK, "No phy found for initialization !!\n");
                return -EINVAL;
index ab0a250f95fa14ea0107e7fcde58c0d3c33f8612..ecc7fa6a6ca5ed1c01b22649afee218da9e528ca 100644 (file)
 #define XMAC_CTRL_REG_TX_EN                                     (0x1<<0)
 #define XMAC_PAUSE_CTRL_REG_RX_PAUSE_EN                                 (0x1<<18)
 #define XMAC_PAUSE_CTRL_REG_TX_PAUSE_EN                                 (0x1<<17)
+#define XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON                      (0x1<<1)
 #define XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN                     (0x1<<0)
 #define XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN                       (0x1<<3)
 #define XMAC_PFC_CTRL_HI_REG_RX_PFC_EN                          (0x1<<4)