From patchwork Wed Feb 3 17:30:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 87703 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6DD6EA0A0E; Wed, 3 Feb 2021 18:30:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 314EE240687; Wed, 3 Feb 2021 18:30:32 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 00F5E240686; Wed, 3 Feb 2021 18:30:29 +0100 (CET) IronPort-SDR: LXlvrcQJt0QfLckSaGr6+XnAfdtZY7U/G0WB5U7L9grziZd1+vSEughEAzKmtCrK50ZH4bABai s874NOFYrY1Q== X-IronPort-AV: E=McAfee;i="6000,8403,9884"; a="242592783" X-IronPort-AV: E=Sophos;i="5.79,399,1602572400"; d="scan'208";a="242592783" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2021 09:30:28 -0800 IronPort-SDR: O4Rrtz5Zg30pRnX9j0GdekN2wSjNbgD72jpTDQ6VBT/MuyR8eN/pEqykQ3CLQxwHrm7bOVnRvf gKwlt6VOu7xA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,399,1602572400"; d="scan'208";a="359510942" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.27]) by orsmga006.jf.intel.com with ESMTP; 03 Feb 2021 09:30:27 -0800 From: Ferruh Yigit To: Cian Ferriter Cc: Ferruh Yigit , dev@dpdk.org, stable@dpdk.org Date: Wed, 3 Feb 2021 17:30:25 +0000 Message-Id: <20210203173025.2786063-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/pcap: fix byte stats for drop Tx X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- drivers/net/pcap/rte_eth_pcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index ff02ade70d1a..c7751b7ba742 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]); }