diff options
| -rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4vf/adapter.h | 4 | ||||
| -rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 142 | ||||
| -rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h | 2 | ||||
| -rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | 54 |
4 files changed, 161 insertions, 41 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h index d00a751f0588..6049f70e110c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h +++ b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h | |||
| @@ -96,6 +96,9 @@ struct port_info { | |||
| 96 | s16 xact_addr_filt; /* index of our MAC address filter */ | 96 | s16 xact_addr_filt; /* index of our MAC address filter */ |
| 97 | u16 rss_size; /* size of VI's RSS table slice */ | 97 | u16 rss_size; /* size of VI's RSS table slice */ |
| 98 | u8 pidx; /* index into adapter port[] */ | 98 | u8 pidx; /* index into adapter port[] */ |
| 99 | s8 mdio_addr; | ||
| 100 | u8 port_type; /* firmware port type */ | ||
| 101 | u8 mod_type; /* firmware module type */ | ||
| 99 | u8 port_id; /* physical port ID */ | 102 | u8 port_id; /* physical port ID */ |
| 100 | u8 nqsets; /* # of "Queue Sets" */ | 103 | u8 nqsets; /* # of "Queue Sets" */ |
| 101 | u8 first_qset; /* index of first "Queue Set" */ | 104 | u8 first_qset; /* index of first "Queue Set" */ |
| @@ -522,6 +525,7 @@ static inline struct adapter *netdev2adap(const struct net_device *dev) | |||
| 522 | * is "contracted" to provide for the common code. | 525 | * is "contracted" to provide for the common code. |
| 523 | */ | 526 | */ |
| 524 | void t4vf_os_link_changed(struct adapter *, int, int); | 527 | void t4vf_os_link_changed(struct adapter *, int, int); |
| 528 | void t4vf_os_portmod_changed(struct adapter *, int); | ||
| 525 | 529 | ||
| 526 | /* | 530 | /* |
| 527 | * SGE function prototype declarations. | 531 | * SGE function prototype declarations. |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index aa74ec34a467..2215d432a059 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | #include <linux/etherdevice.h> | 44 | #include <linux/etherdevice.h> |
| 45 | #include <linux/debugfs.h> | 45 | #include <linux/debugfs.h> |
| 46 | #include <linux/ethtool.h> | 46 | #include <linux/ethtool.h> |
| 47 | #include <linux/mdio.h> | ||
| 47 | 48 | ||
| 48 | #include "t4vf_common.h" | 49 | #include "t4vf_common.h" |
| 49 | #include "t4vf_defs.h" | 50 | #include "t4vf_defs.h" |
| @@ -210,6 +211,38 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok) | |||
| 210 | } | 211 | } |
| 211 | 212 | ||
| 212 | /* | 213 | /* |
| 214 | * THe port module type has changed on the indicated "port" (Virtual | ||
| 215 | * Interface). | ||
| 216 | */ | ||
| 217 | void t4vf_os_portmod_changed(struct adapter *adapter, int pidx) | ||
| 218 | { | ||
| 219 | static const char * const mod_str[] = { | ||
| 220 | NULL, "LR", "SR", "ER", "passive DA", "active DA", "LRM" | ||
| 221 | }; | ||
| 222 | const struct net_device *dev = adapter->port[pidx]; | ||
| 223 | const struct port_info *pi = netdev_priv(dev); | ||
| 224 | |||
| 225 | if (pi->mod_type == FW_PORT_MOD_TYPE_NONE) | ||
| 226 | dev_info(adapter->pdev_dev, "%s: port module unplugged\n", | ||
| 227 | dev->name); | ||
| 228 | else if (pi->mod_type < ARRAY_SIZE(mod_str)) | ||
| 229 | dev_info(adapter->pdev_dev, "%s: %s port module inserted\n", | ||
| 230 | dev->name, mod_str[pi->mod_type]); | ||
| 231 | else if (pi->mod_type == FW_PORT_MOD_TYPE_NOTSUPPORTED) | ||
| 232 | dev_info(adapter->pdev_dev, "%s: unsupported optical port " | ||
| 233 | "module inserted\n", dev->name); | ||
| 234 | else if (pi->mod_type == FW_PORT_MOD_TYPE_UNKNOWN) | ||
| 235 | dev_info(adapter->pdev_dev, "%s: unknown port module inserted," | ||
| 236 | "forcing TWINAX\n", dev->name); | ||
| 237 | else if (pi->mod_type == FW_PORT_MOD_TYPE_ERROR) | ||
| 238 | dev_info(adapter->pdev_dev, "%s: transceiver module error\n", | ||
| 239 | dev->name); | ||
| 240 | else | ||
| 241 | dev_info(adapter->pdev_dev, "%s: unknown module type %d " | ||
| 242 | "inserted\n", dev->name, pi->mod_type); | ||
| 243 | } | ||
| 244 | |||
| 245 | /* | ||
| 213 | * Net device operations. | 246 | * Net device operations. |
| 214 | * ====================== | 247 | * ====================== |
| 215 | */ | 248 | */ |
| @@ -1193,24 +1226,103 @@ static void cxgb4vf_poll_controller(struct net_device *dev) | |||
| 1193 | * state of the port to which we're linked. | 1226 | * state of the port to which we're linked. |
| 1194 | */ | 1227 | */ |
| 1195 | 1228 | ||
| 1196 | /* | 1229 | static unsigned int t4vf_from_fw_linkcaps(enum fw_port_type type, |
| 1197 | * Return current port link settings. | 1230 | unsigned int caps) |
| 1198 | */ | 1231 | { |
| 1199 | static int cxgb4vf_get_settings(struct net_device *dev, | 1232 | unsigned int v = 0; |
| 1200 | struct ethtool_cmd *cmd) | 1233 | |
| 1201 | { | 1234 | if (type == FW_PORT_TYPE_BT_SGMII || type == FW_PORT_TYPE_BT_XFI || |
| 1202 | const struct port_info *pi = netdev_priv(dev); | 1235 | type == FW_PORT_TYPE_BT_XAUI) { |
| 1236 | v |= SUPPORTED_TP; | ||
| 1237 | if (caps & FW_PORT_CAP_SPEED_100M) | ||
| 1238 | v |= SUPPORTED_100baseT_Full; | ||
| 1239 | if (caps & FW_PORT_CAP_SPEED_1G) | ||
| 1240 | v |= SUPPORTED_1000baseT_Full; | ||
| 1241 | if (caps & FW_PORT_CAP_SPEED_10G) | ||
| 1242 | v |= SUPPORTED_10000baseT_Full; | ||
| 1243 | } else if (type == FW_PORT_TYPE_KX4 || type == FW_PORT_TYPE_KX) { | ||
| 1244 | v |= SUPPORTED_Backplane; | ||
| 1245 | if (caps & FW_PORT_CAP_SPEED_1G) | ||
| 1246 | v |= SUPPORTED_1000baseKX_Full; | ||
| 1247 | if (caps & FW_PORT_CAP_SPEED_10G) | ||
| 1248 | v |= SUPPORTED_10000baseKX4_Full; | ||
| 1249 | } else if (type == FW_PORT_TYPE_KR) | ||
| 1250 | v |= SUPPORTED_Backplane | SUPPORTED_10000baseKR_Full; | ||
| 1251 | else if (type == FW_PORT_TYPE_BP_AP) | ||
| 1252 | v |= SUPPORTED_Backplane | SUPPORTED_10000baseR_FEC | | ||
| 1253 | SUPPORTED_10000baseKR_Full | SUPPORTED_1000baseKX_Full; | ||
| 1254 | else if (type == FW_PORT_TYPE_BP4_AP) | ||
| 1255 | v |= SUPPORTED_Backplane | SUPPORTED_10000baseR_FEC | | ||
| 1256 | SUPPORTED_10000baseKR_Full | SUPPORTED_1000baseKX_Full | | ||
| 1257 | SUPPORTED_10000baseKX4_Full; | ||
| 1258 | else if (type == FW_PORT_TYPE_FIBER_XFI || | ||
| 1259 | type == FW_PORT_TYPE_FIBER_XAUI || | ||
| 1260 | type == FW_PORT_TYPE_SFP || | ||
| 1261 | type == FW_PORT_TYPE_QSFP_10G || | ||
| 1262 | type == FW_PORT_TYPE_QSA) { | ||
| 1263 | v |= SUPPORTED_FIBRE; | ||
| 1264 | if (caps & FW_PORT_CAP_SPEED_1G) | ||
| 1265 | v |= SUPPORTED_1000baseT_Full; | ||
| 1266 | if (caps & FW_PORT_CAP_SPEED_10G) | ||
| 1267 | v |= SUPPORTED_10000baseT_Full; | ||
| 1268 | } else if (type == FW_PORT_TYPE_BP40_BA || | ||
| 1269 | type == FW_PORT_TYPE_QSFP) { | ||
| 1270 | v |= SUPPORTED_40000baseSR4_Full; | ||
| 1271 | v |= SUPPORTED_FIBRE; | ||
| 1272 | } | ||
| 1273 | |||
| 1274 | if (caps & FW_PORT_CAP_ANEG) | ||
| 1275 | v |= SUPPORTED_Autoneg; | ||
| 1276 | return v; | ||
| 1277 | } | ||
| 1278 | |||
| 1279 | static int cxgb4vf_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
| 1280 | { | ||
| 1281 | const struct port_info *p = netdev_priv(dev); | ||
| 1282 | |||
| 1283 | if (p->port_type == FW_PORT_TYPE_BT_SGMII || | ||
| 1284 | p->port_type == FW_PORT_TYPE_BT_XFI || | ||
| 1285 | p->port_type == FW_PORT_TYPE_BT_XAUI) | ||
| 1286 | cmd->port = PORT_TP; | ||
| 1287 | else if (p->port_type == FW_PORT_TYPE_FIBER_XFI || | ||
| 1288 | p->port_type == FW_PORT_TYPE_FIBER_XAUI) | ||
| 1289 | cmd->port = PORT_FIBRE; | ||
| 1290 | else if (p->port_type == FW_PORT_TYPE_SFP || | ||
| 1291 | p->port_type == FW_PORT_TYPE_QSFP_10G || | ||
| 1292 | p->port_type == FW_PORT_TYPE_QSA || | ||
| 1293 | p->port_type == FW_PORT_TYPE_QSFP) { | ||
| 1294 | if (p->mod_type == FW_PORT_MOD_TYPE_LR || | ||
| 1295 | p->mod_type == FW_PORT_MOD_TYPE_SR || | ||
| 1296 | p->mod_type == FW_PORT_MOD_TYPE_ER || | ||
| 1297 | p->mod_type == FW_PORT_MOD_TYPE_LRM) | ||
| 1298 | cmd->port = PORT_FIBRE; | ||
| 1299 | else if (p->mod_type == FW_PORT_MOD_TYPE_TWINAX_PASSIVE || | ||
| 1300 | p->mod_type == FW_PORT_MOD_TYPE_TWINAX_ACTIVE) | ||
| 1301 | cmd->port = PORT_DA; | ||
| 1302 | else | ||
| 1303 | cmd->port = PORT_OTHER; | ||
| 1304 | } else | ||
| 1305 | cmd->port = PORT_OTHER; | ||
| 1203 | 1306 | ||
| 1204 | cmd->supported = pi->link_cfg.supported; | 1307 | if (p->mdio_addr >= 0) { |
| 1205 | cmd->advertising = pi->link_cfg.advertising; | 1308 | cmd->phy_address = p->mdio_addr; |
| 1309 | cmd->transceiver = XCVR_EXTERNAL; | ||
