diff options
author | Eric Dumazet <edumazet@google.com> | 2019-05-24 12:03:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-05-26 17:08:05 -0400 |
commit | 4907abc605e328d61bee56e4e89db4f56ade2090 (patch) | |
tree | 764e708aaa78091e2a8ccb046cfbf8a59aa10c88 /net/ieee802154 | |
parent | a39aca678a0626941aa99c18c1c452ca758e7865 (diff) |
net: dynamically allocate fqdir structures
Following patch will add rcu grace period before fqdir
rhashtable destruction, so we need to dynamically allocate
fqdir structures to not force expensive synchronize_rcu() calls
in netns dismantle path.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154')
-rw-r--r-- | net/ieee802154/6lowpan/reassembly.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c index 03a444c9e191..e59c3b708969 100644 --- a/net/ieee802154/6lowpan/reassembly.c +++ b/net/ieee802154/6lowpan/reassembly.c | |||
@@ -79,7 +79,7 @@ fq_find(struct net *net, const struct lowpan_802154_cb *cb, | |||
79 | key.src = *src; | 79 | key.src = *src; |
80 | key.dst = *dst; | 80 | key.dst = *dst; |
81 | 81 | ||
82 | q = inet_frag_find(&ieee802154_lowpan->fqdir, &key); | 82 | q = inet_frag_find(ieee802154_lowpan->fqdir, &key); |
83 | if (!q) | 83 | if (!q) |
84 | return NULL; | 84 | return NULL; |
85 | 85 | ||
@@ -377,11 +377,11 @@ static int __net_init lowpan_frags_ns_sysctl_register(struct net *net) | |||
377 | table[0].procname = NULL; | 377 | table[0].procname = NULL; |
378 | } | 378 | } |
379 | 379 | ||
380 | table[0].data = &ieee802154_lowpan->fqdir.high_thresh; | 380 | table[0].data = &ieee802154_lowpan->fqdir->high_thresh; |
381 | table[0].extra1 = &ieee802154_lowpan->fqdir.low_thresh; | 381 | table[0].extra1 = &ieee802154_lowpan->fqdir->low_thresh; |
382 | table[1].data = &ieee802154_lowpan->fqdir.low_thresh; | 382 | table[1].data = &ieee802154_lowpan->fqdir->low_thresh; |
383 | table[1].extra2 = &ieee802154_lowpan->fqdir.high_thresh; | 383 | table[1].extra2 = &ieee802154_lowpan->fqdir->high_thresh; |
384 | table[2].data = &ieee802154_lowpan->fqdir.timeout; | 384 | table[2].data = &ieee802154_lowpan->fqdir->timeout; |
385 | 385 | ||
386 | hdr = register_net_sysctl(net, "net/ieee802154/6lowpan", table); | 386 | hdr = register_net_sysctl(net, "net/ieee802154/6lowpan", table); |
387 | if (hdr == NULL) | 387 | if (hdr == NULL) |
@@ -449,16 +449,18 @@ static int __net_init lowpan_frags_init_net(struct net *net) | |||
449 | net_ieee802154_lowpan(net); | 449 | net_ieee802154_lowpan(net); |
450 | int res; | 450 | int res; |
451 | 451 | ||
452 | ieee802154_lowpan->fqdir.high_thresh = IPV6_FRAG_HIGH_THRESH; | ||
453 | ieee802154_lowpan->fqdir.low_thresh = IPV6_FRAG_LOW_THRESH; | ||
454 | ieee802154_lowpan->fqdir.timeout = IPV6_FRAG_TIMEOUT; | ||
455 | 452 | ||
456 | res = fqdir_init(&ieee802154_lowpan->fqdir, &lowpan_frags, net); | 453 | res = fqdir_init(&ieee802154_lowpan->fqdir, &lowpan_frags, net); |
457 | if (res < 0) | 454 | if (res < 0) |
458 | return res; | 455 | return res; |
456 | |||
457 | ieee802154_lowpan->fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH; | ||
458 | ieee802154_lowpan->fqdir->low_thresh = IPV6_FRAG_LOW_THRESH; | ||
459 | ieee802154_lowpan->fqdir->timeout = IPV6_FRAG_TIMEOUT; | ||
460 | |||
459 | res = lowpan_frags_ns_sysctl_register(net); | 461 | res = lowpan_frags_ns_sysctl_register(net); |
460 | if (res < 0) | 462 | if (res < 0) |
461 | fqdir_exit(&ieee802154_lowpan->fqdir); | 463 | fqdir_exit(ieee802154_lowpan->fqdir); |
462 | return res; | 464 | return res; |
463 | } | 465 | } |
464 | 466 | ||
@@ -468,7 +470,7 @@ static void __net_exit lowpan_frags_exit_net(struct net *net) | |||
468 | net_ieee802154_lowpan(net); | 470 | net_ieee802154_lowpan(net); |
469 | 471 | ||
470 | lowpan_frags_ns_sysctl_unregister(net); | 472 | lowpan_frags_ns_sysctl_unregister(net); |
471 | fqdir_exit(&ieee802154_lowpan->fqdir); | 473 | fqdir_exit(ieee802154_lowpan->fqdir); |
472 | } | 474 | } |
473 | 475 | ||
474 | static struct pernet_operations lowpan_frags_ops = { | 476 | static struct pernet_operations lowpan_frags_ops = { |