From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Woojung.Huh@microchip.com, davem@davemloft.net, netdev@vger.kernel.org
Cc: UNGLinuxDriver@microchip.com
Subject: Re: [PATCH 2/2] lan78xx: add ndo_get_stats64
Date: Wed, 16 Mar 2016 17:16:30 +0300 [thread overview]
Message-ID: <56E96ABE.1010206@cogentembedded.com> (raw)
In-Reply-To: <9235D6609DB808459E95D78E17F2E43D404C906A@CHN-SV-EXMX02.mchp-main.com>
Hello.
On 3/16/2016 1:52 AM, Woojung.Huh@microchip.com wrote:
> From: Woojung Huh <woojung.huh@microchip.com>
>
> Add lan78xx_get_stats64 of ndo_get_stats64 to report
> all statistics counters including errors from HW statistics.
>
> Read from HW when auto suspend is disabled, use saved counter when
> auto suspend is enabled because periodic call to ndo_get_stats64
> prevents USB auto suspend.
>
> Signed-off-by: Woojung Huh <woojung.huh@microchip.com>
> ---
> drivers/net/usb/lan78xx.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 49 insertions(+)
>
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index f20890e..f4a9708f 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -3261,6 +3261,54 @@ void lan78xx_tx_timeout(struct net_device *net)
> tasklet_schedule(&dev->bh);
> }
>
> +struct rtnl_link_stats64 *lan78xx_get_stats64(struct net_device *netdev,
> + struct rtnl_link_stats64 *storage)
> +{
[...]
> + storage->rx_length_errors = (stats.rx_undersize_frame_errors +
> + stats.rx_oversize_frame_errors);
Parens not needed.
> + storage->rx_crc_errors = stats.rx_fcs_errors;
> + storage->rx_frame_errors = stats.rx_alignment_errors;
> + storage->rx_fifo_errors = stats.rx_dropped_frames;
> + storage->rx_over_errors = stats.rx_oversize_frame_errors;
> + storage->rx_errors = (stats.rx_fcs_errors +
> + stats.rx_alignment_errors +
> + stats.rx_fragment_errors +
> + stats.rx_jabber_errors +
> + stats.rx_undersize_frame_errors +
> + stats.rx_oversize_frame_errors +
> + stats.rx_dropped_frames);
Neither here.
> +
> + storage->tx_carrier_errors = stats.tx_carrier_errors;
> + storage->tx_errors = (stats.tx_fcs_errors +
> + stats.tx_excess_deferral_errors +
> + stats.tx_carrier_errors);
And here.
[...]
MBR, Sergei
next prev parent reply other threads:[~2016-03-16 14:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-15 22:52 [PATCH 2/2] lan78xx: add ndo_get_stats64 Woojung.Huh
2016-03-16 14:16 ` Sergei Shtylyov [this message]
2016-03-16 16:11 ` Woojung.Huh
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=56E96ABE.1010206@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=Woojung.Huh@microchip.com \
--cc=davem@davemloft.net \
--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.