From: Ben Hutchings <ben@decadent.org.uk>
To: Ed Swierk <eswierk@skyportsystems.com>
Cc: Ben Hutchings <bwh@kernel.org>, netdev@vger.kernel.org
Subject: Re: [PATCH v2 RESEND] ethtool: Include SFP serial number and date in EEPROM dump
Date: Sun, 31 May 2015 21:09:42 +0100 [thread overview]
Message-ID: <1433102982.6319.112.camel@decadent.org.uk> (raw)
In-Reply-To: <1432003608-87071-1-git-send-email-eswierk@skyportsystems.com>
[-- Attachment #1: Type: text/plain, Size: 3433 bytes --]
On Mon, 2015-05-18 at 19:46 -0700, Ed Swierk wrote:
> ethtool -m currently omits the serial number, date code, and other useful
> EEPROM fields defined in INF-8074, which is part of the SFF-8079 standard.
> This patch adds them.
>
> It also trims space characters from the end of ASCII text fields.
>
> $ ethtool -m eth0
> ...
> Option values : 0x00 0x10
> Option : TX_DISABLE implemented
> BR margin, max : 0%
> BR margin, min : 0%
> Vendor SN : AGC143953079
> Date code : 140926
>
> Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
Applied, thanks.
Ben.
> ---
> sfpid.c | 41 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
> diff --git a/sfpid.c b/sfpid.c
> index 4f88aa2..b1a5044 100644
> --- a/sfpid.c
> +++ b/sfpid.c
> @@ -355,6 +355,8 @@ static void sff8079_show_ascii(const __u8 *id, unsigned int first_reg,
> unsigned int reg, val;
>
> printf("\t%-41s : ", name);
> + while (first_reg <= last_reg && id[last_reg] == ' ')
> + last_reg--;
> for (reg = first_reg; reg <= last_reg; reg++) {
> val = id[reg];
> putchar(((val >= 32) && (val <= 126)) ? val : '_');
> @@ -362,6 +364,40 @@ static void sff8079_show_ascii(const __u8 *id, unsigned int first_reg,
> printf("\n");
> }
>
> +static void sff8079_show_options(const __u8 *id)
> +{
> + static const char *pfx =
> + "\tOption :";
> +
> + printf("\t%-41s : 0x%02x 0x%02x\n", "Option values", id[64], id[65]);
> + if (id[65] & (1 << 1))
> + printf("%s RX_LOS implemented\n", pfx);
> + if (id[65] & (1 << 2))
> + printf("%s RX_LOS implemented, inverted\n", pfx);
> + if (id[65] & (1 << 3))
> + printf("%s TX_FAULT implemented\n", pfx);
> + if (id[65] & (1 << 4))
> + printf("%s TX_DISABLE implemented\n", pfx);
> + if (id[65] & (1 << 5))
> + printf("%s RATE_SELECT implemented\n", pfx);
> + if (id[65] & (1 << 6))
> + printf("%s Tunable transmitter technology\n", pfx);
> + if (id[65] & (1 << 7))
> + printf("%s Receiver decision threshold implemented\n", pfx);
> + if (id[64] & (1 << 0))
> + printf("%s Linear receiver output implemented\n", pfx);
> + if (id[64] & (1 << 1))
> + printf("%s Power level 2 requirement\n", pfx);
> + if (id[64] & (1 << 2))
> + printf("%s Cooled transceiver implemented\n", pfx);
> + if (id[64] & (1 << 3))
> + printf("%s Retimer or CDR implemented\n", pfx);
> + if (id[64] & (1 << 4))
> + printf("%s Paging implemented\n", pfx);
> + if (id[64] & (1 << 5))
> + printf("%s Power level 3 requirement\n", pfx);
> +}
> +
> void sff8079_show_all(const __u8 *id)
> {
> sff8079_show_identifier(id);
> @@ -385,5 +421,10 @@ void sff8079_show_all(const __u8 *id)
> sff8079_show_oui(id);
> sff8079_show_ascii(id, 40, 55, "Vendor PN");
> sff8079_show_ascii(id, 56, 59, "Vendor rev");
> + sff8079_show_options(id);
> + sff8079_show_value_with_unit(id, 66, "BR margin, max", 1, "%");
> + sff8079_show_value_with_unit(id, 67, "BR margin, min", 1, "%");
> + sff8079_show_ascii(id, 68, 83, "Vendor SN");
> + sff8079_show_ascii(id, 84, 91, "Date code");
> }
> }
--
Ben Hutchings
Reality is just a crutch for people who can't handle science fiction.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
prev parent reply other threads:[~2015-05-31 20:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 2:46 [PATCH v2 RESEND] ethtool: Include SFP serial number and date in EEPROM dump Ed Swierk
2015-05-31 20:09 ` Ben Hutchings [this message]
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=1433102982.6319.112.camel@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=bwh@kernel.org \
--cc=eswierk@skyportsystems.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).