• J
    i40e: add helper function for copying strings from stat arrays · 91f06544
    Jacob Keller 提交于
    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: NJacob Keller <jacob.e.keller@intel.com>
    Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
    91f06544
i40e_ethtool.c 145.5 KB