aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-06-13 15:07:37 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-11 01:15:02 -0400
commita4bf3af4ac46802436d352ef409cee4fe80445b3 (patch)
treee03e7ceb21ff17d886485c9b137f8a47c1b58c56
parentb020cb488586f982f40eb257a32e92a4de710d65 (diff)
[VLAN]: Introduce symbolic constants for flag values
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/if_vlan.h4
-rw-r--r--net/8021q/vlan.c2
-rw-r--r--net/8021q/vlan_dev.c13
3 files changed, 12 insertions, 7 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index b46d4225f74e..c7912876a210 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -398,6 +398,10 @@ enum vlan_ioctl_cmds {
398 GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */ 398 GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */
399}; 399};
400 400
401enum vlan_flags {
402 VLAN_FLAG_REORDER_HDR = 0x1,
403};
404
401enum vlan_name_types { 405enum vlan_name_types {
402 VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */ 406 VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */
403 VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */ 407 VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 5801993182b4..f12f914edf02 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -565,7 +565,7 @@ static int register_vlan_device(struct net_device *real_dev,
565 VLAN_DEV_INFO(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */ 565 VLAN_DEV_INFO(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */
566 VLAN_DEV_INFO(new_dev)->real_dev = real_dev; 566 VLAN_DEV_INFO(new_dev)->real_dev = real_dev;
567 VLAN_DEV_INFO(new_dev)->dent = NULL; 567 VLAN_DEV_INFO(new_dev)->dent = NULL;
568 VLAN_DEV_INFO(new_dev)->flags = 1; 568 VLAN_DEV_INFO(new_dev)->flags = VLAN_FLAG_REORDER_HDR;
569 569
570 err = register_vlan_dev(new_dev); 570 err = register_vlan_dev(new_dev);
571 if (err < 0) 571 if (err < 0)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 4f6ede752a37..95afe387b952 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -73,7 +73,7 @@ int vlan_dev_rebuild_header(struct sk_buff *skb)
73 73
74static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb) 74static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
75{ 75{
76 if (VLAN_DEV_INFO(skb->dev)->flags & 1) { 76 if (VLAN_DEV_INFO(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) {
77 if (skb_shared(skb) || skb_cloned(skb)) { 77 if (skb_shared(skb) || skb_cloned(skb)) {
78 struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC); 78 struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC);
79 kfree_skb(skb); 79 kfree_skb(skb);
@@ -350,7 +350,8 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
350 * header shuffling in the hard_start_xmit. Users can turn off this 350 * header shuffling in the hard_start_xmit. Users can turn off this
351 * REORDER behaviour with the vconfig tool. 351 * REORDER behaviour with the vconfig tool.
352 */ 352 */
353 build_vlan_header = ((VLAN_DEV_INFO(dev)->flags & 1) == 0); 353 if (!(VLAN_DEV_INFO(dev)->flags & VLAN_FLAG_REORDER_HDR))
354 build_vlan_header = 1;
354 355
355 if (build_vlan_header) { 356 if (build_vlan_header) {
356 vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN); 357 vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN);
@@ -584,16 +585,16 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
584 return 0; 585 return 0;
585} 586}
586 587
587/* Flags are defined in the vlan_dev_info class in include/linux/if_vlan.h file. */ 588/* Flags are defined in the vlan_flags enum in include/linux/if_vlan.h file. */
588int vlan_dev_set_vlan_flag(const struct net_device *dev, 589int vlan_dev_set_vlan_flag(const struct net_device *dev,
589 u32 flag, short flag_val) 590 u32 flag, short flag_val)
590{ 591{
591 /* verify flag is supported */ 592 /* verify flag is supported */
592 if (flag == 1) { 593 if (flag == VLAN_FLAG_REORDER_HDR) {
593 if (flag_val) { 594 if (flag_val) {
594 VLAN_DEV_INFO(dev)->flags |= 1; 595 VLAN_DEV_INFO(dev)->flags |= VLAN_FLAG_REORDER_HDR;
595 } else { 596 } else {
596 VLAN_DEV_INFO(dev)->flags &= ~1; 597 VLAN_DEV_INFO(dev)->flags &= ~VLAN_FLAG_REORDER_HDR;
597 } 598 }
598 return 0; 599 return 0;
599 } 600 }