* [dpdk-dev] [PATCH] gro: fix an error when packet is IPv6
@ 2020-11-04 4:22 yang_y_yi
2020-11-05 1:41 ` Hu, Jiayu
2020-11-05 2:54 ` [dpdk-dev] [PATCH v2] " yang_y_yi
0 siblings, 2 replies; 6+ messages in thread
From: yang_y_yi @ 2020-11-04 4:22 UTC (permalink / raw)
To: dev; +Cc: jiayu.hu, konstantin.ananyev, thomas, yangyi01, yang_y_yi
From: Yi Yang <yangyi01@inspur.com>
Current code will think IPv6 packet as IPv4 packet
if inner header is IPv6 and outer header is IPv4,
the result is rte_gro_reassemble() will handle it
as if inner header also is IPv4, so IPv6 can't
be handled correctly as one of unprocess_pkts.
Fixes: e2d811063673 ("gro: support VXLAN UDP/IPv4")
Fixes: 1ca5e6740852 ("gro: support UDP/IPv4")
Fixes: 9e0b9d2ec0f4 ("gro: support VxLAN GRO")
Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4")
Signed-off-by: Yi Yang <yangyi01@inspur.com>
---
lib/librte_gro/rte_gro.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/lib/librte_gro/rte_gro.c b/lib/librte_gro/rte_gro.c
index e56bd20..4347267 100644
--- a/lib/librte_gro/rte_gro.c
+++ b/lib/librte_gro/rte_gro.c
@@ -32,32 +32,38 @@
NULL};
#define IS_IPV4_TCP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
- ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP))
+ ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP) && \
+ ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == 0))
#define IS_IPV4_UDP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
- ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP))
+ ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
+ ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == 0))
#define IS_IPV4_VXLAN_TCP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
RTE_PTYPE_TUNNEL_VXLAN) && \
- ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
- RTE_PTYPE_INNER_L4_TCP) && \
- (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
- (RTE_PTYPE_INNER_L3_IPV4 | \
- RTE_PTYPE_INNER_L3_IPV4_EXT | \
- RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
+ ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
+ RTE_PTYPE_INNER_L4_TCP) && \
+ (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
#define IS_IPV4_VXLAN_UDP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
RTE_PTYPE_TUNNEL_VXLAN) && \
- ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
- RTE_PTYPE_INNER_L4_UDP) && \
- (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
- (RTE_PTYPE_INNER_L3_IPV4 | \
- RTE_PTYPE_INNER_L3_IPV4_EXT | \
- RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
+ ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
+ RTE_PTYPE_INNER_L4_UDP) && \
+ (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
/*
* GRO context structure. It keeps the table structures, which are
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] gro: fix an error when packet is IPv6
2020-11-04 4:22 [dpdk-dev] [PATCH] gro: fix an error when packet is IPv6 yang_y_yi
@ 2020-11-05 1:41 ` Hu, Jiayu
2020-11-05 1:48 ` yang_y_yi
2020-11-05 2:54 ` [dpdk-dev] [PATCH v2] " yang_y_yi
1 sibling, 1 reply; 6+ messages in thread
From: Hu, Jiayu @ 2020-11-05 1:41 UTC (permalink / raw)
To: yang_y_yi, dev; +Cc: Ananyev, Konstantin, thomas, yangyi01
Hi Yi,
> -----Original Message-----
> From: yang_y_yi@163.com <yang_y_yi@163.com>
> Sent: Wednesday, November 4, 2020 12:23 PM
> To: dev@dpdk.org
> Cc: Hu, Jiayu <jiayu.hu@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; thomas@monjalon.net;
> yangyi01@inspur.com; yang_y_yi@163.com
> Subject: [PATCH] gro: fix an error when packet is IPv6
>
> From: Yi Yang <yangyi01@inspur.com>
>
> Current code will think IPv6 packet as IPv4 packet
> if inner header is IPv6 and outer header is IPv4,
> the result is rte_gro_reassemble() will handle it
> as if inner header also is IPv4, so IPv6 can't
> be handled correctly as one of unprocess_pkts.
Good catch. If the input is a VxLAN pkt whose inner
L3 is IPv6, inner L4 is TCP or UDP, and outer L3 is IPv4,
the value of IS_IPV4_VXLAN_TCP4/UDP4_PKT is true.
Thus, GRO will mistakenly reassemble it.
But for IS_IPV4_UDP/TCP_PKT, I think it's better to use
"RTE_ETH_IS_TUNNEL_PKT(ptype) == 0", rather than
"((ptype & RTE_PTYPE_TUNNEL_VXLAN) == 0".
BTW, the commit log is not easy to understand what
bug the patch tries to fix.
Thanks,
Jiayu
>
> Fixes: e2d811063673 ("gro: support VXLAN UDP/IPv4")
> Fixes: 1ca5e6740852 ("gro: support UDP/IPv4")
> Fixes: 9e0b9d2ec0f4 ("gro: support VxLAN GRO")
> Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4")
> Signed-off-by: Yi Yang <yangyi01@inspur.com>
> ---
> lib/librte_gro/rte_gro.c | 34 ++++++++++++++++++++--------------
> 1 file changed, 20 insertions(+), 14 deletions(-)
>
> diff --git a/lib/librte_gro/rte_gro.c b/lib/librte_gro/rte_gro.c
> index e56bd20..4347267 100644
> --- a/lib/librte_gro/rte_gro.c
> +++ b/lib/librte_gro/rte_gro.c
> @@ -32,32 +32,38 @@
> NULL};
>
> #define IS_IPV4_TCP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
> - ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP))
> + ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP) && \
> + ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == 0))
>
> #define IS_IPV4_UDP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
> - ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP))
> + ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
> + ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == 0))
>
> #define IS_IPV4_VXLAN_TCP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype)
> && \
> ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
> ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
> RTE_PTYPE_TUNNEL_VXLAN) && \
> - ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
> - RTE_PTYPE_INNER_L4_TCP) && \
> - (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
> - (RTE_PTYPE_INNER_L3_IPV4 | \
> - RTE_PTYPE_INNER_L3_IPV4_EXT | \
> - RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
> + ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
> + RTE_PTYPE_INNER_L4_TCP) && \
> + (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4) || \
> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4_EXT) || \
> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
>
> #define IS_IPV4_VXLAN_UDP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype)
> && \
> ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
> ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
> RTE_PTYPE_TUNNEL_VXLAN) && \
> - ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
> - RTE_PTYPE_INNER_L4_UDP) && \
> - (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
> - (RTE_PTYPE_INNER_L3_IPV4 | \
> - RTE_PTYPE_INNER_L3_IPV4_EXT | \
> - RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
> + ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
> + RTE_PTYPE_INNER_L4_UDP) && \
> + (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4) || \
> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4_EXT) || \
> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
>
> /*
> * GRO context structure. It keeps the table structures, which are
> --
> 1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] gro: fix an error when packet is IPv6
2020-11-05 1:41 ` Hu, Jiayu
@ 2020-11-05 1:48 ` yang_y_yi
0 siblings, 0 replies; 6+ messages in thread
From: yang_y_yi @ 2020-11-05 1:48 UTC (permalink / raw)
To: Hu, Jiayu; +Cc: dev, Ananyev, Konstantin, thomas, yangyi01
At 2020-11-05 09:41:13, "Hu, Jiayu" <jiayu.hu@intel.com> wrote:
>Hi Yi,
>
>> -----Original Message-----
>> From: yang_y_yi@163.com <yang_y_yi@163.com>
>> Sent: Wednesday, November 4, 2020 12:23 PM
>> To: dev@dpdk.org
>> Cc: Hu, Jiayu <jiayu.hu@intel.com>; Ananyev, Konstantin
>> <konstantin.ananyev@intel.com>; thomas@monjalon.net;
>> yangyi01@inspur.com; yang_y_yi@163.com
>> Subject: [PATCH] gro: fix an error when packet is IPv6
>>
>> From: Yi Yang <yangyi01@inspur.com>
>>
>> Current code will think IPv6 packet as IPv4 packet
>> if inner header is IPv6 and outer header is IPv4,
>> the result is rte_gro_reassemble() will handle it
>> as if inner header also is IPv4, so IPv6 can't
>> be handled correctly as one of unprocess_pkts.
>
>Good catch. If the input is a VxLAN pkt whose inner
>L3 is IPv6, inner L4 is TCP or UDP, and outer L3 is IPv4,
>the value of IS_IPV4_VXLAN_TCP4/UDP4_PKT is true.
>Thus, GRO will mistakenly reassemble it.
>
>But for IS_IPV4_UDP/TCP_PKT, I think it's better to use
>"RTE_ETH_IS_TUNNEL_PKT(ptype) == 0", rather than
>"((ptype & RTE_PTYPE_TUNNEL_VXLAN) == 0".
>
>BTW, the commit log is not easy to understand what
>bug the patch tries to fix.
>
>Thanks,
>Jiayu
Thanks Jiayu, I'll change commit log and vxlan tunnel check condition per you comments.
>
>>
>> Fixes: e2d811063673 ("gro: support VXLAN UDP/IPv4")
>> Fixes: 1ca5e6740852 ("gro: support UDP/IPv4")
>> Fixes: 9e0b9d2ec0f4 ("gro: support VxLAN GRO")
>> Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4")
>> Signed-off-by: Yi Yang <yangyi01@inspur.com>
>> ---
>> lib/librte_gro/rte_gro.c | 34 ++++++++++++++++++++--------------
>> 1 file changed, 20 insertions(+), 14 deletions(-)
>>
>> diff --git a/lib/librte_gro/rte_gro.c b/lib/librte_gro/rte_gro.c
>> index e56bd20..4347267 100644
>> --- a/lib/librte_gro/rte_gro.c
>> +++ b/lib/librte_gro/rte_gro.c
>> @@ -32,32 +32,38 @@
>> NULL};
>>
>> #define IS_IPV4_TCP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
>> - ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP))
>> + ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP) && \
>> + ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == 0))
>>
>> #define IS_IPV4_UDP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
>> - ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP))
>> + ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
>> + ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == 0))
>>
>> #define IS_IPV4_VXLAN_TCP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype)
>> && \
>> ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
>> ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
>> RTE_PTYPE_TUNNEL_VXLAN) && \
>> - ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
>> - RTE_PTYPE_INNER_L4_TCP) && \
>> - (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
>> - (RTE_PTYPE_INNER_L3_IPV4 | \
>> - RTE_PTYPE_INNER_L3_IPV4_EXT | \
>> - RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
>> + ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
>> + RTE_PTYPE_INNER_L4_TCP) && \
>> + (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
>> + RTE_PTYPE_INNER_L3_IPV4) || \
>> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
>> + RTE_PTYPE_INNER_L3_IPV4_EXT) || \
>> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
>> + RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
>>
>> #define IS_IPV4_VXLAN_UDP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype)
>> && \
>> ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
>> ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
>> RTE_PTYPE_TUNNEL_VXLAN) && \
>> - ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
>> - RTE_PTYPE_INNER_L4_UDP) && \
>> - (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
>> - (RTE_PTYPE_INNER_L3_IPV4 | \
>> - RTE_PTYPE_INNER_L3_IPV4_EXT | \
>> - RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
>> + ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
>> + RTE_PTYPE_INNER_L4_UDP) && \
>> + (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
>> + RTE_PTYPE_INNER_L3_IPV4) || \
>> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
>> + RTE_PTYPE_INNER_L3_IPV4_EXT) || \
>> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
>> + RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
>>
>> /*
>> * GRO context structure. It keeps the table structures, which are
>> --
>> 1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v2] gro: fix an error when packet is IPv6
2020-11-04 4:22 [dpdk-dev] [PATCH] gro: fix an error when packet is IPv6 yang_y_yi
2020-11-05 1:41 ` Hu, Jiayu
@ 2020-11-05 2:54 ` yang_y_yi
2020-11-05 6:08 ` Hu, Jiayu
1 sibling, 1 reply; 6+ messages in thread
From: yang_y_yi @ 2020-11-05 2:54 UTC (permalink / raw)
To: dev; +Cc: jiayu.hu, konstantin.ananyev, thomas, yangyi01, yang_y_yi
From: Yi Yang <yangyi01@inspur.com>
For VxLAN packets, GRO will mistakenly reassemble them
if inner L3 is IPv6, inner L4 is TCP or UDP, and outer L3
is IPv4 because the value of IS_IPV4_VXLAN_TCP4/UDP4_PKT
is true for them.
This fix makes sure IS_IPV4_TCP_PKT, IS_IPV4_UDP_PKT,
IS_IPV4_VXLAN_TCP4_PKT and IS_IPV4_VXLAN_UDP4_PKT can make
decision precisely.
Fixes: e2d811063673 ("gro: support VXLAN UDP/IPv4")
Fixes: 1ca5e6740852 ("gro: support UDP/IPv4")
Fixes: 9e0b9d2ec0f4 ("gro: support VxLAN GRO")
Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4")
Signed-off-by: Yi Yang <yangyi01@inspur.com>
---
lib/librte_gro/rte_gro.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/lib/librte_gro/rte_gro.c b/lib/librte_gro/rte_gro.c
index e56bd20..8ca4da6 100644
--- a/lib/librte_gro/rte_gro.c
+++ b/lib/librte_gro/rte_gro.c
@@ -32,32 +32,38 @@
NULL};
#define IS_IPV4_TCP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
- ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP))
+ ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP) && \
+ (RTE_ETH_IS_TUNNEL_PKT(ptype) == 0))
#define IS_IPV4_UDP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
- ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP))
+ ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
+ (RTE_ETH_IS_TUNNEL_PKT(ptype) == 0))
#define IS_IPV4_VXLAN_TCP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
RTE_PTYPE_TUNNEL_VXLAN) && \
- ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
- RTE_PTYPE_INNER_L4_TCP) && \
- (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
- (RTE_PTYPE_INNER_L3_IPV4 | \
- RTE_PTYPE_INNER_L3_IPV4_EXT | \
- RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
+ ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
+ RTE_PTYPE_INNER_L4_TCP) && \
+ (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
#define IS_IPV4_VXLAN_UDP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
RTE_PTYPE_TUNNEL_VXLAN) && \
- ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
- RTE_PTYPE_INNER_L4_UDP) && \
- (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
- (RTE_PTYPE_INNER_L3_IPV4 | \
- RTE_PTYPE_INNER_L3_IPV4_EXT | \
- RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
+ ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
+ RTE_PTYPE_INNER_L4_UDP) && \
+ (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
/*
* GRO context structure. It keeps the table structures, which are
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v2] gro: fix an error when packet is IPv6
2020-11-05 2:54 ` [dpdk-dev] [PATCH v2] " yang_y_yi
@ 2020-11-05 6:08 ` Hu, Jiayu
2020-11-14 8:47 ` Thomas Monjalon
0 siblings, 1 reply; 6+ messages in thread
From: Hu, Jiayu @ 2020-11-05 6:08 UTC (permalink / raw)
To: yang_y_yi, dev; +Cc: Ananyev, Konstantin, thomas, yangyi01
Acked-by: Jiayu Hu <jiayu.hu@intel.com>
> -----Original Message-----
> From: yang_y_yi@163.com <yang_y_yi@163.com>
> Sent: Thursday, November 5, 2020 10:55 AM
> To: dev@dpdk.org
> Cc: Hu, Jiayu <jiayu.hu@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; thomas@monjalon.net;
> yangyi01@inspur.com; yang_y_yi@163.com
> Subject: [PATCH v2] gro: fix an error when packet is IPv6
>
> From: Yi Yang <yangyi01@inspur.com>
>
> For VxLAN packets, GRO will mistakenly reassemble them
> if inner L3 is IPv6, inner L4 is TCP or UDP, and outer L3
> is IPv4 because the value of IS_IPV4_VXLAN_TCP4/UDP4_PKT
> is true for them.
>
> This fix makes sure IS_IPV4_TCP_PKT, IS_IPV4_UDP_PKT,
> IS_IPV4_VXLAN_TCP4_PKT and IS_IPV4_VXLAN_UDP4_PKT can make
> decision precisely.
>
> Fixes: e2d811063673 ("gro: support VXLAN UDP/IPv4")
> Fixes: 1ca5e6740852 ("gro: support UDP/IPv4")
> Fixes: 9e0b9d2ec0f4 ("gro: support VxLAN GRO")
> Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4")
> Signed-off-by: Yi Yang <yangyi01@inspur.com>
> ---
> lib/librte_gro/rte_gro.c | 34 ++++++++++++++++++++--------------
> 1 file changed, 20 insertions(+), 14 deletions(-)
>
> diff --git a/lib/librte_gro/rte_gro.c b/lib/librte_gro/rte_gro.c
> index e56bd20..8ca4da6 100644
> --- a/lib/librte_gro/rte_gro.c
> +++ b/lib/librte_gro/rte_gro.c
> @@ -32,32 +32,38 @@
> NULL};
>
> #define IS_IPV4_TCP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
> - ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP))
> + ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP) && \
> + (RTE_ETH_IS_TUNNEL_PKT(ptype) == 0))
>
> #define IS_IPV4_UDP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
> - ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP))
> + ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
> + (RTE_ETH_IS_TUNNEL_PKT(ptype) == 0))
>
> #define IS_IPV4_VXLAN_TCP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype)
> && \
> ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
> ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
> RTE_PTYPE_TUNNEL_VXLAN) && \
> - ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
> - RTE_PTYPE_INNER_L4_TCP) && \
> - (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
> - (RTE_PTYPE_INNER_L3_IPV4 | \
> - RTE_PTYPE_INNER_L3_IPV4_EXT | \
> - RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
> + ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
> + RTE_PTYPE_INNER_L4_TCP) && \
> + (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4) || \
> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4_EXT) || \
> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
>
> #define IS_IPV4_VXLAN_UDP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype)
> && \
> ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
> ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
> RTE_PTYPE_TUNNEL_VXLAN) && \
> - ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
> - RTE_PTYPE_INNER_L4_UDP) && \
> - (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
> - (RTE_PTYPE_INNER_L3_IPV4 | \
> - RTE_PTYPE_INNER_L3_IPV4_EXT | \
> - RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
> + ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
> + RTE_PTYPE_INNER_L4_UDP) && \
> + (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4) || \
> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4_EXT) || \
> + ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
> + RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
>
> /*
> * GRO context structure. It keeps the table structures, which are
> --
> 1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v2] gro: fix an error when packet is IPv6
2020-11-05 6:08 ` Hu, Jiayu
@ 2020-11-14 8:47 ` Thomas Monjalon
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2020-11-14 8:47 UTC (permalink / raw)
To: yang_y_yi; +Cc: dev, Ananyev, Konstantin, yangyi01, Hu, Jiayu, stable
> > For VxLAN packets, GRO will mistakenly reassemble them
> > if inner L3 is IPv6, inner L4 is TCP or UDP, and outer L3
> > is IPv4 because the value of IS_IPV4_VXLAN_TCP4/UDP4_PKT
> > is true for them.
> >
> > This fix makes sure IS_IPV4_TCP_PKT, IS_IPV4_UDP_PKT,
> > IS_IPV4_VXLAN_TCP4_PKT and IS_IPV4_VXLAN_UDP4_PKT can make
> > decision precisely.
> >
> > Fixes: e2d811063673 ("gro: support VXLAN UDP/IPv4")
> > Fixes: 1ca5e6740852 ("gro: support UDP/IPv4")
> > Fixes: 9e0b9d2ec0f4 ("gro: support VxLAN GRO")
> > Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4")
> > Signed-off-by: Yi Yang <yangyi01@inspur.com>
> Acked-by: Jiayu Hu <jiayu.hu@intel.com>
Added missing Cc: stable@dpdk.org
Tried to be more precise in the title:
"gro: fix packet type detection with IPv6 tunnel"
Applied, thanks
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-11-14 8:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 4:22 [dpdk-dev] [PATCH] gro: fix an error when packet is IPv6 yang_y_yi
2020-11-05 1:41 ` Hu, Jiayu
2020-11-05 1:48 ` yang_y_yi
2020-11-05 2:54 ` [dpdk-dev] [PATCH v2] " yang_y_yi
2020-11-05 6:08 ` Hu, Jiayu
2020-11-14 8:47 ` Thomas Monjalon
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).