From: "Émeric Vigier" <emeric.vigier@savoirfairelinux.com>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: Steve Glendinning <steve@shawell.net>,
steve glendinning <steve.glendinning@smsc.com>,
netdev@vger.kernel.org, Nancy Lin <nancy.lin@smsc.com>
Subject: Re: [PATCH] smsc95xx: support ethtool get_regs
Date: Fri, 6 Jul 2012 17:26:45 -0400 (EDT) [thread overview]
Message-ID: <2138981415.303377.1341610005571.JavaMail.root@mail.savoirfairelinux.com> (raw)
In-Reply-To: <20120706200146.GA11931@electric-eye.fr.zoreil.com>
----- Mail original -----
> De: "Francois Romieu" <romieu@fr.zoreil.com>
> À: "Émeric Vigier" <emeric.vigier@savoirfairelinux.com>
> Cc: "Steve Glendinning" <steve@shawell.net>, "steve glendinning" <steve.glendinning@smsc.com>,
> netdev@vger.kernel.org, "Nancy Lin" <nancy.lin@smsc.com>
> Envoyé: Vendredi 6 Juillet 2012 16:01:46
> Objet: Re: [PATCH] smsc95xx: support ethtool get_regs
>
> Émeric Vigier <emeric.vigier@savoirfairelinux.com> :
> [...]
> > +static int smsc95xx_ethtool_getregslen(struct net_device *dev)
> > +{
> > + /* all smsc95xx registers plus all phy registers */
> > + return COE_CR - ID_REV + 1 + 32 * sizeof(u32);
>
> I do not see where ID_REV is accounted for in the loops below.
>
> s/32 */PHY_SPECIAL */ or s/PHY_SPECIAL/32/ below.
I will go for the second proposal. I love your sed syntax btw :-)
>
> I thought PHY registers were 16 bits wide. Moreover they are already
> available through smsc95xx_ioctl().
Yes, there are 16 bits wide according to smsc95xx.h.
But other smsc drivers define 32bit wide PHY regs. I made myself believe that smsc would use the same PHY for each ethernet chip.
So would something like s/32 * sizeof(u32)/PHY_SPECIAL * sizeof(u16)/ solve the issue here?
Concerning the ioctl, I found ethtool much easier to use. And I believe smsc9514 is a very popular chipset, so this could help others debugging it.
>
> > +}
> > +
> > +static void
> > +smsc95xx_ethtool_getregs(struct net_device *netdev, struct
> > ethtool_regs *regs,
> > + void *buf)
> > +{
> > + struct usbnet *dev = netdev_priv(netdev);
> > + unsigned int i, j = 0, retval;
>
> unsigned int i, j, retval;
>
> > + u32 *data = buf;
> > +
> > + netif_dbg(dev, hw, dev->net, "ethtool_getregs\n");
>
> The tracing framework does provide almost the same information.
Do you mean LTT? I am not familiar with it, I should have a look.
I remove netif_dbg then.
>
> > +
> > + retval = smsc95xx_read_reg(dev, ID_REV, ®s->version);
> > + if (retval < 0) {
> > + netdev_warn(dev->net, "REGS: cannot read ID_REV\n");
>
> s/dev->net/netdev/ ?
You are right, I also changed smsc95xx_ethtool_getregslen() definition to match this syntax.
>
>
> > + return;
> > + }
> > +
> > + for (i = 0; i <= COE_CR; i += (sizeof(u32))) {
> > + retval = smsc95xx_read_reg(dev, i, &data[j++]);
>
> for (i = 0, j = 0; i <= COE_CR; i += sizeof(u32), j++) {
> retval = smsc95xx_read_reg(dev, i, data + j);
I should change that in previous "for" loop as well I suppose?
>
> --
> Ueimor
>
Emeric
next prev parent reply other threads:[~2012-07-06 21:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1291035348.223127.1341596173191.JavaMail.root@mail.savoirfairelinux.com>
2012-07-06 18:15 ` [PATCH] smsc95xx: support ethtool get_regs Émeric Vigier
2012-07-06 20:01 ` Francois Romieu
2012-07-06 21:26 ` Émeric Vigier [this message]
2012-07-06 22:11 ` Francois Romieu
2012-07-07 14:13 ` Émeric Vigier
2012-07-07 0:24 ` Ben Hutchings
2012-07-07 13:58 ` Émeric Vigier
2012-07-07 19:55 ` Ben Hutchings
2012-07-09 13:44 ` Émeric Vigier
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=2138981415.303377.1341610005571.JavaMail.root@mail.savoirfairelinux.com \
--to=emeric.vigier@savoirfairelinux.com \
--cc=nancy.lin@smsc.com \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.com \
--cc=steve.glendinning@smsc.com \
--cc=steve@shawell.net \
/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).