aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip6_route.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-11-18 18:23:55 -0800
committerJakub Kicinski <kuba@kernel.org>2021-11-19 20:09:55 -0800
commit8d22679dc89a6d9e1d41b2514902e3f7ef51547a (patch)
tree1977b52616447ab35399bc8cc18407cb35df6b79 /include/net/ip6_route.h
parentnet/bridge: replace simple_strtoul to kstrtol (diff)
downloadlinux-dev-8d22679dc89a6d9e1d41b2514902e3f7ef51547a.tar.xz
linux-dev-8d22679dc89a6d9e1d41b2514902e3f7ef51547a.zip
ipv6: ip6_skb_dst_mtu() cleanups
Use const attribute where we can, and cache skb_dst() Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20211119022355.2985984-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/ip6_route.h')
-rw-r--r--include/net/ip6_route.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 5efd0b71dc67..ca2d6b60e1ec 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -263,19 +263,19 @@ static inline bool ipv6_anycast_destination(const struct dst_entry *dst,
int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
int (*output)(struct net *, struct sock *, struct sk_buff *));
-static inline unsigned int ip6_skb_dst_mtu(struct sk_buff *skb)
+static inline unsigned int ip6_skb_dst_mtu(const struct sk_buff *skb)
{
- unsigned int mtu;
-
- struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
+ const struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
inet6_sk(skb->sk) : NULL;
+ const struct dst_entry *dst = skb_dst(skb);
+ unsigned int mtu;
if (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) {
- mtu = READ_ONCE(skb_dst(skb)->dev->mtu);
- mtu -= lwtunnel_headroom(skb_dst(skb)->lwtstate, mtu);
- } else
- mtu = dst_mtu(skb_dst(skb));
-
+ mtu = READ_ONCE(dst->dev->mtu);
+ mtu -= lwtunnel_headroom(dst->lwtstate, mtu);
+ } else {
+ mtu = dst_mtu(dst);
+ }
return mtu;
}