Re: tunnels: Don't apply GRO to multiple layers of encapsulation.

2017-09-05 Thread joe . korty
Hi Sasha,
The backport of

   fac8e0f579695a3ecbc4d3cac369139d7f819971
   tunnels: Don't apply GRO to multiple layers of encapsulation

into 4.1 missed a hunk.  The same backport into 3.18 was done
correctly.  This patch introduces the missing hunk into 4.1.
Excepts from some emails:

Joe Korty wrote:
> I am not experiencing any bad symptoms.  I simply noticed
> that the patch introduced a new function, sit_gro_receive,
> without introducing any users, and that same patch in
> linux-4.4.y does have a user.

Jesse gross wrote:
> Thanks for pointing that out. The line you mentioned
> should indeed be there and seems to have been missed in
> the backport.
> 
> The backport was actually done by Sasha, not by me -
> would you mind sending a patch to him or working with him
> to fix it?

Could you review this and run it through your tests and
send it along to Greg if appropriate?

Thanks,
Joe

Signed-off-by: Joe Korty <joe.ko...@concurrent-rt.com>

Index: b/net/ipv6/ip6_offload.c
===
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -300,7 +300,7 @@ static struct packet_offload ipv6_packet
.type = cpu_to_be16(ETH_P_IPV6),
.callbacks = {
.gso_segment = ipv6_gso_segment,
-   .gro_receive = ipv6_gro_receive,
+   .gro_receive = sit_gro_receive,
.gro_complete = ipv6_gro_complete,
},
 };


Re: tunnels: Don't apply GRO to multiple layers of encapsulation.

2017-09-05 Thread joe . korty
Hi Sasha,
The backport of

   fac8e0f579695a3ecbc4d3cac369139d7f819971
   tunnels: Don't apply GRO to multiple layers of encapsulation

into 4.1 missed a hunk.  The same backport into 3.18 was done
correctly.  This patch introduces the missing hunk into 4.1.
Excepts from some emails:

Joe Korty wrote:
> I am not experiencing any bad symptoms.  I simply noticed
> that the patch introduced a new function, sit_gro_receive,
> without introducing any users, and that same patch in
> linux-4.4.y does have a user.

Jesse gross wrote:
> Thanks for pointing that out. The line you mentioned
> should indeed be there and seems to have been missed in
> the backport.
> 
> The backport was actually done by Sasha, not by me -
> would you mind sending a patch to him or working with him
> to fix it?

Could you review this and run it through your tests and
send it along to Greg if appropriate?

Thanks,
Joe

Signed-off-by: Joe Korty 

Index: b/net/ipv6/ip6_offload.c
===
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -300,7 +300,7 @@ static struct packet_offload ipv6_packet
.type = cpu_to_be16(ETH_P_IPV6),
.callbacks = {
.gso_segment = ipv6_gso_segment,
-   .gro_receive = ipv6_gro_receive,
+   .gro_receive = sit_gro_receive,
.gro_complete = ipv6_gro_complete,
},
 };


Re: tunnels: Don't apply GRO to multiple layers of encapsulation.

2017-09-01 Thread Jesse Gross
On Thu, Aug 31, 2017 at 6:58 AM,  <joe.ko...@concurrent-rt.com> wrote:
> [ resend due to mail problems at my end ]
>
> Hi Jesse,
>
> The backport of fac8e0f579695a3ecbc4d3cac369139d7f819971,
> "tunnels: Don't apply GRO to multiple layers of encapsulation",
> to linux-4.1.y seems to have missed a line.
>
> The 4.1 commit is 066b300e5be43cb61697539e2a3a9aac5afb422f.
>
> The potentially missing line is:
>
> -   .gro_receive= ipv6_gro_receive,
> +   .gro_receive= sit_gro_receive,
>
>
> I am not experiencing any bad symptoms.  I simply noticed
> that the patch introduced a new function, sit_gro_receive,
> without introducing any users, and that same patch in
> linux-4.4.y does have a user.

Thanks for pointing that out. The line you mentioned should indeed be
there and seems to have been missed in the backport.

The backport was actually done by Sasha, not by me - would you mind
sending a patch to him or working with him to fix it?


Re: tunnels: Don't apply GRO to multiple layers of encapsulation.

2017-09-01 Thread Jesse Gross
On Thu, Aug 31, 2017 at 6:58 AM,   wrote:
> [ resend due to mail problems at my end ]
>
> Hi Jesse,
>
> The backport of fac8e0f579695a3ecbc4d3cac369139d7f819971,
> "tunnels: Don't apply GRO to multiple layers of encapsulation",
> to linux-4.1.y seems to have missed a line.
>
> The 4.1 commit is 066b300e5be43cb61697539e2a3a9aac5afb422f.
>
> The potentially missing line is:
>
> -   .gro_receive= ipv6_gro_receive,
> +   .gro_receive= sit_gro_receive,
>
>
> I am not experiencing any bad symptoms.  I simply noticed
> that the patch introduced a new function, sit_gro_receive,
> without introducing any users, and that same patch in
> linux-4.4.y does have a user.

Thanks for pointing that out. The line you mentioned should indeed be
there and seems to have been missed in the backport.

The backport was actually done by Sasha, not by me - would you mind
sending a patch to him or working with him to fix it?


Re: tunnels: Don't apply GRO to multiple layers of encapsulation.

2017-08-31 Thread joe . korty
[ resend due to mail problems at my end ]

Hi Jesse,

The backport of fac8e0f579695a3ecbc4d3cac369139d7f819971,
"tunnels: Don't apply GRO to multiple layers of encapsulation",
to linux-4.1.y seems to have missed a line.

The 4.1 commit is 066b300e5be43cb61697539e2a3a9aac5afb422f.

The potentially missing line is:

-   .gro_receive= ipv6_gro_receive,
+   .gro_receive= sit_gro_receive,


I am not experiencing any bad symptoms.  I simply noticed
that the patch introduced a new function, sit_gro_receive,
without introducing any users, and that same patch in  
linux-4.4.y does have a user.

Regards,
Joe



Re: tunnels: Don't apply GRO to multiple layers of encapsulation.

2017-08-31 Thread joe . korty
[ resend due to mail problems at my end ]

Hi Jesse,

The backport of fac8e0f579695a3ecbc4d3cac369139d7f819971,
"tunnels: Don't apply GRO to multiple layers of encapsulation",
to linux-4.1.y seems to have missed a line.

The 4.1 commit is 066b300e5be43cb61697539e2a3a9aac5afb422f.

The potentially missing line is:

-   .gro_receive= ipv6_gro_receive,
+   .gro_receive= sit_gro_receive,


I am not experiencing any bad symptoms.  I simply noticed
that the patch introduced a new function, sit_gro_receive,
without introducing any users, and that same patch in  
linux-4.4.y does have a user.

Regards,
Joe



[PATCH 3.16 129/217] tunnels: Don't apply GRO to multiple layers of encapsulation.

2016-04-26 Thread Ben Hutchings
3.16.35-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Jesse Gross 

commit fac8e0f579695a3ecbc4d3cac369139d7f819971 upstream.

When drivers express support for TSO of encapsulated packets, they
only mean that they can do it for one layer of encapsulation.
Supporting additional levels would mean updating, at a minimum,
more IP length fields and they are unaware of this.

No encapsulation device expresses support for handling offloaded
encapsulated packets, so we won't generate these types of frames
in the transmit path. However, GRO doesn't have a check for
multiple levels of encapsulation and will attempt to build them.

UDP tunnel GRO actually does prevent this situation but it only
handles multiple UDP tunnels stacked on top of each other. This
generalizes that solution to prevent any kind of tunnel stacking
that would cause problems.

Fixes: bf5a755f ("net-gre-gro: Add GRE support to the GRO stack")
Signed-off-by: Jesse Gross 
Signed-off-by: David S. Miller 
[bwh: Backported to 3.16:
 - Drop the ipip and sit cases
 - Adjust context]
Signed-off-by: Ben Hutchings 
---
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1759,8 +1759,8 @@ struct napi_gro_cb {
/* Used in ipv6_gro_receive() */
u16 proto;
 
-   /* Used in udp_gro_receive */
-   u16 udp_mark;
+   /* Used in tunnel GRO receive */
+   u16 encap_mark;
 
/* used to support CHECKSUM_COMPLETE for tunneling protocols */
__wsum  csum;
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3974,7 +3974,7 @@ static enum gro_result dev_gro_receive(s
NAPI_GRO_CB(skb)->same_flow = 0;
NAPI_GRO_CB(skb)->flush = 0;
NAPI_GRO_CB(skb)->free = 0;
-   NAPI_GRO_CB(skb)->udp_mark = 0;
+   NAPI_GRO_CB(skb)->encap_mark = 0;
 
pp = ptype->callbacks.gro_receive(>gro_list, skb);
break;
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -154,6 +154,11 @@ static struct sk_buff **gre_gro_receive(
struct packet_offload *ptype;
__be16 type;
 
+   if (NAPI_GRO_CB(skb)->encap_mark)
+   goto out;
+
+   NAPI_GRO_CB(skb)->encap_mark = 1;
+
off = skb_gro_offset(skb);
hlen = off + sizeof(*greh);
greh = skb_gro_header_fast(skb, off);
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -160,12 +160,12 @@ static struct sk_buff **udp_gro_receive(
unsigned int hlen, off;
int flush = 1;
 
-   if (NAPI_GRO_CB(skb)->udp_mark ||
+   if (NAPI_GRO_CB(skb)->encap_mark ||
(!skb->encapsulation && skb->ip_summed != CHECKSUM_COMPLETE))
goto out;
 
-   /* mark that this skb passed once through the udp gro layer */
-   NAPI_GRO_CB(skb)->udp_mark = 1;
+   /* mark that this skb passed once through the tunnel gro layer */
+   NAPI_GRO_CB(skb)->encap_mark = 1;
 
off  = skb_gro_offset(skb);
hlen = off + sizeof(*uh);



[PATCH 3.16 129/217] tunnels: Don't apply GRO to multiple layers of encapsulation.

2016-04-26 Thread Ben Hutchings
3.16.35-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Jesse Gross 

commit fac8e0f579695a3ecbc4d3cac369139d7f819971 upstream.

When drivers express support for TSO of encapsulated packets, they
only mean that they can do it for one layer of encapsulation.
Supporting additional levels would mean updating, at a minimum,
more IP length fields and they are unaware of this.

No encapsulation device expresses support for handling offloaded
encapsulated packets, so we won't generate these types of frames
in the transmit path. However, GRO doesn't have a check for
multiple levels of encapsulation and will attempt to build them.

UDP tunnel GRO actually does prevent this situation but it only
handles multiple UDP tunnels stacked on top of each other. This
generalizes that solution to prevent any kind of tunnel stacking
that would cause problems.

Fixes: bf5a755f ("net-gre-gro: Add GRE support to the GRO stack")
Signed-off-by: Jesse Gross 
Signed-off-by: David S. Miller 
[bwh: Backported to 3.16:
 - Drop the ipip and sit cases
 - Adjust context]
Signed-off-by: Ben Hutchings 
---
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1759,8 +1759,8 @@ struct napi_gro_cb {
/* Used in ipv6_gro_receive() */
u16 proto;
 
-   /* Used in udp_gro_receive */
-   u16 udp_mark;
+   /* Used in tunnel GRO receive */
+   u16 encap_mark;
 
/* used to support CHECKSUM_COMPLETE for tunneling protocols */
__wsum  csum;
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3974,7 +3974,7 @@ static enum gro_result dev_gro_receive(s
NAPI_GRO_CB(skb)->same_flow = 0;
NAPI_GRO_CB(skb)->flush = 0;
NAPI_GRO_CB(skb)->free = 0;
-   NAPI_GRO_CB(skb)->udp_mark = 0;
+   NAPI_GRO_CB(skb)->encap_mark = 0;
 
pp = ptype->callbacks.gro_receive(>gro_list, skb);
break;
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -154,6 +154,11 @@ static struct sk_buff **gre_gro_receive(
struct packet_offload *ptype;
__be16 type;
 
+   if (NAPI_GRO_CB(skb)->encap_mark)
+   goto out;
+
+   NAPI_GRO_CB(skb)->encap_mark = 1;
+
off = skb_gro_offset(skb);
hlen = off + sizeof(*greh);
greh = skb_gro_header_fast(skb, off);
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -160,12 +160,12 @@ static struct sk_buff **udp_gro_receive(
unsigned int hlen, off;
int flush = 1;
 
-   if (NAPI_GRO_CB(skb)->udp_mark ||
+   if (NAPI_GRO_CB(skb)->encap_mark ||
(!skb->encapsulation && skb->ip_summed != CHECKSUM_COMPLETE))
goto out;
 
-   /* mark that this skb passed once through the udp gro layer */
-   NAPI_GRO_CB(skb)->udp_mark = 1;
+   /* mark that this skb passed once through the tunnel gro layer */
+   NAPI_GRO_CB(skb)->encap_mark = 1;
 
off  = skb_gro_offset(skb);
hlen = off + sizeof(*uh);