From patchwork Mon Sep 9 16:12:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaolong Ye X-Patchwork-Id: 59044 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A1C101ECED; Mon, 9 Sep 2019 18:16:38 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D11341EBAF; Mon, 9 Sep 2019 18:16:36 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Sep 2019 09:16:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,486,1559545200"; d="scan'208";a="183865327" Received: from dpdk_yexl_af_xdp.sh.intel.com ([10.67.119.189]) by fmsmga008.fm.intel.com with ESMTP; 09 Sep 2019 09:16:33 -0700 From: Xiaolong Ye To: Ferruh Yigit , Loftus Ciara , Xiaolong Ye , Qi Zhang Cc: dev@dpdk.org, stable@dpdk.org Date: Tue, 10 Sep 2019 00:12:47 +0800 Message-Id: <20190909161247.61801-1-xiaolong.ye@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/af_xdp: fix Tx halt when no recv packets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" The kernel only consumes Tx packets if we have some Rx traffic on specified queue or we have called send(). So we need to issue a send() even when the allocation fails so that kernel will start to consume packets again. Commit 45bba02c95b0 ("net/af_xdp: support need wakeup feature") breaks above rule by adding some condition to send, this patch fixes it while still keeps the need_wakeup feature for Tx. Fixes: 45bba02c95b0 ("net/af_xdp: support need wakeup feature") Cc: stable@dpdk.org Signed-off-by: Xiaolong Ye Tested-by: Ciara Loftus --- drivers/net/af_xdp/rte_eth_af_xdp.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 41ed5b2af..e496e9aaa 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -286,19 +286,16 @@ kick_tx(struct pkt_tx_queue *txq) { struct xsk_umem_info *umem = txq->pair->umem; -#if defined(XDP_USE_NEED_WAKEUP) - if (xsk_ring_prod__needs_wakeup(&txq->tx)) -#endif - while (send(xsk_socket__fd(txq->pair->xsk), NULL, - 0, MSG_DONTWAIT) < 0) { - /* some thing unexpected */ - if (errno != EBUSY && errno != EAGAIN && errno != EINTR) - break; - - /* pull from completion queue to leave more space */ - if (errno == EAGAIN) - pull_umem_cq(umem, ETH_AF_XDP_TX_BATCH_SIZE); - } + while (send(xsk_socket__fd(txq->pair->xsk), NULL, + 0, MSG_DONTWAIT) < 0) { + /* some thing unexpected */ + if (errno != EBUSY && errno != EAGAIN && errno != EINTR) + break; + + /* pull from completion queue to leave more space */ + if (errno == EAGAIN) + pull_umem_cq(umem, ETH_AF_XDP_TX_BATCH_SIZE); + } pull_umem_cq(umem, ETH_AF_XDP_TX_BATCH_SIZE); } @@ -367,7 +364,10 @@ eth_af_xdp_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) xsk_ring_prod__submit(&txq->tx, nb_pkts); - kick_tx(txq); +#if defined(XDP_USE_NEED_WAKEUP) + if (xsk_ring_prod__needs_wakeup(&txq->tx)) +#endif + kick_tx(txq); txq->stats.tx_pkts += nb_pkts; txq->stats.tx_bytes += tx_bytes;