[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170811160532.6a35b3b2@xeon-e3>
Date: Fri, 11 Aug 2017 16:05:32 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: <Bryan.Whitehead@...rochip.com>
Cc: <netdev@...r.kernel.org>, <davem@...emloft.net>,
<UNGLinuxDriver@...rochip.com>
Subject: Re: [PATCH net-next 1/3] Add LAN743X driver
On Fri, 11 Aug 2017 19:47:57 +0000
<Bryan.Whitehead@...rochip.com> wrote:
> +
> +static struct net_device_stats *mac_get_stats(struct lan743x_adapter *adapter)
> +{
> + struct lan743x_mac *mac = &adapter->mac;
> +
> + memset(&mac->statistics, 0, sizeof(mac->statistics));
> + mac->statistics.rx_packets = lan743x_csr_read(adapter,
> + STAT_RX_TOTAL_FRAMES);
> + mac->statistics.tx_packets = lan743x_csr_read(adapter,
> + STAT_TX_TOTAL_FRAMES);
> + return &mac->statistics;
> +}
The statistics code here is confused.
You are already counting rx_packets in software in napi_poll
Then you get values from MAC. One or the other?
There are two copies of stats, one in netdev and other in your mac structure.
Also what about byte and error counts?
If possible implement 64 bit get_stats64 instead.
Powered by blists - more mailing lists