From patchwork Wed Oct 7 21:48:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eric W. Biederman" X-Patchwork-Id: 527465 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E6C89140D8A for ; Thu, 8 Oct 2015 09:01:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756623AbbJGWBf (ORCPT ); Wed, 7 Oct 2015 18:01:35 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:33015 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755027AbbJGWBV (ORCPT ); Wed, 7 Oct 2015 18:01:21 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out01.mta.xmission.com with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1Zjwm0-0001I1-O1; Wed, 07 Oct 2015 16:01:20 -0600 Received: from 67-3-201-231.omah.qwest.net ([67.3.201.231] helo=x220.int.ebiederm.org) by in02.mta.xmission.com with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1Zjwi3-0006ys-Bz; Wed, 07 Oct 2015 15:57:16 -0600 From: "Eric W. Biederman" To: David Miller Cc: netfilter-devel@vger.kernel.org, , Nicolas Dichtel , lvs-devel@vger.kernel.org Date: Wed, 7 Oct 2015 16:48:44 -0500 Message-Id: <1444254527-17833-13-git-send-email-ebiederm@xmission.com> X-Mailer: git-send-email 2.2.1 In-Reply-To: <87bnca4aie.fsf_-_@x220.int.ebiederm.org> References: <87bnca4aie.fsf_-_@x220.int.ebiederm.org> X-XM-AID: U2FsdGVkX1+jFlsl8ksu6RnssIpdzhrkTtuzjRhxx4Y= X-SA-Exim-Connect-IP: 67.3.201.231 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sa06.xmission.com X-Spam-Level: * X-Spam-Status: No, score=1.0 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE, TVD_RCVD_IP, T_TooManySym_01, T_TooManySym_02, XMGappySubj_01, XMSubLong autolearn=disabled version=3.4.0 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 0.5 XMGappySubj_01 Very gappy subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=2 Fuz1=2 Fuz2=2] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=2 Fuz1=2 Fuz2=2 X-Spam-Combo: *;David Miller X-Spam-Relay-Country: X-Spam-Timing: total 1237 ms - load_scoreonly_sql: 0.16 (0.0%), signal_user_changed: 6 (0.5%), b_tie_ro: 4.4 (0.4%), parse: 1.25 (0.1%), extract_message_metadata: 15 (1.2%), get_uri_detail_list: 1.49 (0.1%), tests_pri_-1000: 8 (0.6%), tests_pri_-950: 2.6 (0.2%), tests_pri_-900: 1.84 (0.1%), tests_pri_-400: 21 (1.7%), check_bayes: 19 (1.5%), b_tokenize: 6 (0.5%), b_tok_get_all: 5 (0.4%), b_comp_prob: 2.1 (0.2%), b_tok_touch_all: 2.9 (0.2%), b_finish: 0.89 (0.1%), tests_pri_0: 1169 (94.5%), tests_pri_500: 8 (0.6%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH net-next 13/16] ipvlan: Cache net in ipvlan_process_v4_outbound and ipvlan_process_v6_outbound X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Compute net once in ipvlan_process_v4_outbound and ipvlan_process_v6_outbound and store it in a variable so that net does not need to be recomputed next time it is used. Signed-off-by: "Eric W. Biederman" --- drivers/net/ipvlan/ipvlan_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c index 75dcf36c0366..976f30b291f6 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c @@ -344,6 +344,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb) { const struct iphdr *ip4h = ip_hdr(skb); struct net_device *dev = skb->dev; + struct net *net = dev_net(dev); struct rtable *rt; int err, ret = NET_XMIT_DROP; struct flowi4 fl4 = { @@ -354,7 +355,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb) .saddr = ip4h->saddr, }; - rt = ip_route_output_flow(dev_net(dev), &fl4, NULL); + rt = ip_route_output_flow(net, &fl4, NULL); if (IS_ERR(rt)) goto err; @@ -381,6 +382,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) { const struct ipv6hdr *ip6h = ipv6_hdr(skb); struct net_device *dev = skb->dev; + struct net *net = dev_net(dev); struct dst_entry *dst; int err, ret = NET_XMIT_DROP; struct flowi6 fl6 = { @@ -393,7 +395,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) .flowi6_proto = ip6h->nexthdr, }; - dst = ip6_route_output(dev_net(dev), NULL, &fl6); + dst = ip6_route_output(net, NULL, &fl6); if (dst->error) { ret = dst->error; dst_release(dst);