From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6384AC10F0E for ; Tue, 9 Apr 2019 21:41:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F8402082A for ; Tue, 9 Apr 2019 21:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554846097; bh=dvA9QiyD7OqwuF39IUEnsZKoXSd24wH2WwDrmQlXmls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=K8q1BVb6wCzUwJ1pVLg4M39i3N2qQ+7LW9pJtlj0a99U1Zl7xQCC7iUDFtwhQ+P8a QXSYCRb3i39YrmIDL8Szg7KDDngtNzD9+M5IKszeWkVOd/ibOtYq6XAOCMtSX4tjPz wr4FxgJz1SMspSw9IesxIu6KiexZxM4S2rvBlEzM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726775AbfDIVlA (ORCPT ); Tue, 9 Apr 2019 17:41:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:56008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726742AbfDIVk7 (ORCPT ); Tue, 9 Apr 2019 17:40:59 -0400 Received: from kenny.it.cumulusnetworks.com. (fw.cumulusnetworks.com [216.129.126.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E61C42133D; Tue, 9 Apr 2019 21:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554846059; bh=dvA9QiyD7OqwuF39IUEnsZKoXSd24wH2WwDrmQlXmls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CiTvIDyWB40rVp8xYHKQibOi2ZkWR3KsMWGfg4Kl7MG90xzVDoJ6Ae4RUgoI3jv71 YvRCYa7v/AnxF1cGijPmOvg86EQJlf74Z0mz1l9H9aYxSnny6S8YpJDpDSngQTo7QR mEnxH9Nvp5CHPW2IKUTb9jHMneLT1yZQx9/4wDhI= From: David Ahern To: davem@davemloft.net, netdev@vger.kernel.org Cc: idosch@mellanox.com, David Ahern Subject: [PATCH net-next 01/10] ipv6: Only call rt6_check_neigh for nexthop with gateway Date: Tue, 9 Apr 2019 14:41:10 -0700 Message-Id: <20190409214119.15258-2-dsahern@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190409214119.15258-1-dsahern@kernel.org> References: <20190409214119.15258-1-dsahern@kernel.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: David Ahern Change rt6_check_neigh to take a fib6_nh instead of a fib entry. Move the check on fib_flags and whether the nexthop has a gateway up to the one caller. Remove the inline from the definition as well. Not necessary. Signed-off-by: David Ahern --- net/ipv6/route.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 69f92d2b780e..b515fa8f787e 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -589,18 +589,14 @@ static inline int rt6_check_dev(struct fib6_info *rt, int oif) return 0; } -static inline enum rt6_nud_state rt6_check_neigh(struct fib6_info *rt) +static enum rt6_nud_state rt6_check_neigh(const struct fib6_nh *fib6_nh) { enum rt6_nud_state ret = RT6_NUD_FAIL_HARD; struct neighbour *neigh; - if (rt->fib6_flags & RTF_NONEXTHOP || - !rt->fib6_nh.fib_nh_gw_family) - return RT6_NUD_SUCCEED; - rcu_read_lock_bh(); - neigh = __ipv6_neigh_lookup_noref(rt->fib6_nh.fib_nh_dev, - &rt->fib6_nh.fib_nh_gw6); + neigh = __ipv6_neigh_lookup_noref(fib6_nh->fib_nh_dev, + &fib6_nh->fib_nh_gw6); if (neigh) { read_lock(&neigh->lock); if (neigh->nud_state & NUD_VALID) @@ -623,6 +619,7 @@ static inline enum rt6_nud_state rt6_check_neigh(struct fib6_info *rt) static int rt6_score_route(struct fib6_info *rt, int oif, int strict) { + struct fib6_nh *nh = &rt->fib6_nh; int m; m = rt6_check_dev(rt, oif); @@ -631,8 +628,9 @@ static int rt6_score_route(struct fib6_info *rt, int oif, int strict) #ifdef CONFIG_IPV6_ROUTER_PREF m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(rt->fib6_flags)) << 2; #endif - if (strict & RT6_LOOKUP_F_REACHABLE) { - int n = rt6_check_neigh(rt); + if ((strict & RT6_LOOKUP_F_REACHABLE) && + !(rt->fib6_flags & RTF_NONEXTHOP) && nh->fib_nh_gw_family) { + int n = rt6_check_neigh(nh); if (n < 0) return n; } -- 2.11.0