[ovs-dev] [PATCH v3 5/5] datapath: Fix cvlan test failure on the old kernel versions

Yi Yang yi.y.yang at intel.com
Mon Feb 13 02:39:16 UTC 2017


The root cause is the upcall re-inserts the VLAN back into the raw
packet data, but the TPID is hard coded to 0x8100. This affects
kernels for which HAVE_VLAN_INSERT_TAG_SET_PROTO is not set.

The below patch allows the cvlan and 802.ad tests to pass on debian
with 3.16 kernel.

Signed-off-by: Eric Garver <e at erig.me>
Signed-off-by: Yi Yang <yi.y.yang at intel.com>
---
 datapath/linux/compat/include/linux/if_vlan.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/datapath/linux/compat/include/linux/if_vlan.h b/datapath/linux/compat/include/linux/if_vlan.h
index d51e5c9..fc95b04 100644
--- a/datapath/linux/compat/include/linux/if_vlan.h
+++ b/datapath/linux/compat/include/linux/if_vlan.h
@@ -24,8 +24,9 @@
  * acceptable.
  */
 #define vlan_insert_tag_set_proto(skb, proto, vlan_tci) \
-	rpl_vlan_insert_tag_set_proto(skb, vlan_tci)
+	rpl_vlan_insert_tag_set_proto(skb, proto, vlan_tci)
 static inline struct sk_buff *rpl_vlan_insert_tag_set_proto(struct sk_buff *skb,
+							    __be16 vlan_proto,
 							    u16 vlan_tci)
 {
 	struct vlan_ethhdr *veth;
@@ -41,12 +42,12 @@ static inline struct sk_buff *rpl_vlan_insert_tag_set_proto(struct sk_buff *skb,
 	skb->mac_header -= VLAN_HLEN;
 
 	/* first, the ethernet type */
-	veth->h_vlan_proto = htons(ETH_P_8021Q);
+	veth->h_vlan_proto = vlan_proto;
 
 	/* now, the TCI */
 	veth->h_vlan_TCI = htons(vlan_tci);
 
-	skb->protocol = htons(ETH_P_8021Q);
+	skb->protocol = vlan_proto;
 
 	return skb;
 }
-- 
2.1.0



More information about the dev mailing list