Skip to content

Commit 62248df

Browse files
ummakynesdavem330
authored andcommitted
netfilter: nf_flowtable: remove flow_offload_entry structure
Move rcu_head to struct flow_offload, then remove the flow_offload_entry structure definition. Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9f48e9b commit 62248df

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

include/net/netfilter/nf_flow_table.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ struct flow_offload {
7575
struct nf_conn *ct;
7676
u32 flags;
7777
u32 timeout;
78+
struct rcu_head rcu_head;
7879
};
7980

8081
#define NF_FLOW_TIMEOUT (30 * HZ)

net/netfilter/nf_flow_table_core.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
#include <net/netfilter/nf_conntrack_l4proto.h>
1515
#include <net/netfilter/nf_conntrack_tuple.h>
1616

17-
struct flow_offload_entry {
18-
struct flow_offload flow;
19-
struct rcu_head rcu_head;
20-
};
21-
2217
static DEFINE_MUTEX(flowtable_lock);
2318
static LIST_HEAD(flowtables);
2419

@@ -59,19 +54,16 @@ flow_offload_fill_dir(struct flow_offload *flow, struct nf_conn *ct,
5954
struct flow_offload *
6055
flow_offload_alloc(struct nf_conn *ct, struct nf_flow_route *route)
6156
{
62-
struct flow_offload_entry *entry;
6357
struct flow_offload *flow;
6458

6559
if (unlikely(nf_ct_is_dying(ct) ||
6660
!atomic_inc_not_zero(&ct->ct_general.use)))
6761
return NULL;
6862

69-
entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
70-
if (!entry)
63+
flow = kzalloc(sizeof(*flow), GFP_ATOMIC);
64+
if (!flow)
7165
goto err_ct_refcnt;
7266

73-
flow = &entry->flow;
74-
7567
if (!dst_hold_safe(route->tuple[FLOW_OFFLOAD_DIR_ORIGINAL].dst))
7668
goto err_dst_cache_original;
7769

@@ -93,7 +85,7 @@ flow_offload_alloc(struct nf_conn *ct, struct nf_flow_route *route)
9385
err_dst_cache_reply:
9486
dst_release(route->tuple[FLOW_OFFLOAD_DIR_ORIGINAL].dst);
9587
err_dst_cache_original:
96-
kfree(entry);
88+
kfree(flow);
9789
err_ct_refcnt:
9890
nf_ct_put(ct);
9991

@@ -151,15 +143,12 @@ static void flow_offload_fixup_ct(struct nf_conn *ct)
151143

152144
void flow_offload_free(struct flow_offload *flow)
153145
{
154-
struct flow_offload_entry *e;
155-
156146
dst_release(flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_cache);
157147
dst_release(flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_cache);
158-
e = container_of(flow, struct flow_offload_entry, flow);
159148
if (flow->flags & FLOW_OFFLOAD_DYING)
160149
nf_ct_delete(flow->ct, 0, 0);
161150
nf_ct_put(flow->ct);
162-
kfree_rcu(e, rcu_head);
151+
kfree_rcu(flow, rcu_head);
163152
}
164153
EXPORT_SYMBOL_GPL(flow_offload_free);
165154

0 commit comments

Comments
 (0)