Subject: Re: [PATCH net-next 06/14] net: dev: Add hardware stats support

From: Petr Machata <[email-masked]>
Date: Fri, 25 Feb 2022 09:31:23 +0100

Jakub Kicinski <[email-masked]> writes:

> On Thu, 24 Feb 2022 15:33:27 +0200 Ido Schimmel wrote:
>> From: Petr Machata <[email-masked]>
>> 
>> Offloading switch device drivers may be able to collect statistics of the
>> traffic taking place in the HW datapath that pertains to a certain soft
>> netdevice, such as VLAN. Add the necessary infrastructure to allow exposing
>> these statistics to the offloaded netdevice in question. The API was shaped
>> by the following considerations:
>> 
>> - Collection of HW statistics is not free: there may be a finite number of
>>   counters, and the act of counting may have a performance impact. It is
>>   therefore necessary to allow toggling whether HW counting should be done
>>   for any particular SW netdevice.
>> 
>> - As the drivers are loaded and removed, a particular device may get
>>   offloaded and unoffloaded again. At the same time, the statistics values
>>   need to stay monotonous (modulo the eventual 64-bit wraparound),
>
> monotonic

OK.

>>   increasing only to reflect traffic measured in the device.
>
>> +	struct rtnl_link_stats64 *offload_xstats_l3;
>
> Does it make sense to stick to rtnl_link_stats64 for this?
> There's a lot of.. historical baggage in that struct.

It seemed like a reasonable default that every tool already understands.

Was there a discussion in the past about what a cross-vendor stats suite
should look like? It seems like one of those things that can be bikeshed
forever...