aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan_dev.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-07-06 00:26:27 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-06 00:26:27 -0400
commitb3ce0325f2bf1bb737cb8fc7c349ce8fefdd9e40 (patch)
treef2925e18555561b528b781c535c96bdbc0c809a9 /net/8021q/vlan_dev.c
parenteca9ebac651f774d8b10fce7c5d173c3c3d3394f (diff)
vlan: Change vlan_dev_set_vlan_flag() to handle multiple flags at once
Change vlan_dev_set_vlan_flag() to handle multiple flags at once and rename to vlan_dev_change_flags(). This allows to to use it from the netlink interface, which in turn allows to handle necessary adjustments when changing flags centrally. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan_dev.c')
-rw-r--r--net/8021q/vlan_dev.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 5d055c242ed8..76c665cdab66 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -507,18 +507,16 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
507} 507}
508 508
509/* Flags are defined in the vlan_flags enum in include/linux/if_vlan.h file. */ 509/* Flags are defined in the vlan_flags enum in include/linux/if_vlan.h file. */
510int vlan_dev_set_vlan_flag(const struct net_device *dev, 510int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask)
511 u32 flag, short flag_val)
512{ 511{
513 /* verify flag is supported */ 512 struct vlan_dev_info *vlan = vlan_dev_info(dev);
514 if (flag == VLAN_FLAG_REORDER_HDR) { 513 u32 old_flags = vlan->flags;
515 if (flag_val) 514
516 vlan_dev_info(dev)->flags |= VLAN_FLAG_REORDER_HDR; 515 if (mask & ~VLAN_FLAG_REORDER_HDR)
517 else 516 return -EINVAL;
518 vlan_dev_info(dev)->flags &= ~VLAN_FLAG_REORDER_HDR; 517
519 return 0; 518 vlan->flags = (old_flags & ~mask) | (flags & mask);
520 } 519 return 0;
521 return -EINVAL;
522} 520}
523 521
524void vlan_dev_get_realdev_name(const struct net_device *dev, char *result) 522void vlan_dev_get_realdev_name(const struct net_device *dev, char *result)