2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-01 06:45:17 +00:00

compat:inet_frag.h: Check for frag_percpu_counter_batch

Fix up the compat layer to check for frag_percpu_counter_batch and
if not present then use atomic_sub and atomic_add as per the
backport in the 3.16.50 LTS kernel.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
This commit is contained in:
Greg Rose
2018-02-07 07:30:03 -08:00
committed by Pravin B Shelar
parent b66081f33c
commit 64d8cb7295

View File

@@ -30,6 +30,7 @@ static inline bool inet_frag_evicting(struct inet_frag_queue *q)
#endif
#ifndef HAVE_SUB_FRAG_MEM_LIMIT_ARG_STRUCT_NETNS_FRAGS
#ifdef frag_percpu_counter_batch
static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i)
{
__percpu_counter_add(&nf->mem, -i, frag_percpu_counter_batch);
@@ -41,6 +42,19 @@ static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i)
__percpu_counter_add(&nf->mem, i, frag_percpu_counter_batch);
}
#define add_frag_mem_limit rpl_add_frag_mem_limit
#else /* !frag_percpu_counter_batch */
static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i)
{
atomic_sub(i, &nf->mem);
}
#define sub_frag_mem_limit rpl_sub_frag_mem_limit
static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i)
{
atomic_add(i, &nf->mem);
}
#define add_frag_mem_limit rpl_add_frag_mem_limit
#endif /* frag_percpu_counter_batch */
#endif
#ifdef HAVE_VOID_INET_FRAGS_INIT