Subject: Re: [Patch RFC net-next] net: usb: r8152: Fix rx_bytes/tx_bytes to include FCS

From: Andrew Lunn <[email-masked]>
Date: Thu, 18 May 2017 17:09:25 +0200

> I am afraid that we won't be able to enforce a consistent behavior,
> because the HW itself is not consistent, both on the NIC and on the
> switch side.

Hi Florian

I agree with that, for MIB counters. They tend to come direct from the
hardware.

However, rx_bytes and tx_bytes are not from the hardware. They are
software stats, kept by the drivers. Just grep in driver/net/ethernet
and you see:

broadcom/bcmsysport.c:		        ndev->stats.rx_bytes += len;
broadcom/sb1250-mac.c:			dev->stats.rx_bytes += len;
mellanox/mlx5/core/en_main.c:		s->rx_bytes	+= rq_stats->bytes;
microchip/encx24j600.c:			dev->stats.rx_bytes += rsv->len;
neterion/vxge/vxge-main.c:		net_stats->rx_bytes += bytes;
nuvoton/w90p910_ether.c:		dev->stats.rx_bytes += length;

etc.

Since these are software counters, they can be consistent. From a
practical point of view, i doubt they ever will all be consistent,
there are simply too many drivers to test and change if
needed. However, for the ones somebody cares about, they can be made
consistent.

I care about r8152, and would like to make it consistent with asix,
dsa, e1000e.

     Andrew