From: Sabrina Dubroca <sd@queasysnail.net>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, jcliburn@gmail.com,
chris.snook@gmail.com
Subject: Re: [PATCH 3/3] atl1: update statistics code
Date: Fri, 10 Jan 2014 22:30:44 +0100 [thread overview]
Message-ID: <20140110213044.GA4006@kria> (raw)
In-Reply-To: <1389378566.2025.78.camel@bwh-desktop.uk.level5networks.com>
2014-01-10, 18:29:26 +0000, Ben Hutchings wrote:
> On Fri, 2014-01-10 at 17:08 +0100, Sabrina Dubroca wrote:
> > As Ben Hutchings pointed out for the stats in alx, some
> > hardware-specific stats aren't matched to the right net_device_stats
> > field. Also fix the collision field and include errors in the total
> > number of RX/TX packets.
> >
> > Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> > ---
> > drivers/net/ethernet/atheros/atlx/atl1.c | 16 ++++++++--------
> > 1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
> > index 538211d..31d460a 100644
> > --- a/drivers/net/ethernet/atheros/atlx/atl1.c
> > +++ b/drivers/net/ethernet/atheros/atlx/atl1.c
> [...]
> > @@ -1718,23 +1718,18 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
> > adapter->soft_stats.tx_trunc += smb->tx_trunc;
> > adapter->soft_stats.tx_pause += smb->tx_pause;
> >
> > - netdev->stats.rx_packets = adapter->soft_stats.rx_packets;
> > - netdev->stats.tx_packets = adapter->soft_stats.tx_packets;
> > netdev->stats.rx_bytes = adapter->soft_stats.rx_bytes;
> > netdev->stats.tx_bytes = adapter->soft_stats.tx_bytes;
> > netdev->stats.multicast = adapter->soft_stats.multicast;
> > netdev->stats.collisions = adapter->soft_stats.collisions;
> > netdev->stats.rx_errors = adapter->soft_stats.rx_errors;
> > - netdev->stats.rx_over_errors =
> > - adapter->soft_stats.rx_missed_errors;
> > netdev->stats.rx_length_errors =
> > adapter->soft_stats.rx_length_errors;
> > netdev->stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors;
> > netdev->stats.rx_frame_errors =
> > adapter->soft_stats.rx_frame_errors;
> > netdev->stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors;
> > - netdev->stats.rx_missed_errors =
> > - adapter->soft_stats.rx_missed_errors;
>
> So adapter->soft_stats.rx_missed_errors is set (to something silly) and
> then ignored...
Ignored in netdev->stats, but still used in ethtool stats, as both
rx_over_errors and rx_missed_errors. I don't want to rename or remove
ethtool stats entries, so I could leave it set to 0.
> > + netdev->stats.rx_dropped = adapter->soft_stats.rx_rrd_ov;
> > netdev->stats.tx_errors = adapter->soft_stats.tx_errors;
> > netdev->stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors;
> > netdev->stats.tx_aborted_errors =
> > @@ -1743,6 +1738,11 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
> > adapter->soft_stats.tx_window_errors;
> > netdev->stats.tx_carrier_errors =
> > adapter->soft_stats.tx_carrier_errors;
> > +
> > + netdev->stats.rx_packets = adapter->soft_stats.rx_packets +
> > + netdev->stats.rx_errors;
> > + netdev->stats.tx_packets = adapter->soft_stats.tx_packets +
> > + netdev->stats.tx_errors;
>
> Given that adapter->soft_stats largely mirrors struct net_device_stats,
> would it not make sense to do these additions there so that
> adapter->soft_stats.{rx,tx}_packets include all packets?
>
> I.e. you could do something like:
>
> delta_rx_errors = (smb->rx_frag + smb->rx_fcs_err +
> smb->rx_len_err + smb->rx_sz_ov + smb->rx_rxf_ov +
> smb->rx_rrd_ov + smb->rx_align_err);
> adapter->soft_stats.rx_errors += delta_rx_errors;
> adapter->soft_stats.rx_packets += delta_rx_errors;
>
> (and similarly for TX).
>
> Basically I think these changes belong further up the function.
Oops, yeah.
I just noticed this bit in atl1_alloc_rx_buffers:
static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter)
{
<...>
skb = netdev_alloc_skb_ip_align(adapter->netdev,
adapter->rx_buffer_len);
if (unlikely(!skb)) {
/* Better luck next round */
adapter->netdev->stats.rx_dropped++;
break;
}
<...>
}
Now that netdev->stats.rx_dropped gets overwritten, it should be
changed to a field in soft_stats. soft_stats doesn't have a rx_dropped
field, so rx_rrd_ov? Or do I add rx_dropped to soft_stats?
Thanks a lot Ben!
--
Sabrina
prev parent reply other threads:[~2014-01-10 21:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-10 16:08 [PATCH 0/3] atheros: modify statistics code Sabrina Dubroca
2014-01-10 16:08 ` [PATCH 1/3] atl1c: update " Sabrina Dubroca
2014-01-10 18:19 ` Ben Hutchings
2014-01-10 16:08 ` [PATCH 2/3] atl1e: " Sabrina Dubroca
2014-01-10 18:20 ` Ben Hutchings
2014-01-10 16:08 ` [PATCH 3/3] atl1: " Sabrina Dubroca
2014-01-10 18:29 ` Ben Hutchings
2014-01-10 21:30 ` Sabrina Dubroca [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=20140110213044.GA4006@kria \
--to=sd@queasysnail.net \
--cc=bhutchings@solarflare.com \
--cc=chris.snook@gmail.com \
--cc=davem@davemloft.net \
--cc=jcliburn@gmail.com \
--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.