seg6_iptunnel: Refactor seg6_lwt_headroom out of uapi header
authorIoana-Ruxandra Stăncioi <stancioi@google.com>
Mon, 3 Aug 2020 07:33:33 +0000 (07:33 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Aug 2020 00:57:40 +0000 (17:57 -0700)
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: David Miller <davem@davemloft.net>
Signed-off-by: Ioana-Ruxandra Stăncioi <stancioi@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/seg6_iptunnel.h
net/ipv6/seg6_iptunnel.c

index 09fb608..eb815e0 100644 (file)
@@ -37,25 +37,4 @@ enum {
        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
index e0e9f48..897fa59 100644 (file)
 #include <net/seg6_hmac.h>
 #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 dst_cache cache;
        struct seg6_iptunnel_encap tuninfo[];