bnxt_en: Add 100G link speed reporting for BCM57454 ASIC in ethtool
authorDeepak Khungar <deepak.khungar@broadcom.com>
Sat, 22 Apr 2017 00:11:24 +0000 (20:11 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Apr 2017 17:54:46 +0000 (13:54 -0400)
Added support for 100G link speed reporting for Broadcom BCM57454
ASIC in ethtool command.

Signed-off-by: Deepak Khungar <deepak.khungar@broadcom.com>
Signed-off-by: Ray Jui <ray.jui@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

index 129b8101b93256366af883a6944eb03de78c9824..447ee3d27d21952980ce2031f12862abe940de18 100644 (file)
@@ -5471,7 +5471,8 @@ static void bnxt_report_link(struct bnxt *bp)
        if (bp->link_info.link_up) {
                const char *duplex;
                const char *flow_ctrl;
-               u16 speed, fec;
+               u32 speed;
+               u16 fec;
 
                netif_carrier_on(bp->dev);
                if (bp->link_info.duplex == BNXT_LINK_DUPLEX_FULL)
@@ -5487,7 +5488,7 @@ static void bnxt_report_link(struct bnxt *bp)
                else
                        flow_ctrl = "none";
                speed = bnxt_fw_to_ethtool_speed(bp->link_info.link_speed);
-               netdev_info(bp->dev, "NIC Link is Up, %d Mbps %s duplex, Flow control: %s\n",
+               netdev_info(bp->dev, "NIC Link is Up, %u Mbps %s duplex, Flow control: %s\n",
                            speed, duplex, flow_ctrl);
                if (bp->flags & BNXT_FLAG_EEE_CAP)
                        netdev_info(bp->dev, "EEE is %s\n",
index c9a1688a65dedd851148af34534c6342779e7636..25fef612de7018d032d6ed0f7321346b56db26bd 100644 (file)
@@ -851,6 +851,7 @@ struct bnxt_link_info {
 #define BNXT_LINK_SPEED_25GB   PORT_PHY_QCFG_RESP_LINK_SPEED_25GB
 #define BNXT_LINK_SPEED_40GB   PORT_PHY_QCFG_RESP_LINK_SPEED_40GB
 #define BNXT_LINK_SPEED_50GB   PORT_PHY_QCFG_RESP_LINK_SPEED_50GB
+#define BNXT_LINK_SPEED_100GB  PORT_PHY_QCFG_RESP_LINK_SPEED_100GB
        u16                     support_speeds;
        u16                     auto_link_speeds;       /* fw adv setting */
 #define BNXT_LINK_SPEED_MSK_100MB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_100MB
@@ -862,6 +863,7 @@ struct bnxt_link_info {
 #define BNXT_LINK_SPEED_MSK_25GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_25GB
 #define BNXT_LINK_SPEED_MSK_40GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_40GB
 #define BNXT_LINK_SPEED_MSK_50GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_50GB
+#define BNXT_LINK_SPEED_MSK_100GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_100GB
        u16                     support_auto_speeds;
        u16                     lp_auto_link_speeds;
        u16                     force_link_speed;
index 848ecf212b8f58fec7e00ab2891d0add3ebb77a5..11ddf0adc6e1e2bad4d681014136eb2706d3bca9 100644 (file)
@@ -929,6 +929,9 @@ u32 _bnxt_fw_to_ethtool_adv_spds(u16 fw_speeds, u8 fw_pause)
        if ((fw_speeds) & BNXT_LINK_SPEED_MSK_50GB)                     \
                ethtool_link_ksettings_add_link_mode(lk_ksettings, name,\
                                                     50000baseCR2_Full);\
+       if ((fw_speeds) & BNXT_LINK_SPEED_MSK_100GB)                    \
+               ethtool_link_ksettings_add_link_mode(lk_ksettings, name,\
+                                                    100000baseCR4_Full);\
        if ((fw_pause) & BNXT_LINK_PAUSE_RX) {                          \
                ethtool_link_ksettings_add_link_mode(lk_ksettings, name,\
                                                     Pause);            \
@@ -965,6 +968,9 @@ u32 _bnxt_fw_to_ethtool_adv_spds(u16 fw_speeds, u8 fw_pause)
        if (ethtool_link_ksettings_test_link_mode(lk_ksettings, name,   \
                                                  50000baseCR2_Full))   \
                (fw_speeds) |= BNXT_LINK_SPEED_MSK_50GB;                \
+       if (ethtool_link_ksettings_test_link_mode(lk_ksettings, name,   \
+                                                 100000baseCR4_Full))  \
+               (fw_speeds) |= BNXT_LINK_SPEED_MSK_100GB;               \
 }
 
 static void bnxt_fw_to_ethtool_advertised_spds(struct bnxt_link_info *link_info,
@@ -1027,6 +1033,8 @@ u32 bnxt_fw_to_ethtool_speed(u16 fw_link_speed)
                return SPEED_40000;
        case BNXT_LINK_SPEED_50GB:
                return SPEED_50000;
+       case BNXT_LINK_SPEED_100GB:
+               return SPEED_100000;
        default:
                return SPEED_UNKNOWN;
        }
@@ -1092,7 +1100,7 @@ static int bnxt_get_link_ksettings(struct net_device *dev,
        return 0;
 }
 
-static u32 bnxt_get_fw_speed(struct net_device *dev, u16 ethtool_speed)
+static u32 bnxt_get_fw_speed(struct net_device *dev, u32 ethtool_speed)
 {
        struct bnxt *bp = netdev_priv(dev);
        struct bnxt_link_info *link_info = &bp->link_info;
@@ -1132,6 +1140,10 @@ static u32 bnxt_get_fw_speed(struct net_device *dev, u16 ethtool_speed)
                if (support_spds & BNXT_LINK_SPEED_MSK_50GB)
                        fw_speed = PORT_PHY_CFG_REQ_AUTO_LINK_SPEED_50GB;
                break;
+       case SPEED_100000:
+               if (support_spds & BNXT_LINK_SPEED_MSK_100GB)
+                       fw_speed = PORT_PHY_CFG_REQ_AUTO_LINK_SPEED_100GB;
+               break;
        default:
                netdev_err(dev, "unsupported speed!\n");
                break;