OSDN Git Service

i40e: convert VEB TC stats to use an i40e_stats array
authorJacob Keller <jacob.e.keller@intel.com>
Tue, 31 Jul 2018 10:41:41 +0000 (03:41 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 7 Aug 2018 15:19:09 +0000 (08:19 -0700)
commit1510ae0be2a4d4630823752235c41f8a0e06f37a
tree661889d322df8b6a84aaa3cfbb82f833c2e9f5d9
parent1ac2ee231f922d46cc7bb4c9f02eeb841b3e4b47
i40e: convert VEB TC stats to use an i40e_stats array

The VEB TC stats are currently implemented with separate parsing,
instead of using the i40e_stats array and associated helper functions.
This is likely because the stats rely on embedding the TC number into
the stat name.

Update i40e_add_stat_strings to take variadic arguments, and use these
to vsnprintf the i40e_stats string as a string containing format
specifiers.

Create a stats array for the VEB TC related stats,
i40e_gstrings_veb_tc_stats, and use this along with the helper functions
to remove the specialized boiler plate code.

Always call i40e_add_ethtool_stats for both this array and the general
VEB stats array. This ensures that we zero out any memory in case it was
not zero-allocated for us.

This ultimately results in less boiler plate code for the
i40e_get_stat_strings and i40e_get_ethtool_stats.

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/i40e/i40e_ethtool.c