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 8F6DFA0096 for ; Tue, 9 Apr 2019 10:35:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B9DE58CB; Tue, 9 Apr 2019 10:35:13 +0200 (CEST) Received: from mail-vs1-f66.google.com (mail-vs1-f66.google.com [209.85.217.66]) by dpdk.org (Postfix) with ESMTP id 7A27658C4 for ; Tue, 9 Apr 2019 10:35:11 +0200 (CEST) Received: by mail-vs1-f66.google.com with SMTP id j184so9286092vsd.11 for ; Tue, 09 Apr 2019 01:35:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CH/adgAFs9N0rw2PIOpcXjnBH0cNuOXxVTrYvfC0us8=; b=mWgPZRP/luvK7riDfa9LF2u30xuPXsa46jfW6MHKW0+OVSxTLym+76AuFDqQj2aD9x o8F+Zj2kSv0sqIxrhnaY2F+aEouvtwMRGSVapnKEqq++l9FmD8jb6vkZcMQWNG+EWdct +c+fnfRCJBCbCv0LzqITroIm/dJ1q4lDdNeq9jGO+1a3mEYv9PZNtHFDxfrEfQKYaAkd Ak2JyvBv9nuRc/xi+fLLhr1n0USs5IvLmbMy3Y9sNA0TrCKQT3AWmsRv/JQp8Cm1BZyB 3lPjZlMxX8RXZm2n/2duCpl8cNr4FucO0VhHSZugTOEhwT9pyNwSs1nZX0kanE1nnrfG eggg== X-Gm-Message-State: APjAAAUFCTR5fjT7jIHQmm9wwPAWH8EoxmEW+y6plcEgavzwJm1kS6hb n3DGSmJ+3wFMyt/a2vsiDNV9DtiopU3zbYHQGu4EVw== X-Google-Smtp-Source: APXvYqzbROrDfGAtnclOjWq7iiM7RNSYTJZYIYaqn+HBKG77W8UrC7OanqzuRUN8On4K5os0lgSMqw84uovUGyVr5o0= X-Received: by 2002:a05:6102:199:: with SMTP id r25mr17395003vsq.166.1554798910781; Tue, 09 Apr 2019 01:35:10 -0700 (PDT) MIME-Version: 1.0 References: <20190409082128.33896-1-xiaolong.ye@intel.com> In-Reply-To: <20190409082128.33896-1-xiaolong.ye@intel.com> From: David Marchand Date: Tue, 9 Apr 2019 10:34:59 +0200 Message-ID: To: Xiaolong Ye Cc: dev , Ferruh Yigit , Qi Zhang , Karlsson Magnus , Topel Bjorn Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 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: <20190409083459.AfJceXJAsNaUCzQL4uivzvUed2UkwqVki5LUZ8brsyY@z> 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... > 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. } > > for (i = 0; i < nb_pkts; i++) { > -- David Marchand