netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevic@redhat.com>
To: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Cc: bridge@lists.linux-foundation.org,
	"Stephen Hemminger" <stephen@networkplumber.org>,
	"Michał Mirosław" <mirqus@gmail.com>,
	netdev@vger.kernel.org, davem@davemloft.net,
	shemminger@vyatta.com, mst@redhat.com
Subject: Re: [PATCH net-next V6 02/14] bridge: Add vlan filtering infrastructure
Date: Tue, 22 Jan 2013 09:31:43 -0500	[thread overview]
Message-ID: <50FEA2CF.4060406@redhat.com> (raw)
In-Reply-To: <20130121134534.78032a54.shmulik.ladkani@gmail.com>

On 01/21/2013 06:45 AM, Shmulik Ladkani wrote:
> Hi Vlad,
>
> On Sun, 20 Jan 2013 20:50:59 -0500 Vlad Yasevich <vyasevic@redhat.com> wrote:
>> On 01/20/2013 02:38 PM, Stephen Hemminger wrote:
>>> Let's assume the people that really want this feature are using a lot
>>> of vlan's. i.e n = 1000 or so. A bitmap is O(1). Any hash list would
>>> incur a just a big memory penalty for the list head. In other words
>>> a full bitmap is 4096 bits = 512 bytes.  If you use hash list,
>>> then the equivalent memory size would be only 64 list heads, therefore
>>> a bitmap is a better choice than a hlist.
>>>
>>
>> This was the approach taken in the RFC v1 of this series.  What I found
>> was that while it worked very well as far as speed goes, it was a bit
>> cumbersome to extend it to support pvids and it would completely fall
>> on its face for egress policy that Shmulik is suggesting.  So any kinds
>> of extensions to it were tough to do.
>
> I don't see why this is the case.
>
> How about (sketch only, names questionable...):
>
> struct net_bridge {
> +	unsigned long vlan_port_membership_bitmap[VLAN_N_VID][PORT_BITMAP_LEN];
> +	unsigned long vlan_port_egress_policy_bitmap[VLAN_N_VID][PORT_BITMAP_LEN];
> }
>
> (can be alloc'ed instead of the arrays being part of the struct)
>
> struct net_bridge_port {
> +	u16 pvid;
> };
>
> Allows O(1) to the query "is port P member of vlan V".
> Allows O(1) to the query "should vlan V egress tagged/untagged on port P".
>
> I guess this might simplify the data structures involved, avoiding the
> refcounts, etc...
>
> The penaties are:
>   - memory
>   - aesthetics (?)
>   - inefficient if query is "give me the entire list of VLANs port P is
>     member of". But do we have such a query in bridge's code?

Yes.  When a mac address is added to a port without an explicit vlan tag 
we try to add it for every vlan available on the port.

Also, in the API, the user may request vlans configured on a port.

>
> You say it went cumbersome. Am I missing something?
>
> BTW, altenatively, you may:
>
> struct net_bridge_port {
> +	unsigned long vlan_membership_bitmap[BITS_TO_LONGS(VLAN_N_VID)];
> +	unsigned long vlan_egress_policy_bitmap[BITS_TO_LONGS(VLAN_N_VID)];
> +	u16 pvid;
> };
>
> Which also allows O(1) to "is port 'nbp' member of vlan V".
>

This is what the earlier RFC patches did.  You are paying a large memory 
penalty and carrying a mostly empty bitmap when only a small number of 
vlans is used.

If someone decides that they'd like priority support, you'd need another 
array or list to hold priority values.

-vlad

> Difference:
> - For the membership structure:
>    former (within net_bridge) uses 4096 * BR_MAX_PORTS bits,
>    latter (within net_bridge_port) uses NumOfNBPs * 4096 bits
> - better aesthetics (?)
>
> Regards,
> Shmulik
>

  reply	other threads:[~2013-01-22 14:31 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 18:17 [PATCH net-next V6 00/14] Add basic VLAN support to bridges Vlad Yasevich
2013-01-16 18:17 ` [PATCH net-next V6 01/14] vlan: wrap hw-acceleration calls in separate functions Vlad Yasevich
2013-01-16 22:00   ` Michał Mirosław
2013-01-16 22:03   ` Michał Mirosław
2013-01-16 18:17 ` [PATCH net-next V6 02/14] bridge: Add vlan filtering infrastructure Vlad Yasevich
2013-01-17  4:47   ` Cong Wang
2013-01-18  1:57   ` Michał Mirosław
2013-01-20 17:59     ` Vlad Yasevich
2013-01-20 19:38       ` Stephen Hemminger
2013-01-21  1:50         ` Vlad Yasevich
2013-01-21 11:45           ` Shmulik Ladkani
2013-01-22 14:31             ` Vlad Yasevich [this message]
2013-01-22 15:55               ` Shmulik Ladkani
2013-01-22 16:27                 ` Vlad Yasevich
     [not found]                 ` <CB4696DA7737D0409230B481D0363B1414F0E6029D@HQ1-EXCH03.corp.brocade.com>
     [not found]                   ` <20130122091746.7a3820e9@nehalam.linuxnetplumber.net>
2013-01-22 17:32                     ` Vlad Yasevich
2013-01-20 21:38   ` Shmulik Ladkani
2013-01-21  1:56     ` Vlad Yasevich
2013-01-16 18:17 ` [PATCH net-next V6 03/14] bridge: Validate that vlan is permitted on ingress Vlad Yasevich
2013-01-20 22:27   ` Shmulik Ladkani
2013-01-21  1:58     ` Vlad Yasevich
2013-01-16 18:17 ` [PATCH net-next V6 04/14] bridge: Verify that a vlan is allowed to egress on give port Vlad Yasevich
2013-01-16 18:18 ` [PATCH net-next V6 05/14] bridge: Cache vlan in the cb for faster egress lookup Vlad Yasevich
2013-01-16 18:18 ` [PATCH net-next V6 06/14] bridge: Add netlink interface to configure vlans on bridge ports Vlad Yasevich
2013-01-17  4:54   ` Cong Wang
2013-01-17  5:52     ` David Miller
2013-01-16 18:18 ` [PATCH net-next V6 07/14] bridge: Add the ability to configure pvid Vlad Yasevich
2013-01-16 18:18 ` [PATCH net-next V6 08/14] bridge: Implement vlan ingress/egress policy Vlad Yasevich
2013-01-16 18:18 ` [PATCH net-next V6 09/14] bridge: API to configure egress policy Vlad Yasevich
2013-01-16 18:18 ` [PATCH net-next V6 10/14] bridge: Add vlan to unicast fdb entries Vlad Yasevich
2013-01-16 18:18 ` [PATCH net-next V6 11/14] bridge: Add vlan id to multicast groups Vlad Yasevich
2013-01-16 18:18 ` [PATCH net-next V6 12/14] bridge: Add vlan support to static neighbors Vlad Yasevich
2013-01-17  5:16   ` Cong Wang
2013-01-16 18:18 ` [PATCH net-next V6 13/14] bridge: Add vlan support for local fdb entries Vlad Yasevich
2013-01-16 18:18 ` [PATCH net-next V6 14/14] bridge: Dump vlan information from a bridge port Vlad Yasevich

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=50FEA2CF.4060406@redhat.com \
    --to=vyasevic@redhat.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=mirqus@gmail.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=shmulik.ladkani@gmail.com \
    --cc=stephen@networkplumber.org \
    /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).