netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	vivien.didelot@savoirfairelinux.com, jiri@mellanox.com,
	idosch@mellanox.com
Subject: Re: [PATCH net-next 4/4] net: dsa: bcm_sf2: Add VLAN support
Date: Fri, 10 Jun 2016 20:53:51 +0200	[thread overview]
Message-ID: <20160610185351.GG2338@lunn.ch> (raw)
In-Reply-To: <575B0B54.7030305@gmail.com>

On Fri, Jun 10, 2016 at 11:47:48AM -0700, Florian Fainelli wrote:
> On 06/10/2016 05:00 AM, Andrew Lunn wrote:
> >> @@ -148,6 +155,9 @@ struct bcm_sf2_priv {
> >>  	struct device_node		*master_mii_dn;
> >>  	struct mii_bus			*slave_mii_bus;
> >>  	struct mii_bus			*master_mii_bus;
> >> +
> >> +	/* Cache of programmed VLANs */
> >> +	struct bcm_sf2_vlan		vlans[VLAN_N_VID];
> > 
> > Hi Florian
> > 
> > This is a 16Kbyte array. So i assume the whole priv structure needs 5
> > pages. Have you had any trouble allocating this much memory,
> > particularly once it has been used for a while and fragmented?
> 
> Well, since this is using the old binding, we can't unload the driver,
> it's built into the kernel, so initializes early enough we have got
> plenty of memory.

Don't you want to use the new binding at some point?

> > I just wondered if it might be better to use vmalloc() for the
> > vlans.
> 
> That's a very good point, I can't really see a drawback to doing this,
> will submit a patch moving this to a dynamic allocation.
> 
> Another possible approach would have been to allocate the vlan structure
> upong port_vlan_prepare() though that would typically result in more
> fragmentation over time once se start using more VLANs.

It is a trade off, code complexity vs saved memory. I don't think such
a table is too bad, assuming your not trying to run the whole system
in 32Mbyes of RAM.

   Andrew

  reply	other threads:[~2016-06-10 18:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10  0:42 [PATCH net-next 0/4] net: dsa: bcm_sf2: add VLAN support Florian Fainelli
2016-06-10  0:42 ` [PATCH net-next 1/4] net: dsa: bcm_sf2: Split fast age into a helper function Florian Fainelli
2016-06-10  0:42 ` [PATCH net-next 2/4] net: dsa: bcm_sf2: Move setup function at the far end Florian Fainelli
2016-06-10  0:42 ` [PATCH net-next 3/4] net: dsa: bcm_sf2: Add VLAN registers definitions Florian Fainelli
2016-06-10  0:42 ` [PATCH net-next 4/4] net: dsa: bcm_sf2: Add VLAN support Florian Fainelli
2016-06-10 12:00   ` Andrew Lunn
2016-06-10 18:47     ` Florian Fainelli
2016-06-10 18:53       ` Andrew Lunn [this message]
2016-06-10 19:04       ` Vivien Didelot
2016-06-10  5:13 ` [PATCH net-next 0/4] net: dsa: bcm_sf2: add " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160610185351.GG2338@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).