datapath: Provide compatibility for kernels up to 3.17
[cascardo/ovs.git] / datapath / linux / compat / include / linux / skbuff.h
index a9dc2e7..18e75d6 100644 (file)
@@ -3,8 +3,13 @@
 
 #include_next <linux/skbuff.h>
 
+#include <linux/jhash.h>
 #include <linux/version.h>
 
+#ifndef HAVE_IGNORE_DF_RENAME
+#define ignore_df local_df
+#endif
+
 #ifndef HAVE_SKB_COPY_FROM_LINEAR_DATA_OFFSET
 static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
                                                    const int offset, void *to,
@@ -260,7 +265,11 @@ static inline __u32 skb_get_hash(struct sk_buff *skb)
 {
 #ifdef HAVE_RXHASH
        if (skb->rxhash)
+#ifndef HAVE_U16_RXHASH
                return skb->rxhash;
+#else
+               return jhash_1word(skb->rxhash, 0);
+#endif
 #endif
        return __skb_get_hash(skb);
 }
@@ -286,10 +295,10 @@ int skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len,
 #ifndef HAVE_SKB_CLEAR_HASH
 static inline void skb_clear_hash(struct sk_buff *skb)
 {
-#if HAVE_RXHASH
+#ifdef HAVE_RXHASH
        skb->rxhash = 0;
 #endif
-#if HAVE_L4_RXHASH
+#ifdef HAVE_L4_RXHASH
        skb->l4_rxhash = 0;
 #endif
 }