DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/af_xdp: free mbuf when allocate Tx queue fails
@ 2019-04-09  8:21 Xiaolong Ye
  2019-04-09  8:21 ` Xiaolong Ye
                   ` (2 more replies)
  0 siblings, 3 replies; 82+ messages in thread
From: Xiaolong Ye @ 2019-04-09  8:21 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Qi Zhang, Karlsson Magnus, Topel Bjorn, Xiaolong Ye

When we fail to allocate enough slots in tx queue for transmitting
packets, we need to free the corresponding mbufs.

Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 007a1c6b4..bc7973b56 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -276,7 +276,8 @@ eth_af_xdp_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 
 	if (xsk_ring_prod__reserve(&txq->tx, nb_pkts, &idx_tx) != nb_pkts) {
 		kick_tx(txq);
-		return 0;
+		nb_pkts = 0;
+		goto out;
 	}
 
 	for (i = 0; i < nb_pkts; i++) {
@@ -296,7 +297,6 @@ eth_af_xdp_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			valid++;
 			tx_bytes += mbuf->pkt_len;
 		}
-		rte_pktmbuf_free(mbuf);
 	}
 
 	xsk_ring_prod__submit(&txq->tx, nb_pkts);
@@ -311,6 +311,10 @@ eth_af_xdp_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	txq->stats.tx_pkts += valid;
 	txq->stats.tx_bytes += tx_bytes;
 
+ out:
+	for (i = 0; i < nb_pkts; i++)
+		rte_pktmbuf_free(bufs[i]);
+
 	return nb_pkts;
 }
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 82+ messages in thread

end of thread, other threads:[~2019-04-17 16:38 UTC | newest]

Thread overview: 82+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09  8:21 [dpdk-dev] [PATCH] net/af_xdp: free mbuf when allocate Tx queue fails Xiaolong Ye
2019-04-09  8:21 ` Xiaolong Ye
2019-04-09  8:34 ` David Marchand
2019-04-09  8:34   ` David Marchand
2019-04-09 14:48   ` Ye Xiaolong
2019-04-09 14:48     ` Ye Xiaolong
2019-04-09 15:19 ` [dpdk-dev] [PATCH] net/af_xdp: enqueue buf ring " Xiaolong Ye
2019-04-09 15:19   ` Xiaolong Ye
2019-04-10  8:23   ` David Marchand
2019-04-10  8:23     ` David Marchand
2019-04-10 10:22     ` Ye Xiaolong
2019-04-10 10:22       ` Ye Xiaolong
2019-04-10 10:53   ` [dpdk-dev] [PATCH] net/af_xdp: submit valid count to Tx queue Xiaolong Ye
2019-04-10 10:53     ` Xiaolong Ye
2019-04-10 11:30     ` David Marchand
2019-04-10 11:30       ` David Marchand
2019-04-11  2:24       ` Ye Xiaolong
2019-04-11  2:24         ` Ye Xiaolong
2019-04-11  7:20         ` David Marchand
2019-04-11  7:20           ` David Marchand
2019-04-11  7:27           ` Ye Xiaolong
2019-04-11  7:27             ` Ye Xiaolong
2019-04-12 14:48           ` [dpdk-dev] [PATCH 1/2] net/af_xdp: enqueue buf ring when allocate Tx queue fails Xiaolong Ye
2019-04-12 14:48             ` Xiaolong Ye
2019-04-12 14:48             ` [dpdk-dev] [PATCH 2/2] net/af_xdp: make reserve/submit peek/release consistent Xiaolong Ye
2019-04-12 14:48               ` Xiaolong Ye
2019-04-15  8:19               ` David Marchand
2019-04-15  8:19                 ` David Marchand
2019-04-15 14:42                 ` Ye Xiaolong
2019-04-15 14:42                   ` Ye Xiaolong
2019-04-16 15:03           ` [dpdk-dev] [PATCH v2 0/2] some fixes Xiaolong Ye
2019-04-16 15:03             ` Xiaolong Ye
2019-04-16 15:03             ` [dpdk-dev] [PATCH v2 1/2] net/af_xdp: enqueue buf ring when allocate Tx queue fails Xiaolong Ye
2019-04-16 15:03               ` Xiaolong Ye
2019-04-17  7:45               ` David Marchand
2019-04-17  7:45                 ` David Marchand
2019-04-16 15:03             ` [dpdk-dev] [PATCH v2 2/2] net/af_xdp: make reserve/submit peek/release consistent Xiaolong Ye
2019-04-16 15:03               ` Xiaolong Ye
2019-04-17  7:45               ` David Marchand
2019-04-17  7:45                 ` David Marchand
2019-04-17  7:53                 ` Ye Xiaolong
2019-04-17  7:53                   ` Ye Xiaolong
2019-04-17  8:56           ` [dpdk-dev] [PATCH v3 0/4] some fixes for AF_XDP pmd Xiaolong Ye
2019-04-17  8:56             ` Xiaolong Ye
2019-04-17  8:56             ` [dpdk-dev] [PATCH v3 1/4] net/af_xdp: enqueue buf ring when allocate Tx queue fails Xiaolong Ye
2019-04-17  8:56               ` Xiaolong Ye
2019-04-17  9:15               ` David Marchand
2019-04-17  9:15                 ` David Marchand
2019-04-17 13:26                 ` Ye Xiaolong
2019-04-17 13:26                   ` Ye Xiaolong
2019-04-17  8:56             ` [dpdk-dev] [PATCH v3 2/4] net/af_xdp: specify minimal and maximal MTU Xiaolong Ye
2019-04-17  8:56               ` Xiaolong Ye
2019-04-17  9:38               ` David Marchand
2019-04-17  9:38                 ` David Marchand
2019-04-17 13:25                 ` Ye Xiaolong
2019-04-17 13:25                   ` Ye Xiaolong
2019-04-17  8:56             ` [dpdk-dev] [PATCH v3 3/4] net/af_xdp: make reserve/submit peek/release consistent Xiaolong Ye
2019-04-17  8:56               ` Xiaolong Ye
2019-04-17  9:25               ` David Marchand
2019-04-17  9:25                 ` David Marchand
2019-04-17  8:56             ` [dpdk-dev] [PATCH v3 4/4] net/af_xdp: fix typos in Rx function Xiaolong Ye
2019-04-17  8:56               ` Xiaolong Ye
2019-04-17  9:25               ` David Marchand
2019-04-17  9:25                 ` David Marchand
2019-04-17 13:49           ` [dpdk-dev] [PATCH v4 0/4] some fixes for AF_XDP pmd Xiaolong Ye
2019-04-17 13:49             ` Xiaolong Ye
2019-04-17 13:49             ` [dpdk-dev] [PATCH v4 1/4] net/af_xdp: enqueue buf ring when allocate Tx queue fails Xiaolong Ye
2019-04-17 13:49               ` Xiaolong Ye
2019-04-17 13:49             ` [dpdk-dev] [PATCH v4 2/4] net/af_xdp: specify minimal and maximal MTU Xiaolong Ye
2019-04-17 13:49               ` Xiaolong Ye
2019-04-17 13:49             ` [dpdk-dev] [PATCH v4 3/4] net/af_xdp: make reserve/submit peek/release consistent Xiaolong Ye
2019-04-17 13:49               ` Xiaolong Ye
2019-04-17 13:49             ` [dpdk-dev] [PATCH v4 4/4] net/af_xdp: fix typos in Rx function Xiaolong Ye
2019-04-17 13:49               ` Xiaolong Ye
2019-04-17 15:31               ` Rami Rosen
2019-04-17 15:31                 ` Rami Rosen
2019-04-17 14:02             ` [dpdk-dev] [PATCH v4 0/4] some fixes for AF_XDP pmd David Marchand
2019-04-17 14:02               ` David Marchand
2019-04-17 15:27               ` Ye Xiaolong
2019-04-17 15:27                 ` Ye Xiaolong
2019-04-17 16:38               ` Ferruh Yigit
2019-04-17 16:38                 ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).