netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] gre: Fix regression in gretap TSO support
@ 2014-10-30  3:26 alexander.duyck
  2014-10-30  5:14 ` Pravin Shelar
  0 siblings, 1 reply; 8+ messages in thread
From: alexander.duyck @ 2014-10-30  3:26 UTC (permalink / raw)
  To: netdev, davem
  Cc: H.K. Jerry Chu, Eric Dumazet, Alexander Duyck, Neal Cardwell,
	Pravin B Shelar

From: Alexander Duyck <alexander.h.duyck@redhat.com>

On recent kernels I found that TSO on gretap interfaces didn't work.  After
bisecting it I found that commit b884b1a4 had introduced a regression in
which the Ethernet header was being included in the GRE header length.

This change corrects that by basing the GRE header length on the inner mac
header in the case of GRE tunnels using transparent Ethernet bridging, and
uses the network header for all other GRE tunnel types.

Fixes: b884b1a4 ("gre_offload: simplify GRE header length calculation in gre_gso_segment()")
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: H.K. Jerry Chu <hkchu@google.com>
Cc: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
---
 net/ipv4/gre_offload.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
index f6e345c..67a1f66 100644
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -47,7 +47,10 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
 
 	greh = (struct gre_base_hdr *)skb_transport_header(skb);
 
-	ghl = skb_inner_network_header(skb) - skb_transport_header(skb);
+	if (greh->protocol == htons(ETH_P_TEB))
+		ghl = skb_inner_mac_header(skb) - skb_transport_header(skb);
+	else
+		ghl = skb_inner_network_header(skb) - skb_transport_header(skb);
 	if (unlikely(ghl < sizeof(*greh)))
 		goto out;
 

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

* Re: [PATCH net] gre: Fix regression in gretap TSO support
  2014-10-30  3:26 [PATCH net] gre: Fix regression in gretap TSO support alexander.duyck
@ 2014-10-30  5:14 ` Pravin Shelar
  2014-10-30 13:51   ` Neal Cardwell
  0 siblings, 1 reply; 8+ messages in thread
From: Pravin Shelar @ 2014-10-30  5:14 UTC (permalink / raw)
  To: alexander.duyck
  Cc: netdev, David Miller, H.K. Jerry Chu, Eric Dumazet,
	Alexander Duyck, Neal Cardwell

On Wed, Oct 29, 2014 at 8:26 PM,  <alexander.duyck@gmail.com> wrote:
> From: Alexander Duyck <alexander.h.duyck@redhat.com>
>
> On recent kernels I found that TSO on gretap interfaces didn't work.  After
> bisecting it I found that commit b884b1a4 had introduced a regression in
> which the Ethernet header was being included in the GRE header length.
>
> This change corrects that by basing the GRE header length on the inner mac
> header in the case of GRE tunnels using transparent Ethernet bridging, and
> uses the network header for all other GRE tunnel types.
>
> Fixes: b884b1a4 ("gre_offload: simplify GRE header length calculation in gre_gso_segment()")
> Cc: Neal Cardwell <ncardwell@google.com>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: H.K. Jerry Chu <hkchu@google.com>
> Cc: Pravin B Shelar <pshelar@nicira.com>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>

Patch also fixed problem with ovs-gre.

Acked-by: Pravin B Shelar <pshelar@nicira.com>

Thanks.

> ---
>  net/ipv4/gre_offload.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
> index f6e345c..67a1f66 100644
> --- a/net/ipv4/gre_offload.c
> +++ b/net/ipv4/gre_offload.c
> @@ -47,7 +47,10 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
>
>         greh = (struct gre_base_hdr *)skb_transport_header(skb);
>
> -       ghl = skb_inner_network_header(skb) - skb_transport_header(skb);
> +       if (greh->protocol == htons(ETH_P_TEB))
> +               ghl = skb_inner_mac_header(skb) - skb_transport_header(skb);
> +       else
> +               ghl = skb_inner_network_header(skb) - skb_transport_header(skb);
>         if (unlikely(ghl < sizeof(*greh)))
>                 goto out;
>
>

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

* Re: [PATCH net] gre: Fix regression in gretap TSO support
  2014-10-30  5:14 ` Pravin Shelar
@ 2014-10-30 13:51   ` Neal Cardwell
  2014-10-30 14:30     ` Alexander Duyck
  0 siblings, 1 reply; 8+ messages in thread
From: Neal Cardwell @ 2014-10-30 13:51 UTC (permalink / raw)
  To: Pravin Shelar
  Cc: alexander.duyck, netdev, David Miller, H.K. Jerry Chu,
	Eric Dumazet, Alexander Duyck

On Thu, Oct 30, 2014 at 1:14 AM, Pravin Shelar <pshelar@nicira.com> wrote:
> On Wed, Oct 29, 2014 at 8:26 PM,  <alexander.duyck@gmail.com> wrote:
>> From: Alexander Duyck <alexander.h.duyck@redhat.com>
>>
>> On recent kernels I found that TSO on gretap interfaces didn't work.  After
>> bisecting it I found that commit b884b1a4 had introduced a regression in
>> which the Ethernet header was being included in the GRE header length.
>>
>> This change corrects that by basing the GRE header length on the inner mac
>> header in the case of GRE tunnels using transparent Ethernet bridging, and
>> uses the network header for all other GRE tunnel types.
>>
>> Fixes: b884b1a4 ("gre_offload: simplify GRE header length calculation in gre_gso_segment()")

Hmm. There may be other protocols, either now or in the future, where
we want to be able to have a mac header inside the GRE header, rather
than a network header. AFAICT it would be safer to revert b884b1a4,
and go back to the previous code (from c50cd357), where we parse the
GRE header to figure out its length.

neal

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

* Re: [PATCH net] gre: Fix regression in gretap TSO support
  2014-10-30 13:51   ` Neal Cardwell
@ 2014-10-30 14:30     ` Alexander Duyck
  2014-10-30 15:00       ` Eric Dumazet
  2014-10-30 15:05       ` Tom Herbert
  0 siblings, 2 replies; 8+ messages in thread
From: Alexander Duyck @ 2014-10-30 14:30 UTC (permalink / raw)
  To: Neal Cardwell, Pravin Shelar
  Cc: alexander.duyck, netdev, David Miller, H.K. Jerry Chu, Eric Dumazet


On 10/30/2014 06:51 AM, Neal Cardwell wrote:
> On Thu, Oct 30, 2014 at 1:14 AM, Pravin Shelar <pshelar@nicira.com> wrote:
>> On Wed, Oct 29, 2014 at 8:26 PM,  <alexander.duyck@gmail.com> wrote:
>>> From: Alexander Duyck <alexander.h.duyck@redhat.com>
>>>
>>> On recent kernels I found that TSO on gretap interfaces didn't work.  After
>>> bisecting it I found that commit b884b1a4 had introduced a regression in
>>> which the Ethernet header was being included in the GRE header length.
>>>
>>> This change corrects that by basing the GRE header length on the inner mac
>>> header in the case of GRE tunnels using transparent Ethernet bridging, and
>>> uses the network header for all other GRE tunnel types.
>>>
>>> Fixes: b884b1a4 ("gre_offload: simplify GRE header length calculation in gre_gso_segment()")
> Hmm. There may be other protocols, either now or in the future, where
> we want to be able to have a mac header inside the GRE header, rather
> than a network header. AFAICT it would be safer to revert b884b1a4,
> and go back to the previous code (from c50cd357), where we parse the
> GRE header to figure out its length.
>
> neal

The change is consistent with how we handle this in other spots 
throughout the kernel.  If nothing else you can just search for 
ETH_P_TEB and you will find multiple spots in the kernel where IP 
tunnels differentiate between transparent Ethernet bridging and regular 
IP in IP tunnels by checking for the protocol ETH_P_TEB.

Thanks,

Alex

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

* Re: [PATCH net] gre: Fix regression in gretap TSO support
  2014-10-30 14:30     ` Alexander Duyck
@ 2014-10-30 15:00       ` Eric Dumazet
  2014-10-30 15:05       ` Tom Herbert
  1 sibling, 0 replies; 8+ messages in thread
From: Eric Dumazet @ 2014-10-30 15:00 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Neal Cardwell, Pravin Shelar, alexander.duyck, netdev,
	David Miller, H.K. Jerry Chu, Eric Dumazet

On Thu, 2014-10-30 at 07:30 -0700, Alexander Duyck wrote:

> The change is consistent with how we handle this in other spots 
> throughout the kernel.  If nothing else you can just search for 
> ETH_P_TEB and you will find multiple spots in the kernel where IP 
> tunnels differentiate between transparent Ethernet bridging and regular 
> IP in IP tunnels by checking for the protocol ETH_P_TEB.

Agreed, I think that GUE might supersedes GRE usage anyway ;)

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

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

* Re: [PATCH net] gre: Fix regression in gretap TSO support
  2014-10-30 14:30     ` Alexander Duyck
  2014-10-30 15:00       ` Eric Dumazet
@ 2014-10-30 15:05       ` Tom Herbert
  2014-10-30 15:32         ` Tom Herbert
  2014-10-30 15:32         ` Alexander Duyck
  1 sibling, 2 replies; 8+ messages in thread
From: Tom Herbert @ 2014-10-30 15:05 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Neal Cardwell, Pravin Shelar, Alexander Duyck, netdev,
	David Miller, H.K. Jerry Chu, Eric Dumazet

On Thu, Oct 30, 2014 at 7:30 AM, Alexander Duyck
<alexander.h.duyck@redhat.com> wrote:
>
> On 10/30/2014 06:51 AM, Neal Cardwell wrote:
>>
>> On Thu, Oct 30, 2014 at 1:14 AM, Pravin Shelar <pshelar@nicira.com> wrote:
>>>
>>> On Wed, Oct 29, 2014 at 8:26 PM,  <alexander.duyck@gmail.com> wrote:
>>>>
>>>> From: Alexander Duyck <alexander.h.duyck@redhat.com>
>>>>
>>>> On recent kernels I found that TSO on gretap interfaces didn't work.
>>>> After
>>>> bisecting it I found that commit b884b1a4 had introduced a regression in
>>>> which the Ethernet header was being included in the GRE header length.
>>>>
>>>> This change corrects that by basing the GRE header length on the inner
>>>> mac
>>>> header in the case of GRE tunnels using transparent Ethernet bridging,
>>>> and
>>>> uses the network header for all other GRE tunnel types.
>>>>
>>>> Fixes: b884b1a4 ("gre_offload: simplify GRE header length calculation in
>>>> gre_gso_segment()")
>>
>> Hmm. There may be other protocols, either now or in the future, where
>> we want to be able to have a mac header inside the GRE header, rather
>> than a network header. AFAICT it would be safer to revert b884b1a4,
>> and go back to the previous code (from c50cd357), where we parse the
>> GRE header to figure out its length.
>>
>> neal
>
>
> The change is consistent with how we handle this in other spots throughout
> the kernel.  If nothing else you can just search for ETH_P_TEB and you will
> find multiple spots in the kernel where IP tunnels differentiate between
> transparent Ethernet bridging and regular IP in IP tunnels by checking for
> the protocol ETH_P_TEB.
>
I'm not sure I understand this. We always use inner mac header in
__skb_udp_tunnel_segment for computing tunnel length and don't
distinguish between Ethernet or IP encapsulation. Presumably, in the
case of IP encapsulation inner mac header is equal to inner network
header. Why is this different for GRE?

Thanks,
Tom

> Thanks,
>
> Alex
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH net] gre: Fix regression in gretap TSO support
  2014-10-30 15:05       ` Tom Herbert
@ 2014-10-30 15:32         ` Tom Herbert
  2014-10-30 15:32         ` Alexander Duyck
  1 sibling, 0 replies; 8+ messages in thread
From: Tom Herbert @ 2014-10-30 15:32 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Neal Cardwell, Pravin Shelar, Alexander Duyck, netdev,
	David Miller, H.K. Jerry Chu, Eric Dumazet

> I'm not sure I understand this. We always use inner mac header in
> __skb_udp_tunnel_segment for computing tunnel length and don't
> distinguish between Ethernet or IP encapsulation. Presumably, in the
> case of IP encapsulation inner mac header is equal to inner network
> header. Why is this different for GRE?
>

Using skb_inner_mac_header seems to work okay for IP encapsulation.
I'll post the path momentarily.

Tom


> Thanks,
> Tom
>
>> Thanks,
>>
>> Alex
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH net] gre: Fix regression in gretap TSO support
  2014-10-30 15:05       ` Tom Herbert
  2014-10-30 15:32         ` Tom Herbert
@ 2014-10-30 15:32         ` Alexander Duyck
  1 sibling, 0 replies; 8+ messages in thread
From: Alexander Duyck @ 2014-10-30 15:32 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Neal Cardwell, Pravin Shelar, Alexander Duyck, netdev,
	David Miller, H.K. Jerry Chu, Eric Dumazet


On 10/30/2014 08:05 AM, Tom Herbert wrote:
> On Thu, Oct 30, 2014 at 7:30 AM, Alexander Duyck
> <alexander.h.duyck@redhat.com> wrote:
>> On 10/30/2014 06:51 AM, Neal Cardwell wrote:
>>> On Thu, Oct 30, 2014 at 1:14 AM, Pravin Shelar <pshelar@nicira.com> wrote:
>>>> On Wed, Oct 29, 2014 at 8:26 PM,  <alexander.duyck@gmail.com> wrote:
>>>>> From: Alexander Duyck <alexander.h.duyck@redhat.com>
>>>>>
>>>>> On recent kernels I found that TSO on gretap interfaces didn't work.
>>>>> After
>>>>> bisecting it I found that commit b884b1a4 had introduced a regression in
>>>>> which the Ethernet header was being included in the GRE header length.
>>>>>
>>>>> This change corrects that by basing the GRE header length on the inner
>>>>> mac
>>>>> header in the case of GRE tunnels using transparent Ethernet bridging,
>>>>> and
>>>>> uses the network header for all other GRE tunnel types.
>>>>>
>>>>> Fixes: b884b1a4 ("gre_offload: simplify GRE header length calculation in
>>>>> gre_gso_segment()")
>>> Hmm. There may be other protocols, either now or in the future, where
>>> we want to be able to have a mac header inside the GRE header, rather
>>> than a network header. AFAICT it would be safer to revert b884b1a4,
>>> and go back to the previous code (from c50cd357), where we parse the
>>> GRE header to figure out its length.
>>>
>>> neal
>>
>> The change is consistent with how we handle this in other spots throughout
>> the kernel.  If nothing else you can just search for ETH_P_TEB and you will
>> find multiple spots in the kernel where IP tunnels differentiate between
>> transparent Ethernet bridging and regular IP in IP tunnels by checking for
>> the protocol ETH_P_TEB.
>>
> I'm not sure I understand this. We always use inner mac header in
> __skb_udp_tunnel_segment for computing tunnel length and don't
> distinguish between Ethernet or IP encapsulation. Presumably, in the
> case of IP encapsulation inner mac header is equal to inner network
> header. Why is this different for GRE?
>
> Thanks,
> Tom

I'll dig into that a bit more and see if I can simplify this.  I just 
wasn't sure if the inner mac header was being initialized or not in the 
case of IP in IP tunnels.

Thanks,

Alex

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

end of thread, other threads:[~2014-10-30 15:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-30  3:26 [PATCH net] gre: Fix regression in gretap TSO support alexander.duyck
2014-10-30  5:14 ` Pravin Shelar
2014-10-30 13:51   ` Neal Cardwell
2014-10-30 14:30     ` Alexander Duyck
2014-10-30 15:00       ` Eric Dumazet
2014-10-30 15:05       ` Tom Herbert
2014-10-30 15:32         ` Tom Herbert
2014-10-30 15:32         ` Alexander Duyck

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).