diff options
author | Justin Iurman <justin.iurman@uliege.be> | 2024-12-03 13:49:42 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-07 16:45:42 +0100 |
commit | 665d91b0e4651686e0b796f594f00171217277c7 (patch) | |
tree | 3977a8d9dab60349453e4b7ff7c63ab431400092 /include | |
parent | 0df388df81fbc1fa44db30ae85392d2625db8d31 (diff) | |
download | linux-665d91b0e4651686e0b796f594f00171217277c7.tar.gz linux-665d91b0e4651686e0b796f594f00171217277c7.tar.bz2 linux-665d91b0e4651686e0b796f594f00171217277c7.zip |
include: net: add static inline dst_dev_overhead() to dst.h
[ Upstream commit 0600cf40e9b36fe17f9c9f04d4f9cef249eaa5e7 ]
Add static inline dst_dev_overhead() function to include/net/dst.h. This
helper function is used by ioam6_iptunnel, rpl_iptunnel and
seg6_iptunnel to get the dev's overhead based on a cache entry
(dst_entry). If the cache is empty, the default and generic value
skb->mac_len is returned. Otherwise, LL_RESERVED_SPACE() over dst's dev
is returned.
Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
Cc: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: c64a0727f9b1 ("net: ipv6: fix dst ref loop on input in seg6 lwt")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/dst.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/dst.h b/include/net/dst.h index 78884429deed..16b7b99b5f30 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -448,6 +448,15 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout) dst->expires = expires; } +static inline unsigned int dst_dev_overhead(struct dst_entry *dst, + struct sk_buff *skb) +{ + if (likely(dst)) + return LL_RESERVED_SPACE(dst->dev); + + return skb->mac_len; +} + INDIRECT_CALLABLE_DECLARE(int ip6_output(struct net *, struct sock *, struct sk_buff *)); INDIRECT_CALLABLE_DECLARE(int ip_output(struct net *, struct sock *, |