From: Ferruh Yigit Date: Wed, 3 Feb 2021 17:30:25 +0000 (+0000) Subject: net/pcap: fix byte stats for drop Tx X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=cec222d6e55d9bd15eff7fbbf45464c0c6a941c0;p=dpdk.git net/pcap: fix byte stats for drop Tx Drop Tx path in pcap is Tx that just drops the packets, which is used for the case only Rx from a pcap file is requested/matters. The byte stats was calculated using first mbuf segment, which gives wrong values for multi segmented mbufs, updated to use packet length instead. Bugzilla ID: 597 Fixes: a3f5252e5cbd ("net/pcap: enable infinitely Rx a pcap file") Cc: stable@dpdk.org Reported-by: Cian Ferriter Signed-off-by: Ferruh Yigit Acked-by: Cian Ferriter --- diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index ff02ade70d..c7751b7ba7 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -386,7 +386,7 @@ eth_tx_drop(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) return 0; for (i = 0; i < nb_pkts; i++) { - tx_bytes += bufs[i]->data_len; + tx_bytes += bufs[i]->pkt_len; rte_pktmbuf_free(bufs[i]); }