From patchwork Tue Jul 12 22:26:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 647662 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3rpxRL2xqBz9s3v for ; Wed, 13 Jul 2016 08:27:26 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id B875E10972; Tue, 12 Jul 2016 15:26:50 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id B76CA10922 for ; Tue, 12 Jul 2016 15:26:47 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 3F4DA1E02B0 for ; Tue, 12 Jul 2016 16:26:47 -0600 (MDT) X-ASG-Debug-ID: 1468362406-09eadd46a015070001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id IzPtfd32D5zP4wvr (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 12 Jul 2016 16:26:46 -0600 (MDT) X-Barracuda-Envelope-From: joe@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO relay3-d.mail.gandi.net) (217.70.183.195) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 12 Jul 2016 22:26:46 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at ovn.org designates 217.70.183.195 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.195 X-Barracuda-RBL-IP: 217.70.183.195 Received: from mfilter42-d.gandi.net (mfilter42-d.gandi.net [217.70.178.172]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 72552A80E4 for ; Wed, 13 Jul 2016 00:26:45 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter42-d.gandi.net Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter42-d.gandi.net (mfilter42-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id EURYPyzK_WlH for ; Wed, 13 Jul 2016 00:26:44 +0200 (CEST) X-Originating-IP: 208.91.1.34 Received: from archer.eng.vmware.com (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 783D0A80D0 for ; Wed, 13 Jul 2016 00:26:43 +0200 (CEST) X-CudaMail-Envelope-Sender: joe@ovn.org From: Joe Stringer To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E1-711079641 X-CudaMail-DTE: 071216 X-CudaMail-Originating-IP: 217.70.183.195 Date: Tue, 12 Jul 2016 15:26:23 -0700 X-ASG-Orig-Subj: [##CM-E1-711079641##][PATCH 6/6] compat: Only call nf_defrag_ipv[46]_enable() once. Message-Id: <20160712222623.9079-7-joe@ovn.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160712222623.9079-1-joe@ovn.org> References: <20160712222623.9079-1-joe@ovn.org> X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1468362406 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH 6/6] compat: Only call nf_defrag_ipv[46]_enable() once. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" This function is just a dummy to ensure that the corresponding netfilter fragment module is loaded, to initialize the shared structures. But it doesn't need to be invoked once per namespace; one call per protocol should do the trick. Signed-off-by: Joe Stringer --- datapath/linux/compat/ip_fragment.c | 9 +-------- datapath/linux/compat/nf_conntrack_reasm.c | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/datapath/linux/compat/ip_fragment.c b/datapath/linux/compat/ip_fragment.c index 64e2cf23c327..3b737f304287 100644 --- a/datapath/linux/compat/ip_fragment.c +++ b/datapath/linux/compat/ip_fragment.c @@ -725,25 +725,18 @@ int rpl_ip_defrag(struct net *net, struct sk_buff *skb, u32 user) return -ENOMEM; } -static int __net_init ipv4_frags_init_net(struct net *net) -{ - nf_defrag_ipv4_enable(); - - return 0; -} - static void __net_exit ipv4_frags_exit_net(struct net *net) { inet_frags_exit_net(&net->ipv4.frags, &ip4_frags); } static struct pernet_operations ip4_frags_ops = { - .init = ipv4_frags_init_net, .exit = ipv4_frags_exit_net, }; int __init rpl_ipfrag_init(void) { + nf_defrag_ipv4_enable(); register_pernet_subsys(&ip4_frags_ops); ip4_frags.hashfn = ip4_hashfn; ip4_frags.constructor = ip4_frag_init; diff --git a/datapath/linux/compat/nf_conntrack_reasm.c b/datapath/linux/compat/nf_conntrack_reasm.c index c48459199d72..a66d00f8065e 100644 --- a/datapath/linux/compat/nf_conntrack_reasm.c +++ b/datapath/linux/compat/nf_conntrack_reasm.c @@ -556,20 +556,12 @@ out_unlock: return ret; } -static int nf_ct_net_init(struct net *net) -{ - nf_defrag_ipv6_enable(); - - return 0; -} - static void nf_ct_net_exit(struct net *net) { inet_frags_exit_net(&net->nf_frag.frags, &nf_frags); } static struct pernet_operations nf_ct_net_ops = { - .init = nf_ct_net_init, .exit = nf_ct_net_exit, }; @@ -577,6 +569,7 @@ int rpl_nf_ct_frag6_init(void) { int ret = 0; + nf_defrag_ipv6_enable(); nf_frags.hashfn = nf_hashfn; nf_frags.constructor = ip6_frag_init; nf_frags.destructor = NULL;