aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorHariprasad Shenai <hariprasad@chelsio.com>2014-10-08 20:18:46 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-09 18:53:52 -0400
commit897d55df3ca794ad4522472d46aa2dbbface8c37 (patch)
tree204b74dbda3423d98d7382617fff9bc1322ffca1 /drivers/net
parent7207c0d1540b679993d1f0bb9c1ff8e068958c75 (diff)
cxgb4vf: Add 40G support for cxgb4vf driver
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c12
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h6
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c10
3 files changed, 21 insertions, 7 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
index 8498a641b2e3..bfa398d91826 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
@@ -163,15 +163,19 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok)
163 netif_carrier_on(dev); 163 netif_carrier_on(dev);
164 164
165 switch (pi->link_cfg.speed) { 165 switch (pi->link_cfg.speed) {
166 case SPEED_10000: 166 case 40000:
167 s = "40Gbps";
168 break;
169
170 case 10000:
167 s = "10Gbps"; 171 s = "10Gbps";
168 break; 172 break;
169 173
170 case SPEED_1000: 174 case 1000:
171 s = "1000Mbps"; 175 s = "1000Mbps";
172 break; 176 break;
173 177
174 case SPEED_100: 178 case 100:
175 s = "100Mbps"; 179 s = "100Mbps";
176 break; 180 break;
177 181
@@ -2351,7 +2355,7 @@ static void cfg_queues(struct adapter *adapter)
2351 struct port_info *pi = adap2pinfo(adapter, pidx); 2355 struct port_info *pi = adap2pinfo(adapter, pidx);
2352 2356
2353 pi->first_qset = qidx; 2357 pi->first_qset = qidx;
2354 pi->nqsets = is_10g_port(&pi->link_cfg) ? q10g : 1; 2358 pi->nqsets = is_x_10g_port(&pi->link_cfg) ? q10g : 1;
2355 qidx += pi->nqsets; 2359 qidx += pi->nqsets;
2356 } 2360 }
2357 s->ethqsets = qidx; 2361 s->ethqsets = qidx;
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h
index f412d0fa0850..95df61dcb4ce 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h
@@ -228,6 +228,12 @@ static inline bool is_10g_port(const struct link_config *lc)
228 return (lc->supported & SUPPORTED_10000baseT_Full) != 0; 228 return (lc->supported & SUPPORTED_10000baseT_Full) != 0;
229} 229}
230 230
231static inline bool is_x_10g_port(const struct link_config *lc)
232{
233 return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0 ||
234 (lc->supported & FW_PORT_CAP_SPEED_40G) != 0;
235}
236
231static inline unsigned int core_ticks_per_usec(const struct adapter *adapter) 237static inline unsigned int core_ticks_per_usec(const struct adapter *adapter)
232{ 238{
233 return adapter->params.vpd.cclk / 1000; 239 return adapter->params.vpd.cclk / 1000;
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
index 25dfeb8f28ed..e984fdc48ba2 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
@@ -327,6 +327,8 @@ int t4vf_port_init(struct adapter *adapter, int pidx)
327 v |= SUPPORTED_1000baseT_Full; 327 v |= SUPPORTED_1000baseT_Full;
328 if (word & FW_PORT_CAP_SPEED_10G) 328 if (word & FW_PORT_CAP_SPEED_10G)
329 v |= SUPPORTED_10000baseT_Full; 329 v |= SUPPORTED_10000baseT_Full;
330 if (word & FW_PORT_CAP_SPEED_40G)
331 v |= SUPPORTED_40000baseSR4_Full;
330 if (word & FW_PORT_CAP_ANEG) 332 if (word & FW_PORT_CAP_ANEG)
331 v |= SUPPORTED_Autoneg; 333 v |= SUPPORTED_Autoneg;
332 init_link_config(&pi->link_cfg, v); 334 init_link_config(&pi->link_cfg, v);
@@ -1352,11 +1354,13 @@ int t4vf_handle_fw_rpl(struct adapter *adapter, const __be64 *rpl)
1352 if (word & FW_PORT_CMD_TXPAUSE) 1354 if (word & FW_PORT_CMD_TXPAUSE)
1353 fc |= PAUSE_TX; 1355 fc |= PAUSE_TX;
1354 if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100M)) 1356 if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100M))
1355 speed = SPEED_100; 1357 speed = 100;
1356 else if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_1G)) 1358 else if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_1G))
1357 speed = SPEED_1000; 1359 speed = 1000;
1358 else if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_10G)) 1360 else if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_10G))
1359 speed = SPEED_10000; 1361 speed = 10000;
1362 else if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_40G))
1363 speed = 40000;
1360 1364
1361 /* 1365 /*
1362 * Scan all of our "ports" (Virtual Interfaces) looking for 1366 * Scan all of our "ports" (Virtual Interfaces) looking for