cxgb4vf: Add 40G support for cxgb4vf driver
authorHariprasad Shenai <hariprasad@chelsio.com>
Thu, 9 Oct 2014 00:18:46 +0000 (05:48 +0530)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Oct 2014 22:53:52 +0000 (18:53 -0400)
Add 40G support for cxgb4vf driver. ethtool speed values are just numbers of
megabits and there is no SPEED_40000 in ethtool speed values. To be consistent,
use integer constants directly for all speeds.

Use is_x_10g_port()("is 10Gb/s or higher") in cfg_queues() instead of
is_10g_port() ("is exactly 10Gb/s"). Else we will end up using a single
"Queue Set" on 40Gb/s adapters.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c

index 8498a641b2e32c9c17169b2dfe9c4122a584a3d9..bfa398d9182681c92203f5a7687010e5fdcad7d8 100644 (file)
@@ -163,15 +163,19 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok)
                netif_carrier_on(dev);
 
                switch (pi->link_cfg.speed) {
-               case SPEED_10000:
+               case 40000:
+                       s = "40Gbps";
+                       break;
+
+               case 10000:
                        s = "10Gbps";
                        break;
 
-               case SPEED_1000:
+               case 1000:
                        s = "1000Mbps";
                        break;
 
-               case SPEED_100:
+               case 100:
                        s = "100Mbps";
                        break;
 
@@ -2351,7 +2355,7 @@ static void cfg_queues(struct adapter *adapter)
                struct port_info *pi = adap2pinfo(adapter, pidx);
 
                pi->first_qset = qidx;
-               pi->nqsets = is_10g_port(&pi->link_cfg) ? q10g : 1;
+               pi->nqsets = is_x_10g_port(&pi->link_cfg) ? q10g : 1;
                qidx += pi->nqsets;
        }
        s->ethqsets = qidx;
index f412d0fa0850c720849301b46584a208bfd79b26..95df61dcb4ce57021237a15013bfdc8e88c0fa5d 100644 (file)
@@ -228,6 +228,12 @@ static inline bool is_10g_port(const struct link_config *lc)
        return (lc->supported & SUPPORTED_10000baseT_Full) != 0;
 }
 
+static inline bool is_x_10g_port(const struct link_config *lc)
+{
+       return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0 ||
+               (lc->supported & FW_PORT_CAP_SPEED_40G) != 0;
+}
+
 static inline unsigned int core_ticks_per_usec(const struct adapter *adapter)
 {
        return adapter->params.vpd.cclk / 1000;
index 25dfeb8f28ed015c6c49f12e163809daa8e1976a..e984fdc48ba2e326a738e6f5bfa14e1bfda73f02 100644 (file)
@@ -327,6 +327,8 @@ int t4vf_port_init(struct adapter *adapter, int pidx)
                v |= SUPPORTED_1000baseT_Full;
        if (word & FW_PORT_CAP_SPEED_10G)
                v |= SUPPORTED_10000baseT_Full;
+       if (word & FW_PORT_CAP_SPEED_40G)
+               v |= SUPPORTED_40000baseSR4_Full;
        if (word & FW_PORT_CAP_ANEG)
                v |= SUPPORTED_Autoneg;
        init_link_config(&pi->link_cfg, v);
@@ -1352,11 +1354,13 @@ int t4vf_handle_fw_rpl(struct adapter *adapter, const __be64 *rpl)
                if (word & FW_PORT_CMD_TXPAUSE)
                        fc |= PAUSE_TX;
                if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100M))
-                       speed = SPEED_100;
+                       speed = 100;
                else if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_1G))
-                       speed = SPEED_1000;
+                       speed = 1000;
                else if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_10G))
-                       speed = SPEED_10000;
+                       speed = 10000;
+               else if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_40G))
+                       speed = 40000;
 
                /*
                 * Scan all of our "ports" (Virtual Interfaces) looking for