Skip to content

Commit

Permalink
compat:inet_frag.h: Check for frag_percpu_counter_batch
Browse files Browse the repository at this point in the history
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.  Fixes compile errors on
3.16 series kernels from 3.16.50 on.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
  • Loading branch information
gvrose8192 authored and justinpettit committed Jan 23, 2018
1 parent a8e2add commit 822afef
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions datapath/linux/compat/include/net/inet_frag.h
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 822afef

Please sign in to comment.