Skip to content

Commit 0600cf4

Browse files
IurmanJPaolo Abeni
authored andcommitted
include: net: add static inline dst_dev_overhead() to dst.h
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>
1 parent 152d00a commit 0600cf4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/net/dst.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,15 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout)
440440
dst->expires = expires;
441441
}
442442

443+
static inline unsigned int dst_dev_overhead(struct dst_entry *dst,
444+
struct sk_buff *skb)
445+
{
446+
if (likely(dst))
447+
return LL_RESERVED_SPACE(dst->dev);
448+
449+
return skb->mac_len;
450+
}
451+
443452
INDIRECT_CALLABLE_DECLARE(int ip6_output(struct net *, struct sock *,
444453
struct sk_buff *));
445454
INDIRECT_CALLABLE_DECLARE(int ip_output(struct net *, struct sock *,

0 commit comments

Comments
 (0)