Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] seg6_iptunnel: Refactor seg6_lwt_headroom out of uapi header
@ 2020-07-31  7:40 Ioana-Ruxandra Stancioi
  2020-07-31 21:25 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ioana-Ruxandra Stancioi @ 2020-07-31  7:40 UTC (permalink / raw)
  To: david.lebrun, davem, kuznet, yoshfuji, netdev, linux-kernel
  Cc: elver, glider, Ioana-Ruxandra Stăncioi

From: Ioana-Ruxandra Stăncioi <stancioi@google.com>

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>
---
v2:
* Apply David's suggestion and just move the function.
---
 include/uapi/linux/seg6_iptunnel.h | 21 ---------------------
 net/ipv6/seg6_iptunnel.c           | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/include/uapi/linux/seg6_iptunnel.h b/include/uapi/linux/seg6_iptunnel.h
index 09fb608a35ec..eb815e0d0ac3 100644
--- a/include/uapi/linux/seg6_iptunnel.h
+++ b/include/uapi/linux/seg6_iptunnel.h
@@ -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
diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
index e0e9f48ab14f..d8aa9fdc5819 100644
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -27,6 +27,23 @@
 #include <net/seg6_hmac.h>
 #endif
 
+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;
+}
+
 struct seg6_lwt {
 	struct dst_cache cache;
 	struct seg6_iptunnel_encap tuninfo[];
-- 
2.28.0.163.g6104cc2f0b6-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] seg6_iptunnel: Refactor seg6_lwt_headroom out of uapi header
  2020-07-31  7:40 [PATCH v2] seg6_iptunnel: Refactor seg6_lwt_headroom out of uapi header Ioana-Ruxandra Stancioi
@ 2020-07-31 21:25 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-07-31 21:25 UTC (permalink / raw)
  To: ioanaruxandra.stancioi
  Cc: david.lebrun, kuznet, yoshfuji, netdev, linux-kernel, elver,
	glider, stancioi

From: Ioana-Ruxandra Stancioi <ioanaruxandra.stancioi@gmail.com>
Date: Fri, 31 Jul 2020 07:40:32 +0000

> --- a/net/ipv6/seg6_iptunnel.c
> +++ b/net/ipv6/seg6_iptunnel.c
> @@ -27,6 +27,23 @@
>  #include <net/seg6_hmac.h>
>  #endif
>  
> +static inline size_t seg6_lwt_headroom(struct seg6_iptunnel_encap *tuninfo)
> +{

Please remove the inline tag when you move the function here, we do
not use the inline keyword in foo.c files.

Thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-31  7:40 [PATCH v2] seg6_iptunnel: Refactor seg6_lwt_headroom out of uapi header Ioana-Ruxandra Stancioi
2020-07-31 21:25 ` David Miller

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git