OSDN Git Service

i40evf: update ethtool stats code and use helper functions
authorJacob Keller <jacob.e.keller@intel.com>
Mon, 20 Aug 2018 15:12:25 +0000 (08:12 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 30 Aug 2018 20:53:03 +0000 (13:53 -0700)
commit6dba41cd02fc0c408ae9a99809e1960a691dfad0
tree76fdcacba5d05ef8d46426738c000d10bc937546
parent8fd75c58a09a571543b5b61e49171bb3a1d88c19
i40evf: update ethtool stats code and use helper functions

Fix a bug in the way we handled VF queues, by always showing stats for
the maximum number of queues, even if they aren't allocated. It is not
safe to change the number of strings reported to ethtool, as grabbing
statistics occurs over multiple ethtool ops for which the rtnl_lock()
cannot be held the entire time.

Avoid this by always reporting queue stats for the maximum number of
queues in the netdevice. Share some of the helper functionality for
adding stats with the PF code in i40e_ethtool_stats.h

This should reduce the chance of potential future bugs, and make adding
new statistics easier.

Note for the queue stats, unlike the PF driver we do not keep an array
of queue pointers, but an array of queues, so care must be taken to
avoid accessing queue memory that hasn't yet been allocated.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40evf/i40e_ethtool_stats.h [new file with mode: 0644]
drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c