[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <510AD571.6060309@redhat.com>
Date: Thu, 31 Jan 2013 15:34:57 -0500
From: Vlad Yasevich <vyasevic@...hat.com>
To: Simon Barber <simon@...erduper.net>
CC: Michał Mirosław <mirqus@...il.com>,
netdev@...r.kernel.org, shemminger@...tta.com,
bridge@...ts.linux-foundation.org, davem@...emloft.net,
shmulik.ladkani@...il.com
Subject: Re: [Bridge] [PATCH v7 net-next 01/12] bridge: Add vlan filtering
infrastructure
On 01/31/2013 03:33 PM, Simon Barber wrote:
> I wrote a similar patch a few years ago:
>
> https://lists.linux-foundation.org/pipermail/bridge/2006-September/005046.html
>
>
> This patch also added the possibility to define a native vlan for each
> port and for the bridge port itself - is there any interest in this
> feature as well as the filtering?
>
See patch 5 and 6 and the series :)
-vlad
> Simon
>
>
> On 01/31/2013 11:57 AM, Michał Mirosław wrote:
>> 2013/1/31 Vlad Yasevich <vyasevic@...hat.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))
>>
>>> + 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 **'?
>>
>> Best Regards,
>> Michał Mirosław
>>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists