mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-12 05:24:12 +08:00
ice: update ethtool stats on-demand
Users expect ethtool statistics to be updated on-demand when invoking 'ethtool -S <iface>' instead of providing a snapshot of statistics taken once a second (the frequency of the watchdog task where stats are currently updated). Update stats every time 'ethtool -S <iface>' is run. Also, fix an indentation style issue and an unnecessary local variable initialization in ice_get_ethtool_stats() discovered while investigating the subject issue. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
3f416961b0
commit
5a4a867310
@ -447,6 +447,8 @@ ice_find_vsi_by_type(struct ice_pf *pf, enum ice_vsi_type type)
|
||||
int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);
|
||||
int ice_vsi_setup_rx_rings(struct ice_vsi *vsi);
|
||||
void ice_set_ethtool_ops(struct net_device *netdev);
|
||||
void ice_update_vsi_stats(struct ice_vsi *vsi);
|
||||
void ice_update_pf_stats(struct ice_pf *pf);
|
||||
int ice_up(struct ice_vsi *vsi);
|
||||
int ice_down(struct ice_vsi *vsi);
|
||||
int ice_vsi_cfg(struct ice_vsi *vsi);
|
||||
|
@ -1319,14 +1319,17 @@ ice_get_ethtool_stats(struct net_device *netdev,
|
||||
struct ice_vsi *vsi = np->vsi;
|
||||
struct ice_pf *pf = vsi->back;
|
||||
struct ice_ring *ring;
|
||||
unsigned int j = 0;
|
||||
unsigned int j;
|
||||
int i = 0;
|
||||
char *p;
|
||||
|
||||
ice_update_pf_stats(pf);
|
||||
ice_update_vsi_stats(vsi);
|
||||
|
||||
for (j = 0; j < ICE_VSI_STATS_LEN; j++) {
|
||||
p = (char *)vsi + ice_gstrings_vsi_stats[j].stat_offset;
|
||||
data[i++] = (ice_gstrings_vsi_stats[j].sizeof_stat ==
|
||||
sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
|
||||
sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
|
||||
}
|
||||
|
||||
/* populate per queue stats */
|
||||
|
@ -34,8 +34,6 @@ static const struct net_device_ops ice_netdev_ops;
|
||||
static void ice_rebuild(struct ice_pf *pf);
|
||||
|
||||
static void ice_vsi_release_all(struct ice_pf *pf);
|
||||
static void ice_update_vsi_stats(struct ice_vsi *vsi);
|
||||
static void ice_update_pf_stats(struct ice_pf *pf);
|
||||
|
||||
/**
|
||||
* ice_get_tx_pending - returns number of Tx descriptors not processed
|
||||
@ -3254,7 +3252,7 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)
|
||||
* ice_update_vsi_stats - Update VSI stats counters
|
||||
* @vsi: the VSI to be updated
|
||||
*/
|
||||
static void ice_update_vsi_stats(struct ice_vsi *vsi)
|
||||
void ice_update_vsi_stats(struct ice_vsi *vsi)
|
||||
{
|
||||
struct rtnl_link_stats64 *cur_ns = &vsi->net_stats;
|
||||
struct ice_eth_stats *cur_es = &vsi->eth_stats;
|
||||
@ -3290,7 +3288,7 @@ static void ice_update_vsi_stats(struct ice_vsi *vsi)
|
||||
* ice_update_pf_stats - Update PF port stats counters
|
||||
* @pf: PF whose stats needs to be updated
|
||||
*/
|
||||
static void ice_update_pf_stats(struct ice_pf *pf)
|
||||
void ice_update_pf_stats(struct ice_pf *pf)
|
||||
{
|
||||
struct ice_hw_port_stats *prev_ps, *cur_ps;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
|
Loading…
Reference in New Issue
Block a user