diff options
-rw-r--r-- | include/linux/if_vlan.h | 14 | ||||
-rw-r--r-- | net/8021q/vlan.h | 2 | ||||
-rw-r--r-- | net/8021q/vlan_dev.c | 2 | ||||
-rw-r--r-- | net/core/dev.c | 2 | ||||
-rw-r--r-- | net/packet/af_packet.c | 5 |
5 files changed, 15 insertions, 10 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 7ff9af1d0f05..8898cbebcf34 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -63,7 +63,11 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) | |||
63 | return (struct vlan_ethhdr *)skb_mac_header(skb); | 63 | return (struct vlan_ethhdr *)skb_mac_header(skb); |
64 | } | 64 | } |
65 | 65 | ||
66 | #define VLAN_VID_MASK 0xfff | 66 | #define VLAN_PRIO_MASK 0xe000 /* Priority Code Point */ |
67 | #define VLAN_PRIO_SHIFT 13 | ||
68 | #define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator */ | ||
69 | #define VLAN_TAG_PRESENT VLAN_CFI_MASK | ||
70 | #define VLAN_VID_MASK 0x0fff /* VLAN Identifier */ | ||
67 | 71 | ||
68 | /* found in socket.c */ | 72 | /* found in socket.c */ |
69 | extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); | 73 | extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); |
@@ -105,8 +109,8 @@ static inline void vlan_group_set_device(struct vlan_group *vg, | |||
105 | array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; | 109 | array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; |
106 | } | 110 | } |
107 | 111 | ||
108 | #define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci) | 112 | #define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) |
109 | #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci) | 113 | #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) |
110 | 114 | ||
111 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 115 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
112 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); | 116 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); |
@@ -231,7 +235,7 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) | |||
231 | static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, | 235 | static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, |
232 | u16 vlan_tci) | 236 | u16 vlan_tci) |
233 | { | 237 | { |
234 | skb->vlan_tci = vlan_tci; | 238 | skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci; |
235 | return skb; | 239 | return skb; |
236 | } | 240 | } |
237 | 241 | ||
@@ -284,7 +288,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, | |||
284 | u16 *vlan_tci) | 288 | u16 *vlan_tci) |
285 | { | 289 | { |
286 | if (vlan_tx_tag_present(skb)) { | 290 | if (vlan_tx_tag_present(skb)) { |
287 | *vlan_tci = skb->vlan_tci; | 291 | *vlan_tci = vlan_tx_tag_get(skb); |
288 | return 0; | 292 | return 0; |
289 | } else { | 293 | } else { |
290 | *vlan_tci = 0; | 294 | *vlan_tci = 0; |
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 82570bc2a180..4ade5edf1033 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h | |||
@@ -89,7 +89,7 @@ static inline u32 vlan_get_ingress_priority(struct net_device *dev, | |||
89 | { | 89 | { |
90 | struct vlan_dev_info *vip = vlan_dev_info(dev); | 90 | struct vlan_dev_info *vip = vlan_dev_info(dev); |
91 | 91 | ||
92 | return vip->ingress_priority_map[(vlan_tci >> 13) & 0x7]; | 92 | return vip->ingress_priority_map[(vlan_tci >> VLAN_PRIO_SHIFT) & 0x7]; |
93 | } | 93 | } |
94 | 94 | ||
95 | #ifdef CONFIG_VLAN_8021Q_GVRP | 95 | #ifdef CONFIG_VLAN_8021Q_GVRP |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 4198ec5c8abc..e3701977f58d 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -393,7 +393,7 @@ int vlan_dev_set_egress_priority(const struct net_device *dev, | |||
393 | struct vlan_dev_info *vlan = vlan_dev_info(dev); | 393 | struct vlan_dev_info *vlan = vlan_dev_info(dev); |
394 | struct vlan_priority_tci_mapping *mp = NULL; | 394 | struct vlan_priority_tci_mapping *mp = NULL; |
395 | struct vlan_priority_tci_mapping *np; | 395 | struct vlan_priority_tci_mapping *np; |
396 | u32 vlan_qos = (vlan_prio << 13) & 0xE000; | 396 | u32 vlan_qos = (vlan_prio << VLAN_PRIO_SHIFT) & VLAN_PRIO_MASK; |
397 | 397 | ||
398 | /* See if a priority mapping exists.. */ | 398 | /* See if a priority mapping exists.. */ |
399 | mp = vlan->egress_priority_map[skb_prio & 0xF]; | 399 | mp = vlan->egress_priority_map[skb_prio & 0xF]; |
diff --git a/net/core/dev.c b/net/core/dev.c index e7bada1d5ed9..950c13fa60d2 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2300,7 +2300,7 @@ int netif_receive_skb(struct sk_buff *skb) | |||
2300 | if (!skb->tstamp.tv64) | 2300 | if (!skb->tstamp.tv64) |
2301 | net_timestamp(skb); | 2301 | net_timestamp(skb); |
2302 | 2302 | ||
2303 | if (skb->vlan_tci && vlan_hwaccel_do_receive(skb)) | 2303 | if (vlan_tx_tag_present(skb) && vlan_hwaccel_do_receive(skb)) |
2304 | return NET_RX_SUCCESS; | 2304 | return NET_RX_SUCCESS; |
2305 | 2305 | ||
2306 | /* if we've gotten here through NAPI, check netpoll */ | 2306 | /* if we've gotten here through NAPI, check netpoll */ |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index ff752c606413..33e68f20ec61 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -79,6 +79,7 @@ | |||
79 | #include <linux/module.h> | 79 | #include <linux/module.h> |
80 | #include <linux/init.h> | 80 | #include <linux/init.h> |
81 | #include <linux/mutex.h> | 81 | #include <linux/mutex.h> |
82 | #include <linux/if_vlan.h> | ||
82 | 83 | ||
83 | #ifdef CONFIG_INET | 84 | #ifdef CONFIG_INET |
84 | #include <net/inet_common.h> | 85 | #include <net/inet_common.h> |
@@ -766,7 +767,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, | |||
766 | getnstimeofday(&ts); | 767 | getnstimeofday(&ts); |
767 | h.h2->tp_sec = ts.tv_sec; | 768 | h.h2->tp_sec = ts.tv_sec; |
768 | h.h2->tp_nsec = ts.tv_nsec; | 769 | h.h2->tp_nsec = ts.tv_nsec; |
769 | h.h2->tp_vlan_tci = skb->vlan_tci; | 770 | h.h2->tp_vlan_tci = vlan_tx_tag_get(skb); |
770 | hdrlen = sizeof(*h.h2); | 771 | hdrlen = sizeof(*h.h2); |
771 | break; | 772 | break; |
772 | default: | 773 | default: |
@@ -1493,7 +1494,7 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1493 | aux.tp_snaplen = skb->len; | 1494 | aux.tp_snaplen = skb->len; |
1494 | aux.tp_mac = 0; | 1495 | aux.tp_mac = 0; |
1495 | aux.tp_net = skb_network_offset(skb); | 1496 | aux.tp_net = skb_network_offset(skb); |
1496 | aux.tp_vlan_tci = skb->vlan_tci; | 1497 | aux.tp_vlan_tci = vlan_tx_tag_get(skb); |
1497 | 1498 | ||
1498 | put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux); | 1499 | put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux); |
1499 | } | 1500 | } |