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 D5E5DC10F0E for ; Tue, 9 Apr 2019 21:41:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C4662133D for ; Tue, 9 Apr 2019 21:41:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554846063; bh=KQX+HomfUdSwpHD3Yel/Qh2lHL47A8fpkUzhXvVAEH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=k+J631pKuARnIOP0XRkQD33O9ZzY5SZ4viJCHd7mtSpwE9LLK9JdK+8/NlhMtFIoI tQJQPz0A13TttwvIvRncWCObL2B4LLeoOpll48STR82Il7A7/EPZYOUgeI6lQve9Rx eu6HvseOlsFYya4hmBKqD+KQPuyVSaau2j55hJZw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726800AbfDIVlC (ORCPT ); Tue, 9 Apr 2019 17:41:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:56040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726757AbfDIVlA (ORCPT ); Tue, 9 Apr 2019 17:41:00 -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 9BD1A217F9; Tue, 9 Apr 2019 21:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554846059; bh=KQX+HomfUdSwpHD3Yel/Qh2lHL47A8fpkUzhXvVAEH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qF5VN6U0cul2/iACjIfpP6cI7j9m42PAWBvL0KNp7tC0dpSNFVZHdHtdJkppVmhoQ ETJ85h9yuu0T50ZTOKytwjUkgqAAux4xXTGYBaqRFQMjw1Rb9a15gPSX0ZsIOnYO0o KsR76/P+w0SX+CSxr4Pt+PH1zJNiwYb5VnrZpRUY= From: David Ahern To: davem@davemloft.net, netdev@vger.kernel.org Cc: idosch@mellanox.com, David Ahern Subject: [PATCH net-next 04/10] ipv6: Pass fib6_nh and flags to rt6_score_route Date: Tue, 9 Apr 2019 14:41:13 -0700 Message-Id: <20190409214119.15258-5-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 rt6_score_route only needs the fib6_flags and nexthop data. Change it accordingly. Allows re-use later for nexthop based fib6_nh. Signed-off-by: David Ahern --- net/ipv6/route.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index c2b0d6f049e3..22d1933278ae 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -102,7 +102,8 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb, u32 mtu); static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb); -static int rt6_score_route(struct fib6_info *rt, int oif, int strict); +static int rt6_score_route(const struct fib6_nh *nh, u32 fib6_flags, int oif, + int strict); static size_t rt6_nlmsg_size(struct fib6_info *rt); static int rt6_fill_node(struct net *net, struct sk_buff *skb, struct fib6_info *rt, struct dst_entry *dst, @@ -446,12 +447,13 @@ struct fib6_info *fib6_multipath_select(const struct net *net, list_for_each_entry_safe(sibling, next_sibling, &match->fib6_siblings, fib6_siblings) { + const struct fib6_nh *nh = &sibling->fib6_nh; int nh_upper_bound; - nh_upper_bound = atomic_read(&sibling->fib6_nh.fib_nh_upper_bound); + nh_upper_bound = atomic_read(&nh->fib_nh_upper_bound); if (fl6->mp_hash > nh_upper_bound) continue; - if (rt6_score_route(sibling, oif, strict) < 0) + if (rt6_score_route(nh, sibling->fib6_flags, oif, strict) < 0) break; match = sibling; break; @@ -608,9 +610,9 @@ static enum rt6_nud_state rt6_check_neigh(const struct fib6_nh *fib6_nh) return ret; } -static int rt6_score_route(struct fib6_info *rt, int oif, int strict) +static int rt6_score_route(const struct fib6_nh *nh, u32 fib6_flags, int oif, + int strict) { - struct fib6_nh *nh = &rt->fib6_nh; int m = 0; if (!oif || nh->fib_nh_dev->ifindex == oif) @@ -619,10 +621,10 @@ static int rt6_score_route(struct fib6_info *rt, int oif, int strict) if (!m && (strict & RT6_LOOKUP_F_IFACE)) return RT6_NUD_FAIL_HARD; #ifdef CONFIG_IPV6_ROUTER_PREF - m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(rt->fib6_flags)) << 2; + m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(fib6_flags)) << 2; #endif if ((strict & RT6_LOOKUP_F_REACHABLE) && - !(rt->fib6_flags & RTF_NONEXTHOP) && nh->fib_nh_gw_family) { + !(fib6_flags & RTF_NONEXTHOP) && nh->fib_nh_gw_family) { int n = rt6_check_neigh(nh); if (n < 0) return n; @@ -648,7 +650,7 @@ static struct fib6_info *find_match(struct fib6_info *rt, int oif, int strict, if (fib6_check_expired(rt)) goto out; - m = rt6_score_route(rt, oif, strict); + m = rt6_score_route(&rt->fib6_nh, rt->fib6_flags, oif, strict); if (m == RT6_NUD_FAIL_DO_RR) { match_do_rr = true; m = 0; /* lowest valid score */ -- 2.11.0