From patchwork Wed Sep 16 01:04:02 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: 518197 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 73DD4140187 for ; Wed, 16 Sep 2015 11:13:51 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752656AbbIPBNr (ORCPT ); Tue, 15 Sep 2015 21:13:47 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:39405 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752226AbbIPBNm (ORCPT ); Tue, 15 Sep 2015 21:13:42 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1Zc1I6-0008Eh-2J; Tue, 15 Sep 2015 19:13:42 -0600 Received: from 67-3-201-231.omah.qwest.net ([67.3.201.231] helo=x220.int.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1Zc1GQ-0002zs-2I; Tue, 15 Sep 2015 19:11:58 -0600 From: "Eric W. Biederman" To: Pablo Neira Ayuso , David Miller Cc: netfilter-devel@vger.kernel.org, Date: Tue, 15 Sep 2015 20:04:02 -0500 Message-Id: <1442365458-16349-14-git-send-email-ebiederm@xmission.com> X-Mailer: git-send-email 2.2.1 In-Reply-To: <87mvwn18my.fsf@x220.int.ebiederm.org> References: <87mvwn18my.fsf@x220.int.ebiederm.org> X-XM-AID: U2FsdGVkX18sB8FYDxM9yHzG/muPvu6ksCBnnO+YAM4= 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 sa04.xmission.com X-Spam-Level: X-Spam-Status: No, score=0.8 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE, TVD_RCVD_IP, T_TooManySym_01, TooManyTo_001, XMSubLong autolearn=disabled version=3.4.0 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 0.3 TooManyTo_001 Multiple "To" Header Recipients 2x (uncommon) * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4911] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa04 1397; Body=1 Fuz1=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 X-Spam-Combo: ;Pablo Neira Ayuso , David Miller X-Spam-Relay-Country: X-Spam-Timing: total 321 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 5 (1.7%), b_tie_ro: 3.8 (1.2%), parse: 1.10 (0.3%), extract_message_metadata: 15 (4.6%), get_uri_detail_list: 1.79 (0.6%), tests_pri_-1000: 5 (1.7%), tests_pri_-950: 1.18 (0.4%), tests_pri_-900: 0.96 (0.3%), tests_pri_-400: 16 (5.1%), check_bayes: 15 (4.7%), b_tokenize: 4.4 (1.4%), b_tok_get_all: 4.4 (1.4%), b_comp_prob: 1.56 (0.5%), b_tok_touch_all: 2.5 (0.8%), b_finish: 0.74 (0.2%), tests_pri_0: 268 (83.7%), tests_pri_500: 4.1 (1.3%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH next 14/30] ipv4: Only compute net once in ip_rcv_finish 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 in01.mta.xmission.com) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: "Eric W. Biederman" --- net/ipv4/ip_input.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index ff908863f22e..cc242b9501d9 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -314,6 +314,7 @@ EXPORT_SYMBOL(sysctl_ip_early_demux); static int ip_rcv_finish(struct sock *sk, struct sk_buff *skb) { const struct iphdr *iph = ip_hdr(skb); + struct net *net = dev_net(skb->dev); struct rtable *rt; if (sysctl_ip_early_demux && !skb_dst(skb) && !skb->sk) { @@ -337,8 +338,7 @@ static int ip_rcv_finish(struct sock *sk, struct sk_buff *skb) iph->tos, skb->dev); if (unlikely(err)) { if (err == -EXDEV) - NET_INC_STATS_BH(dev_net(skb->dev), - LINUX_MIB_IPRPFILTER); + NET_INC_STATS_BH(net, LINUX_MIB_IPRPFILTER); goto drop; } } @@ -359,11 +359,9 @@ static int ip_rcv_finish(struct sock *sk, struct sk_buff *skb) rt = skb_rtable(skb); if (rt->rt_type == RTN_MULTICAST) { - IP_UPD_PO_STATS_BH(dev_net(rt->dst.dev), IPSTATS_MIB_INMCAST, - skb->len); + IP_UPD_PO_STATS_BH(net, IPSTATS_MIB_INMCAST, skb->len); } else if (rt->rt_type == RTN_BROADCAST) - IP_UPD_PO_STATS_BH(dev_net(rt->dst.dev), IPSTATS_MIB_INBCAST, - skb->len); + IP_UPD_PO_STATS_BH(net, IPSTATS_MIB_INBCAST, skb->len); return dst_input(skb);