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>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
[OVS_DEFINE([HAVE_INET_FRAGS_LAST_IN])])
OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frags],
[frags_work])
[OVS_DEFINE([HAVE_INET_FRAGS_LAST_IN])])
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])
OVS_GREP_IFELSE([$KSRC/include/net/dst_metadata.h], [metadata_dst])
static struct inet_frag_bucket *
get_frag_bucket_locked(struct inet_frag_queue *fq, 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)
__acquires(f->lock)
#endif
__acquires(hb->chain_lock)
struct inet_frag_bucket *hb;
unsigned int hash;
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;
read_lock(&f->lock);
#else
unsigned int seq;
spin_lock(&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;
if (read_seqretry(&f->rnd_seqlock, seq)) {
spin_unlock(&hb->chain_lock);
goto restart;
}
static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f)
}
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)
__releases(f->lock)
#endif
__releases(hb->chain_lock)
q_flags(fq) |= INET_FRAG_COMPLETE;
spin_unlock(&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
}
read_unlock(&f->lock);
#endif
}
if (qp->net == nf && f->match(qp, arg)) {
atomic_inc(&qp->refcnt);
spin_unlock(&hb->chain_lock);
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;
read_unlock(&f->lock);
#endif
q_flags(qp_in) |= INET_FRAG_COMPLETE;
hlist_add_head(&qp->list, &hb->chain);
spin_unlock(&hb->chain_lock);
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
read_unlock(&f->lock);
#endif