All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ESP: Export esp_output_fill_trailer function
@ 2020-02-19 12:01 Raed Salem
  2020-02-19 12:15 ` Steffen Klassert
  0 siblings, 1 reply; 8+ messages in thread
From: Raed Salem @ 2020-02-19 12:01 UTC (permalink / raw)
  To: steffen.klassert, herbert; +Cc: netdev, kuznet, davem, yoshfuji, Raed Salem

The esp fill trailer method is identical for both
IPv6 and IPv4.

Share the implementation for esp6 and esp to avoid
code duplication in addition it could be also used
at various drivers code.

Change-Id: Iebb4325fe12ef655a5cd6cb896cf9eed68033979
Signed-off-by: Raed Salem <raeds@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
---
 include/net/esp.h | 16 ++++++++++++++++
 net/ipv4/esp4.c   | 16 ----------------
 net/ipv6/esp6.c   | 16 ----------------
 3 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/include/net/esp.h b/include/net/esp.h
index 117652e..9c5637d 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -11,6 +11,22 @@ static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
 	return (struct ip_esp_hdr *)skb_transport_header(skb);
 }
 
+static inline void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
+{
+	/* Fill padding... */
+	if (tfclen) {
+		memset(tail, 0, tfclen);
+		tail += tfclen;
+	}
+	do {
+		int i;
+		for (i = 0; i < plen - 2; i++)
+			tail[i] = i + 1;
+	} while (0);
+	tail[plen - 2] = plen - 2;
+	tail[plen - 1] = proto;
+}
+
 struct esp_info {
 	struct	ip_esp_hdr *esph;
 	__be64	seqno;
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 5c96776..2c7f391 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -209,22 +209,6 @@ static void esp_output_done_esn(struct crypto_async_request *base, int err)
 	esp_output_done(base, err);
 }
 
-static void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
-{
-	/* Fill padding... */
-	if (tfclen) {
-		memset(tail, 0, tfclen);
-		tail += tfclen;
-	}
-	do {
-		int i;
-		for (i = 0; i < plen - 2; i++)
-			tail[i] = i + 1;
-	} while (0);
-	tail[plen - 2] = plen - 2;
-	tail[plen - 1] = proto;
-}
-
 static int esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp)
 {
 	int encap_type;
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index a3b403b..11143d0 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -207,22 +207,6 @@ static void esp_output_done_esn(struct crypto_async_request *base, int err)
 	esp_output_done(base, err);
 }
 
-static void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
-{
-	/* Fill padding... */
-	if (tfclen) {
-		memset(tail, 0, tfclen);
-		tail += tfclen;
-	}
-	do {
-		int i;
-		for (i = 0; i < plen - 2; i++)
-			tail[i] = i + 1;
-	} while (0);
-	tail[plen - 2] = plen - 2;
-	tail[plen - 1] = proto;
-}
-
 int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp)
 {
 	u8 *tail;
-- 
1.9.4


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

* Re: [PATCH net-next] ESP: Export esp_output_fill_trailer function
  2020-02-19 12:01 [PATCH net-next] ESP: Export esp_output_fill_trailer function Raed Salem
@ 2020-02-19 12:15 ` Steffen Klassert
  2020-02-19 12:19   ` Raed Salem
  0 siblings, 1 reply; 8+ messages in thread
From: Steffen Klassert @ 2020-02-19 12:15 UTC (permalink / raw)
  To: Raed Salem; +Cc: herbert, netdev, kuznet, davem, yoshfuji

On Wed, Feb 19, 2020 at 02:01:58PM +0200, Raed Salem wrote:
> The esp fill trailer method is identical for both
> IPv6 and IPv4.
> 
> Share the implementation for esp6 and esp to avoid
> code duplication in addition it could be also used
> at various drivers code.
> 
> Change-Id: Iebb4325fe12ef655a5cd6cb896cf9eed68033979

For what do you need the above line?

> Signed-off-by: Raed Salem <raeds@mellanox.com>
> Reviewed-by: Boris Pismenny <borisp@mellanox.com>
> Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>

Your patch does not apply to ipsec-next, please rebase
on this tree and resend.

Thanks!

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

* RE: [PATCH net-next] ESP: Export esp_output_fill_trailer function
  2020-02-19 12:15 ` Steffen Klassert
@ 2020-02-19 12:19   ` Raed Salem
  0 siblings, 0 replies; 8+ messages in thread
From: Raed Salem @ 2020-02-19 12:19 UTC (permalink / raw)
  To: Steffen Klassert; +Cc: herbert, netdev, kuznet, davem, yoshfuji


 Thanks for the input
> -----Original Message-----
> From: Steffen Klassert [mailto:steffen.klassert@secunet.com]
> Sent: Wednesday, February 19, 2020 2:16 PM
> To: Raed Salem <raeds@mellanox.com>
> Cc: herbert@gondor.apana.org.au; netdev@vger.kernel.org;
> kuznet@ms2.inr.ac.ru; davem@davemloft.net; yoshfuji@linux-ipv6.org
> Subject: Re: [PATCH net-next] ESP: Export esp_output_fill_trailer function
> 
> On Wed, Feb 19, 2020 at 02:01:58PM +0200, Raed Salem wrote:
> > The esp fill trailer method is identical for both
> > IPv6 and IPv4.
> >
> > Share the implementation for esp6 and esp to avoid code duplication in
> > addition it could be also used at various drivers code.
> >
> > Change-Id: Iebb4325fe12ef655a5cd6cb896cf9eed68033979
> 
> For what do you need the above line?
  Will be removed

> > Signed-off-by: Raed Salem <raeds@mellanox.com>
> > Reviewed-by: Boris Pismenny <borisp@mellanox.com>
> > Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
> 
> Your patch does not apply to ipsec-next, please rebase on this tree and
> resend.
  Will do soon 
> Thanks!

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

* Re: [PATCH net-next] ESP: Export esp_output_fill_trailer function
  2020-02-19 12:49 Raed Salem
@ 2020-02-20 12:45 ` Steffen Klassert
  0 siblings, 0 replies; 8+ messages in thread
From: Steffen Klassert @ 2020-02-20 12:45 UTC (permalink / raw)
  To: Raed Salem; +Cc: herbert, netdev, kuznet, davem, yoshfuji

On Wed, Feb 19, 2020 at 02:49:57PM +0200, Raed Salem wrote:
> The esp fill trailer method is identical for both
> IPv6 and IPv4.
> 
> Share the implementation for esp6 and esp to avoid
> code duplication in addition it could be also used
> at various drivers code.
> 
> Signed-off-by: Raed Salem <raeds@mellanox.com>
> Reviewed-by: Boris Pismenny <borisp@mellanox.com>
> Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>

Applied to ipsec-next, thanks Raed!

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

* [PATCH net-next] ESP: Export esp_output_fill_trailer function
@ 2020-02-19 12:49 Raed Salem
  2020-02-20 12:45 ` Steffen Klassert
  0 siblings, 1 reply; 8+ messages in thread
From: Raed Salem @ 2020-02-19 12:49 UTC (permalink / raw)
  To: steffen.klassert, herbert; +Cc: netdev, kuznet, davem, yoshfuji, Raed Salem

The esp fill trailer method is identical for both
IPv6 and IPv4.

Share the implementation for esp6 and esp to avoid
code duplication in addition it could be also used
at various drivers code.

Signed-off-by: Raed Salem <raeds@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
---
 include/net/esp.h | 16 ++++++++++++++++
 net/ipv4/esp4.c   | 16 ----------------
 net/ipv6/esp6.c   | 16 ----------------
 3 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/include/net/esp.h b/include/net/esp.h
index 117652e..9c5637d 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -11,6 +11,22 @@ static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
 	return (struct ip_esp_hdr *)skb_transport_header(skb);
 }
 
+static inline void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
+{
+	/* Fill padding... */
+	if (tfclen) {
+		memset(tail, 0, tfclen);
+		tail += tfclen;
+	}
+	do {
+		int i;
+		for (i = 0; i < plen - 2; i++)
+			tail[i] = i + 1;
+	} while (0);
+	tail[plen - 2] = plen - 2;
+	tail[plen - 1] = proto;
+}
+
 struct esp_info {
 	struct	ip_esp_hdr *esph;
 	__be64	seqno;
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 103c7d5..8b07f3a 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -341,22 +341,6 @@ static void esp_output_done_esn(struct crypto_async_request *base, int err)
 	esp_output_done(base, err);
 }
 
-static void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
-{
-	/* Fill padding... */
-	if (tfclen) {
-		memset(tail, 0, tfclen);
-		tail += tfclen;
-	}
-	do {
-		int i;
-		for (i = 0; i < plen - 2; i++)
-			tail[i] = i + 1;
-	} while (0);
-	tail[plen - 2] = plen - 2;
-	tail[plen - 1] = proto;
-}
-
 static struct ip_esp_hdr *esp_output_udp_encap(struct sk_buff *skb,
 					       int encap_type,
 					       struct esp_info *esp,
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index a3b403b..11143d0 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -207,22 +207,6 @@ static void esp_output_done_esn(struct crypto_async_request *base, int err)
 	esp_output_done(base, err);
 }
 
-static void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
-{
-	/* Fill padding... */
-	if (tfclen) {
-		memset(tail, 0, tfclen);
-		tail += tfclen;
-	}
-	do {
-		int i;
-		for (i = 0; i < plen - 2; i++)
-			tail[i] = i + 1;
-	} while (0);
-	tail[plen - 2] = plen - 2;
-	tail[plen - 1] = proto;
-}
-
 int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp)
 {
 	u8 *tail;
-- 
1.8.3.1


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

* RE: [PATCH net-next] ESP: Export esp_output_fill_trailer function
  2020-02-12  1:07 ` David Miller
@ 2020-02-12  5:58   ` Raed Salem
  0 siblings, 0 replies; 8+ messages in thread
From: Raed Salem @ 2020-02-12  5:58 UTC (permalink / raw)
  To: David Miller; +Cc: steffen.klassert, herbert, netdev, kuznet, yoshfuji

Thanks, will do

-----Original Message-----
From: David Miller [mailto:davem@davemloft.net] 
Sent: Wednesday, February 12, 2020 3:07 AM
To: Raed Salem <raeds@mellanox.com>
Cc: steffen.klassert@secunet.com; herbert@gondor.apana.org.au; netdev@vger.kernel.org; kuznet@ms2.inr.ac.ru; yoshfuji@linux-ipv6.org
Subject: Re: [PATCH net-next] ESP: Export esp_output_fill_trailer function

From: Raed Salem <raeds@mellanox.com>
Date: Tue, 11 Feb 2020 10:20:02 +0200

> The esp fill trailer method is identical for both
> IPv6 and IPv4.
> 
> Share the implementation for esp6 and esp to avoid code duplication in 
> addition it could be also used at various drivers code.
> 
> Change-Id: Iebb4325fe12ef655a5cd6cb896cf9eed68033979
> Signed-off-by: Raed Salem <raeds@mellanox.com>
> Reviewed-by: Boris Pismenny <borisp@mellanox.com>
> Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>

net-next is closed, please resubmit this when it opens back up

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

* Re: [PATCH net-next] ESP: Export esp_output_fill_trailer function
  2020-02-11  8:20 Raed Salem
@ 2020-02-12  1:07 ` David Miller
  2020-02-12  5:58   ` Raed Salem
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2020-02-12  1:07 UTC (permalink / raw)
  To: raeds; +Cc: steffen.klassert, herbert, netdev, kuznet, yoshfuji

From: Raed Salem <raeds@mellanox.com>
Date: Tue, 11 Feb 2020 10:20:02 +0200

> The esp fill trailer method is identical for both
> IPv6 and IPv4.
> 
> Share the implementation for esp6 and esp to avoid
> code duplication in addition it could be also used
> at various drivers code.
> 
> Change-Id: Iebb4325fe12ef655a5cd6cb896cf9eed68033979
> Signed-off-by: Raed Salem <raeds@mellanox.com>
> Reviewed-by: Boris Pismenny <borisp@mellanox.com>
> Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>

net-next is closed, please resubmit this when it opens back up

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

* [PATCH net-next] ESP: Export esp_output_fill_trailer function
@ 2020-02-11  8:20 Raed Salem
  2020-02-12  1:07 ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Raed Salem @ 2020-02-11  8:20 UTC (permalink / raw)
  To: steffen.klassert, herbert; +Cc: netdev, kuznet, davem, yoshfuji, Raed Salem

The esp fill trailer method is identical for both
IPv6 and IPv4.

Share the implementation for esp6 and esp to avoid
code duplication in addition it could be also used
at various drivers code.

Change-Id: Iebb4325fe12ef655a5cd6cb896cf9eed68033979
Signed-off-by: Raed Salem <raeds@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
---
 include/net/esp.h | 16 ++++++++++++++++
 net/ipv4/esp4.c   | 16 ----------------
 net/ipv6/esp6.c   | 16 ----------------
 3 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/include/net/esp.h b/include/net/esp.h
index 117652e..9c5637d 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -11,6 +11,22 @@ static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
 	return (struct ip_esp_hdr *)skb_transport_header(skb);
 }
 
+static inline void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
+{
+	/* Fill padding... */
+	if (tfclen) {
+		memset(tail, 0, tfclen);
+		tail += tfclen;
+	}
+	do {
+		int i;
+		for (i = 0; i < plen - 2; i++)
+			tail[i] = i + 1;
+	} while (0);
+	tail[plen - 2] = plen - 2;
+	tail[plen - 1] = proto;
+}
+
 struct esp_info {
 	struct	ip_esp_hdr *esph;
 	__be64	seqno;
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 5c96776..2c7f391 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -209,22 +209,6 @@ static void esp_output_done_esn(struct crypto_async_request *base, int err)
 	esp_output_done(base, err);
 }
 
-static void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
-{
-	/* Fill padding... */
-	if (tfclen) {
-		memset(tail, 0, tfclen);
-		tail += tfclen;
-	}
-	do {
-		int i;
-		for (i = 0; i < plen - 2; i++)
-			tail[i] = i + 1;
-	} while (0);
-	tail[plen - 2] = plen - 2;
-	tail[plen - 1] = proto;
-}
-
 static int esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp)
 {
 	int encap_type;
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index a3b403b..11143d0 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -207,22 +207,6 @@ static void esp_output_done_esn(struct crypto_async_request *base, int err)
 	esp_output_done(base, err);
 }
 
-static void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
-{
-	/* Fill padding... */
-	if (tfclen) {
-		memset(tail, 0, tfclen);
-		tail += tfclen;
-	}
-	do {
-		int i;
-		for (i = 0; i < plen - 2; i++)
-			tail[i] = i + 1;
-	} while (0);
-	tail[plen - 2] = plen - 2;
-	tail[plen - 1] = proto;
-}
-
 int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp)
 {
 	u8 *tail;
-- 
1.9.4


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

end of thread, other threads:[~2020-02-20 12:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-19 12:01 [PATCH net-next] ESP: Export esp_output_fill_trailer function Raed Salem
2020-02-19 12:15 ` Steffen Klassert
2020-02-19 12:19   ` Raed Salem
  -- strict thread matches above, loose matches on Subject: below --
2020-02-19 12:49 Raed Salem
2020-02-20 12:45 ` Steffen Klassert
2020-02-11  8:20 Raed Salem
2020-02-12  1:07 ` David Miller
2020-02-12  5:58   ` Raed Salem

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.