[ovs-dev] [PATCH] compat: Replace the HAVE_L4_RXHASH define with HAVE_L4_HASH

Greg Rose gvrose8192 at gmail.com
Thu Sep 17 19:59:05 UTC 2020


The skb now uses l4_hash and it is easier to check for it.  Also
fixes a compile error for RHEL 7.7.

Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
---
 acinclude.m4                                 | 4 ++--
 datapath/datapath.c                          | 6 +++---
 datapath/linux/compat/include/linux/skbuff.h | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 84f344da0..d4e249dac 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -874,8 +874,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_clear_hash])
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [int.skb_zerocopy(],
                   [OVS_DEFINE([HAVE_SKB_ZEROCOPY])])
-  OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [u8.*l4_rxhash],
-                  [OVS_DEFINE([HAVE_L4_RXHASH])])
+  OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [l4_hash],
+                  [OVS_DEFINE([HAVE_L4_HASH])])
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_ensure_writable])
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_vlan_pop])
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [__skb_vlan_pop])
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 05c1e4274..c3f57f62a 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -532,10 +532,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
 		hash |= OVS_PACKET_HASH_SW_BIT;
 #endif
 
-#ifdef HAVE_L4_RXHASH
-	if (skb->l4_rxhash)
-#else
+#ifdef HAVE_L4_HASH
 	if (skb->l4_hash)
+#else
+	if (skb->l4_rxhash)
 #endif
 		hash |= OVS_PACKET_HASH_L4_BIT;
 
diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h
index 6d248b3ed..29253e433 100644
--- a/datapath/linux/compat/include/linux/skbuff.h
+++ b/datapath/linux/compat/include/linux/skbuff.h
@@ -278,7 +278,7 @@ static inline void skb_clear_hash(struct sk_buff *skb)
 #ifdef HAVE_RXHASH
 	skb->rxhash = 0;
 #endif
-#if defined(HAVE_L4_RXHASH) && !defined(HAVE_RHEL_OVS_HOOK)
+#if !defined(HAVE_L4_HASH) && !defined(HAVE_RHEL_OVS_HOOK)
 	skb->l4_rxhash = 0;
 #endif
 }
@@ -465,7 +465,7 @@ __skb_set_hash(struct sk_buff *skb, __u32 hash, bool is_sw, bool is_l4)
 #else
 	skb->hash = hash;
 #endif
-#if defined(HAVE_L4_RXHASH)
+#if !defined(HAVE_L4_HASH)
 	skb->l4_rxhash = is_l4;
 #else
 	skb->l4_hash = is_l4;
-- 
2.17.1



More information about the dev mailing list