diff mbox series

[ovs-dev,V4,2/9] compat: Fix up changes to inet frags in 5.1+

Message ID 1583534241-16600-3-git-send-email-gvrose8192@gmail.com
State Accepted
Commit f77d85b109f049a45c73fd2bbafe4d4220ca7c78
Headers show
Series Add Linux kernel datapath support up to 5.5 | expand

Commit Message

Gregory Rose March 6, 2020, 10:37 p.m. UTC
Since Linux kernel release 5.1 the fragments field of the inet_frag_queue
structure is removed and now only the rb_fragments structure with an
rb_node pointer is used for both ipv4 and ipv6.  In addition, the
atomic_sub and atomic_add functions are replaced with their
equivalent long counterparts.

Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
V3 - Use HAVE_CORRECT_MRU_HANDLING instead of less reliable kernel
     version check for compile time handling of the rb_fragments
     change.
---
 acinclude.m4                                  |  2 ++
 datapath/linux/compat/include/net/inet_frag.h | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

Comments

0-day Robot March 6, 2020, 11:01 p.m. UTC | #1
Bleep bloop.  Greetings Gregory Rose, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


git-am:
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 compat: Fix up changes to inet frags in 5.1+
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/acinclude.m4 b/acinclude.m4
index 03d3484..3a555ad 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1048,6 +1048,8 @@  AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                   [OVS_DEFINE([HAVE_RBTREE_RB_LINK_NODE_RCU])])
   OVS_GREP_IFELSE([$KSRC/include/net/dst_ops.h], [bool confirm_neigh],
                   [OVS_DEFINE([HAVE_DST_OPS_CONFIRM_NEIGH])])
+  OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [fqdir],
+                  [OVS_DEFINE([HAVE_INET_FRAG_FQDIR])])
 
   if cmp -s datapath/linux/kcompat.h.new \
             datapath/linux/kcompat.h >/dev/null 2>&1; then
diff --git a/datapath/linux/compat/include/net/inet_frag.h b/datapath/linux/compat/include/net/inet_frag.h
index 124c8be..00784da 100644
--- a/datapath/linux/compat/include/net/inet_frag.h
+++ b/datapath/linux/compat/include/net/inet_frag.h
@@ -12,6 +12,7 @@ 
 #define qp_flags(qp) (qp->q.flags)
 #endif
 
+#ifndef HAVE_CORRECT_MRU_HANDLING
 #ifndef HAVE_INET_FRAG_EVICTING
 static inline bool inet_frag_evicting(struct inet_frag_queue *q)
 {
@@ -22,6 +23,7 @@  static inline bool inet_frag_evicting(struct inet_frag_queue *q)
 #endif /* HAVE_INET_FRAG_QUEUE_WITH_LIST_EVICTOR */
 }
 #endif /* HAVE_INET_FRAG_EVICTING */
+#endif /* HAVE_CORRECT_MRU_HANDLING */
 
 /* Upstream commit 3fd588eb90bf ("inet: frag: remove lru list") dropped this
  * function, but we call it from our compat code. Provide a noop version. */
@@ -29,6 +31,10 @@  static inline bool inet_frag_evicting(struct inet_frag_queue *q)
 #define inet_frag_lru_move(q)
 #endif
 
+#ifdef HAVE_INET_FRAG_FQDIR
+#define netns_frags fqdir
+#endif
+
 #ifndef HAVE_SUB_FRAG_MEM_LIMIT_ARG_STRUCT_NETNS_FRAGS
 #ifdef HAVE_FRAG_PERCPU_COUNTER_BATCH
 static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i)
@@ -45,13 +51,21 @@  static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i)
 #else /* !frag_percpu_counter_batch */
 static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i)
 {
+#ifdef HAVE_INET_FRAG_FQDIR
+	atomic_long_sub(i, &nf->mem);
+#else
 	atomic_sub(i, &nf->mem);
+#endif
 }
 #define sub_frag_mem_limit rpl_sub_frag_mem_limit
 
 static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i)
 {
+#ifdef HAVE_INET_FRAG_FQDIR
+	atomic_long_add(i, &nf->mem);
+#else
 	atomic_add(i, &nf->mem);
+#endif
 }
 #define add_frag_mem_limit rpl_add_frag_mem_limit
 #endif /* frag_percpu_counter_batch */