Skip to content

Commit 396cf94

Browse files
Pravin B Shelarjessegross
authored andcommitted
vlan: Move vlan_set_encap_proto() to vlan header file
Open vSwitch needs this function for vlan handling. Signed-off-by: Pravin B Shelar <[email protected]> Signed-off-by: Jesse Gross <[email protected]>
1 parent b4e1661 commit 396cf94

File tree

2 files changed

+34
-33
lines changed

2 files changed

+34
-33
lines changed

include/linux/if_vlan.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,40 @@ static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
310310

311311
return protocol;
312312
}
313+
314+
static 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+
}
313347
#endif /* __KERNEL__ */
314348

315349
/* VLAN IOCTLs are found in sockios.h */

net/8021q/vlan_core.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -110,39 +110,6 @@ static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
110110
return skb;
111111
}
112112

113-
static void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vhdr)
114-
{
115-
__be16 proto;
116-
unsigned char *rawp;
117-
118-
/*
119-
* Was a VLAN packet, grab the encapsulated protocol, which the layer
120-
* three protocols care about.
121-
*/
122-
123-
proto = vhdr->h_vlan_encapsulated_proto;
124-
if (ntohs(proto) >= 1536) {
125-
skb->protocol = proto;
126-
return;
127-
}
128-
129-
rawp = skb->data;
130-
if (*(unsigned short *) rawp == 0xFFFF)
131-
/*
132-
* This is a magic hack to spot IPX packets. Older Novell
133-
* breaks the protocol design and runs IPX over 802.3 without
134-
* an 802.2 LLC layer. We look for FFFF which isn't a used
135-
* 802.2 SSAP/DSAP. This won't work for fault tolerant netware
136-
* but does for the rest.
137-
*/
138-
skb->protocol = htons(ETH_P_802_3);
139-
else
140-
/*
141-
* Real 802.2 LLC
142-
*/
143-
skb->protocol = htons(ETH_P_802_2);
144-
}
145-
146113
struct sk_buff *vlan_untag(struct sk_buff *skb)
147114
{
148115
struct vlan_hdr *vhdr;

0 commit comments

Comments
 (0)