Skip to contentSkip to conversation

net/iavf: adjust the CRC statistics calculation

PATCH Applied Haiyue Wang 2 participants 2 messages Jan 15, 2021 – Jan 18, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/iavf: adjust the CRC statistics calculation

The AVF can support to enable / disable CRC strip, so it needs to adjust the statistics calculation for ibytes according to offload setting.

---
 drivers/net/iavf/iavf_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/iavf/iavf_ethdev.c +4 -1
index e22c62ed0..87e606273 100644
@@ -1413,6 +1413,9 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 
 	ret = iavf_query_stats(adapter, &pstats);
 	if (ret == 0) {
+		uint8_t crc_stats_len = (dev->data->dev_conf.rxmode.offloads &
+					 DEV_RX_OFFLOAD_KEEP_CRC) ? 0 :
+					 RTE_ETHER_CRC_LEN;
 		iavf_update_stats(vsi, pstats);
 		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
 				pstats->rx_broadcast - pstats->rx_discards;
@@ -1421,7 +1424,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->ibytes -= stats->ipackets * crc_stats_len;
 		stats->obytes = pstats->tx_bytes;
 	} else {
 		PMD_DRV_LOG(ERR, "Get statistics failed");
Signature · 1 line
2.30.0
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 12 lines

-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Friday, January 15, 2021 2:57 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Fu, Qi <[email protected]>; Wang, Haiyue <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v1] net/iavf: adjust the CRC statistics calculation

Quoted 4 lines

The AVF can support to enable / disable CRC strip, so it needs to adjust the statistics calculation for ibytes according to offload setting.

Applied to dpdk-next-net-intel.

Thanks
Qi