[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180305104813.GI1156@kwain>
Date: Mon, 5 Mar 2018 11:48:13 +0100
From: Antoine Tenart <antoine.tenart@...tlin.com>
To: Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Cc: Antoine Tenart <antoine.tenart@...tlin.com>, davem@...emloft.net,
Stefan Chulski <stefanc@...vell.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, maxime.chevallier@...tlin.com,
gregory.clement@...tlin.com, miquel.raynal@...tlin.com,
nadavh@...vell.com, ymarkman@...vell.com, mw@...ihalf.com
Subject: Re: [PATCH net-next 1/5] net: mvpp2: use the same buffer pool for
all ports
Hi Thomas,
On Fri, Mar 02, 2018 at 05:01:59PM +0100, Thomas Petazzoni wrote:
> On Fri, 2 Mar 2018 16:40:40 +0100, Antoine Tenart wrote:
> > +static struct {
> > + int pkt_size;
> > + int buf_num;
> > +} mvpp2_pools[MVPP2_BM_POOLS_NUM];
>
> Any reason for not doing:
>
> } mvpp2_pools[MVPP2_BM_POOLS_NUM] = {
> [MVPP2_BM_SHORT] = {
> .pkt_size = MVPP2_BM_SHORT_PKT_SIZE,
> .buf_num = MVPP2_BM_SHORT_BUF_NUM
> },
> [MVPP2_BM_LONG] = {
> .pkt_size = MVPP2_BM_LONG_PKT_SIZE,
> .buf_num = MVPP2_BM_LONG_BUF_NUM,
> },
> };
>
> And get rid of:
>
> > +static void mvpp2_setup_bm_pool(void)
> > +{
> > + /* Short pool */
> > + mvpp2_pools[MVPP2_BM_SHORT].buf_num = MVPP2_BM_SHORT_BUF_NUM;
> > + mvpp2_pools[MVPP2_BM_SHORT].pkt_size = MVPP2_BM_SHORT_PKT_SIZE;
> > +
> > + /* Long pool */
> > + mvpp2_pools[MVPP2_BM_LONG].buf_num = MVPP2_BM_LONG_BUF_NUM;
> > + mvpp2_pools[MVPP2_BM_LONG].pkt_size = MVPP2_BM_LONG_PKT_SIZE;
> > +}
>
> ?
I wanted to do this, but it's no possible as MVPP2_BM_SHORT_PKT_SIZE and
MVPP2_BM_LONG_PKT_SIZE use a core definition which expands at some point
to __max(...) which has to be called from within a function.
That's why I kept mvpp2_setup_bm_pool().
Thanks!
Antoine
--
Antoine Ténart, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists