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 22FC4A2EFC for ; Tue, 17 Sep 2019 11:13:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EC3481C028; Tue, 17 Sep 2019 11:13:52 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 4153B1BED7; Tue, 17 Sep 2019 11:13:48 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Sep 2019 02:13:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,515,1559545200"; d="scan'208";a="177328110" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga007.jf.intel.com with ESMTP; 17 Sep 2019 02:13:46 -0700 Received: from irsmsx106.ger.corp.intel.com ([169.254.8.184]) by IRSMSX101.ger.corp.intel.com ([169.254.1.129]) with mapi id 14.03.0439.000; Tue, 17 Sep 2019 10:13:45 +0100 From: "Loftus, Ciara" To: "Ye, Xiaolong" , "Yigit, Ferruh" , "Zhang, Qi Z" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] net/af_xdp: fix Tx halt when no recv packets Thread-Index: AQHVZyn0tnjas/bMFkuAE/HWafWy2qcvoTGw Date: Tue, 17 Sep 2019 09:13:44 +0000 Message-ID: <74F120C019F4A64C9B78E802F6AD4CC279213C48@IRSMSX106.ger.corp.intel.com> References: <20190909161247.61801-1-xiaolong.ye@intel.com> In-Reply-To: <20190909161247.61801-1-xiaolong.ye@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzI5OWMyMTEtYmExOC00YzEzLWJiZTYtZTgxNGU2NGI2NWZlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRnFnaTZ5bHhTaFJsbUhmRU9VU3RPRytvMzFUZXpTdGZcL3RDZUpvOGUzWU1lSFBvN3JLMk5xaEFQTUY2TnFETWIifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [PATCH] net/af_xdp: fix Tx halt when no recv packets 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" >=20 > The kernel only consumes Tx packets if we have some Rx traffic on specifi= ed > queue or we have called send(). So we need to issue a send() even when th= e > allocation fails so that kernel will start to consume packets again. >=20 > Commit 45bba02c95b0 ("net/af_xdp: support need wakeup feature") breaks > above rule by adding some condition to send, this patch fixes it while st= ill > keeps the need_wakeup feature for Tx. >=20 > Fixes: 45bba02c95b0 ("net/af_xdp: support need wakeup feature") > Cc: stable@dpdk.org >=20 > Signed-off-by: Xiaolong Ye Thanks for the patch Xiaolong. Verified that this resolved an issue whereby when transmitting in one direc= tion from a NIC PMD to the AF_XDP PMD, the AF_XDP PMD would stop transmitti= ng after a short time. Tested-by: Ciara Loftus Thanks, Ciara > --- > drivers/net/af_xdp/rte_eth_af_xdp.c | 28 ++++++++++++++-------------- > 1 file changed, 14 insertions(+), 14 deletions(-) >=20 > 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 =3D txq->pair->umem; >=20 > -#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 !=3D EBUSY && errno !=3D EAGAIN && errno !=3D > EINTR) > - break; > - > - /* pull from completion queue to leave more space > */ > - if (errno =3D=3D 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 !=3D EBUSY && errno !=3D EAGAIN && errno !=3D EINTR) > + break; > + > + /* pull from completion queue to leave more space */ > + if (errno =3D=3D EAGAIN) > + pull_umem_cq(umem, > ETH_AF_XDP_TX_BATCH_SIZE); > + } > pull_umem_cq(umem, ETH_AF_XDP_TX_BATCH_SIZE); } >=20 > @@ -367,7 +364,10 @@ eth_af_xdp_tx(void *queue, struct rte_mbuf > **bufs, uint16_t nb_pkts) >=20 > xsk_ring_prod__submit(&txq->tx, nb_pkts); >=20 > - kick_tx(txq); > +#if defined(XDP_USE_NEED_WAKEUP) > + if (xsk_ring_prod__needs_wakeup(&txq->tx)) > +#endif > + kick_tx(txq); >=20 > txq->stats.tx_pkts +=3D nb_pkts; > txq->stats.tx_bytes +=3D tx_bytes; > -- > 2.17.1