aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@nicira.com>2011-11-18 16:15:54 -0500
committerJesse Gross <jesse@nicira.com>2011-12-03 12:35:09 -0500
commit396cf9430505cfba529a2f2a037d782719fa5844 (patch)
treed628b40d09c5e608d1bd41ac14f64774c8fddf10 /include
parentb4e16611c4e1cd98765269c8fdaf43f96baa57b1 (diff)
vlan: Move vlan_set_encap_proto() to vlan header file
Open vSwitch needs this function for vlan handling. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/if_vlan.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 12d5543b14f2..070ac50c1d2d 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -310,6 +310,40 @@ static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
310 310
311 return protocol; 311 return protocol;
312} 312}
313
314static inline void vlan_set_encap_proto(struct sk_buff *skb,
315 struct vlan_hdr *vhdr)
316{
317 __be16 proto;
318 unsigned char *rawp;
319
320 /*
321 * Was a VLAN packet, grab the encapsulated protocol, which the layer
322 * three protocols care about.
323 */
324
325 proto = vhdr->h_vlan_encapsulated_proto;
326 if (ntohs(proto) >= 1536) {
327 skb->protocol = proto;
328 return;
329 }
330
331 rawp = skb->data;
332 if (*(unsigned short *) rawp == 0xFFFF)
333 /*
334 * This is a magic hack to spot IPX packets. Older Novell
335 * breaks the protocol design and runs IPX over 802.3 without
336 * an 802.2 LLC layer. We look for FFFF which isn't a used
337 * 802.2 SSAP/DSAP. This won't work for fault tolerant netware
338 * but does for the rest.
339 */
340 skb->protocol = htons(ETH_P_802_3);
341 else
342 /*
343 * Real 802.2 LLC
344 */
345 skb->protocol = htons(ETH_P_802_2);
346}
313#endif /* __KERNEL__ */ 347#endif /* __KERNEL__ */
314 348
315/* VLAN IOCTLs are found in sockios.h */ 349/* VLAN IOCTLs are found in sockios.h */