aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_vlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bridge/br_vlan.c')
-rw-r--r--net/bridge/br_vlan.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 53f0990eab58..af5ebd18d705 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -34,7 +34,6 @@ static void __vlan_add_flags(struct net_port_vlans *v, u16 vid, u16 flags)
34 34
35static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags) 35static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
36{ 36{
37 const struct net_device_ops *ops;
38 struct net_bridge_port *p = NULL; 37 struct net_bridge_port *p = NULL;
39 struct net_bridge *br; 38 struct net_bridge *br;
40 struct net_device *dev; 39 struct net_device *dev;
@@ -53,17 +52,15 @@ static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
53 br = v->parent.br; 52 br = v->parent.br;
54 dev = br->dev; 53 dev = br->dev;
55 } 54 }
56 ops = dev->netdev_ops;
57 55
58 if (p && (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) { 56 if (p) {
59 /* Add VLAN to the device filter if it is supported. 57 /* Add VLAN to the device filter if it is supported.
60 * Stricly speaking, this is not necessary now, since 58 * Stricly speaking, this is not necessary now, since
61 * devices are made promiscuous by the bridge, but if 59 * devices are made promiscuous by the bridge, but if
62 * that ever changes this code will allow tagged 60 * that ever changes this code will allow tagged
63 * traffic to enter the bridge. 61 * traffic to enter the bridge.
64 */ 62 */
65 err = ops->ndo_vlan_rx_add_vid(dev, htons(ETH_P_8021Q), 63 err = vlan_vid_add(dev, htons(ETH_P_8021Q), vid);
66 vid);
67 if (err) 64 if (err)
68 return err; 65 return err;
69 } 66 }
@@ -82,8 +79,8 @@ static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
82 return 0; 79 return 0;
83 80
84out_filt: 81out_filt:
85 if (p && (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) 82 if (p)
86 ops->ndo_vlan_rx_kill_vid(dev, htons(ETH_P_8021Q), vid); 83 vlan_vid_del(dev, htons(ETH_P_8021Q), vid);
87 return err; 84 return err;
88} 85}
89 86
@@ -95,13 +92,8 @@ static int __vlan_del(struct net_port_vlans *v, u16 vid)
95 __vlan_delete_pvid(v, vid); 92 __vlan_delete_pvid(v, vid);
96 clear_bit(vid, v->untagged_bitmap); 93 clear_bit(vid, v->untagged_bitmap);
97 94
98 if (v->port_idx) { 95 if (v->port_idx)
99 struct net_device *dev = v->parent.port->dev; 96 vlan_vid_del(v->parent.port->dev, htons(ETH_P_8021Q), vid);
100 const struct net_device_ops *ops = dev->netdev_ops;
101
102 if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
103 ops->ndo_vlan_rx_kill_vid(dev, htons(ETH_P_8021Q), vid);
104 }
105 97
106 clear_bit(vid, v->vlan_bitmap); 98 clear_bit(vid, v->vlan_bitmap);
107 v->num_vlans--; 99 v->num_vlans--;
@@ -398,6 +390,7 @@ int nbp_vlan_delete(struct net_bridge_port *port, u16 vid)
398void nbp_vlan_flush(struct net_bridge_port *port) 390void nbp_vlan_flush(struct net_bridge_port *port)
399{ 391{
400 struct net_port_vlans *pv; 392 struct net_port_vlans *pv;
393 u16 vid;
401 394
402 ASSERT_RTNL(); 395 ASSERT_RTNL();
403 396
@@ -405,6 +398,9 @@ void nbp_vlan_flush(struct net_bridge_port *port)
405 if (!pv) 398 if (!pv)
406 return; 399 return;
407 400
401 for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID)
402 vlan_vid_del(port->dev, htons(ETH_P_8021Q), vid);
403
408 __vlan_flush(pv); 404 __vlan_flush(pv);
409} 405}
410 406