]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/8021q/vlan_dev.c
vlan: Change vlan_dev_set_vlan_flag() to handle multiple flags at once
[linux-2.6-omap-h63xx.git] / net / 8021q / vlan_dev.c
index c961f0826005bc196c90c687a41297e6860d8c6b..76c665cdab6619670b97303bae18d14bf83f928a 100644 (file)
@@ -507,18 +507,16 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
 }
 
 /* Flags are defined in the vlan_flags enum in include/linux/if_vlan.h file. */
-int vlan_dev_set_vlan_flag(const struct net_device *dev,
-                          u32 flag, short flag_val)
+int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask)
 {
-       /* verify flag is supported */
-       if (flag == VLAN_FLAG_REORDER_HDR) {
-               if (flag_val)
-                       vlan_dev_info(dev)->flags |= VLAN_FLAG_REORDER_HDR;
-               else
-                       vlan_dev_info(dev)->flags &= ~VLAN_FLAG_REORDER_HDR;
-               return 0;
-       }
-       return -EINVAL;
+       struct vlan_dev_info *vlan = vlan_dev_info(dev);
+       u32 old_flags = vlan->flags;
+
+       if (mask & ~VLAN_FLAG_REORDER_HDR)
+               return -EINVAL;
+
+       vlan->flags = (old_flags & ~mask) | (flags & mask);
+       return 0;
 }
 
 void vlan_dev_get_realdev_name(const struct net_device *dev, char *result)
@@ -663,6 +661,8 @@ static int vlan_dev_init(struct net_device *dev)
                                          (1<<__LINK_STATE_DORMANT))) |
                      (1<<__LINK_STATE_PRESENT);
 
+       dev->features |= real_dev->features & real_dev->vlan_features;
+
        /* ipv6 shared card related stuff */
        dev->dev_id = real_dev->dev_id;