From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: [PATCH v2 net-next 04/12] inet: frags: refactor ipv6_frag_init() Date: Fri, 30 Mar 2018 13:42:28 -0700 Message-ID: <20180330204236.43675-5-edumazet@google.com> References: <20180330204236.43675-1-edumazet@google.com> Cc: netdev , Florian Westphal , Herbert Xu , Thomas Graf , Jesper Dangaard Brouer , Alexander Aring , Stefan Schmidt , Kirill Tkhai , Eric Dumazet , Eric Dumazet To: "David S . Miller" Return-path: Received: from mail-pg0-f67.google.com ([74.125.83.67]:41784 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752314AbeC3Uoa (ORCPT ); Fri, 30 Mar 2018 16:44:30 -0400 Received: by mail-pg0-f67.google.com with SMTP id t10so5654817pgv.8 for ; Fri, 30 Mar 2018 13:44:30 -0700 (PDT) In-Reply-To: <20180330204236.43675-1-edumazet@google.com> Sender: netdev-owner@vger.kernel.org List-ID: We want to call inet_frags_init() earlier. This is a prereq to "inet: frags: use rhashtables for reassembly units" Signed-off-by: Eric Dumazet --- net/ipv6/reassembly.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 4855de6f673a4753526679ca29dcdaebecb5777f..f0071b113a92fcff15ac57610170c12b17cb59ba 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c @@ -742,18 +742,6 @@ int __init ipv6_frag_init(void) { int ret; - ret = inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT); - if (ret) - goto out; - - ret = ip6_frags_sysctl_register(); - if (ret) - goto err_sysctl; - - ret = register_pernet_subsys(&ip6_frags_ops); - if (ret) - goto err_pernet; - ip6_frags.hashfn = ip6_hashfn; ip6_frags.constructor = ip6_frag_init; ip6_frags.destructor = NULL; @@ -762,8 +750,21 @@ int __init ipv6_frag_init(void) ip6_frags.frag_expire = ip6_frag_expire; ip6_frags.frags_cache_name = ip6_frag_cache_name; ret = inet_frags_init(&ip6_frags); + if (ret) + goto out; + + ret = inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT); + if (ret) + goto err_protocol; + + ret = ip6_frags_sysctl_register(); + if (ret) + goto err_sysctl; + + ret = register_pernet_subsys(&ip6_frags_ops); if (ret) goto err_pernet; + out: return ret; @@ -771,6 +772,8 @@ int __init ipv6_frag_init(void) ip6_frags_sysctl_unregister(); err_sysctl: inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT); +err_protocol: + inet_frags_fini(&ip6_frags); goto out; } -- 2.17.0.rc1.321.gba9d0f2565-goog