From: Peter Wu <lekensteyn@gmail.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: netdev@vger.kernel.org, Francois Romieu <romieu@fr.zoreil.com>
Subject: Re: [PATCH v3 1/2] realtek: convert to per-chip mask
Date: Fri, 09 Aug 2013 10:51:11 +0200 [thread overview]
Message-ID: <6171378.LP1RDUmkgD@al> (raw)
In-Reply-To: <1375986341.2853.52.camel@deadeye.wl.decadent.org.uk>
On Thursday 08 August 2013 20:25:41 Ben Hutchings wrote:
> On Thu, 2013-07-25 at 15:36 +0200, Peter Wu wrote:
> [...]
>
> > @@ -35,36 +32,62 @@ enum chip_type {
> >
> > RTL8100E2,
> >
> > };
> >
> > -enum {
> > - chip_type_mask = HW_REVID(1, 1, 1, 1, 1, 1, 1, 1)
> > +static const char * const chip_names[] = {
> > + [RTL8139] = "8139",
> > + [RTL8139_K] = "8139-K",
> > + [RTL8139A] = "8139A",
> > + [RTL8139A_G] = "8139A-G",
> > + [RTL8139B] = "8139B",
> > + [RTL8130] = "8130",
> > + [RTL8139C] = "8139C",
> > + [RTL8100] = "8100",
> > + [RTL8100B_8139D] = "8100B/8139D",
> > + [RTL8139C] = "8139C+",
>
> Shouldn't the index here be RTL8139Cp?
The specifications mention "RTL8139C+", I took pre-8169 names from the previous
rtl_info_tbl contents:
- { "RTL-8139C+", HW_REVID(0, 1, 1, 1, 0, 1, 1, 0) },
> [...]
>
> > static struct chip_info {
> >
> > - const char *name;
> >
> > u32 id_mask;
> >
> > + u32 id_val;
> > + int mac_version;
> >
> > } rtl_info_tbl[] = {
>
> [...]
>
> > - { "RTL-8169/8110SCe", HW_REVID(1, 0, 0, 1, 1, 0, 0, 0) },
>
> [...]
>
> > + { 0xfcc00000, 0x68000000, RTL8169_8110SCe },
>
> [...]
>
> The old value would be converted to 0x98000000; is this a fix or a
> mistake?
I made a mistake here, I pre-processed it to some Javascript code, but
apparantly (1 << 31) overflows to -0x80000000 which is what you are seeing
here. I'll fix it up in a next revision.
In the following patch (2/2), I inserted automatically extracted values from
the r8169 driver using an AWK script (see bottom of this message). At that
point, "8169sc/8110sc" is restored again:
[RTL_GIGA_MAC_VER_06] = "8169sc/8110sc",
...
{ 0xfc800000, 0x98000000, RTL_GIGA_MAC_VER_06 },
Thanks for reviewing.
Regards,
Peter
--
#!/usr/bin/awk -f
# Usage: $0 drivers/net/ethernet/realtek/r8169.c
BEGIN {
# stage 0: copy enum for chip version
# stage 1: grab names
# stage 2: grab masks and mappings to name
stage = -1;
ver = "";
}
/enum mac_version/ {
stage = 0;
}
/struct rtl_mac_info/ {
stage = 2;
print "};\n"
}
{
if (stage == 0) {
print
}
if (stage == 1 && ver) {
split($1, a, "\"");
name = a[2];
print "\t" ver " = \"" name "\","
ver = "";
}
if (stage == 2) {
sub("\t", "");
print
}
}
/};/ {
if (stage == 0) {
stage = 1;
print "\nstatic const char *chip_names[] = {"
}
if (stage == 2) exit
}
/\[RTL_GIGA_MAC_VER_/ {
ver = $1
}
next prev parent reply other threads:[~2013-08-09 8:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-25 13:36 [PATCH v3 0/2] [ethtool] Add new Realtek devices Peter Wu
2013-07-25 13:36 ` [PATCH v3 1/2] realtek: convert to per-chip mask Peter Wu
2013-08-08 18:25 ` Ben Hutchings
2013-08-09 8:51 ` Peter Wu [this message]
2013-08-09 9:44 ` Ben Hutchings
2013-08-09 9:58 ` Peter Wu
2013-07-25 13:36 ` [PATCH v3 2/2] realtek: update devices to 3.11 Peter Wu
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=6171378.LP1RDUmkgD@al \
--to=lekensteyn@gmail.com \
--cc=bhutchings@solarflare.com \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.com \
/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.