From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH RFC] net: mvneta: add ethtool statistics
Date: Thu, 8 Oct 2015 16:42:12 +0100 [thread overview]
Message-ID: <20151008154211.GG32532@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20151008153257.GT17952@lunn.ch>
On Thu, Oct 08, 2015 at 05:32:57PM +0200, Andrew Lunn wrote:
> > > This would suggest the driver is not clearing the statistics when it
> > > loads. Should it?
> >
> > That's an interesting question, one which I have no answer for.
>
> So i took a look at the other Marvell drivers. mv643xx_eth.c, skge and
> sky2.c all have code to clear the statistics. So for consistency, i
> think nvneta should as well.
>
> But it gets stranger. mvneta has:
>
> static void mvneta_mib_counters_clear(struct mvneta_port *pp)
> {
> int i;
> u32 dummy;
>
> /* Perform dummy reads from MIB counters */
> for (i = 0; i < MVNETA_MIB_LATE_COLLISION; i += 4)
> dummy = mvreg_read(pp, (MVNETA_MIB_COUNTERS_BASE + i));
> }
That's called from mvneta_port_up(), which is called every time the link
comes up or the MTU is changed. That's really not nice. However, it
seems ineffectual because it's not accessing any documented registers:
#define MVNETA_MIB_COUNTERS_BASE 0x3080
#define MVNETA_MIB_LATE_COLLISION 0x7c
However, the documented counters are from 0x3000 to 0x307c.
> Looks like somebody did not finish this?
All you need to do is to read the counter to clear it, so the above
should result in it being cleared as above.
Maybe the above code can be fixed to read the proper counters, and
called from a more appropriate place (driver initialisation?)
--
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
prev parent reply other threads:[~2015-10-08 15:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-04 16:58 [RFC PATCH] net: mvneta: add ethtool statistics Russell King
2015-10-06 16:52 ` Andrew Lunn
2015-10-06 20:41 ` [PATCH RFC] " Russell King
2015-10-07 23:03 ` Andrew Lunn
2015-10-08 8:51 ` Russell King - ARM Linux
2015-10-08 15:32 ` Andrew Lunn
2015-10-08 15:42 ` Russell King - ARM Linux [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=20151008154211.GG32532@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=andrew@lunn.ch \
--cc=netdev@vger.kernel.org \
--cc=thomas.petazzoni@free-electrons.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 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).