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 3F8AAA2EEB for ; Wed, 11 Sep 2019 13:33:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1D1DD1E54B; Wed, 11 Sep 2019 13:33:20 +0200 (CEST) Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 9DC671DFF2 for ; Wed, 11 Sep 2019 13:33:18 +0200 (CEST) Received: from lfbn-lil-1-176-160.w90-45.abo.wanadoo.fr ([90.45.26.160] helo=droids-corp.org) by mail.droids-corp.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i80vX-0002Ho-OM; Wed, 11 Sep 2019 13:36:49 +0200 Received: by droids-corp.org (sSMTP sendmail emulation); Wed, 11 Sep 2019 13:33:13 +0200 Date: Wed, 11 Sep 2019 13:33:13 +0200 From: Olivier Matz To: Stephen Hemminger Cc: Morten =?utf-8?Q?Br=C3=B8rup?= , dev@dpdk.org Message-ID: <20190911113313.5nrcjvtm5dgi2r76@platinum> References: <20190911091908.123151-1-mb@smartsharesystems.com> <20190911121834.4ec73590@xps13> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190911121834.4ec73590@xps13> User-Agent: NeoMutt/20180716 Subject: Re: [dpdk-dev] [PATCH] mbuf: add bulk free function 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" Hi, On Wed, Sep 11, 2019 at 12:18:34PM +0100, Stephen Hemminger wrote: > On Wed, 11 Sep 2019 09:19:08 +0000 > Morten Brørup wrote: > > > Add function for freeing a bulk of mbufs. > > > > Signed-off-by: Morten Brørup > > --- > > lib/librte_mbuf/rte_mbuf.h | 17 +++++++++++++++++ > > 1 file changed, 17 insertions(+) > > > > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > > index 98225ec80..f2e174da1 100644 > > --- a/lib/librte_mbuf/rte_mbuf.h > > +++ b/lib/librte_mbuf/rte_mbuf.h > > @@ -1907,6 +1907,23 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m) > > } > > } > > > > +/** > > + * Free a bulk of mbufs back into their original mempool. > > + * > > + * @param mbufs > > + * Array of pointers to mbufs > > + * @param count > > + * Array size > > + */ > > +static inline void > > +rte_pktmbuf_free_bulk(struct rte_mbuf **mbufs, unsigned count) > > +{ > > + unsigned idx = 0; > > + > > + for (idx = 0; idx < count; idx++) > > + rte_pktmbuf_free(mbufs[idx]); > > +} > > + > > You can optimize this to use mempool bulk put operation. A bulk free for mbuf is not as simple as a bulk mempool put, because of indirect mbufs, and because mbufs may return in different mempools. Morten, do you have more details about why do you need such a function? Thanks, Olivier