Merge branch 'mainstream'
[sliver-openvswitch.git] / datapath / linux / compat / include / linux / if_vlan.h
index 326abb2..730175b 100644 (file)
@@ -1,9 +1,11 @@
 #ifndef __LINUX_IF_VLAN_WRAPPER_H
 #define __LINUX_IF_VLAN_WRAPPER_H 1
 
-#include_next <linux/if_vlan.h>
 #include <linux/skbuff.h>
+#include <linux/version.h>
+#include_next <linux/if_vlan.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
 /*
  * The behavior of __vlan_put_tag() has changed over time:
  *
@@ -18,8 +20,9 @@
  * to avoid the need to guess whether the version in the kernel tree is
  * acceptable.
  */
-#define __vlan_put_tag rpl_vlan_put_tag
-static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
+#define __vlan_put_tag(skb, proto, tag)  rpl__vlan_put_tag(skb, tag)
+
+static inline struct sk_buff *rpl__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
 {
        struct vlan_ethhdr *veth;
 
@@ -30,7 +33,7 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
        veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
 
        /* Move the mac addresses to the beginning of the new header. */
-       memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN);
+       memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
        skb->mac_header -= VLAN_HLEN;
 
        /* first, the ethernet type */
@@ -44,6 +47,16 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
        return skb;
 }
 
+static inline struct sk_buff *rpl___vlan_hwaccel_put_tag(struct sk_buff *skb,
+                                                    __be16 vlan_proto,
+                                                    u16 vlan_tci)
+{
+       return __vlan_hwaccel_put_tag(skb, vlan_tci);
+}
+
+#define __vlan_hwaccel_put_tag rpl___vlan_hwaccel_put_tag
+
+#endif
 
 /* All of these were introduced in a single commit preceding 2.6.33, so
  * presumably all of them or none of them are present. */
@@ -54,8 +67,7 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
 #define VLAN_TAG_PRESENT       VLAN_CFI_MASK
 #endif
 
-/* This function is not exported from kernel. OVS Upstreaming patch will
- * fix that. */
+#ifndef HAVE_VLAN_SET_ENCAP_PROTO
 static inline void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vhdr)
 {
        __be16 proto;
@@ -88,4 +100,5 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vh
                 */
                skb->protocol = htons(ETH_P_802_2);
 }
+#endif
 #endif /* linux/if_vlan.h wrapper */