Skip to contentSkip to conversation

net/i40e: fix Rx statistic inconsistent

PATCH NAK Wei Zhao1 3 participants 3 messages Aug 9, 2016 – Sep 22, 2016 Network drivers

lore
Share & tools
lore

Wei Zhao1

author
#0 lore raw

PATCH v3 1/1 net/i40e: fix Rx statistic inconsistent

rx_good_bytes and rx_good_packets statistic is inconsistent when port stopped,ipackets statistic is minus the discard packets but rx_bytes statistic not,but i40e has no statistic of discard bytes.So we check "dev_started" flag, if the port is started we do the statistic work,if stopped we don't.We can avoid the statistic inconsistent problem by this way.

Fixes 9aace75fc82e ("i40e: fix statistics")
---
 drivers/net/i40e/i40e_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +4 -2
index d0aeb70..47ed6e9 100644
@@ -2315,7 +2315,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	unsigned i;
 
 	/* call read registers - updates values, now write them to struct */
-	i40e_read_stats_registers(pf, hw);
+	if (dev->data->dev_started == 1)
+		i40e_read_stats_registers(pf, hw);
 
 	stats->ipackets = pf->main_vsi->eth_stats.rx_unicast +
 			pf->main_vsi->eth_stats.rx_multicast +
@@ -2494,7 +2495,8 @@ i40e_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
 	if (n < count)
 		return count;
 
-	i40e_read_stats_registers(pf, hw);
+	if (dev->data->dev_started == 1)
+		i40e_read_stats_registers(pf, hw);
 
 	if (xstats == NULL)
 		return 0;
Signature · 1 line
2.5.5
#1 lore raw
Quoted 30 lines · On 8/9/2016 3:07 AM, Wei Zhao1 wrote:

rx_good_bytes and rx_good_packets statistic is inconsistent when port stopped,ipackets statistic is minus the discard packets but rx_bytes statistic not,but i40e has no statistic of discard bytes.So we check "dev_started" flag, if the port is started we do the statistic work,if stopped we don't.We can avoid the statistic inconsistent problem by this way.

Fixes 9aace75fc82e ("i40e: fix statistics")
---
 drivers/net/i40e/i40e_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +2 -1
index d0aeb70..47ed6e9 100644
@@ -2315,7 +2315,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	unsigned i;
 
 	/* call read registers - updates values, now write them to struct */
-	i40e_read_stats_registers(pf, hw);
+	if (dev->data->dev_started == 1)
+		i40e_read_stats_registers(pf, hw);
 
 	stats->ipackets = pf->main_vsi->eth_stats.rx_unicast +
 			pf->main_vsi->eth_stats.rx_multicast +

drivers/net/i40e/i40e_ethdev.c i40e_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, · line 2502

Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c +2 -1
@@ -2494,7 +2495,8 @@ i40e_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
 	if (n < count)
 		return count;
 
-	i40e_read_stats_registers(pf, hw);
+	if (dev->data->dev_started == 1)
+		i40e_read_stats_registers(pf, hw);
 
 	if (xstats == NULL)
 		return 0;

+cc i40e maintainers, can you please review the code?

#2 lore raw

NACK.
This patch is not required any more as we discussed offline.

@zhaowei, please change the patch's status in patchwork because no change is required now

Quoted 51 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 14, 2016 10:10 PM
To: Zhao1, Wei; [email protected]; Zhang, Helin; Wu, Jingjing
Subject: Re: [dpdk-dev] [PATCH v3] net/i40e: fix Rx statistic inconsistent

drivers/net/i40e/i40e_ethdev.c i40e_dev_stats_get(struct rte_eth_dev *dev,

Quoted 19 lines · On 8/9/2016 3:07 AM, Wei Zhao1 wrote:

rx_good_bytes and rx_good_packets statistic is inconsistent when port stopped,ipackets statistic is minus the discard packets but rx_bytes statistic not,but i40e has no statistic of discard bytes.So we check "dev_started" flag, if the port is started we do the statistic work,if stopped we don't.We can avoid the statistic inconsistent problem by this way.

Fixes 9aace75fc82e ("i40e: fix statistics")
---
 drivers/net/i40e/i40e_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index d0aeb70..47ed6e9 100644

drivers/net/i40e/i40e_ethdev.c +0 -0
@@ -2315,7 +2315,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev,

struct rte_eth_stats *stats)

drivers/net/i40e/i40e_ethdev.c i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)

Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c +2 -1
 	unsigned i;
 
 	/* call read registers - updates values, now write them to struct */
-	i40e_read_stats_registers(pf, hw);
+	if (dev->data->dev_started == 1)
+		i40e_read_stats_registers(pf, hw);
 
 	stats->ipackets = pf->main_vsi->eth_stats.rx_unicast +
 			pf->main_vsi->eth_stats.rx_multicast + @@ -2494,7

+2495,8 @@

Quoted 1 line

i40e_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat

*xstats,

drivers/net/i40e/i40e_ethdev.c i40e_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, · line 2502

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +2 -1
 	if (n < count)
 		return count;
 
-	i40e_read_stats_registers(pf, hw);
+	if (dev->data->dev_started == 1)
+		i40e_read_stats_registers(pf, hw);
 
 	if (xstats == NULL)
 		return 0;

+cc i40e maintainers, can you please review the code?