aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-04-18 00:36:40 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2012-05-08 13:36:33 -0400
commitac3a546ac89fdf3c4b50e40039a5a7f6df4dda72 (patch)
tree8fbe86f3e2fcd9c2ba23a7cc0832f60240b07658
parenta9006892643a8f4e885b692de0708bcb35a7d530 (diff)
netfilter: nf_conntrack: use this_cpu_inc()
this_cpu_inc() is IRQ safe and faster than local_bh_disable()/__this_cpu_inc()/local_bh_enable(), at least on x86. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Patrick McHardy <kaber@trash.net> Cc: Christoph Lameter <cl@linux.com> Cc: Tejun Heo <tj@kernel.org> Reviewed-by: Christoph Lameter <cl@linux.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--include/net/netfilter/nf_conntrack.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index ab86036bbf0c..cce7f6a798bf 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -321,14 +321,8 @@ extern unsigned int nf_conntrack_max;
321extern unsigned int nf_conntrack_hash_rnd; 321extern unsigned int nf_conntrack_hash_rnd;
322void init_nf_conntrack_hash_rnd(void); 322void init_nf_conntrack_hash_rnd(void);
323 323
324#define NF_CT_STAT_INC(net, count) \ 324#define NF_CT_STAT_INC(net, count) __this_cpu_inc((net)->ct.stat->count)
325 __this_cpu_inc((net)->ct.stat->count) 325#define NF_CT_STAT_INC_ATOMIC(net, count) this_cpu_inc((net)->ct.stat->count)
326#define NF_CT_STAT_INC_ATOMIC(net, count) \
327do { \
328 local_bh_disable(); \
329 __this_cpu_inc((net)->ct.stat->count); \
330 local_bh_enable(); \
331} while (0)
332 326
333#define MODULE_ALIAS_NFCT_HELPER(helper) \ 327#define MODULE_ALIAS_NFCT_HELPER(helper) \
334 MODULE_ALIAS("nfct-helper-" helper) 328 MODULE_ALIAS("nfct-helper-" helper)