datapath: Add compile time check for rxhash
authorPravin B Shelar <pshelar@nicira.com>
Wed, 4 Dec 2013 19:26:36 +0000 (11:26 -0800)
committerPravin B Shelar <pshelar@nicira.com>
Tue, 3 Dec 2013 16:36:51 +0000 (08:36 -0800)
Some distribution kernel has backported skb->rxhash (e.g. RHEL)
Following patch allows use precalculated rxhash.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Reviewed-by: Thomas Graf <tgraf@redhat.com>
Acked-by: Jesse Gross <jesse@nicira.com>
acinclude.m4
datapath/linux/compat/flow_dissector.c
datapath/linux/compat/include/linux/skbuff.h

index f987fa0..94f9b61 100644 (file)
@@ -240,6 +240,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   # quoting rules.
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [[[^@]]proto_data_valid],
                   [OVS_DEFINE([HAVE_PROTO_DATA_VALID])])
+  OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [rxhash])
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_dst(],
                   [OVS_DEFINE([HAVE_SKB_DST_ACCESSOR_FUNCS])])
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], 
index f176f9a..7a0d09b 100644 (file)
@@ -226,7 +226,7 @@ u32 __skb_get_rxhash(struct sk_buff *skb)
        if (!hash)
                hash = 1;
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34)
+#ifdef HAVE_RXHASH
        skb->rxhash = hash;
 #endif
        return hash;
index 3af3ddc..4f22600 100644 (file)
@@ -220,7 +220,7 @@ static inline int skb_unclone(struct sk_buff *skb, gfp_t pri)
 extern u32 __skb_get_rxhash(struct sk_buff *skb);
 static inline __u32 skb_get_rxhash(struct sk_buff *skb)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34)
+#ifdef HAVE_RXHASH
        if (skb->rxhash)
                return skb->rxhash;
 #endif