Skip to contentSkip to conversation

netfilter: conntrack: simplify early_drop

PATCH Applied Florian Westphal 2 participants 2 messages Jul 3, 2016 – Jul 11, 2016

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: conntrack: simplify early_drop

We don't need to acquire the bucket lock during early drop, we can use lockless traveral just like ____nf_conntrack_find.

The timer deletion serves as synchronization point, if another cpu attempts to evict same entry, only one will succeed with timer deletion.

---
 include/net/netfilter/nf_conntrack.h |  1 +
 net/netfilter/nf_conntrack_core.c    | 95 ++++++++++++++++++------------------
 2 files changed, 48 insertions(+), 48 deletions(-)
include/net/netfilter/nf_conntrack.h +1 -0
index 5d3397f..2a5133e 100644
@@ -301,6 +301,7 @@ void nf_ct_tmpl_free(struct nf_conn *tmpl);
 
 #define NF_CT_STAT_INC(net, count)	  __this_cpu_inc((net)->ct.stat->count)
 #define NF_CT_STAT_INC_ATOMIC(net, count) this_cpu_inc((net)->ct.stat->count)
+#define NF_CT_STAT_ADD_ATOMIC(net, count, v) this_cpu_add((net)->ct.stat->count, (v))
 
 #define MODULE_ALIAS_NFCT_HELPER(helper) \
         MODULE_ALIAS("nfct-helper-" helper)
net/netfilter/nf_conntrack_core.c +47 -48

114 lines not on this page · raw message

Signature · 1 line
2.7.3
maintainer Applied
#1 lore raw
Quoted 5 lines · Florian Westphal

We don't need to acquire the bucket lock during early drop, we can use lockless traveral just like ____nf_conntrack_find.

The timer deletion serves as synchronization point, if another cpu attempts to evict same entry, only one will succeed with timer deletion.

Applied, thanks Florian.