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 D49E1A2EFC for ; Thu, 19 Sep 2019 16:17:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E5A821F050; Thu, 19 Sep 2019 16:17:03 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 5E3931F041 for ; Thu, 19 Sep 2019 16:17:00 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2019 07:16:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,523,1559545200"; d="scan'208";a="271228779" Received: from silpixa00399839.ir.intel.com (HELO localhost.localdomain) ([10.237.223.65]) by orsmga001.jf.intel.com with ESMTP; 19 Sep 2019 07:16:58 -0700 From: Ciara Loftus To: dev@dpdk.org, xiaolong.ye@intel.com, kevin.laatz@intel.com, bruce.richardson@intel.com, ciara.loftus@intel.com Date: Thu, 19 Sep 2019 14:15:18 +0000 Message-Id: <20190919141520.4227-2-ciara.loftus@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190919141520.4227-1-ciara.loftus@intel.com> References: <20190919141520.4227-1-ciara.loftus@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/3] 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" From: Xiaolong Ye 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; -- 2.17.1