net: rtnetlink: Stop assuming that IFLA_OFFLOAD_XSTATS_* are dev-backed
authorPetr Machata <petrm@nvidia.com>
Wed, 2 Mar 2022 16:31:16 +0000 (18:31 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Mar 2022 10:37:22 +0000 (10:37 +0000)
commitf6e0fb81298825e195888d2a32e6f7b6e64abf76
treeed8e39091c40142154feecf69a38992f0bfdb652
parent6b524a1d012b61d605e052db0555e9d8fee29f04
net: rtnetlink: Stop assuming that IFLA_OFFLOAD_XSTATS_* are dev-backed

The IFLA_STATS_LINK_OFFLOAD_XSTATS attribute is a nest whose child
attributes carry various special hardware statistics. The code that handles
this nest was written with the idea that all these statistics would be
exposed by the device driver of a physical netdevice.

In the following patches, a new attribute is added to the abovementioned
nest, which however can be defined for some soft netdevices. The NDO-based
approach to querying these does not work, because it is not the soft
netdevice driver that exposes these statistics, but an offloading NIC
driver that does so.

The current code does not scale well to this usage. Simply rewrite it back
to the pattern seen in other fill-like and get_size-like functions
elsewhere.

Extract to helpers the code that is concerned with handling specifically
NDO-backed statistics so that it can be easily reused should more such
statistics be added.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c