aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/myri10ge
diff options
context:
space:
mode:
authorBrice Goglin <brice@myri.com>2008-05-08 20:18:24 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-05-13 01:30:27 -0400
commitc0bf8801535d45df3597839edf864e24f60a4188 (patch)
treed69d84c44fed65086d0ee098b0a9eb4349a791d1 /drivers/net/myri10ge
parentf8fd57c11159d89d0d9cd624eafad41c680e8f6e (diff)
myri10ge: report FIBER in ethtool for XFP based NIC
Make ethtool report FIBER for XFP based NIC's port type. Don't bother to poke around and try to find out what is in the XFP cage, since Linux does not have separate media types for -SR -LR, etc. Signed-off-by: Brice Goglin <brice@myri.com> Signed-off-by: Andrew Gallatin <gallatin@myri.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/myri10ge')
-rw-r--r--drivers/net/myri10ge/myri10ge.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 3f871c467ed2..4a65e4155c0f 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -205,6 +205,7 @@ struct myri10ge_priv {
205 int pause; 205 int pause;
206 char *fw_name; 206 char *fw_name;
207 char eeprom_strings[MYRI10GE_EEPROM_STRINGS_SIZE]; 207 char eeprom_strings[MYRI10GE_EEPROM_STRINGS_SIZE];
208 char *product_code_string;
208 char fw_version[128]; 209 char fw_version[128];
209 int fw_ver_major; 210 int fw_ver_major;
210 int fw_ver_minor; 211 int fw_ver_minor;
@@ -421,6 +422,10 @@ static int myri10ge_read_mac_addr(struct myri10ge_priv *mgp)
421 ptr += 1; 422 ptr += 1;
422 } 423 }
423 } 424 }
425 if (memcmp(ptr, "PC=", 3) == 0) {
426 ptr += 3;
427 mgp->product_code_string = ptr;
428 }
424 if (memcmp((const void *)ptr, "SN=", 3) == 0) { 429 if (memcmp((const void *)ptr, "SN=", 3) == 0) {
425 ptr += 3; 430 ptr += 3;
426 mgp->serial_number = simple_strtoul(ptr, &ptr, 10); 431 mgp->serial_number = simple_strtoul(ptr, &ptr, 10);
@@ -1304,9 +1309,39 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
1304static int 1309static int
1305myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) 1310myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
1306{ 1311{
1312 struct myri10ge_priv *mgp = netdev_priv(netdev);
1313 char *ptr;
1314 int i;
1315
1307 cmd->autoneg = AUTONEG_DISABLE; 1316 cmd->autoneg = AUTONEG_DISABLE;
1308 cmd->speed = SPEED_10000; 1317 cmd->speed = SPEED_10000;
1309 cmd->duplex = DUPLEX_FULL; 1318 cmd->duplex = DUPLEX_FULL;
1319
1320 /*
1321 * parse the product code to deterimine the interface type
1322 * (CX4, XFP, Quad Ribbon Fiber) by looking at the character
1323 * after the 3rd dash in the driver's cached copy of the
1324 * EEPROM's product code string.
1325 */
1326 ptr = mgp->product_code_string;
1327 if (ptr == NULL) {
1328 printk(KERN_ERR "myri10ge: %s: Missing product code\n",
1329 netdev->name);
1330 return 0;
1331 }
1332 for (i = 0; i < 3; i++, ptr++) {
1333 ptr = strchr(ptr, '-');
1334 if (ptr == NULL) {
1335 printk(KERN_ERR "myri10ge: %s: Invalid product "
1336 "code %s\n", netdev->name,
1337 mgp->product_code_string);
1338 return 0;
1339 }
1340 }
1341 if (*ptr == 'R' || *ptr == 'Q') {
1342 /* We've found either an XFP or quad ribbon fiber */
1343 cmd->port = PORT_FIBRE;
1344 }
1310 return 0; 1345 return 0;
1311} 1346}
1312 1347