]> git.baikalelectronics.ru Git - kernel.git/commit
i40e: add helper function for copying strings from stat arrays
authorJacob Keller <jacob.e.keller@intel.com>
Tue, 31 Jul 2018 10:41:38 +0000 (03:41 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 7 Aug 2018 15:19:08 +0000 (08:19 -0700)
commit59094ca814ecce7f64e63dcfc846d565e0e3dce3
tree63123d64cd4b336fb6eb412d2a767e4f3eeddfaa
parentd55c35b59a18cc013f7166821cd4943361d050dc
i40e: add helper function for copying strings from stat arrays

Many of the ethtool statistics use the same basic logic for copying
strings into the supplied buffer. A set of stats are stored in a const
array of i40e_stats structures, and we apply these all together.

Simplify the stats code by introducing a helper function which can take
a stats array and copy the strings into the buffer, updating the buffer
pointer as we go.

We use a macro to implement i40e_add_stat_strings so that ARRAY_SIZE can
be used on the array passed in. This ensures that we always use the
matching size in __i40e_add_stat_strings.

More complex stats currently do not use i40e_stats arrays, usually due
to custom formatted strings, or because the stats are not laid out in
the expected way. These stats will be updated to use the helper function
in separate future patches.

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