Commit 88fab21c authored by Ioana-Ruxandra Stăncioi's avatar Ioana-Ruxandra Stăncioi Committed by David S. Miller

seg6_iptunnel: Refactor seg6_lwt_headroom out of uapi header

Refactor the function seg6_lwt_headroom out of the seg6_iptunnel.h uapi
header, because it is only used in seg6_iptunnel.c. Moreover, it is only
used in the kernel code, as indicated by the "#ifdef __KERNEL__".
Suggested-by: default avatarDavid Miller <davem@davemloft.net>
Signed-off-by: default avatarIoana-Ruxandra Stăncioi <stancioi@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 730e700e
...@@ -37,25 +37,4 @@ enum { ...@@ -37,25 +37,4 @@ enum {
SEG6_IPTUN_MODE_L2ENCAP, SEG6_IPTUN_MODE_L2ENCAP,
}; };
#ifdef __KERNEL__
static inline size_t seg6_lwt_headroom(struct seg6_iptunnel_encap *tuninfo)
{
int head = 0;
switch (tuninfo->mode) {
case SEG6_IPTUN_MODE_INLINE:
break;
case SEG6_IPTUN_MODE_ENCAP:
head = sizeof(struct ipv6hdr);
break;
case SEG6_IPTUN_MODE_L2ENCAP:
return 0;
}
return ((tuninfo->srh->hdrlen + 1) << 3) + head;
}
#endif
#endif #endif
...@@ -27,6 +27,23 @@ ...@@ -27,6 +27,23 @@
#include <net/seg6_hmac.h> #include <net/seg6_hmac.h>
#endif #endif
static size_t seg6_lwt_headroom(struct seg6_iptunnel_encap *tuninfo)
{
int head = 0;
switch (tuninfo->mode) {
case SEG6_IPTUN_MODE_INLINE:
break;
case SEG6_IPTUN_MODE_ENCAP:
head = sizeof(struct ipv6hdr);
break;
case SEG6_IPTUN_MODE_L2ENCAP:
return 0;
}
return ((tuninfo->srh->hdrlen + 1) << 3) + head;
}
struct seg6_lwt { struct seg6_lwt {
struct dst_cache cache; struct dst_cache cache;
struct seg6_iptunnel_encap tuninfo[]; struct seg6_iptunnel_encap tuninfo[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment