From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH] examples/l2fwd: increase pktmbuf pool size Date: Thu, 28 Dec 2017 12:36:42 -0800 Message-ID: <20171228123642.39c7aca4@xeon-e3> References: <20171228201906.22770-1-pbhagavatula@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: bruce.richardson@intel.com, pablo.de.lara.guarch@intel.com, dev@dpdk.org To: Pavan Nikhilesh Return-path: Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by dpdk.org (Postfix) with ESMTP id 0100A23D for ; Thu, 28 Dec 2017 21:36:50 +0100 (CET) Received: by mail-pf0-f194.google.com with SMTP id j124so21360296pfc.2 for ; Thu, 28 Dec 2017 12:36:50 -0800 (PST) In-Reply-To: <20171228201906.22770-1-pbhagavatula@caviumnetworks.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, 29 Dec 2017 01:49:06 +0530 Pavan Nikhilesh wrote: > +/* > + * This expression is used to calculate the number of mbufs needed > + * depending on user input, taking into account memory for rx and > + * tx hardware rings, cache per lcore and mbuf pkt burst per port > + * per lcore. RTE_MAX is used to ensure that NB_MBUF never goes below > + * a minimum value of 8192 > + */ > +#define NB_MBUF RTE_MAX(\ > + nb_ports * (nb_rxd + nb_txd + MAX_PKT_BURST +\ > + nb_lcores * MEMPOOL_CACHE_SIZE), (unsigned int)8192) Why not put this inplace where it is used, rather than keeping the define? Also good practice with macros is to not have the macro depend on variables that are in context at that point. You also don't need a cast of (unsigned int)8192, use 8192u instead