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 355C9C10F12 for ; Tue, 16 Apr 2019 00:56:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 05EB520830 for ; Tue, 16 Apr 2019 00:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555376204; bh=hGX/Zc7C4CfU3Eqm833KVR5MIEKe1APkvhhbSlLN49M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=J36iARYE+XNednOCJSTI/6UFgeTu5xdcLc1A6vmCYhb/2bUjJujgufJkhFAre68LO cb2mCMRV24czipYEdn89oHjh6v23AjKFZcZ1Nni3TsvO4WIlTmC2lGechEayENeNJX b5mpGKCEVp4imem4UDCe4aNqmAjAJ2UbJgO0rYbM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728372AbfDPA4i (ORCPT ); Mon, 15 Apr 2019 20:56:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:41866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728286AbfDPA4V (ORCPT ); Mon, 15 Apr 2019 20:56:21 -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 73E8B218DA; Tue, 16 Apr 2019 00:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555376180; bh=hGX/Zc7C4CfU3Eqm833KVR5MIEKe1APkvhhbSlLN49M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JDcBAOlMPgK7R0M3WgO2zafG7LGLtNE3jQxfaAwXnvyyBgHGgcfKO5uDYRSPmGy0z jEgQ/FVchlrQ2o1YorN50IbmCdbOZ96LygM4sYH0hOsMQSBIn8tkeTSJwZWg6IIaOq r7ltnHoVFctLM8EyLyR8+jYb7oADhBXEKTU/9ivo= From: David Ahern To: davem@davemloft.net, netdev@vger.kernel.org Cc: idosch@mellanox.com, David Ahern Subject: [PATCH net-next 08/13] ipv6: Pass fib6_result to ip6_mtu_from_fib6 and fib6_mtu Date: Mon, 15 Apr 2019 17:56:47 -0700 Message-Id: <20190416005652.29286-9-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 Change ip6_mtu_from_fib6 and fib6_mtu to take a fib6_result over a fib6_info. Update both to use the fib6_nh from fib6_result. Since the signature of ip6_mtu_from_fib6 is already changing, add const to daddr and saddr. Signed-off-by: David Ahern --- include/net/ip6_route.h | 5 +++-- include/net/ipv6_stubs.h | 5 +++-- net/core/filter.c | 2 +- net/ipv6/addrconf_core.c | 5 +++-- net/ipv6/route.c | 26 +++++++++++++++----------- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 5909fc421305..46bbd8ff9cc6 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -302,8 +302,9 @@ static inline unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst) return mtu; } -u32 ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr, - struct in6_addr *saddr); +u32 ip6_mtu_from_fib6(const struct fib6_result *res, + const struct in6_addr *daddr, + const struct in6_addr *saddr); struct neighbour *ip6_neigh_lookup(const struct in6_addr *gw, struct net_device *dev, struct sk_buff *skb, diff --git a/include/net/ipv6_stubs.h b/include/net/ipv6_stubs.h index 5df36d6a2613..0d16b9ec0485 100644 --- a/include/net/ipv6_stubs.h +++ b/include/net/ipv6_stubs.h @@ -38,8 +38,9 @@ struct ipv6_stub { void (*fib6_select_path)(const struct net *net, struct fib6_result *res, struct flowi6 *fl6, int oif, bool oif_match, const struct sk_buff *skb, int strict); - u32 (*ip6_mtu_from_fib6)(struct fib6_info *f6i, struct in6_addr *daddr, - struct in6_addr *saddr); + u32 (*ip6_mtu_from_fib6)(const struct fib6_result *res, + const struct in6_addr *daddr, + const struct in6_addr *saddr); int (*fib6_nh_init)(struct net *net, struct fib6_nh *fib6_nh, struct fib6_config *cfg, gfp_t gfp_flags, diff --git a/net/core/filter.c b/net/core/filter.c index 72b29e4d705b..3dd22f450271 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4759,7 +4759,7 @@ static int bpf_ipv6_fib_lookup(struct net *net, struct bpf_fib_lookup *params, fl6.flowi6_oif != 0, NULL, strict); if (check_mtu) { - mtu = ipv6_stub->ip6_mtu_from_fib6(res.f6i, dst, src); + mtu = ipv6_stub->ip6_mtu_from_fib6(&res, dst, src); if (params->tot_len > mtu) return BPF_FIB_LKUP_RET_FRAG_NEEDED; } diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c index b11fa0aa18a0..c4c0203d6836 100644 --- a/net/ipv6/addrconf_core.c +++ b/net/ipv6/addrconf_core.c @@ -166,8 +166,9 @@ eafnosupport_fib6_select_path(const struct net *net, struct fib6_result *res, } static u32 -eafnosupport_ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr, - struct in6_addr *saddr) +eafnosupport_ip6_mtu_from_fib6(const struct fib6_result *res, + const struct in6_addr *daddr, + const struct in6_addr *saddr) { return 0; } diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 7d88bb1401ed..c28fd554f7cf 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1417,14 +1417,15 @@ __rt6_find_exception_rcu(struct rt6_exception_bucket **bucket, return NULL; } -static unsigned int fib6_mtu(const struct fib6_info *rt) +static unsigned int fib6_mtu(const struct fib6_result *res) { + const struct fib6_nh *nh = res->nh; unsigned int mtu; - if (rt->fib6_pmtu) { - mtu = rt->fib6_pmtu; + if (res->f6i->fib6_pmtu) { + mtu = res->f6i->fib6_pmtu; } else { - struct net_device *dev = fib6_info_nh_dev(rt); + struct net_device *dev = nh->fib_nh_dev; struct inet6_dev *idev; rcu_read_lock(); @@ -1435,7 +1436,7 @@ static unsigned int fib6_mtu(const struct fib6_info *rt) mtu = min_t(unsigned int, mtu, IP6_MAX_MTU); - return mtu - lwtunnel_headroom(rt->fib6_nh.fib_nh_lws, mtu); + return mtu - lwtunnel_headroom(nh->fib_nh_lws, mtu); } static int rt6_insert_exception(struct rt6_info *nrt, @@ -1481,7 +1482,7 @@ static int rt6_insert_exception(struct rt6_info *nrt, * Only insert this exception route if its mtu * is less than f6i's mtu value. */ - if (dst_metric_raw(&nrt->dst, RTAX_MTU) >= fib6_mtu(res->f6i)) { + if (dst_metric_raw(&nrt->dst, RTAX_MTU) >= fib6_mtu(res)) { err = -EINVAL; goto out; } @@ -2636,12 +2637,15 @@ static unsigned int ip6_mtu(const struct dst_entry *dst) * based on ip6_dst_mtu_forward and exception logic of * rt6_find_cached_rt; called with rcu_read_lock */ -u32 ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr, - struct in6_addr *saddr) +u32 ip6_mtu_from_fib6(const struct fib6_result *res, + const struct in6_addr *daddr, + const struct in6_addr *saddr) { struct rt6_exception_bucket *bucket; + const struct fib6_nh *nh = res->nh; + struct fib6_info *f6i = res->f6i; + const struct in6_addr *src_key; struct rt6_exception *rt6_ex; - struct in6_addr *src_key; struct inet6_dev *idev; u32 mtu = 0; @@ -2663,7 +2667,7 @@ u32 ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr, mtu = dst_metric_raw(&rt6_ex->rt6i->dst, RTAX_MTU); if (likely(!mtu)) { - struct net_device *dev = fib6_info_nh_dev(f6i); + struct net_device *dev = nh->fib_nh_dev; mtu = IPV6_MIN_MTU; idev = __in6_dev_get(dev); @@ -2673,7 +2677,7 @@ u32 ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr, mtu = min_t(unsigned int, mtu, IP6_MAX_MTU); out: - return mtu - lwtunnel_headroom(fib6_info_nh_lwt(f6i), mtu); + return mtu - lwtunnel_headroom(nh->fib_nh_lws, mtu); } struct dst_entry *icmp6_dst_alloc(struct net_device *dev, -- 2.11.0