From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 826A74F9C for ; Wed, 10 Apr 2019 12:28:20 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2019 03:28:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,332,1549958400"; d="scan'208";a="290301876" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206]) by orsmga004.jf.intel.com with ESMTP; 10 Apr 2019 03:28:16 -0700 Date: Wed, 10 Apr 2019 18:22:58 +0800 From: Ye Xiaolong To: David Marchand Cc: dev , Ferruh Yigit , Qi Zhang , Karlsson Magnus , Topel Bjorn Message-ID: <20190410102258.GA22137@intel.com> References: <20190409082128.33896-1-xiaolong.ye@intel.com> <20190409151902.14675-1-xiaolong.ye@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH] net/af_xdp: enqueue buf ring when allocate Tx queue fails 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: , X-List-Received-Date: Wed, 10 Apr 2019 10:28:21 -0000 On 04/10, David Marchand wrote: >On Tue, Apr 9, 2019 at 5:24 PM Xiaolong Ye wrote: > >> When it fails to allocate enough slots in Tx queue for transmitting >> packets, we need to return the dequeued addrs to buf ring. >> >> Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD") >> >> Signed-off-by: Xiaolong Ye >> --- >> drivers/net/af_xdp/rte_eth_af_xdp.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c >> b/drivers/net/af_xdp/rte_eth_af_xdp.c >> index 007a1c6b4..5cc643ce2 100644 >> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c >> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c >> @@ -276,6 +276,7 @@ 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); >> + rte_ring_enqueue_bulk(umem->buf_ring, addrs, nb_pkts, >> NULL); >> return 0; >> } >> >> -- >> 2.17.1 >> > >Looks good to me. >But I have an additional question. > >After the for loop that only picks the mbufs it can copy to the xdp desc, >is it normal to call xsk_ring_prod__submit(&txq->tx, nb_pkts); rather than >with valid count ? Good catch, I think it needs to submit valid count other than nb_pkts, and return back (nb_pkts - count) addrs to buf ring. I'll send a fix patch for it. Thanks, Xiaolong > >-- >David Marchand From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 302E9A0096 for ; Wed, 10 Apr 2019 12:28:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7A8D6568A; Wed, 10 Apr 2019 12:28:24 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 826A74F9C for ; Wed, 10 Apr 2019 12:28:20 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2019 03:28:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,332,1549958400"; d="scan'208";a="290301876" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206]) by orsmga004.jf.intel.com with ESMTP; 10 Apr 2019 03:28:16 -0700 Date: Wed, 10 Apr 2019 18:22:58 +0800 From: Ye Xiaolong To: David Marchand Cc: dev , Ferruh Yigit , Qi Zhang , Karlsson Magnus , Topel Bjorn Message-ID: <20190410102258.GA22137@intel.com> References: <20190409082128.33896-1-xiaolong.ye@intel.com> <20190409151902.14675-1-xiaolong.ye@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH] net/af_xdp: enqueue buf ring when allocate Tx queue fails 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" Message-ID: <20190410102258.ZYx9ERjs_CScjr6cJCq-zj22Ae_oqA-UhaU-TRdCMjs@z> On 04/10, David Marchand wrote: >On Tue, Apr 9, 2019 at 5:24 PM Xiaolong Ye wrote: > >> When it fails to allocate enough slots in Tx queue for transmitting >> packets, we need to return the dequeued addrs to buf ring. >> >> Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD") >> >> Signed-off-by: Xiaolong Ye >> --- >> drivers/net/af_xdp/rte_eth_af_xdp.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c >> b/drivers/net/af_xdp/rte_eth_af_xdp.c >> index 007a1c6b4..5cc643ce2 100644 >> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c >> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c >> @@ -276,6 +276,7 @@ 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); >> + rte_ring_enqueue_bulk(umem->buf_ring, addrs, nb_pkts, >> NULL); >> return 0; >> } >> >> -- >> 2.17.1 >> > >Looks good to me. >But I have an additional question. > >After the for loop that only picks the mbufs it can copy to the xdp desc, >is it normal to call xsk_ring_prod__submit(&txq->tx, nb_pkts); rather than >with valid count ? Good catch, I think it needs to submit valid count other than nb_pkts, and return back (nb_pkts - count) addrs to buf ring. I'll send a fix patch for it. Thanks, Xiaolong > >-- >David Marchand