14
14
#include <net/netfilter/nf_conntrack_l4proto.h>
15
15
#include <net/netfilter/nf_conntrack_tuple.h>
16
16
17
- struct flow_offload_entry {
18
- struct flow_offload flow ;
19
- struct rcu_head rcu_head ;
20
- };
21
-
22
17
static DEFINE_MUTEX (flowtable_lock );
23
18
static LIST_HEAD (flowtables );
24
19
@@ -59,19 +54,16 @@ flow_offload_fill_dir(struct flow_offload *flow, struct nf_conn *ct,
59
54
struct flow_offload *
60
55
flow_offload_alloc (struct nf_conn * ct , struct nf_flow_route * route )
61
56
{
62
- struct flow_offload_entry * entry ;
63
57
struct flow_offload * flow ;
64
58
65
59
if (unlikely (nf_ct_is_dying (ct ) ||
66
60
!atomic_inc_not_zero (& ct -> ct_general .use )))
67
61
return NULL ;
68
62
69
- entry = kzalloc (sizeof (* entry ), GFP_ATOMIC );
70
- if (!entry )
63
+ flow = kzalloc (sizeof (* flow ), GFP_ATOMIC );
64
+ if (!flow )
71
65
goto err_ct_refcnt ;
72
66
73
- flow = & entry -> flow ;
74
-
75
67
if (!dst_hold_safe (route -> tuple [FLOW_OFFLOAD_DIR_ORIGINAL ].dst ))
76
68
goto err_dst_cache_original ;
77
69
@@ -93,7 +85,7 @@ flow_offload_alloc(struct nf_conn *ct, struct nf_flow_route *route)
93
85
err_dst_cache_reply :
94
86
dst_release (route -> tuple [FLOW_OFFLOAD_DIR_ORIGINAL ].dst );
95
87
err_dst_cache_original :
96
- kfree (entry );
88
+ kfree (flow );
97
89
err_ct_refcnt :
98
90
nf_ct_put (ct );
99
91
@@ -151,15 +143,12 @@ static void flow_offload_fixup_ct(struct nf_conn *ct)
151
143
152
144
void flow_offload_free (struct flow_offload * flow )
153
145
{
154
- struct flow_offload_entry * e ;
155
-
156
146
dst_release (flow -> tuplehash [FLOW_OFFLOAD_DIR_ORIGINAL ].tuple .dst_cache );
157
147
dst_release (flow -> tuplehash [FLOW_OFFLOAD_DIR_REPLY ].tuple .dst_cache );
158
- e = container_of (flow , struct flow_offload_entry , flow );
159
148
if (flow -> flags & FLOW_OFFLOAD_DYING )
160
149
nf_ct_delete (flow -> ct , 0 , 0 );
161
150
nf_ct_put (flow -> ct );
162
- kfree_rcu (e , rcu_head );
151
+ kfree_rcu (flow , rcu_head );
163
152
}
164
153
EXPORT_SYMBOL_GPL (flow_offload_free );
165
154
0 commit comments