From 7b0a60dd394969fb17409519fd673e61b05f284e Mon Sep 17 00:00:00 2001 From: Alvin Zhang Date: Thu, 1 Apr 2021 13:21:32 +0800 Subject: [PATCH] net/e1000: fix Rx error counter for bad length When the size of a packet in Rx channel is less than the minimum or greater than the maximum, the packet will be simultaneously counted by RLEC(Receive Length Error Count) and RUC(Receive Under Size Count)/ROC(Receive Oversize Count) registers. This patch fixes the issue of counting a length error packet twice when counting the total number of received error packets. Fixes: 70bdb18657da ("ethdev: add Rx error counters for missed, badcrc and badlen packets") Cc: stable@dpdk.org Signed-off-by: Alvin Zhang Acked-by: Haiyue Wang --- drivers/net/e1000/em_ethdev.c | 3 +-- drivers/net/e1000/igb_ethdev.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 3e7ccdbf09..a0ca371b02 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -975,8 +975,7 @@ eth_em_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats) /* Rx Errors */ rte_stats->imissed = stats->mpc; - rte_stats->ierrors = stats->crcerrs + - stats->rlec + stats->ruc + stats->roc + + rte_stats->ierrors = stats->crcerrs + stats->rlec + stats->rxerrc + stats->algnerrc + stats->cexterr; /* Tx Errors */ diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index a1a72339ba..25218da240 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -1825,8 +1825,7 @@ eth_igb_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats) /* Rx Errors */ rte_stats->imissed = stats->mpc; - rte_stats->ierrors = stats->crcerrs + - stats->rlec + stats->ruc + stats->roc + + rte_stats->ierrors = stats->crcerrs + stats->rlec + stats->rxerrc + stats->algnerrc + stats->cexterr; /* Tx Errors */ -- 2.20.1