[dpdk-dev] i40e: fix packet stats getting

Message ID 1461046273-16755-1-git-send-email-jingjing.wu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Jingjing Wu April 19, 2016, 6:11 a.m. UTC
  The statistics queried by calling rte_eth_stats_get are zero when
the API is first called on the port. The root cause is because of
offset_loaded flag is not set correctly after device started.
This patch fixes this issue by resetting statistics at initialization
time, at the meanwhile the resetting process will set offset_loaded
flag.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Zhang, Helin April 19, 2016, 6:21 a.m. UTC | #1
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Tuesday, April 19, 2016 2:11 PM
> To: Richardson, Bruce <bruce.richardson@intel.com>
> Cc: dev@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Helin
> <helin.zhang@intel.com>
> Subject: [PATCH] i40e: fix packet stats getting
> 
> The statistics queried by calling rte_eth_stats_get are zero when the API is first
> called on the port. The root cause is because of offset_loaded flag is not set
> correctly after device started.
> This patch fixes this issue by resetting statistics at initialization time, at the
> meanwhile the resetting process will set offset_loaded flag.
> 
> Fixes: 4861cde46116 ("i40e: new poll mode driver")
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
  
Bruce Richardson April 21, 2016, 2:14 p.m. UTC | #2
On Tue, Apr 19, 2016 at 07:21:16AM +0100, Zhang, Helin wrote:
> 
> 
> > -----Original Message-----
> > From: Wu, Jingjing
> > Sent: Tuesday, April 19, 2016 2:11 PM
> > To: Richardson, Bruce <bruce.richardson@intel.com>
> > Cc: dev@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Helin
> > <helin.zhang@intel.com>
> > Subject: [PATCH] i40e: fix packet stats getting
> > 
> > The statistics queried by calling rte_eth_stats_get are zero when the API is first
> > called on the port. The root cause is because of offset_loaded flag is not set
> > correctly after device started.
> > This patch fixes this issue by resetting statistics at initialization time, at the
> > meanwhile the resetting process will set offset_loaded flag.
> > 
> > Fixes: 4861cde46116 ("i40e: new poll mode driver")
> > Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
> Acked-by: Helin Zhang <helin.zhang@intel.com>
> 
Applied to dpdk-next-net/rel_16_07

/Bruce
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index bc28d3c..3aaef07 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -934,6 +934,9 @@  eth_i40e_dev_init(struct rte_eth_dev *dev)
 		goto err_setup_pf_switch;
 	}
 
+	/* reset all stats of the device, including pf and main vsi */
+	i40e_dev_stats_reset(dev);
+
 	vsi = pf->main_vsi;
 
 	/* Disable double vlan by default */