[ovs-dev] [PATCH 2/3] datapath: Add compile time check for rxhash
Pravin B Shelar
pshelar at nicira.com
Wed Dec 4 19:26:36 UTC 2013
Some distribution kernel has backported skb->rxhash (e.g. RHEL)
Following patch allows use precalculated rxhash.
Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
Reviewed-by: Thomas Graf <tgraf at redhat.com>
Acked-by: Jesse Gross <jesse at nicira.com>
---
acinclude.m4 | 1 +
datapath/linux/compat/flow_dissector.c | 2 +-
datapath/linux/compat/include/linux/skbuff.h | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4
index f987fa0..94f9b61 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -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],
diff --git a/datapath/linux/compat/flow_dissector.c b/datapath/linux/compat/flow_dissector.c
index f176f9a..7a0d09b 100644
--- a/datapath/linux/compat/flow_dissector.c
+++ b/datapath/linux/compat/flow_dissector.c
@@ -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;
diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h
index 3af3ddc..4f22600 100644
--- a/datapath/linux/compat/include/linux/skbuff.h
+++ b/datapath/linux/compat/include/linux/skbuff.h
@@ -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
--
1.7.1
More information about the dev
mailing list