aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_nat.c
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2013-12-15 23:15:08 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-18 12:52:07 -0500
commit369ba56787d7469c0afda70bb9ff76ad5faaead5 (patch)
tree58425d3d564e3255c6660185bf22c80b76305ff5 /net/sched/act_nat.c
parent5da57f422d89c504a1d72dadd4e19d3dca8e974e (diff)
net_sched: init struct tcf_hashinfo at register time
It looks weird to store the lock out of the struct but still points to a static variable. Just move them into the struct. Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_nat.c')
-rw-r--r--net/sched/act_nat.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 6a15ace00241..409fe7181c5f 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -30,15 +30,9 @@
30 30
31 31
32#define NAT_TAB_MASK 15 32#define NAT_TAB_MASK 15
33static struct tcf_common *tcf_nat_ht[NAT_TAB_MASK + 1];
34static u32 nat_idx_gen; 33static u32 nat_idx_gen;
35static DEFINE_RWLOCK(nat_lock);
36 34
37static struct tcf_hashinfo nat_hash_info = { 35static struct tcf_hashinfo nat_hash_info;
38 .htab = tcf_nat_ht,
39 .hmask = NAT_TAB_MASK,
40 .lock = &nat_lock,
41};
42 36
43static const struct nla_policy nat_policy[TCA_NAT_MAX + 1] = { 37static const struct nla_policy nat_policy[TCA_NAT_MAX + 1] = {
44 [TCA_NAT_PARMS] = { .len = sizeof(struct tc_nat) }, 38 [TCA_NAT_PARMS] = { .len = sizeof(struct tc_nat) },
@@ -316,12 +310,16 @@ MODULE_LICENSE("GPL");
316 310
317static int __init nat_init_module(void) 311static int __init nat_init_module(void)
318{ 312{
313 int err = tcf_hashinfo_init(&nat_hash_info, NAT_TAB_MASK+1);
314 if (err)
315 return err;
319 return tcf_register_action(&act_nat_ops); 316 return tcf_register_action(&act_nat_ops);
320} 317}
321 318
322static void __exit nat_cleanup_module(void) 319static void __exit nat_cleanup_module(void)
323{ 320{
324 tcf_unregister_action(&act_nat_ops); 321 tcf_unregister_action(&act_nat_ops);
322 tcf_hashinfo_destroy(&nat_hash_info);
325} 323}
326 324
327module_init(nat_init_module); 325module_init(nat_init_module);