diff options
author | Yidong Ren <yidren@microsoft.com> | 2018-07-30 17:09:45 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-30 12:35:04 -0700 |
commit | 6ae746711263bd6da45f709fdb9f12e4f57e22bd (patch) | |
tree | 4664778fd609ee4c93300d56a2eae8c0bef5f828 /drivers/net/hyperv/hyperv_net.h | |
parent | 494f2e765d4ae855455bb2488fd3796a4e6e1235 (diff) | |
download | linux-stable-6ae746711263bd6da45f709fdb9f12e4f57e22bd.tar.gz linux-stable-6ae746711263bd6da45f709fdb9f12e4f57e22bd.tar.bz2 linux-stable-6ae746711263bd6da45f709fdb9f12e4f57e22bd.zip |
hv_netvsc: Add per-cpu ethtool stats for netvsc
This patch implements following ethtool stats fields for netvsc:
cpu<n>_tx/rx_packets/bytes
cpu<n>_vf_tx/rx_packets/bytes
Corresponding per-cpu counters already exist in current code. Exposing
these counters will help troubleshooting performance issues.
for_each_present_cpu() was used instead of for_each_possible_cpu().
for_each_possible_cpu() would create very long and useless output.
It is still being used for internal buffer, but not for ethtool
output.
There could be an overflow if cpu was added between ethtool
call netvsc_get_sset_count() and netvsc_get_ethtool_stats() and
netvsc_get_strings(). (still safe if cpu was removed)
ethtool makes these three function calls separately.
As long as we use ethtool, I can't see any clean solution.
Currently and in foreseeable short term, Hyper-V doesn't support
cpu hot-plug. Plus, ethtool is for admin use. Unlikely the admin
would perform such combo operations.
Changes in v2:
- Remove cpp style comment
- Resubmit after freeze
Changes in v3:
- Reimplemented with kvmalloc instead of alloc_percpu
Changes in v4:
- Fixed inconsistent array size
- Use kvmalloc_array instead of kvmalloc
Signed-off-by: Yidong Ren <yidren@microsoft.com>
Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv/hyperv_net.h')
-rw-r--r-- | drivers/net/hyperv/hyperv_net.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 4b6e308199d2..a32ded5b4f41 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -873,6 +873,17 @@ struct netvsc_ethtool_stats { unsigned long wake_queue; }; +struct netvsc_ethtool_pcpu_stats { + u64 rx_packets; + u64 rx_bytes; + u64 tx_packets; + u64 tx_bytes; + u64 vf_rx_packets; + u64 vf_rx_bytes; + u64 vf_tx_packets; + u64 vf_tx_bytes; +}; + struct netvsc_vf_pcpu_stats { u64 rx_packets; u64 rx_bytes; |