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-
2217static DEFINE_MUTEX (flowtable_lock );
2318static LIST_HEAD (flowtables );
2419
@@ -59,19 +54,16 @@ flow_offload_fill_dir(struct flow_offload *flow, struct nf_conn *ct,
5954struct flow_offload *
6055flow_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)
9385err_dst_cache_reply :
9486 dst_release (route -> tuple [FLOW_OFFLOAD_DIR_ORIGINAL ].dst );
9587err_dst_cache_original :
96- kfree (entry );
88+ kfree (flow );
9789err_ct_refcnt :
9890 nf_ct_put (ct );
9991
@@ -151,15 +143,12 @@ static void flow_offload_fixup_ct(struct nf_conn *ct)
151143
152144void 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}
164153EXPORT_SYMBOL_GPL (flow_offload_free );
165154
0 commit comments