[ovs-dev] [PATCH 1/2] compat: Fix build issue on RHEL 7.7

Greg Rose gvrose8192 at gmail.com
Tue Oct 20 17:07:04 UTC 2020


RHEL 7.7 has a KABI fixup in struct sk_buff to backport the member
name change of l4_rxhash to l4_hash.  This exposed a couple of
issues in patch 8063e0958780 which was intended to remove support
for kernels older than 3.10.

Remove stale code and add a compat level check to detect the change.
This fixes a compile error on RHEL 7.7.

Fixes: 8063e0958780 ("datapath: Drop support for kernel older than 3.10")
Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
---
 acinclude.m4                                 | 4 ++--
 datapath/datapath.c                          | 2 +-
 datapath/linux/compat/include/linux/percpu.h | 6 ------
 datapath/linux/compat/include/linux/skbuff.h | 4 +++-
 4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 1460289ca..8e80d7930 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -879,6 +879,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                   [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], [u8.*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])
@@ -975,8 +977,6 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
 
   OVS_GREP_IFELSE([$KSRC/include/net/sock.h], [sk_no_check_tx])
   OVS_GREP_IFELSE([$KSRC/include/linux/udp.h], [no_check6_tx])
-  OVS_GREP_IFELSE([$KSRC/include/linux/utsrelease.h], [el6],
-                  [OVS_DEFINE([HAVE_RHEL6_PER_CPU])])
   OVS_FIND_PARAM_IFELSE([$KSRC/include/net/protocol.h],
                         [udp_add_offload], [net],
                         [OVS_DEFINE([HAVE_UDP_ADD_OFFLOAD_TAKES_NET])])
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 52a59f135..09fb3b1fc 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -529,7 +529,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
 		hash |= OVS_PACKET_HASH_SW_BIT;
 #endif
 
-#ifdef HAVE_L4_RXHASH
+#if defined(HAVE_L4_RXHASH) && !defined(HAVE_L4_HASH)
 	if (skb->l4_rxhash)
 #else
 	if (skb->l4_hash)
diff --git a/datapath/linux/compat/include/linux/percpu.h b/datapath/linux/compat/include/linux/percpu.h
index 7c346aa31..a039142e2 100644
--- a/datapath/linux/compat/include/linux/percpu.h
+++ b/datapath/linux/compat/include/linux/percpu.h
@@ -7,12 +7,6 @@
 #define this_cpu_ptr(ptr) per_cpu_ptr(ptr, smp_processor_id())
 #endif
 
-#ifdef HAVE_RHEL6_PER_CPU
-#undef this_cpu_read
-#undef this_cpu_inc
-#undef this_cpu_dec
-#endif
-
 #if !defined this_cpu_read
 #define this_cpu_read(ptr) percpu_read(ptr)
 #endif
diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h
index 204ce5497..94479f57b 100644
--- a/datapath/linux/compat/include/linux/skbuff.h
+++ b/datapath/linux/compat/include/linux/skbuff.h
@@ -278,8 +278,10 @@ 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_RXHASH) && !defined(HAVE_L4_HASH)
 	skb->l4_rxhash = 0;
+#else
+	skb->l4_hash = 0;
 #endif
 }
 #endif
-- 
2.17.1



More information about the dev mailing list