Subject: Re: [PATCH v2 net-next 6/6] sfc: add per-queue RX and TX bytes stats

From: Jakub Kicinski <[email-masked]>
Date: Tue, 10 Sep 2024 08:37:40 -0700

On Tue, 10 Sep 2024 16:03:04 +0100 Edward Cree wrote:
> >> + * @tx_bytes: Number of bytes sent since this struct was created.  For TSO,
> >> + *	counts the superframe size, not the sizes of generated frames on the
> >> + *	wire (i.e. the headers are only counted once)  
> > 
> > Hm. Hm. This is technically not documented but my intuition is that
> > tx_bytes should count wire bytes. tx_packets counts segments / wire
> > packets, looking at ef100_tx.c 
> > qstats "bytes" should be the same kind of bytes as counted by the MAC.  
> 
> Well, even if we calculated the wire bytes, the figures still wouldn't
>  match entirely because the MAC counts the FCS, which isn't included
>  here.  We can add that in too, but then one would expect the same
>  thing on RX, which would require an extra branch in the datapath
>  checking NETIF_F_RXFCS and I didn't want to take that performance hit.
> So my preference here would be to keep this as skb bytes rather than
>  wire bytes, since as you say it's the packet count that really
>  matters here.

Right, that's fine. But just to state the obvious - adding / subtracting
FCS bytes is relatively easy for user space to do (assuming RXFCS
handling is correct, as you mention). Converting from LSO bytes to wire
bytes is impossible, FCS is fixed size while header length varies.