From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 634264F93 for ; Tue, 9 Apr 2019 16:53:32 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Apr 2019 07:53:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,329,1549958400"; d="scan'208";a="159595982" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206]) by fmsmga002.fm.intel.com with ESMTP; 09 Apr 2019 07:53:30 -0700 Date: Tue, 9 Apr 2019 22:48:15 +0800 From: Ye Xiaolong To: David Marchand Cc: dev , Ferruh Yigit , Qi Zhang , Karlsson Magnus , Topel Bjorn Message-ID: <20190409144815.GA13056@intel.com> References: <20190409082128.33896-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: free mbuf 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: Tue, 09 Apr 2019 14:53:32 -0000 Hi, David On 04/09, David Marchand wrote: >On Tue, Apr 9, 2019 at 10:27 AM Xiaolong Ye wrote: > >> When we fail to allocate enough slots in tx queue for transmitting >> packets, we need to free the corresponding mbufs. >> > >You'd better let the application retry on its own... Make sense. > > >> Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD") >> >> Signed-off-by: Xiaolong Ye >> --- >> drivers/net/af_xdp/rte_eth_af_xdp.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c >> b/drivers/net/af_xdp/rte_eth_af_xdp.c >> index 007a1c6b4..bc7973b56 100644 >> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c >> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c >> @@ -276,7 +276,8 @@ 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); >> - return 0; >> + nb_pkts = 0; >> + goto out; >> > >...and free back the buffers you got from the umem ring here. Agree, will send a new version. Thanks, Xiaolong > > } >> >> for (i = 0; i < nb_pkts; i++) { >> > > >-- >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 C0733A0096 for ; Tue, 9 Apr 2019 16:53:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ABCA54F9A; Tue, 9 Apr 2019 16:53:33 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 634264F93 for ; Tue, 9 Apr 2019 16:53:32 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Apr 2019 07:53:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,329,1549958400"; d="scan'208";a="159595982" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206]) by fmsmga002.fm.intel.com with ESMTP; 09 Apr 2019 07:53:30 -0700 Date: Tue, 9 Apr 2019 22:48:15 +0800 From: Ye Xiaolong To: David Marchand Cc: dev , Ferruh Yigit , Qi Zhang , Karlsson Magnus , Topel Bjorn Message-ID: <20190409144815.GA13056@intel.com> References: <20190409082128.33896-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: free mbuf 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: <20190409144815.NUJALBm89Rdvxj5uLStn5YUfLSiRM3albLN2xPccoXc@z> Hi, David On 04/09, David Marchand wrote: >On Tue, Apr 9, 2019 at 10:27 AM Xiaolong Ye wrote: > >> When we fail to allocate enough slots in tx queue for transmitting >> packets, we need to free the corresponding mbufs. >> > >You'd better let the application retry on its own... Make sense. > > >> Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD") >> >> Signed-off-by: Xiaolong Ye >> --- >> drivers/net/af_xdp/rte_eth_af_xdp.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c >> b/drivers/net/af_xdp/rte_eth_af_xdp.c >> index 007a1c6b4..bc7973b56 100644 >> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c >> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c >> @@ -276,7 +276,8 @@ 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); >> - return 0; >> + nb_pkts = 0; >> + goto out; >> > >...and free back the buffers you got from the umem ring here. Agree, will send a new version. Thanks, Xiaolong > > } >> >> for (i = 0; i < nb_pkts; i++) { >> > > >-- >David Marchand