From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BCE86A046B for ; Thu, 25 Jul 2019 21:24:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BDBCE1C3BB; Thu, 25 Jul 2019 21:24:40 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id EB49A1C3A8; Thu, 25 Jul 2019 21:24:33 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4CAA616D9E1; Thu, 25 Jul 2019 19:24:33 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-235.brq.redhat.com [10.40.204.235]) by smtp.corp.redhat.com (Postfix) with ESMTP id 997E45DE8E; Thu, 25 Jul 2019 19:24:31 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: ferruh.yigit@intel.com, stable@dpdk.org Date: Thu, 25 Jul 2019 21:24:18 +0200 Message-Id: <1564082659-21922-3-git-send-email-david.marchand@redhat.com> In-Reply-To: <1564082659-21922-1-git-send-email-david.marchand@redhat.com> References: <1563969270-29669-1-git-send-email-david.marchand@redhat.com> <1564082659-21922-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 25 Jul 2019 19:24:33 +0000 (UTC) Subject: [dpdk-stable] [PATCH v3 2/3] net/pcap: fix transmit return count in error conditions X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" When a packet cannot be transmitted, the driver is supposed to free this packet and report it as handled. This is to prevent the application from retrying to send the same packet and ending up in a liveloop since the driver will never manage to send it. Fixes: 49a0a2ffd5db ("net/pcap: fix possible mbuf double freeing") Fixes: 6db141c91e1f ("pcap: support jumbo frames") CC: stable@dpdk.org Signed-off-by: David Marchand Acked-by: Ferruh Yigit --- Changelog since v1: - restored the original behavior if pcap_sendpacket returns an error --- drivers/net/pcap/rte_eth_pcap.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 470867d..bfc0756 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -354,7 +354,8 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) mbuf->pkt_len, RTE_ETHER_MAX_JUMBO_FRAME_LEN); - break; + rte_pktmbuf_free(mbuf); + continue; } } @@ -373,7 +374,7 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) dumper_q->tx_stat.bytes += tx_bytes; dumper_q->tx_stat.err_pkts += nb_pkts - num_tx; - return num_tx; + return nb_pkts; } /* @@ -439,7 +440,8 @@ eth_pcap_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) mbuf->pkt_len, RTE_ETHER_MAX_JUMBO_FRAME_LEN); - break; + rte_pktmbuf_free(mbuf); + continue; } } @@ -452,9 +454,9 @@ eth_pcap_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) tx_queue->tx_stat.pkts += num_tx; tx_queue->tx_stat.bytes += tx_bytes; - tx_queue->tx_stat.err_pkts += nb_pkts - num_tx; + tx_queue->tx_stat.err_pkts += i - num_tx; - return num_tx; + return i; } /* -- 1.8.3.1