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 14D62A3295 for ; Wed, 23 Oct 2019 13:45:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CCB271C10F; Wed, 23 Oct 2019 13:45:58 +0200 (CEST) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 4A4831C10C for ; Wed, 23 Oct 2019 13:45:57 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 2B073335751; Wed, 23 Oct 2019 13:45:57 +0200 (CEST) Date: Wed, 23 Oct 2019 13:45:57 +0200 From: Olivier Matz To: "Ananyev, Konstantin" Cc: "dev@dpdk.org" , Andrew Rybchenko , "Richardson, Bruce" , "Wang, Haiyue" , Jerin Jacob Kollanukkaran , "Wiles, Keith" , Morten =?iso-8859-1?Q?Br=F8rup?= , Stephen Hemminger , Thomas Monjalon Message-ID: <20191023114557.GL25286@glumotte.dev.6wind.com> References: <20190710092907.5565-1-olivier.matz@6wind.com> <20191017144219.32708-1-olivier.matz@6wind.com> <2601191342CEEE43887BDE71AB97725801A8C6E2BD@IRSMSX104.ger.corp.intel.com> <20191023101946.GH25286@glumotte.dev.6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191023101946.GH25286@glumotte.dev.6wind.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v2] mbuf: support dynamic fields and flags 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" On Wed, Oct 23, 2019 at 12:19:46PM +0200, Olivier Matz wrote: > On Tue, Oct 22, 2019 at 10:51:51PM +0000, Ananyev, Konstantin wrote: (...) > > > +/* Allocate and initialize the shared memory. Assume tailq is locked */ > > > +static int > > > +init_shared_mem(void) > > > +{ > > > + const struct rte_memzone *mz; > > > + uint64_t mask; > > > + > > > + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { > > > + mz = rte_memzone_reserve_aligned(RTE_MBUF_DYN_MZNAME, > > > + sizeof(struct mbuf_dyn_shm), > > > + SOCKET_ID_ANY, 0, > > > + RTE_CACHE_LINE_SIZE); > > > + } else { > > > + mz = rte_memzone_lookup(RTE_MBUF_DYN_MZNAME); > > > + } > > > + if (mz == NULL) > > > + return -1; > > > + > > > + shm = mz->addr; > > > + > > > +#define mark_free(field) \ > > > + memset(&shm->free_space[offsetof(struct rte_mbuf, field)], \ > > > + 1, sizeof(((struct rte_mbuf *)0)->field)) > > > > Still think it would look nicer without multi-line macro defines/undef in the middle of the function. > > I rather think that macro helps to make the code more readable, but it's > probably just a matter of taste. Will someone puts a contract on me if I > keep it like this? If yes I'll do the change ;) More seriously, do you prefer if I move the macro definition above the function?