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 19081C10F12 for ; Tue, 16 Apr 2019 00:56:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D098620830 for ; Tue, 16 Apr 2019 00:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555376182; bh=g5gPGmEaS1eiktfuuHJSFKDwIKBpdVdWFSrlWDo2kdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iCilPkKMHnZBgdIJ4Bzyb/idgxqAjr3gsJb3lQx53ahXKFdN6HmOt5DXouTw310d5 fxBJKkIzlCmYpelg+tfm+mErK1bkYKYgBf/KUsqRct0KPM70DjJoDEwgk7GN3BR3QZ 7vU1jeqecTTcywlyasd4hXYWUjoC5rG6cW2kbVIk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728310AbfDPA4W (ORCPT ); Mon, 15 Apr 2019 20:56:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:41816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbfDPA4U (ORCPT ); Mon, 15 Apr 2019 20:56:20 -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 14B1B2087C; Tue, 16 Apr 2019 00:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555376179; bh=g5gPGmEaS1eiktfuuHJSFKDwIKBpdVdWFSrlWDo2kdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EuSbYhdqtoFUFnZtGB+JSGgSwMP372BdAoovLGX94bkcARCVfd9TaWQprSEx6CvKd aAieh7taNK1Q3B46f4KazV55Ox+8CGCOgbYLCes63ONJGq7Dlb2dykYq0VvnI4V517 Rysc3nVnw9gFYj+aCStCLv7duzft+7RxYFlZ3KTI= From: David Ahern To: davem@davemloft.net, netdev@vger.kernel.org Cc: idosch@mellanox.com, David Ahern Subject: [PATCH net-next 02/13] ipv6: Pass fib6_result to rt6_find_cached_rt Date: Mon, 15 Apr 2019 17:56:41 -0700 Message-Id: <20190416005652.29286-3-dsahern@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190416005652.29286-1-dsahern@kernel.org> References: <20190416005652.29286-1-dsahern@kernel.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: David Ahern Simplify rt6_find_cached_rt for the fast path cases and pass fib6_result to rt6_find_cached_rt. Rename the local return variable to ret to maintain consisting with fib6_result name. Update the comment in rt6_find_cached_rt to reference the new names in a fib6_info vs the old name when fib entries were an rt6_info. Signed-off-by: David Ahern --- net/ipv6/route.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index dd717d1539b6..68122621e0ba 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -110,7 +110,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, struct in6_addr *dest, struct in6_addr *src, int iif, int type, u32 portid, u32 seq, unsigned int flags); -static struct rt6_info *rt6_find_cached_rt(struct fib6_info *rt, +static struct rt6_info *rt6_find_cached_rt(const struct fib6_result *res, struct in6_addr *daddr, struct in6_addr *saddr); @@ -1098,7 +1098,7 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net, fl6->flowi6_oif != 0, skb, flags); /* Search through exception table */ - rt = rt6_find_cached_rt(res.f6i, &fl6->daddr, &fl6->saddr); + rt = rt6_find_cached_rt(&res, &fl6->daddr, &fl6->saddr); if (rt) { if (ip6_hold_safe(net, &rt)) dst_use_noref(&rt->dst, jiffies); @@ -1538,33 +1538,33 @@ void rt6_flush_exceptions(struct fib6_info *rt) /* Find cached rt in the hash table inside passed in rt * Caller has to hold rcu_read_lock() */ -static struct rt6_info *rt6_find_cached_rt(struct fib6_info *rt, +static struct rt6_info *rt6_find_cached_rt(const struct fib6_result *res, struct in6_addr *daddr, struct in6_addr *saddr) { struct rt6_exception_bucket *bucket; struct in6_addr *src_key = NULL; struct rt6_exception *rt6_ex; - struct rt6_info *res = NULL; + struct rt6_info *ret = NULL; - bucket = rcu_dereference(rt->rt6i_exception_bucket); + bucket = rcu_dereference(res->f6i->rt6i_exception_bucket); #ifdef CONFIG_IPV6_SUBTREES - /* rt6i_src.plen != 0 indicates rt is in subtree + /* fib6i_src.plen != 0 indicates f6i is in subtree * and exception table is indexed by a hash of - * both rt6i_dst and rt6i_src. + * both fib6_dst and fib6_src. * Otherwise, the exception table is indexed by - * a hash of only rt6i_dst. + * a hash of only fib6_dst. */ - if (rt->fib6_src.plen) + if (res->f6i->fib6_src.plen) src_key = saddr; #endif rt6_ex = __rt6_find_exception_rcu(&bucket, daddr, src_key); if (rt6_ex && !rt6_check_expired(rt6_ex->rt6i)) - res = rt6_ex->rt6i; + ret = rt6_ex->rt6i; - return res; + return ret; } /* Remove the passed in cached rt from the hash table that contains it */ @@ -1869,7 +1869,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, fib6_select_path(net, &res, fl6, oif, false, skb, strict); /*Search through exception table */ - rt = rt6_find_cached_rt(res.f6i, &fl6->daddr, &fl6->saddr); + rt = rt6_find_cached_rt(&res, &fl6->daddr, &fl6->saddr); if (rt) { if (ip6_hold_safe(net, &rt)) dst_use_noref(&rt->dst, jiffies); @@ -2426,9 +2426,12 @@ static bool ip6_redirect_nh_match(struct fib6_info *f6i, * is different. */ if (!ipv6_addr_equal(gw, &nh->fib_nh_gw6)) { + struct fib6_result res = { + .f6i = f6i, + }; struct rt6_info *rt_cache; - rt_cache = rt6_find_cached_rt(f6i, &fl6->daddr, &fl6->saddr); + rt_cache = rt6_find_cached_rt(&res, &fl6->daddr, &fl6->saddr); if (rt_cache && ipv6_addr_equal(gw, &rt_cache->rt6i_gateway)) { *ret = rt_cache; @@ -3307,9 +3310,13 @@ static int ip6_route_del(struct fib6_config *cfg, struct fib6_nh *nh; if (cfg->fc_flags & RTF_CACHE) { + struct fib6_result res = { + .f6i = rt, + }; int rc; - rt_cache = rt6_find_cached_rt(rt, &cfg->fc_dst, + rt_cache = rt6_find_cached_rt(&res, + &cfg->fc_dst, &cfg->fc_src); if (rt_cache) { rc = ip6_del_cached_rt(rt_cache, cfg); -- 2.11.0