On Fri, Oct 6, 2017 at 6:30 PM, Stephen Hemminger <step...@networkplumber.org> wrote: > On Fri, 6 Oct 2017 18:25:14 -0400 > Willem de Bruijn <willemdebruijn.ker...@gmail.com> wrote: > >> From: Willem de Bruijn <will...@google.com> >> >> Support ethtool -S on tun devices. This interface allows exporting >> device-specific stats not present in rtnl stats. >> >> Signed-off-by: Willem de Bruijn <will...@google.com> >> --- >> drivers/net/tun.c | 38 ++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 38 insertions(+) >> >> diff --git a/drivers/net/tun.c b/drivers/net/tun.c >> index 57e4c31fa84a..df6ef9670d05 100644 >> --- a/drivers/net/tun.c >> +++ b/drivers/net/tun.c >> @@ -194,6 +194,15 @@ struct tun_flow_entry { >> >> #define TUN_NUM_FLOW_ENTRIES 1024 >> >> +static const struct { >> + const char string[ETH_GSTRING_LEN]; >> +} tun_ethtool_stats_keys[] = { >> + { "rx_packets" }, >> + { "tx_packets" }, >> + { "rx_bytes" }, >> + { "tx_bytes" } > > It looks like you are just exporting the statistics taht are already > through normal path. The purpose of ethtool stats is to provide > statistics unique to the device, not to repeat what is available throug > ip, ifconfig, etc.
A follow-up patch adds non-standard statistics. I included these common ones, because the new zerocopy counters are only interesting in relation to tx_packets. It also seems customary among existing network drivers to include at least these base counters in the ethtool output.