diff options
author | Patrick McHardy <kaber@trash.net> | 2008-07-08 06:24:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-08 06:24:44 -0400 |
commit | 9bb8582efb555521c7eec595ebd34e835ddc34b8 (patch) | |
tree | 8eb6aae062bbd359e820a35d51fb16a32e7b828f /net/8021q | |
parent | df6b6a0cf62afeacdeb4c1a35b8fba21fda54399 (diff) |
vlan: TCI related type and naming cleanups
The VLAN code contains multiple spots that use tag, id and tci as
identifiers for arguments and variables incorrectly and they actually
contain or are expected to contain something different. Additionally
types are used inconsistently (unsigned short vs u16) and identifiers
are sometimes capitalized.
- consistently use u16 for storing TCI, ID or QoS values
- consistently use vlan_id and vlan_tci for storing the respective values
- remove capitalization
- add kdoc comment to netif_hwaccel_{rx,receive_skb}
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q')
-rw-r--r-- | net/8021q/vlan.c | 34 | ||||
-rw-r--r-- | net/8021q/vlan.h | 19 | ||||
-rw-r--r-- | net/8021q/vlan_core.c | 6 | ||||
-rw-r--r-- | net/8021q/vlan_dev.c | 47 | ||||
-rw-r--r-- | net/8021q/vlan_gvrp.c | 8 |
5 files changed, 55 insertions, 59 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 7a2625d2f9a0..68bdcf4a795c 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -83,13 +83,12 @@ static struct vlan_group *__vlan_find_group(struct net_device *real_dev) | |||
83 | * | 83 | * |
84 | * Must be invoked with RCU read lock (no preempt) | 84 | * Must be invoked with RCU read lock (no preempt) |
85 | */ | 85 | */ |
86 | struct net_device *__find_vlan_dev(struct net_device *real_dev, | 86 | struct net_device *__find_vlan_dev(struct net_device *real_dev, u16 vlan_id) |
87 | unsigned short VID) | ||
88 | { | 87 | { |
89 | struct vlan_group *grp = __vlan_find_group(real_dev); | 88 | struct vlan_group *grp = __vlan_find_group(real_dev); |
90 | 89 | ||
91 | if (grp) | 90 | if (grp) |
92 | return vlan_group_get_device(grp, VID); | 91 | return vlan_group_get_device(grp, vlan_id); |
93 | 92 | ||
94 | return NULL; | 93 | return NULL; |
95 | } | 94 | } |
@@ -117,14 +116,14 @@ static struct vlan_group *vlan_group_alloc(struct net_device *real_dev) | |||
117 | return grp; | 116 | return grp; |
118 | } | 117 | } |
119 | 118 | ||
120 | static int vlan_group_prealloc_vid(struct vlan_group *vg, int vid) | 119 | static int vlan_group_prealloc_vid(struct vlan_group *vg, u16 vlan_id) |
121 | { | 120 | { |
122 | struct net_device **array; | 121 | struct net_device **array; |
123 | unsigned int size; | 122 | unsigned int size; |
124 | 123 | ||
125 | ASSERT_RTNL(); | 124 | ASSERT_RTNL(); |
126 | 125 | ||
127 | array = vg->vlan_devices_arrays[vid / VLAN_GROUP_ARRAY_PART_LEN]; | 126 | array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; |
128 | if (array != NULL) | 127 | if (array != NULL) |
129 | return 0; | 128 | return 0; |
130 | 129 | ||
@@ -133,7 +132,7 @@ static int vlan_group_prealloc_vid(struct vlan_group *vg, int vid) | |||
133 | if (array == NULL) | 132 | if (array == NULL) |
134 | return -ENOBUFS; | 133 | return -ENOBUFS; |
135 | 134 | ||
136 | vg->vlan_devices_arrays[vid / VLAN_GROUP_ARRAY_PART_LEN] = array; | 135 | vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN] = array; |
137 | return 0; | 136 | return 0; |
138 | } | 137 | } |
139 | 138 | ||
@@ -147,7 +146,7 @@ void unregister_vlan_dev(struct net_device *dev) | |||
147 | struct vlan_dev_info *vlan = vlan_dev_info(dev); | 146 | struct vlan_dev_info *vlan = vlan_dev_info(dev); |
148 | struct net_device *real_dev = vlan->real_dev; | 147 | struct net_device *real_dev = vlan->real_dev; |
149 | struct vlan_group *grp; | 148 | struct vlan_group *grp; |
150 | unsigned short vlan_id = vlan->vlan_id; | 149 | u16 vlan_id = vlan->vlan_id; |
151 | 150 | ||
152 | ASSERT_RTNL(); | 151 | ASSERT_RTNL(); |
153 | 152 | ||
@@ -205,7 +204,7 @@ static void vlan_transfer_operstate(const struct net_device *dev, | |||
205 | } | 204 | } |
206 | } | 205 | } |
207 | 206 | ||
208 | int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id) | 207 | int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id) |
209 | { | 208 | { |
210 | char *name = real_dev->name; | 209 | char *name = real_dev->name; |
211 | 210 | ||
@@ -242,7 +241,7 @@ int register_vlan_dev(struct net_device *dev) | |||
242 | { | 241 | { |
243 | struct vlan_dev_info *vlan = vlan_dev_info(dev); | 242 | struct vlan_dev_info *vlan = vlan_dev_info(dev); |
244 | struct net_device *real_dev = vlan->real_dev; | 243 | struct net_device *real_dev = vlan->real_dev; |
245 | unsigned short vlan_id = vlan->vlan_id; | 244 | u16 vlan_id = vlan->vlan_id; |
246 | struct vlan_group *grp, *ngrp = NULL; | 245 | struct vlan_group *grp, *ngrp = NULL; |
247 | int err; | 246 | int err; |
248 | 247 | ||
@@ -295,8 +294,7 @@ out_free_group: | |||
295 | /* Attach a VLAN device to a mac address (ie Ethernet Card). | 294 | /* Attach a VLAN device to a mac address (ie Ethernet Card). |
296 | * Returns 0 if the device was created or a negative error code otherwise. | 295 | * Returns 0 if the device was created or a negative error code otherwise. |
297 | */ | 296 | */ |
298 | static int register_vlan_device(struct net_device *real_dev, | 297 | static int register_vlan_device(struct net_device *real_dev, u16 vlan_id) |
299 | unsigned short VLAN_ID) | ||
300 | { | 298 | { |
301 | struct net_device *new_dev; | 299 | struct net_device *new_dev; |
302 | struct net *net = dev_net(real_dev); | 300 | struct net *net = dev_net(real_dev); |
@@ -304,10 +302,10 @@ static int register_vlan_device(struct net_device *real_dev, | |||
304 | char name[IFNAMSIZ]; | 302 | char name[IFNAMSIZ]; |
305 | int err; | 303 | int err; |
306 | 304 | ||
307 | if (VLAN_ID >= VLAN_VID_MASK) | 305 | if (vlan_id >= VLAN_VID_MASK) |
308 | return -ERANGE; | 306 | return -ERANGE; |
309 | 307 | ||
310 | err = vlan_check_real_dev(real_dev, VLAN_ID); | 308 | err = vlan_check_real_dev(real_dev, vlan_id); |
311 | if (err < 0) | 309 | if (err < 0) |
312 | return err; | 310 | return err; |
313 | 311 | ||
@@ -315,26 +313,26 @@ static int register_vlan_device(struct net_device *real_dev, | |||
315 | switch (vn->name_type) { | 313 | switch (vn->name_type) { |
316 | case VLAN_NAME_TYPE_RAW_PLUS_VID: | 314 | case VLAN_NAME_TYPE_RAW_PLUS_VID: |
317 | /* name will look like: eth1.0005 */ | 315 | /* name will look like: eth1.0005 */ |
318 | snprintf(name, IFNAMSIZ, "%s.%.4i", real_dev->name, VLAN_ID); | 316 | snprintf(name, IFNAMSIZ, "%s.%.4i", real_dev->name, vlan_id); |
319 | break; | 317 | break; |
320 | case VLAN_NAME_TYPE_PLUS_VID_NO_PAD: | 318 | case VLAN_NAME_TYPE_PLUS_VID_NO_PAD: |
321 | /* Put our vlan.VID in the name. | 319 | /* Put our vlan.VID in the name. |
322 | * Name will look like: vlan5 | 320 | * Name will look like: vlan5 |
323 | */ | 321 | */ |
324 | snprintf(name, IFNAMSIZ, "vlan%i", VLAN_ID); | 322 | snprintf(name, IFNAMSIZ, "vlan%i", vlan_id); |
325 | break; | 323 | break; |
326 | case VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD: | 324 | case VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD: |
327 | /* Put our vlan.VID in the name. | 325 | /* Put our vlan.VID in the name. |
328 | * Name will look like: eth0.5 | 326 | * Name will look like: eth0.5 |
329 | */ | 327 | */ |
330 | snprintf(name, IFNAMSIZ, "%s.%i", real_dev->name, VLAN_ID); | 328 | snprintf(name, IFNAMSIZ, "%s.%i", real_dev->name, vlan_id); |
331 | break; | 329 | break; |
332 | case VLAN_NAME_TYPE_PLUS_VID: | 330 | case VLAN_NAME_TYPE_PLUS_VID: |
333 | /* Put our vlan.VID in the name. | 331 | /* Put our vlan.VID in the name. |
334 | * Name will look like: vlan0005 | 332 | * Name will look like: vlan0005 |
335 | */ | 333 | */ |
336 | default: | 334 | default: |
337 | snprintf(name, IFNAMSIZ, "vlan%.4i", VLAN_ID); | 335 | snprintf(name, IFNAMSIZ, "vlan%.4i", vlan_id); |
338 | } | 336 | } |
339 | 337 | ||
340 | new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name, | 338 | new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name, |
@@ -349,7 +347,7 @@ static int register_vlan_device(struct net_device *real_dev, | |||
349 | */ | 347 | */ |
350 | new_dev->mtu = real_dev->mtu; | 348 | new_dev->mtu = real_dev->mtu; |
351 | 349 | ||
352 | vlan_dev_info(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */ | 350 | vlan_dev_info(new_dev)->vlan_id = vlan_id; |
353 | vlan_dev_info(new_dev)->real_dev = real_dev; | 351 | vlan_dev_info(new_dev)->real_dev = real_dev; |
354 | vlan_dev_info(new_dev)->dent = NULL; | 352 | vlan_dev_info(new_dev)->dent = NULL; |
355 | vlan_dev_info(new_dev)->flags = VLAN_FLAG_REORDER_HDR; | 353 | vlan_dev_info(new_dev)->flags = VLAN_FLAG_REORDER_HDR; |
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 14c421e033f2..a6603a4d917f 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | struct vlan_priority_tci_mapping { | 13 | struct vlan_priority_tci_mapping { |
14 | u32 priority; | 14 | u32 priority; |
15 | unsigned short vlan_qos; | 15 | u16 vlan_qos; |
16 | struct vlan_priority_tci_mapping *next; | 16 | struct vlan_priority_tci_mapping *next; |
17 | }; | 17 | }; |
18 | 18 | ||
@@ -36,8 +36,8 @@ struct vlan_dev_info { | |||
36 | unsigned int nr_egress_mappings; | 36 | unsigned int nr_egress_mappings; |
37 | struct vlan_priority_tci_mapping *egress_priority_map[16]; | 37 | struct vlan_priority_tci_mapping *egress_priority_map[16]; |
38 | 38 | ||
39 | unsigned short vlan_id; | 39 | u16 vlan_id; |
40 | unsigned short flags; | 40 | u16 flags; |
41 | 41 | ||
42 | struct net_device *real_dev; | 42 | struct net_device *real_dev; |
43 | unsigned char real_dev_addr[ETH_ALEN]; | 43 | unsigned char real_dev_addr[ETH_ALEN]; |
@@ -67,30 +67,29 @@ static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev) | |||
67 | * Must be invoked with rcu_read_lock (ie preempt disabled) | 67 | * Must be invoked with rcu_read_lock (ie preempt disabled) |
68 | * or with RTNL. | 68 | * or with RTNL. |
69 | */ | 69 | */ |
70 | struct net_device *__find_vlan_dev(struct net_device *real_dev, | 70 | struct net_device *__find_vlan_dev(struct net_device *real_dev, u16 vlan_id); |
71 | unsigned short VID); /* vlan.c */ | ||
72 | 71 | ||
73 | /* found in vlan_dev.c */ | 72 | /* found in vlan_dev.c */ |
74 | int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, | 73 | int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, |
75 | struct packet_type *ptype, struct net_device *orig_dev); | 74 | struct packet_type *ptype, struct net_device *orig_dev); |
76 | void vlan_dev_set_ingress_priority(const struct net_device *dev, | 75 | void vlan_dev_set_ingress_priority(const struct net_device *dev, |
77 | u32 skb_prio, short vlan_prio); | 76 | u32 skb_prio, u16 vlan_prio); |
78 | int vlan_dev_set_egress_priority(const struct net_device *dev, | 77 | int vlan_dev_set_egress_priority(const struct net_device *dev, |
79 | u32 skb_prio, short vlan_prio); | 78 | u32 skb_prio, u16 vlan_prio); |
80 | int vlan_dev_change_flags(const struct net_device *dev, u32 flag, u32 mask); | 79 | int vlan_dev_change_flags(const struct net_device *dev, u32 flag, u32 mask); |
81 | void vlan_dev_get_realdev_name(const struct net_device *dev, char *result); | 80 | void vlan_dev_get_realdev_name(const struct net_device *dev, char *result); |
82 | 81 | ||
83 | int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id); | 82 | int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id); |
84 | void vlan_setup(struct net_device *dev); | 83 | void vlan_setup(struct net_device *dev); |
85 | int register_vlan_dev(struct net_device *dev); | 84 | int register_vlan_dev(struct net_device *dev); |
86 | void unregister_vlan_dev(struct net_device *dev); | 85 | void unregister_vlan_dev(struct net_device *dev); |
87 | 86 | ||
88 | static inline u32 vlan_get_ingress_priority(struct net_device *dev, | 87 | static inline u32 vlan_get_ingress_priority(struct net_device *dev, |
89 | unsigned short vlan_tag) | 88 | u16 vlan_tci) |
90 | { | 89 | { |
91 | struct vlan_dev_info *vip = vlan_dev_info(dev); | 90 | struct vlan_dev_info *vip = vlan_dev_info(dev); |
92 | 91 | ||
93 | return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7]; | 92 | return vip->ingress_priority_map[(vlan_tci >> 13) & 0x7]; |
94 | } | 93 | } |
95 | 94 | ||
96 | #ifdef CONFIG_VLAN_8021Q_GVRP | 95 | #ifdef CONFIG_VLAN_8021Q_GVRP |
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index f980b9154cc3..68df12d3664b 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | /* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */ | 6 | /* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */ |
7 | int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | 7 | int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, |
8 | unsigned short vlan_tag, int polling) | 8 | u16 vlan_tci, int polling) |
9 | { | 9 | { |
10 | struct net_device_stats *stats; | 10 | struct net_device_stats *stats; |
11 | 11 | ||
@@ -14,7 +14,7 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | |||
14 | return NET_RX_DROP; | 14 | return NET_RX_DROP; |
15 | } | 15 | } |
16 | 16 | ||
17 | skb->dev = vlan_group_get_device(grp, vlan_tag & VLAN_VID_MASK); | 17 | skb->dev = vlan_group_get_device(grp, vlan_tci & VLAN_VID_MASK); |
18 | if (skb->dev == NULL) { | 18 | if (skb->dev == NULL) { |
19 | dev_kfree_skb_any(skb); | 19 | dev_kfree_skb_any(skb); |
20 | /* Not NET_RX_DROP, this is not being dropped | 20 | /* Not NET_RX_DROP, this is not being dropped |
@@ -27,7 +27,7 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | |||
27 | stats->rx_packets++; | 27 | stats->rx_packets++; |
28 | stats->rx_bytes += skb->len; | 28 | stats->rx_bytes += skb->len; |
29 | 29 | ||
30 | skb->priority = vlan_get_ingress_priority(skb->dev, vlan_tag); | 30 | skb->priority = vlan_get_ingress_priority(skb->dev, vlan_tci); |
31 | switch (skb->pkt_type) { | 31 | switch (skb->pkt_type) { |
32 | case PACKET_BROADCAST: | 32 | case PACKET_BROADCAST: |
33 | break; | 33 | break; |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 2aab294c5744..2ccac6bea57e 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -150,9 +150,9 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, | |||
150 | struct packet_type *ptype, struct net_device *orig_dev) | 150 | struct packet_type *ptype, struct net_device *orig_dev) |
151 | { | 151 | { |
152 | struct vlan_hdr *vhdr; | 152 | struct vlan_hdr *vhdr; |
153 | unsigned short vid; | ||
154 | struct net_device_stats *stats; | 153 | struct net_device_stats *stats; |
155 | unsigned short vlan_TCI; | 154 | u16 vlan_id; |
155 | u16 vlan_tci; | ||
156 | 156 | ||
157 | skb = skb_share_check(skb, GFP_ATOMIC); | 157 | skb = skb_share_check(skb, GFP_ATOMIC); |
158 | if (skb == NULL) | 158 | if (skb == NULL) |
@@ -162,14 +162,14 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, | |||
162 | goto err_free; | 162 | goto err_free; |
163 | 163 | ||
164 | vhdr = (struct vlan_hdr *)skb->data; | 164 | vhdr = (struct vlan_hdr *)skb->data; |
165 | vlan_TCI = ntohs(vhdr->h_vlan_TCI); | 165 | vlan_tci = ntohs(vhdr->h_vlan_TCI); |
166 | vid = (vlan_TCI & VLAN_VID_MASK); | 166 | vlan_id = vlan_tci & VLAN_VID_MASK; |
167 | 167 | ||
168 | rcu_read_lock(); | 168 | rcu_read_lock(); |
169 | skb->dev = __find_vlan_dev(dev, vid); | 169 | skb->dev = __find_vlan_dev(dev, vlan_id); |
170 | if (!skb->dev) { | 170 | if (!skb->dev) { |
171 | pr_debug("%s: ERROR: No net_device for VID: %u on dev: %s\n", | 171 | pr_debug("%s: ERROR: No net_device for VID: %u on dev: %s\n", |
172 | __func__, (unsigned int)vid, dev->name); | 172 | __func__, vlan_id, dev->name); |
173 | goto err_unlock; | 173 | goto err_unlock; |
174 | } | 174 | } |
175 | 175 | ||
@@ -181,11 +181,10 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, | |||
181 | 181 | ||
182 | skb_pull_rcsum(skb, VLAN_HLEN); | 182 | skb_pull_rcsum(skb, VLAN_HLEN); |
183 | 183 | ||
184 | skb->priority = vlan_get_ingress_priority(skb->dev, | 184 | skb->priority = vlan_get_ingress_priority(skb->dev, vlan_tci); |
185 | ntohs(vhdr->h_vlan_TCI)); | ||
186 | 185 | ||
187 | pr_debug("%s: priority: %u for TCI: %hu\n", | 186 | pr_debug("%s: priority: %u for TCI: %hu\n", |
188 | __func__, skb->priority, ntohs(vhdr->h_vlan_TCI)); | 187 | __func__, skb->priority, vlan_tci); |
189 | 188 | ||
190 | switch (skb->pkt_type) { | 189 | switch (skb->pkt_type) { |
191 | case PACKET_BROADCAST: /* Yeah, stats collect these together.. */ | 190 | case PACKET_BROADCAST: /* Yeah, stats collect these together.. */ |
@@ -228,7 +227,7 @@ err_free: | |||
228 | return NET_RX_DROP; | 227 | return NET_RX_DROP; |
229 | } | 228 | } |
230 | 229 | ||
231 | static inline unsigned short | 230 | static inline u16 |
232 | vlan_dev_get_egress_qos_mask(struct net_device *dev, struct sk_buff *skb) | 231 | vlan_dev_get_egress_qos_mask(struct net_device *dev, struct sk_buff *skb) |
233 | { | 232 | { |
234 | struct vlan_priority_tci_mapping *mp; | 233 | struct vlan_priority_tci_mapping *mp; |
@@ -260,7 +259,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | |||
260 | unsigned int len) | 259 | unsigned int len) |
261 | { | 260 | { |
262 | struct vlan_hdr *vhdr; | 261 | struct vlan_hdr *vhdr; |
263 | unsigned short veth_TCI = 0; | 262 | u16 vlan_tci = 0; |
264 | int rc = 0; | 263 | int rc = 0; |
265 | int build_vlan_header = 0; | 264 | int build_vlan_header = 0; |
266 | struct net_device *vdev = dev; | 265 | struct net_device *vdev = dev; |
@@ -292,10 +291,10 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | |||
292 | * VLAN ID 12 bits (low bits) | 291 | * VLAN ID 12 bits (low bits) |
293 | * | 292 | * |
294 | */ | 293 | */ |
295 | veth_TCI = vlan_dev_info(dev)->vlan_id; | 294 | vlan_tci = vlan_dev_info(dev)->vlan_id; |
296 | veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb); | 295 | vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb); |
297 | 296 | ||
298 | vhdr->h_vlan_TCI = htons(veth_TCI); | 297 | vhdr->h_vlan_TCI = htons(vlan_tci); |
299 | 298 | ||
300 | /* | 299 | /* |
301 | * Set the protocol type. For a packet of type ETH_P_802_3 we | 300 | * Set the protocol type. For a packet of type ETH_P_802_3 we |
@@ -373,7 +372,7 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
373 | if (veth->h_vlan_proto != htons(ETH_P_8021Q) || | 372 | if (veth->h_vlan_proto != htons(ETH_P_8021Q) || |
374 | vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR) { | 373 | vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR) { |
375 | int orig_headroom = skb_headroom(skb); | 374 | int orig_headroom = skb_headroom(skb); |
376 | unsigned short veth_TCI; | 375 | u16 vlan_tci; |
377 | 376 | ||
378 | /* This is not a VLAN frame...but we can fix that! */ | 377 | /* This is not a VLAN frame...but we can fix that! */ |
379 | vlan_dev_info(dev)->cnt_encap_on_xmit++; | 378 | vlan_dev_info(dev)->cnt_encap_on_xmit++; |
@@ -386,10 +385,10 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
386 | * CFI 1 bit | 385 | * CFI 1 bit |
387 | * VLAN ID 12 bits (low bits) | 386 | * VLAN ID 12 bits (low bits) |
388 | */ | 387 | */ |
389 | veth_TCI = vlan_dev_info(dev)->vlan_id; | 388 | vlan_tci = vlan_dev_info(dev)->vlan_id; |
390 | veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb); | 389 | vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb); |
391 | 390 | ||
392 | skb = __vlan_put_tag(skb, veth_TCI); | 391 | skb = __vlan_put_tag(skb, vlan_tci); |
393 | if (!skb) { | 392 | if (!skb) { |
394 | stats->tx_dropped++; | 393 | stats->tx_dropped++; |
395 | return 0; | 394 | return 0; |
@@ -422,7 +421,7 @@ static int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, | |||
422 | struct net_device *dev) | 421 | struct net_device *dev) |
423 | { | 422 | { |
424 | struct net_device_stats *stats = &dev->stats; | 423 | struct net_device_stats *stats = &dev->stats; |
425 | unsigned short veth_TCI; | 424 | u16 vlan_tci; |
426 | 425 | ||
427 | /* Construct the second two bytes. This field looks something | 426 | /* Construct the second two bytes. This field looks something |
428 | * like: | 427 | * like: |
@@ -430,9 +429,9 @@ static int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, | |||
430 | * CFI 1 bit | 429 | * CFI 1 bit |
431 | * VLAN ID 12 bits (low bits) | 430 | * VLAN ID 12 bits (low bits) |
432 | */ | 431 | */ |
433 | veth_TCI = vlan_dev_info(dev)->vlan_id; | 432 | vlan_tci = vlan_dev_info(dev)->vlan_id; |
434 | veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb); | 433 | vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb); |
435 | skb = __vlan_hwaccel_put_tag(skb, veth_TCI); | 434 | skb = __vlan_hwaccel_put_tag(skb, vlan_tci); |
436 | 435 | ||
437 | stats->tx_packets++; | 436 | stats->tx_packets++; |
438 | stats->tx_bytes += skb->len; | 437 | stats->tx_bytes += skb->len; |
@@ -457,7 +456,7 @@ static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu) | |||
457 | } | 456 | } |
458 | 457 | ||
459 | void vlan_dev_set_ingress_priority(const struct net_device *dev, | 458 | void vlan_dev_set_ingress_priority(const struct net_device *dev, |
460 | u32 skb_prio, short vlan_prio) | 459 | u32 skb_prio, u16 vlan_prio) |
461 | { | 460 | { |
462 | struct vlan_dev_info *vlan = vlan_dev_info(dev); | 461 | struct vlan_dev_info *vlan = vlan_dev_info(dev); |
463 | 462 | ||
@@ -470,7 +469,7 @@ void vlan_dev_set_ingress_priority(const struct net_device *dev, | |||
470 | } | 469 | } |
471 | 470 | ||
472 | int vlan_dev_set_egress_priority(const struct net_device *dev, | 471 | int vlan_dev_set_egress_priority(const struct net_device *dev, |
473 | u32 skb_prio, short vlan_prio) | 472 | u32 skb_prio, u16 vlan_prio) |
474 | { | 473 | { |
475 | struct vlan_dev_info *vlan = vlan_dev_info(dev); | 474 | struct vlan_dev_info *vlan = vlan_dev_info(dev); |
476 | struct vlan_priority_tci_mapping *mp = NULL; | 475 | struct vlan_priority_tci_mapping *mp = NULL; |
diff --git a/net/8021q/vlan_gvrp.c b/net/8021q/vlan_gvrp.c index db9781608362..061ceceeef12 100644 --- a/net/8021q/vlan_gvrp.c +++ b/net/8021q/vlan_gvrp.c | |||
@@ -30,19 +30,19 @@ static struct garp_application vlan_gvrp_app __read_mostly = { | |||
30 | int vlan_gvrp_request_join(const struct net_device *dev) | 30 | int vlan_gvrp_request_join(const struct net_device *dev) |
31 | { | 31 | { |
32 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); | 32 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); |
33 | __be16 vid = htons(vlan->vlan_id); | 33 | __be16 vlan_id = htons(vlan->vlan_id); |
34 | 34 | ||
35 | return garp_request_join(vlan->real_dev, &vlan_gvrp_app, | 35 | return garp_request_join(vlan->real_dev, &vlan_gvrp_app, |
36 | &vid, sizeof(vid), GVRP_ATTR_VID); | 36 | &vlan_id, sizeof(vlan_id), GVRP_ATTR_VID); |
37 | } | 37 | } |
38 | 38 | ||
39 | void vlan_gvrp_request_leave(const struct net_device *dev) | 39 | void vlan_gvrp_request_leave(const struct net_device *dev) |
40 | { | 40 | { |
41 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); | 41 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); |
42 | __be16 vid = htons(vlan->vlan_id); | 42 | __be16 vlan_id = htons(vlan->vlan_id); |
43 | 43 | ||
44 | garp_request_leave(vlan->real_dev, &vlan_gvrp_app, | 44 | garp_request_leave(vlan->real_dev, &vlan_gvrp_app, |
45 | &vid, sizeof(vid), GVRP_ATTR_VID); | 45 | &vlan_id, sizeof(vlan_id), GVRP_ATTR_VID); |
46 | } | 46 | } |
47 | 47 | ||
48 | int vlan_gvrp_init_applicant(struct net_device *dev) | 48 | int vlan_gvrp_init_applicant(struct net_device *dev) |