On Sun, 18 Oct 2020 00:35:59 +0300 Vladimir Oltean wrote: > DSA needs to push a header onto every packet on TX, and this might cause > reallocation under certain scenarios, which might affect, for example, > performance. > > But reallocated packets are not standardized in struct pcpu_sw_netstats, > struct net_device_stats or anywhere else, it seems, so we need to roll > our own extra netdevice statistics and expose them to ethtool. > > Signed-off-by: Vladimir Oltean <vladimir.olt...@nxp.com>
Could you consider adding "driver" stats under RTM_GETSTATS, or a similar new structured interface over ethtool? Looks like the statistic in question has pretty clear semantics, and may be more broadly useful. > +/* Driver statistics, other than those in struct rtnl_link_stats64. > + * These are collected per-CPU and aggregated by ethtool. > + */ > +struct dsa_slave_stats { > + __u64 tx_reallocs; s/__u/u/ > + struct u64_stats_sync syncp; > +} __aligned(1 * sizeof(u64)); Why aligned to u64? Compiler should pick a reasonable alignment here by itself.