@@ -358,6 +358,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
[list_evictor])
OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frags],
[frags_work])
+ OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frags],
+ [rwlock])
OVS_GREP_IFELSE([$KSRC/include/net/dst_metadata.h], [metadata_dst])
@@ -272,7 +272,7 @@ void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f)
static struct inet_frag_bucket *
get_frag_bucket_locked(struct inet_frag_queue *fq, struct inet_frags *f)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
+#ifdef HAVE_INET_FRAGS_WITH_RWLOCK
__acquires(f->lock)
#endif
__acquires(hb->chain_lock)
@@ -280,7 +280,7 @@ __acquires(hb->chain_lock)
struct inet_frag_bucket *hb;
unsigned int hash;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
+#ifdef HAVE_INET_FRAGS_WITH_RWLOCK
read_lock(&f->lock);
#else
unsigned int seq;
@@ -293,7 +293,7 @@ __acquires(hb->chain_lock)
spin_lock(&hb->chain_lock);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+#ifndef HAVE_INET_FRAGS_WITH_RWLOCK
if (read_seqretry(&f->rnd_seqlock, seq)) {
spin_unlock(&hb->chain_lock);
goto restart;
@@ -304,7 +304,7 @@ __acquires(hb->chain_lock)
}
static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
+#ifdef HAVE_INET_FRAGS_WITH_RWLOCK
__releases(f->lock)
#endif
__releases(hb->chain_lock)
@@ -316,7 +316,7 @@ __releases(hb->chain_lock)
q_flags(fq) |= INET_FRAG_COMPLETE;
spin_unlock(&hb->chain_lock);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
+#ifdef HAVE_INET_FRAGS_WITH_RWLOCK
read_unlock(&f->lock);
#endif
}
@@ -433,7 +433,7 @@ static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf,
if (qp->net == nf && f->match(qp, arg)) {
atomic_inc(&qp->refcnt);
spin_unlock(&hb->chain_lock);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
+#ifdef HAVE_INET_FRAGS_WITH_RWLOCK
read_unlock(&f->lock);
#endif
q_flags(qp_in) |= INET_FRAG_COMPLETE;
@@ -450,7 +450,7 @@ static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf,
hlist_add_head(&qp->list, &hb->chain);
spin_unlock(&hb->chain_lock);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
+#ifdef HAVE_INET_FRAGS_WITH_RWLOCK
read_unlock(&f->lock);
#endif
Prior to ab1c724f6330 ("inet: frag: use seqlock for hash rebuild") upstream, a rwlock was used when rebuilding inet_frags. Rather than using a version check to detect this, search for it in the header and enable the code based on whether it exists. Signed-off-by: Joe Stringer <joe@ovn.org> --- acinclude.m4 | 2 ++ datapath/linux/compat/inet_fragment.c | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-)