Commit 3a68844d authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: dsa: Utilize __vlan_find_dev_deep_rcu()

Now that we are guaranteed that dsa_untag_bridge_pvid() is called after
eth_type_trans() we can utilize __vlan_find_dev_deep_rcu() which will
take care of finding an 802.1Q upper on top of a bridge master.

A common use case, prior to 12a1526d067 ("net: dsa: untag the bridge
pvid from rx skbs") was to configure a bridge 802.1Q upper like this:

ip link add name br0 type bridge vlan_filtering 0
ip link add link br0 name br0.1 type vlan id 1

in order to pop the default_pvid VLAN tag.

With this change we restore that behavior while still allowing the DSA
receive path to automatically pop the VLAN tag.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a348292b
...@@ -204,7 +204,6 @@ static inline struct sk_buff *dsa_untag_bridge_pvid(struct sk_buff *skb) ...@@ -204,7 +204,6 @@ static inline struct sk_buff *dsa_untag_bridge_pvid(struct sk_buff *skb)
struct net_device *br = dp->bridge_dev; struct net_device *br = dp->bridge_dev;
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
struct net_device *upper_dev; struct net_device *upper_dev;
struct list_head *iter;
u16 vid, pvid, proto; u16 vid, pvid, proto;
int err; int err;
...@@ -246,13 +245,9 @@ static inline struct sk_buff *dsa_untag_bridge_pvid(struct sk_buff *skb) ...@@ -246,13 +245,9 @@ static inline struct sk_buff *dsa_untag_bridge_pvid(struct sk_buff *skb)
* supports because vlan_filtering is 0. In that case, we should * supports because vlan_filtering is 0. In that case, we should
* definitely keep the tag, to make sure it keeps working. * definitely keep the tag, to make sure it keeps working.
*/ */
netdev_for_each_upper_dev_rcu(dev, upper_dev, iter) { upper_dev = __vlan_find_dev_deep_rcu(br, htons(proto), vid);
if (!is_vlan_dev(upper_dev)) if (upper_dev)
continue; return skb;
if (vid == vlan_dev_vlan_id(upper_dev))
return skb;
}
__vlan_hwaccel_clear_tag(skb); __vlan_hwaccel_clear_tag(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment