]> err.no Git - linux-2.6/commitdiff
[VLAN]: Introduce symbolic constants for flag values
authorPatrick McHardy <kaber@trash.net>
Wed, 13 Jun 2007 19:07:37 +0000 (12:07 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 11 Jul 2007 05:15:02 +0000 (22:15 -0700)
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/if_vlan.h
net/8021q/vlan.c
net/8021q/vlan_dev.c

index b46d4225f74eaac43709a7bac77b5935cf00d150..c7912876a2102c02e0dac48108b5ffa22230cc9e 100644 (file)
@@ -398,6 +398,10 @@ enum vlan_ioctl_cmds {
        GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */
 };
 
+enum vlan_flags {
+       VLAN_FLAG_REORDER_HDR   = 0x1,
+};
+
 enum vlan_name_types {
        VLAN_NAME_TYPE_PLUS_VID, /* Name will look like:  vlan0005 */
        VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like:  eth1.0005 */
index 5801993182b4f33d0f2990c5a9a00e1ccae57a6d..f12f914edf02d8baef0f6a8047fa1926bb6df1d1 100644 (file)
@@ -565,7 +565,7 @@ static int register_vlan_device(struct net_device *real_dev,
        VLAN_DEV_INFO(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */
        VLAN_DEV_INFO(new_dev)->real_dev = real_dev;
        VLAN_DEV_INFO(new_dev)->dent = NULL;
-       VLAN_DEV_INFO(new_dev)->flags = 1;
+       VLAN_DEV_INFO(new_dev)->flags = VLAN_FLAG_REORDER_HDR;
 
        err = register_vlan_dev(new_dev);
        if (err < 0)
index 4f6ede752a37d969bad8aea8d654c1f6a08e19cc..95afe387b95296ca3e1ffb1006ffa80d0b8849f4 100644 (file)
@@ -73,7 +73,7 @@ int vlan_dev_rebuild_header(struct sk_buff *skb)
 
 static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
 {
-       if (VLAN_DEV_INFO(skb->dev)->flags & 1) {
+       if (VLAN_DEV_INFO(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) {
                if (skb_shared(skb) || skb_cloned(skb)) {
                        struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC);
                        kfree_skb(skb);
@@ -350,7 +350,8 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
         * header shuffling in the hard_start_xmit.  Users can turn off this
         * REORDER behaviour with the vconfig tool.
         */
-       build_vlan_header = ((VLAN_DEV_INFO(dev)->flags & 1) == 0);
+       if (!(VLAN_DEV_INFO(dev)->flags & VLAN_FLAG_REORDER_HDR))
+               build_vlan_header = 1;
 
        if (build_vlan_header) {
                vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN);
@@ -584,16 +585,16 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
        return 0;
 }
 
-/* Flags are defined in the vlan_dev_info class in include/linux/if_vlan.h file. */
+/* 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)
 {
        /* verify flag is supported */
-       if (flag == 1) {
+       if (flag == VLAN_FLAG_REORDER_HDR) {
                if (flag_val) {
-                       VLAN_DEV_INFO(dev)->flags |= 1;
+                       VLAN_DEV_INFO(dev)->flags |= VLAN_FLAG_REORDER_HDR;
                } else {
-                       VLAN_DEV_INFO(dev)->flags &= ~1;
+                       VLAN_DEV_INFO(dev)->flags &= ~VLAN_FLAG_REORDER_HDR;
                }
                return 0;
        }