From: Vlad Yasevich <vyasevic@redhat.com>
To: vyasevic@redhat.com
Cc: "Michał Mirosław" <mirqus@gmail.com>,
shemminger@vyatta.com, bridge@lists.linux-foundation.org,
davem@davemloft.net, netdev@vger.kernel.org,
shmulik.ladkani@gmail.com
Subject: Re: [PATCH v7 net-next 01/12] bridge: Add vlan filtering infrastructure
Date: Thu, 31 Jan 2013 21:50:21 -0500 [thread overview]
Message-ID: <510B2D6D.4050908@redhat.com> (raw)
In-Reply-To: <510AD065.9010403@redhat.com>
On 01/31/2013 03:13 PM, Vlad Yasevich wrote:
> On 01/31/2013 02:57 PM, Michał Mirosław wrote:
>> 2013/1/31 Vlad Yasevich <vyasevic@redhat.com>:
>>> Adds an optional infrustructure component to bridge that would allow
>>> native vlan filtering in the bridge. Each bridge port (as well
>>> as the bridge device) now get a VLAN bitmap. Each bit in the bitmap
>>> is associated with a vlan id. This way if the bit corresponding to
>>> the vid is set in the bitmap that the packet with vid is allowed to
>>> enter and exit the port.
>>>
>>> Write access the bitmap is protected by RTNL and read access
>>> protected by RCU.
>> [...]
>>> +static int __vlan_del(struct net_port_vlans *v, u16 vid)
>>> +{
>>> + unsigned long first_bit;
>>> + unsigned long last_bit;
>>> +
>>> + if (!test_bit(vid, v->vlan_bitmap))
>>> + return -EINVAL;
>>> +
>>> + /* Check to see if any other vlans are in this table. If this
>>> + * is the last vlan, delete the whole structure. If this is
>>> not the
>>> + * last vlan, just clear the bit.
>>> + */
>>> + first_bit = find_first_bit(v->vlan_bitmap, BR_VLAN_BITMAP_LEN);
>>> + last_bit = find_last_bit(v->vlan_bitmap, BR_VLAN_BITMAP_LEN);
>>> +
>>> + if (v->port_idx && vid) {
>>> + struct net_device *dev = vlans_to_port(v)->dev;
>>> +
>>> + if (dev->features & NETIF_F_HW_VLAN_FILTER)
>>> + dev->netdev_ops->ndo_vlan_rx_kill_vid(dev, vid);
>>> + }
>>> +
>>> + clear_bit(vid, v->vlan_bitmap);
>>> + if (first_bit == last_bit) {
>>
>> if (bitmap_empty(v->vlan_bitmap, BR_VLAN_BITMAP_LEN))
>
> Yeah. I didn't have the clear_bit about before, but with it
> bitmap_empty() is much better.
>
>>
>>> + if (v->port_idx) {
>>> + struct net_bridge_port *p = vlans_to_port(v);
>>> + rcu_assign_pointer(p->vlan_info, NULL);
>>> + } else {
>>> + struct net_bridge *br = vlans_to_bridge(v);
>>> + rcu_assign_pointer(br->vlan_info, NULL);
>>> + }
>>
>> You seem to use vlans_to_port/vlans_to_bridge only to get at
>> vlan_info. Maybe that could be abstracted to a single interface, or
>> even change v->parent to be a 'net_port_vlans **'?
>
> Hmm.. net_port_vlan** has appeal. I'll see if I can make it work.
So, I went about rewriting this only to realize that there is a bug in
patch 10 and I need the conversion functions to fix it.
I can't really abstract it to a single interface without adding the
whole nbp/port layer on top of the bridge device and that's overkill.
Changing to net_port_vlans** doesn't buy me anything other then obfuscation.
So I think I am going to keep the much simpler parent pointer and
conversion functions since I will need them later.
Thanks
-vlad
>
> Thanks
> -vlad
>>
>> Best Regards,
>> Michał Mirosław
>>
>
next prev parent reply other threads:[~2013-02-01 2:50 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-31 3:12 [PATCH v8 net-next 00/12] Add basic VLAN support to bridges Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 01/12] bridge: Add vlan filtering infrastructure Vlad Yasevich
2013-01-31 19:57 ` Michał Mirosław
2013-01-31 20:13 ` Vlad Yasevich
2013-02-01 2:50 ` Vlad Yasevich [this message]
2013-01-31 20:33 ` [Bridge] " Simon Barber
2013-01-31 20:34 ` Vlad Yasevich
2013-01-31 21:46 ` Simon Barber
2013-01-31 21:54 ` Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 02/12] bridge: Validate that vlan is permitted on ingress Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 03/12] bridge: Verify that a vlan is allowed to egress on give port Vlad Yasevich
2013-01-31 20:03 ` Michał Mirosław
2013-01-31 20:17 ` Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 04/12] bridge: Add netlink interface to configure vlans on bridge ports Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 05/12] bridge: Add the ability to configure pvid Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 06/12] bridge: Implement vlan ingress/egress policy Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 07/12] bridge: Add vlan to unicast fdb entries Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 08/12] bridge: Add vlan id to multicast groups Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 09/12] bridge: Add vlan support to static neighbors Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 10/12] bridge: Add vlan support for local fdb entries Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 11/12] bridge: Dump vlan information from a bridge port Vlad Yasevich
2013-01-31 3:12 ` [PATCH v7 net-next 12/12] bridge: Separate egress policy bitmap 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=510B2D6D.4050908@redhat.com \
--to=vyasevic@redhat.com \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=mirqus@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
--cc=shmulik.ladkani@gmail.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).