netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/5] net: Changes to GRO for encapsulation
@ 2014-09-08  5:26 Tom Herbert
  2014-09-08  5:26 ` [PATCH net-next 1/5] net: Fix GRE RX to use skb_transport_header for GRE header offset Tom Herbert
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Tom Herbert @ 2014-09-08  5:26 UTC (permalink / raw)
  To: davem, netdev

This patch set has some fixes for encapsulation and GRO.

Tom Herbert (5):
  net: Fix GRE RX to use skb_transport_header for GRE header offset
  ipip: Add gro callbacks to ipip offload
  sit: Add gro callbacks to sit offload
  udp: Add try convert checksum is case of skb_steal_sock
  net: Export inet_offloads and inet6_offloads

 net/ipv4/af_inet.c     | 2 ++
 net/ipv4/gre_demux.c   | 5 ++---
 net/ipv4/protocol.c    | 1 +
 net/ipv4/udp.c         | 4 ++++
 net/ipv6/ip6_offload.c | 2 ++
 net/ipv6/protocol.c    | 1 +
 6 files changed, 12 insertions(+), 3 deletions(-)

-- 
2.1.0.rc2.206.gedb03e5

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

* [PATCH net-next 1/5] net: Fix GRE RX to use skb_transport_header for GRE header offset
  2014-09-08  5:26 [PATCH net-next 0/5] net: Changes to GRO for encapsulation Tom Herbert
@ 2014-09-08  5:26 ` Tom Herbert
  2014-09-08 10:37   ` Eric Dumazet
  2014-09-08  5:26 ` [PATCH net-next 2/5] ipip: Add gro callbacks to ipip offload Tom Herbert
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Tom Herbert @ 2014-09-08  5:26 UTC (permalink / raw)
  To: davem, netdev

GRE assumes that the GRE header is at skb_network_header +
ip_hrdlen(skb). It is more general to use skb_transport_header
and this allows the possbility of inserting additional header
between IP and GRE (which is what we will done in Generic UDP
Encapsulation for GRE).

Signed-off-by: Tom Herbert <therbert@google.com>
---
 net/ipv4/gre_demux.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index 7e0756d..4a7b5b2 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -98,7 +98,6 @@ EXPORT_SYMBOL_GPL(gre_build_header);
 static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
 			    bool *csum_err)
 {
-	unsigned int ip_hlen = ip_hdrlen(skb);
 	const struct gre_base_hdr *greh;
 	__be32 *options;
 	int hdr_len;
@@ -106,7 +105,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
 	if (unlikely(!pskb_may_pull(skb, sizeof(struct gre_base_hdr))))
 		return -EINVAL;
 
-	greh = (struct gre_base_hdr *)(skb_network_header(skb) + ip_hlen);
+	greh = (struct gre_base_hdr *)skb_transport_header(skb);
 	if (unlikely(greh->flags & (GRE_VERSION | GRE_ROUTING)))
 		return -EINVAL;
 
@@ -116,7 +115,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
 	if (!pskb_may_pull(skb, hdr_len))
 		return -EINVAL;
 
-	greh = (struct gre_base_hdr *)(skb_network_header(skb) + ip_hlen);
+	greh = (struct gre_base_hdr *)skb_transport_header(skb);
 	tpi->proto = greh->protocol;
 
 	options = (__be32 *)(greh + 1);
-- 
2.1.0.rc2.206.gedb03e5

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

* [PATCH net-next 2/5] ipip: Add gro callbacks to ipip offload
  2014-09-08  5:26 [PATCH net-next 0/5] net: Changes to GRO for encapsulation Tom Herbert
  2014-09-08  5:26 ` [PATCH net-next 1/5] net: Fix GRE RX to use skb_transport_header for GRE header offset Tom Herbert
@ 2014-09-08  5:26 ` Tom Herbert
  2014-09-08  5:26 ` [PATCH net-next 3/5] sit: Add gro callbacks to sit offload Tom Herbert
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Tom Herbert @ 2014-09-08  5:26 UTC (permalink / raw)
  To: davem, netdev

Add inet_gro_receive and inet_gro_complete to ipip_offload to
support GRO.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 net/ipv4/af_inet.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index d156b3c..6d6348d 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1670,6 +1670,8 @@ static const struct net_offload ipip_offload = {
 	.callbacks = {
 		.gso_send_check = inet_gso_send_check,
 		.gso_segment	= inet_gso_segment,
+		.gro_receive	= inet_gro_receive,
+		.gro_complete	= inet_gro_complete,
 	},
 };
 
-- 
2.1.0.rc2.206.gedb03e5

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

* [PATCH net-next 3/5] sit: Add gro callbacks to sit offload
  2014-09-08  5:26 [PATCH net-next 0/5] net: Changes to GRO for encapsulation Tom Herbert
  2014-09-08  5:26 ` [PATCH net-next 1/5] net: Fix GRE RX to use skb_transport_header for GRE header offset Tom Herbert
  2014-09-08  5:26 ` [PATCH net-next 2/5] ipip: Add gro callbacks to ipip offload Tom Herbert
@ 2014-09-08  5:26 ` Tom Herbert
  2014-09-08 11:55   ` Eric Dumazet
  2014-09-08  5:26 ` [PATCH net-next 4/5] udp: Add try convert checksum is case of skb_steal_sock Tom Herbert
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Tom Herbert @ 2014-09-08  5:26 UTC (permalink / raw)
  To: davem, netdev

Add ip6_gro_receive and inet_gro_complete to ip6_offload to
support GRO.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 net/ipv6/ip6_offload.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index 5bcda33..12a686f 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -314,6 +314,8 @@ static const struct net_offload sit_offload = {
 	.callbacks = {
 		.gso_send_check = ipv6_gso_send_check,
 		.gso_segment	= ipv6_gso_segment,
+		.gro_receive	= ipv6_gro_receive,
+		.gro_complete	= ipv6_gro_complete,
 	},
 };
 
-- 
2.1.0.rc2.206.gedb03e5

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

* [PATCH net-next 4/5] udp: Add try convert checksum is case of skb_steal_sock
  2014-09-08  5:26 [PATCH net-next 0/5] net: Changes to GRO for encapsulation Tom Herbert
                   ` (2 preceding siblings ...)
  2014-09-08  5:26 ` [PATCH net-next 3/5] sit: Add gro callbacks to sit offload Tom Herbert
@ 2014-09-08  5:26 ` Tom Herbert
  2014-09-08  5:26 ` [PATCH net-next 5/5] net: Export inet_offloads and inet6_offloads Tom Herbert
  2014-09-09 19:18 ` [PATCH net-next 0/5] net: Changes to GRO for encapsulation David Miller
  5 siblings, 0 replies; 10+ messages in thread
From: Tom Herbert @ 2014-09-08  5:26 UTC (permalink / raw)
  To: davem, netdev

If an skb already has an associated socket that we can steal
in UDP receive then attempt checksum conversion before calling
udp_queue_rcv_skb.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 net/ipv4/udp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index cd0db54..50d3b5c 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1769,6 +1769,10 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
 		if (unlikely(sk->sk_rx_dst != dst))
 			udp_sk_rx_dst_set(sk, dst);
 
+		if (udp_sk(sk)->convert_csum && uh->check && !IS_UDPLITE(sk))
+			skb_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
+						 inet_compute_pseudo);
+
 		ret = udp_queue_rcv_skb(sk, skb);
 		sock_put(sk);
 		/* a return value > 0 means to resubmit the input, but
-- 
2.1.0.rc2.206.gedb03e5

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

* [PATCH net-next 5/5] net: Export inet_offloads and inet6_offloads
  2014-09-08  5:26 [PATCH net-next 0/5] net: Changes to GRO for encapsulation Tom Herbert
                   ` (3 preceding siblings ...)
  2014-09-08  5:26 ` [PATCH net-next 4/5] udp: Add try convert checksum is case of skb_steal_sock Tom Herbert
@ 2014-09-08  5:26 ` Tom Herbert
  2014-09-08 10:42   ` Eric Dumazet
  2014-09-09 19:18 ` [PATCH net-next 0/5] net: Changes to GRO for encapsulation David Miller
  5 siblings, 1 reply; 10+ messages in thread
From: Tom Herbert @ 2014-09-08  5:26 UTC (permalink / raw)
  To: davem, netdev

Want to be able to call this in foo-over-udp offloads, etc.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 net/ipv4/protocol.c | 1 +
 net/ipv6/protocol.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/net/ipv4/protocol.c b/net/ipv4/protocol.c
index 46d6a1c..4b7c0ec 100644
--- a/net/ipv4/protocol.c
+++ b/net/ipv4/protocol.c
@@ -30,6 +30,7 @@
 
 const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS] __read_mostly;
 const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly;
+EXPORT_SYMBOL(inet_offloads);
 
 int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol)
 {
diff --git a/net/ipv6/protocol.c b/net/ipv6/protocol.c
index e048cf1..e3770ab 100644
--- a/net/ipv6/protocol.c
+++ b/net/ipv6/protocol.c
@@ -51,6 +51,7 @@ EXPORT_SYMBOL(inet6_del_protocol);
 #endif
 
 const struct net_offload __rcu *inet6_offloads[MAX_INET_PROTOS] __read_mostly;
+EXPORT_SYMBOL(inet6_offloads);
 
 int inet6_add_offload(const struct net_offload *prot, unsigned char protocol)
 {
-- 
2.1.0.rc2.206.gedb03e5

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

* Re: [PATCH net-next 1/5] net: Fix GRE RX to use skb_transport_header for GRE header offset
  2014-09-08  5:26 ` [PATCH net-next 1/5] net: Fix GRE RX to use skb_transport_header for GRE header offset Tom Herbert
@ 2014-09-08 10:37   ` Eric Dumazet
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Dumazet @ 2014-09-08 10:37 UTC (permalink / raw)
  To: Tom Herbert; +Cc: davem, netdev

On Sun, 2014-09-07 at 22:26 -0700, Tom Herbert wrote:
> GRE assumes that the GRE header is at skb_network_header +
> ip_hrdlen(skb). It is more general to use skb_transport_header
> and this allows the possbility of inserting additional header
> between IP and GRE (which is what we will done in Generic UDP
> Encapsulation for GRE).
> 
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
>  net/ipv4/gre_demux.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Acked-by: Eric Dumazet <edumazet@google.com>

Note this has nothing to do with GRO ;)

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

* Re: [PATCH net-next 5/5] net: Export inet_offloads and inet6_offloads
  2014-09-08  5:26 ` [PATCH net-next 5/5] net: Export inet_offloads and inet6_offloads Tom Herbert
@ 2014-09-08 10:42   ` Eric Dumazet
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Dumazet @ 2014-09-08 10:42 UTC (permalink / raw)
  To: Tom Herbert; +Cc: davem, netdev

On Sun, 2014-09-07 at 22:26 -0700, Tom Herbert wrote:
> Want to be able to call this in foo-over-udp offloads, etc.
> 
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
>  net/ipv4/protocol.c | 1 +
>  net/ipv6/protocol.c | 1 +
>  2 files changed, 2 insertions(+)

This should not be last patch of this serie, but added in a later serie
when really needed.

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

* Re: [PATCH net-next 3/5] sit: Add gro callbacks to sit offload
  2014-09-08  5:26 ` [PATCH net-next 3/5] sit: Add gro callbacks to sit offload Tom Herbert
@ 2014-09-08 11:55   ` Eric Dumazet
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Dumazet @ 2014-09-08 11:55 UTC (permalink / raw)
  To: Tom Herbert; +Cc: davem, netdev

On Sun, 2014-09-07 at 22:26 -0700, Tom Herbert wrote:
> Add ip6_gro_receive and inet_gro_complete to ip6_offload to
> support GRO.
> 
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
>  net/ipv6/ip6_offload.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
> index 5bcda33..12a686f 100644
> --- a/net/ipv6/ip6_offload.c
> +++ b/net/ipv6/ip6_offload.c
> @@ -314,6 +314,8 @@ static const struct net_offload sit_offload = {
>  	.callbacks = {
>  		.gso_send_check = ipv6_gso_send_check,
>  		.gso_segment	= ipv6_gso_segment,
> +		.gro_receive	= ipv6_gro_receive,
> +		.gro_complete	= ipv6_gro_complete,
>  	},
>  };
>  

changelog has typos : It should be :

Add ip6_gro_receive and ip6_gro_complete to sit_offload to
support GRO.

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

* Re: [PATCH net-next 0/5] net: Changes to GRO for encapsulation
  2014-09-08  5:26 [PATCH net-next 0/5] net: Changes to GRO for encapsulation Tom Herbert
                   ` (4 preceding siblings ...)
  2014-09-08  5:26 ` [PATCH net-next 5/5] net: Export inet_offloads and inet6_offloads Tom Herbert
@ 2014-09-09 19:18 ` David Miller
  5 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2014-09-09 19:18 UTC (permalink / raw)
  To: therbert; +Cc: netdev

From: Tom Herbert <therbert@google.com>
Date: Sun,  7 Sep 2014 22:26:24 -0700

> This patch set has some fixes for encapsulation and GRO.
> 
> Tom Herbert (5):
>   net: Fix GRE RX to use skb_transport_header for GRE header offset
>   ipip: Add gro callbacks to ipip offload
>   sit: Add gro callbacks to sit offload
>   udp: Add try convert checksum is case of skb_steal_sock
>   net: Export inet_offloads and inet6_offloads

Please address Eric's feedback and respin this series, thanks!

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

end of thread, other threads:[~2014-09-09 19:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-08  5:26 [PATCH net-next 0/5] net: Changes to GRO for encapsulation Tom Herbert
2014-09-08  5:26 ` [PATCH net-next 1/5] net: Fix GRE RX to use skb_transport_header for GRE header offset Tom Herbert
2014-09-08 10:37   ` Eric Dumazet
2014-09-08  5:26 ` [PATCH net-next 2/5] ipip: Add gro callbacks to ipip offload Tom Herbert
2014-09-08  5:26 ` [PATCH net-next 3/5] sit: Add gro callbacks to sit offload Tom Herbert
2014-09-08 11:55   ` Eric Dumazet
2014-09-08  5:26 ` [PATCH net-next 4/5] udp: Add try convert checksum is case of skb_steal_sock Tom Herbert
2014-09-08  5:26 ` [PATCH net-next 5/5] net: Export inet_offloads and inet6_offloads Tom Herbert
2014-09-08 10:42   ` Eric Dumazet
2014-09-09 19:18 ` [PATCH net-next 0/5] net: Changes to GRO for encapsulation David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).