All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brice Goglin <brice@myri.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: netdev@vger.kernel.org
Subject: [PATCH 06/16] myri10ge: report FIBER in ethtool for XFP based NIC
Date: Fri, 09 May 2008 02:18:24 +0200	[thread overview]
Message-ID: <48239850.5050900@myri.com> (raw)
In-Reply-To: <482397A3.1050604@myri.com>

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>
---
 drivers/net/myri10ge/myri10ge.c |   35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

Index: linux-2.6/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-2.6.orig/drivers/net/myri10ge/myri10ge.c	2008-05-09 00:04:07.000000000 +0200
+++ linux-2.6/drivers/net/myri10ge/myri10ge.c	2008-05-09 00:04:48.000000000 +0200
@@ -205,6 +205,7 @@
 	int pause;
 	char *fw_name;
 	char eeprom_strings[MYRI10GE_EEPROM_STRINGS_SIZE];
+	char *product_code_string;
 	char fw_version[128];
 	int fw_ver_major;
 	int fw_ver_minor;
@@ -421,6 +422,10 @@
 				ptr += 1;
 			}
 		}
+		if (memcmp(ptr, "PC=", 3) == 0) {
+			ptr += 3;
+			mgp->product_code_string = ptr;
+		}
 		if (memcmp((const void *)ptr, "SN=", 3) == 0) {
 			ptr += 3;
 			mgp->serial_number = simple_strtoul(ptr, &ptr, 10);
@@ -1304,9 +1309,39 @@
 static int
 myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
 {
+	struct myri10ge_priv *mgp = netdev_priv(netdev);
+	char *ptr;
+	int i;
+
 	cmd->autoneg = AUTONEG_DISABLE;
 	cmd->speed = SPEED_10000;
 	cmd->duplex = DUPLEX_FULL;
+
+	/*
+	 * parse the product code to deterimine the interface type
+	 * (CX4, XFP, Quad Ribbon Fiber) by looking at the character
+	 * after the 3rd dash in the driver's cached copy of the
+	 * EEPROM's product code string.
+	 */
+	ptr = mgp->product_code_string;
+	if (ptr == NULL) {
+		printk(KERN_ERR "myri10ge: %s: Missing product code\n",
+			netdev->name);
+		return 0;
+	}
+	for (i = 0; i < 3; i++, ptr++) {
+		ptr = strchr(ptr, '-');
+		if (ptr == NULL) {
+			printk(KERN_ERR "myri10ge: %s: Invalid product "
+			       "code %s\n", netdev->name,
+			       mgp->product_code_string);
+			return 0;
+		}
+	}
+	if (*ptr == 'R' || *ptr == 'Q') {
+		/* We've found either an XFP or quad ribbon fiber */
+		cmd->port = PORT_FIBRE;
+	}
 	return 0;
 }
 



  parent reply	other threads:[~2008-05-09  0:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-09  0:15 [PATCH 0/16] myri10ge updates Brice Goglin
2008-05-09  0:16 ` [PATCH 01/16] myri10ge: update firmware headers Brice Goglin
2008-05-13  5:15   ` Jeff Garzik
2008-05-09  0:16 ` [PATCH 02/16] myri10ge: fix module parameter descriptions Brice Goglin
2008-05-09  0:17 ` [PATCH 03/16] myri10ge: increase and fix handoff timeout Brice Goglin
2008-05-09  0:17 ` [PATCH 04/16] myri10ge: properly align scratch buffers Brice Goglin
2008-05-09  0:17 ` [PATCH 05/16] myri10ge: don't warn on rx page allocation failure Brice Goglin
2008-05-09  0:18 ` Brice Goglin [this message]
2008-05-09  0:18 ` [PATCH 07/16] myri10ge: add barrier in myri10ge_send_cmd Brice Goglin
2008-05-09  0:19 ` [PATCH 08/16] myri10ge: trivial formatting fix Brice Goglin
2008-05-09  0:19 ` [PATCH 09/16] myri10ge: fix potential infinite loop in enable_ecrc Brice Goglin
2008-05-09  0:20 ` [PATCH 10/16] myri10ge: move data structures into a single slice Brice Goglin
2008-05-09  0:20 ` [PATCH 11/16] myri10ge: cleanup retrieving of firmware capabilities Brice Goglin
2008-05-09  0:20 ` [PATCH 12/16] myri10ge: fix the number of interrupt slots Brice Goglin
2008-05-09  0:21 ` [PATCH 13/16] myri10ge: add routines for multislices Brice Goglin
2008-05-13  5:47   ` Jeff Garzik
2008-05-13 18:34     ` Brice Goglin
2008-05-13 18:36       ` [PATCH][MAINTAINERS] Add maintainers for myri10ge driver Brice Goglin
2008-05-09  0:21 ` [PATCH 14/16] myri10ge: add multislices support Brice Goglin
2008-05-09  0:22 ` [PATCH 15/16] myri10ge: add Direct Cache Access support Brice Goglin
2008-05-09  0:22 ` [PATCH 16/16] myri10ge: update driver version Brice Goglin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48239850.5050900@myri.com \
    --to=brice@myri.com \
    --cc=jeff@garzik.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.