* [net PATCH] net: Copy inner L3 and L4 headers as unaligned on GRE TEB
@ 2016-02-09 14:14 Alexander Duyck
2016-02-09 14:33 ` Tom Herbert
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Alexander Duyck @ 2016-02-09 14:14 UTC (permalink / raw)
To: netdev, alexander.duyck; +Cc: tom, davem
This patch corrects the unaligned accesses seen on GRE TEB tunnels when
generating hash keys. Specifically what this patch does is make it so that
we force the use of skb_copy_bits when the GRE inner headers will be
unaligned due to NET_IP_ALIGNED being a non-zero value.
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
---
I don't have the ability to test it but this should fix flow dissector for
GRE TEB tunnels traffic seen on architectures that require network and
transport headers to be 4 byte aligned.
net/core/flow_dissector.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 699b2c415cb0..9c181ba7263e 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -402,6 +402,13 @@ ip_proto_again:
goto out_bad;
proto = eth->h_proto;
nhoff += sizeof(*eth);
+
+ /* Cap headers that we access via pointers at the
+ * end of the Ethernet header as our maximum alignment
+ * at that point is only 2 bytes.
+ */
+ if (NET_IP_ALIGN)
+ hlen = nhoff;
}
key_control->flags |= FLOW_DIS_ENCAPSULATION;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [net PATCH] net: Copy inner L3 and L4 headers as unaligned on GRE TEB
2016-02-09 14:14 [net PATCH] net: Copy inner L3 and L4 headers as unaligned on GRE TEB Alexander Duyck
@ 2016-02-09 14:33 ` Tom Herbert
2016-02-09 15:36 ` Alexander Duyck
2016-02-09 15:39 ` Tom Herbert
2016-02-16 20:25 ` David Miller
2 siblings, 1 reply; 5+ messages in thread
From: Tom Herbert @ 2016-02-09 14:33 UTC (permalink / raw)
To: Alexander Duyck
Cc: Linux Kernel Network Developers, Alexander Duyck, David S. Miller
On Tue, Feb 9, 2016 at 3:14 PM, Alexander Duyck <aduyck@mirantis.com> wrote:
> This patch corrects the unaligned accesses seen on GRE TEB tunnels when
> generating hash keys. Specifically what this patch does is make it so that
> we force the use of skb_copy_bits when the GRE inner headers will be
> unaligned due to NET_IP_ALIGNED being a non-zero value.
>
> Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
> ---
>
> I don't have the ability to test it but this should fix flow dissector for
> GRE TEB tunnels traffic seen on architectures that require network and
> transport headers to be 4 byte aligned.
>
> net/core/flow_dissector.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index 699b2c415cb0..9c181ba7263e 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -402,6 +402,13 @@ ip_proto_again:
> goto out_bad;
> proto = eth->h_proto;
> nhoff += sizeof(*eth);
> +
> + /* Cap headers that we access via pointers at the
> + * end of the Ethernet header as our maximum alignment
> + * at that point is only 2 bytes.
> + */
> + if (NET_IP_ALIGN)
> + hlen = nhoff;
I think this should be:
if (NET_IP_ALIGN)
goto out_good;
> }
>
> key_control->flags |= FLOW_DIS_ENCAPSULATION;
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [net PATCH] net: Copy inner L3 and L4 headers as unaligned on GRE TEB
2016-02-09 14:33 ` Tom Herbert
@ 2016-02-09 15:36 ` Alexander Duyck
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Duyck @ 2016-02-09 15:36 UTC (permalink / raw)
To: Tom Herbert
Cc: Alexander Duyck, Linux Kernel Network Developers, David S. Miller
On Tue, Feb 9, 2016 at 3:33 PM, Tom Herbert <tom@herbertland.com> wrote:
> On Tue, Feb 9, 2016 at 3:14 PM, Alexander Duyck <aduyck@mirantis.com> wrote:
>> This patch corrects the unaligned accesses seen on GRE TEB tunnels when
>> generating hash keys. Specifically what this patch does is make it so that
>> we force the use of skb_copy_bits when the GRE inner headers will be
>> unaligned due to NET_IP_ALIGNED being a non-zero value.
>>
>> Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
>> ---
>>
>> I don't have the ability to test it but this should fix flow dissector for
>> GRE TEB tunnels traffic seen on architectures that require network and
>> transport headers to be 4 byte aligned.
>>
>> net/core/flow_dissector.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
>> index 699b2c415cb0..9c181ba7263e 100644
>> --- a/net/core/flow_dissector.c
>> +++ b/net/core/flow_dissector.c
>> @@ -402,6 +402,13 @@ ip_proto_again:
>> goto out_bad;
>> proto = eth->h_proto;
>> nhoff += sizeof(*eth);
>> +
>> + /* Cap headers that we access via pointers at the
>> + * end of the Ethernet header as our maximum alignment
>> + * at that point is only 2 bytes.
>> + */
>> + if (NET_IP_ALIGN)
>> + hlen = nhoff;
>
> I think this should be:
>
> if (NET_IP_ALIGN)
> goto out_good;
>
That is no good since we already updated proto with the inner header
protocol value. I would prefer to parse the entire header and just
keep the behavior consistent between IP aligned and DMA aligned
systems.
The only change in behavior is that the reported header length from
the function eth_get_headlen will only pull to the end of the Ethernet
header since we are now only reporting the aligned IP header length.
Otherwise if we need to exit we should probably exit with "goto out_bad"
- Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [net PATCH] net: Copy inner L3 and L4 headers as unaligned on GRE TEB
2016-02-09 14:14 [net PATCH] net: Copy inner L3 and L4 headers as unaligned on GRE TEB Alexander Duyck
2016-02-09 14:33 ` Tom Herbert
@ 2016-02-09 15:39 ` Tom Herbert
2016-02-16 20:25 ` David Miller
2 siblings, 0 replies; 5+ messages in thread
From: Tom Herbert @ 2016-02-09 15:39 UTC (permalink / raw)
To: Alexander Duyck
Cc: Linux Kernel Network Developers, Alexander Duyck, David S. Miller
On Tue, Feb 9, 2016 at 3:14 PM, Alexander Duyck <aduyck@mirantis.com> wrote:
> This patch corrects the unaligned accesses seen on GRE TEB tunnels when
> generating hash keys. Specifically what this patch does is make it so that
> we force the use of skb_copy_bits when the GRE inner headers will be
> unaligned due to NET_IP_ALIGNED being a non-zero value.
>
> Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Acked-by: Tom Herbert <tom@herbertland.com>
> ---
>
> I don't have the ability to test it but this should fix flow dissector for
> GRE TEB tunnels traffic seen on architectures that require network and
> transport headers to be 4 byte aligned.
>
> net/core/flow_dissector.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index 699b2c415cb0..9c181ba7263e 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -402,6 +402,13 @@ ip_proto_again:
> goto out_bad;
> proto = eth->h_proto;
> nhoff += sizeof(*eth);
> +
> + /* Cap headers that we access via pointers at the
> + * end of the Ethernet header as our maximum alignment
> + * at that point is only 2 bytes.
> + */
> + if (NET_IP_ALIGN)
> + hlen = nhoff;
> }
>
> key_control->flags |= FLOW_DIS_ENCAPSULATION;
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [net PATCH] net: Copy inner L3 and L4 headers as unaligned on GRE TEB
2016-02-09 14:14 [net PATCH] net: Copy inner L3 and L4 headers as unaligned on GRE TEB Alexander Duyck
2016-02-09 14:33 ` Tom Herbert
2016-02-09 15:39 ` Tom Herbert
@ 2016-02-16 20:25 ` David Miller
2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2016-02-16 20:25 UTC (permalink / raw)
To: aduyck; +Cc: netdev, alexander.duyck, tom
From: Alexander Duyck <aduyck@mirantis.com>
Date: Tue, 09 Feb 2016 06:14:43 -0800
> This patch corrects the unaligned accesses seen on GRE TEB tunnels when
> generating hash keys. Specifically what this patch does is make it so that
> we force the use of skb_copy_bits when the GRE inner headers will be
> unaligned due to NET_IP_ALIGNED being a non-zero value.
>
> Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Applied and queued up for -stable, thanks Alex.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-02-16 20:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-09 14:14 [net PATCH] net: Copy inner L3 and L4 headers as unaligned on GRE TEB Alexander Duyck
2016-02-09 14:33 ` Tom Herbert
2016-02-09 15:36 ` Alexander Duyck
2016-02-09 15:39 ` Tom Herbert
2016-02-16 20:25 ` 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).