All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand
@ 2019-07-25  9:53 Tony Nguyen
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 02/12] ice: Fix issues updating VSI MAC filters Tony Nguyen
                   ` (12 more replies)
  0 siblings, 13 replies; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Bruce Allan <bruce.w.allan@intel.com>

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>
---
 drivers/net/ethernet/intel/ice/ice.h         | 2 ++
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 +++++--
 drivers/net/ethernet/intel/ice/ice_main.c    | 6 ++----
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index 0e233b7c40bc..2165366e9250 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -450,6 +450,8 @@ 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);
 int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx);
+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);
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index b60bcbcf9bf2..4b2494e7fa78 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -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 */
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 833f0efc93f9..17358a10866d 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -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
@@ -3290,7 +3288,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;
@@ -3326,7 +3324,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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2019-07-31 18:14 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 02/12] ice: Fix issues updating VSI MAC filters Tony Nguyen
2019-07-31 18:10   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 03/12] ice: Don't allow VSI to remove unassociated ucast filter Tony Nguyen
2019-07-31 18:11   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 04/12] ice: Fix ethtool port and PFC stats for 4x25G cards Tony Nguyen
2019-07-31 18:11   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 05/12] ice: added sibling head to parse nodes Tony Nguyen
2019-07-31 18:11   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 06/12] ice: Sanitize ice_ena_vsi and ice_dis_vsi Tony Nguyen
2019-07-31 18:12   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 07/12] ice: shorten local and add debug prints Tony Nguyen
2019-07-31 18:12   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 08/12] ice: Introduce a local variable for a VSI in the rebuild path Tony Nguyen
2019-07-31 18:13   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 09/12] ice: Don't clog kernel debug log with VF MDD events errors Tony Nguyen
2019-07-31 18:13   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 10/12] ice: add validation in OP_CONFIG_VSI_QUEUES VF message Tony Nguyen
2019-07-31 18:14   ` Bowers, AndrewX
2019-07-25  9:54 ` [Intel-wired-lan] [PATCH S25 11/12] ice: Remove ice_dev_onetime_setup() Tony Nguyen
2019-07-31 18:14   ` Bowers, AndrewX
2019-07-25  9:54 ` [Intel-wired-lan] [PATCH S25 12/12] ice: fix ice_is_tc_ena Tony Nguyen
2019-07-31 18:14   ` Bowers, AndrewX
2019-07-26 15:11 ` [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Allan, Bruce W
2019-07-31 18:10 ` Bowers, AndrewX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.