From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 60C62A0C4D; Tue, 24 Aug 2021 14:09:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 012884069E; Tue, 24 Aug 2021 14:09:09 +0200 (CEST) Received: from mx.tkos.co.il (guitar.tcltek.co.il [192.115.133.116]) by mails.dpdk.org (Postfix) with ESMTP id 3781940142; Mon, 23 Aug 2021 18:57:15 +0200 (CEST) Received: from tarshish.tkos.co.il (unknown [10.0.8.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx.tkos.co.il (Postfix) with ESMTPS id 425AA440139; Mon, 23 Aug 2021 19:57:09 +0300 (IDT) From: Baruch Siach To: Ciara Loftus , Qi Zhang Cc: dev@dpdk.org, Baruch Siach , stable@dpdk.org Date: Mon, 23 Aug 2021 19:56:58 +0300 Message-Id: <421e4003bb7f556588ae95f0ed32ce282906a000.1629737818.git.baruch@tkos.co.il> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Tue, 24 Aug 2021 14:09:08 +0200 Subject: [dpdk-dev] [PATCH] net/af_xdp: fix zero copy Tx queue drain 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" Call xsk_ring_prod__submit() before kick_tx() so that the kernel consumer sees the updated state of Tx ring. Otherwise, Tx packets are stuck in the ring until the next call to af_xdp_tx_zc(). Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks") Cc: stable@dpdk.org Signed-off-by: Baruch Siach --- drivers/net/af_xdp/rte_eth_af_xdp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 74ffa4511284..81998d86b4aa 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -502,10 +502,11 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) if (mbuf->pool == umem->mb_pool) { if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx)) { + xsk_ring_prod__submit(&txq->tx, count); kick_tx(txq, cq); if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx)) - goto out; + goto out_skip_tx; } desc = xsk_ring_prod__tx_desc(&txq->tx, idx_tx); desc->len = mbuf->pkt_len; @@ -527,7 +528,6 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx)) { rte_pktmbuf_free(local_mbuf); - kick_tx(txq, cq); goto out; } @@ -551,11 +551,11 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) tx_bytes += mbuf->pkt_len; } - kick_tx(txq, cq); - out: xsk_ring_prod__submit(&txq->tx, count); + kick_tx(txq, cq); +out_skip_tx: txq->stats.tx_pkts += count; txq->stats.tx_bytes += tx_bytes; txq->stats.tx_dropped += nb_pkts - count; -- 2.32.0