Skip to contentSkip to conversation

net/iavf: fix Rx bytes stats

PATCH In review Qi Zhang 3 participants 4 messages Jul 17, 2019 – Aug 5, 2019 Network drivers

lore
Share & tools
lore

Qi Zhang

author
#0 lore raw

PATCH 1/1 net/iavf: fix Rx bytes stats

Exclude 4 bytes CRC for rx bytes stats.
This also aligned Rx stats calculation with PF.

Fixes f4a41a6953af ("net/avf: support stats")
---
 drivers/net/iavf/iavf_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/iavf/iavf_ethdev.c +1 -0
index 53dc05c78..fe75e86ab 100644
@@ -1047,6 +1047,7 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 		stats->imissed = pstats->rx_discards;
 		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
 		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * RTE_ETHER_CRC_LEN;
 		stats->obytes = pstats->tx_bytes;
 	} else {
 		PMD_DRV_LOG(ERR, "Get statistics failed");
Signature · 1 line
2.13.6
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · On Wed, 17 Jul 2019 12:31:00 +0800 Qi Zhang <[email protected]> wrote:

Exclude 4 bytes CRC for rx bytes stats.
This also aligned Rx stats calculation with PF.

Fixes f4a41a6953af ("net/avf: support stats")
---
 drivers/net/iavf/iavf_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/iavf/iavf_ethdev.c +0 -0
index 53dc05c78..fe75e86ab 100644

drivers/net/iavf/iavf_ethdev.c iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) · line 1053

Quoted 7 lines
drivers/net/iavf/iavf_ethdev.c +1 -0
@@ -1047,6 +1047,7 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 		stats->imissed = pstats->rx_discards;
 		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
 		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * RTE_ETHER_CRC_LEN;
 		stats->obytes = pstats->tx_bytes;
 	} else {
 		PMD_DRV_LOG(ERR, "Get statistics failed");

Correct, DPDK statistics should not include CRC.

author Applied
#2 lore raw
Quoted 40 lines

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Wednesday, July 17, 2019 12:56 PM
To: Zhang, Qi Z <[email protected]>
Cc: Wu, Jingjing <[email protected]>; Lu, Wenzhuo <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/iavf: fix Rx bytes stats

drivers/net/iavf/iavf_ethdev.c iavf_dev_stats_get(struct rte_eth_dev *dev,

Quoted 16 lines · On Wed, 17 Jul 2019 12:31:00 +0800 Qi Zhang <[email protected]> wrote:

Exclude 4 bytes CRC for rx bytes stats.
This also aligned Rx stats calculation with PF.

Fixes f4a41a6953af ("net/avf: support stats")
---
 drivers/net/iavf/iavf_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/drivers/net/iavf/iavf_ethdev.c index 53dc05c78..fe75e86ab 100644

drivers/net/iavf/iavf_ethdev.c +0 -0
@@ -1047,6 +1047,7 @@ iavf_dev_stats_get(struct rte_eth_dev *dev,

struct rte_eth_stats *stats)

drivers/net/iavf/iavf_ethdev.c iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) · line 1053

Quoted 7 lines
drivers/net/iavf/iavf_ethdev.c +1 -0
 		stats->imissed = pstats->rx_discards;
 		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
 		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * RTE_ETHER_CRC_LEN;
 		stats->obytes = pstats->tx_bytes;
 	} else {
 		PMD_DRV_LOG(ERR, "Get statistics failed");

Correct, DPDK statistics should not include CRC.

Quoted 1 line

Applied to dpdk-next-net-intel.

Thanks
Qi

#3 lore raw
In reply to Stephen Hemminger
Quoted 14 lines · Stephen Hemminger
Quoted 11 lines · On Wed, 17 Jul 2019 12:31:00 +0800 Qi Zhang <[email protected]> wrote:

Exclude 4 bytes CRC for rx bytes stats.
This also aligned Rx stats calculation with PF.

Fixes f4a41a6953af ("net/avf: support stats")
---
  drivers/net/iavf/iavf_ethdev.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 13 lines

drivers/net/iavf/iavf_ethdev.c iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) · line 1053

Quoted 12 lines
drivers/net/iavf/iavf_ethdev.c +1 -0
index 53dc05c78..fe75e86ab 100644
@@ -1047,6 +1047,7 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
  		stats->imissed = pstats->rx_discards;
  		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
  		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * RTE_ETHER_CRC_LEN;
  		stats->obytes = pstats->tx_bytes;
  	} else {
  		PMD_DRV_LOG(ERR, "Get statistics failed");

Correct, DPDK statistics should not include CRC.

Stephen, Thomas, Ferruh,

is it documented somewhere? May be we should update fields description and rte_eth_stats_get() which mentions these fields as well to highlight it?

Thanks,
Andrew.