* [dpdk-stable] [PATCH] net/mlx5: fix incorrect L3 layer chosen in TTL action
@ 2019-11-21 3:31 Suanming Mou
2019-11-21 7:39 ` Matan Azrad
2019-11-21 12:09 ` [dpdk-stable] [PATCH v2] net/mlx5: fix incorrect L3/L4 layer chosen with tunnel Suanming Mou
0 siblings, 2 replies; 7+ messages in thread
From: Suanming Mou @ 2019-11-21 3:31 UTC (permalink / raw)
To: matan, viacheslavo; +Cc: dev, stable, dekelp
For IPINIP flow, there are two L3 layer match pattern items, the inner
layer follows the outer layer as the latter L3 layer item, the TTL action
handles the outer layer.
Current the outer and inner L3 layers are both regared as the outer L3
layer, it caueses TTL action uses the incorrect latter inner protocal in
flow_dv_convert_action_modify_ttl() for header modifier.
Check former L3 outer layer existence avoid set the incorrect inner layer
to the flow attr.
Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
Cc: dekelp@mellanox.com
Cc: stable@dpdk.org
Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
---
drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index c402a8d..7cef5d3 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -84,10 +84,18 @@
for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
switch (item->type) {
case RTE_FLOW_ITEM_TYPE_IPV4:
- attr->ipv4 = 1;
+ /*
+ * flow_dv_validate() avoids multiple L3 layers case
+ * other than IPINIP. If attr->ipv6 set, ipv4 should
+ * be the IPINIP inner layer.
+ */
+ if (!attr->ipv6)
+ attr->ipv4 = 1;
break;
case RTE_FLOW_ITEM_TYPE_IPV6:
- attr->ipv6 = 1;
+ /* If ipv4 set, ipv6 is the IPINIP inner layer. */
+ if (!attr->ipv4)
+ attr->ipv6 = 1;
break;
case RTE_FLOW_ITEM_TYPE_UDP:
attr->udp = 1;
--
1.8.3.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [PATCH] net/mlx5: fix incorrect L3 layer chosen in TTL action
2019-11-21 3:31 [dpdk-stable] [PATCH] net/mlx5: fix incorrect L3 layer chosen in TTL action Suanming Mou
@ 2019-11-21 7:39 ` Matan Azrad
2019-11-21 9:41 ` Suanming Mou
2019-11-21 12:09 ` [dpdk-stable] [PATCH v2] net/mlx5: fix incorrect L3/L4 layer chosen with tunnel Suanming Mou
1 sibling, 1 reply; 7+ messages in thread
From: Matan Azrad @ 2019-11-21 7:39 UTC (permalink / raw)
To: Suanming Mou, Slava Ovsiienko; +Cc: dev, stable, Dekel Peled
Hi Mou
From: Suanming Mou
> For IPINIP flow, there are two L3 layer match pattern items, the inner layer
> follows the outer layer as the latter L3 layer item, the TTL action handles the
> outer layer.
>
> Current the outer and inner L3 layers are both regared as the outer L3 layer,
> it caueses TTL action uses the incorrect latter inner protocal in
> flow_dv_convert_action_modify_ttl() for header modifier.
>
> Check former L3 outer layer existence avoid set the incorrect inner layer to
> the flow attr.
>
> Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
> Cc: dekelp@mellanox.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c index c402a8d..7cef5d3 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -84,10 +84,18 @@
> for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
> switch (item->type) {
> case RTE_FLOW_ITEM_TYPE_IPV4:
> - attr->ipv4 = 1;
> + /*
> + * flow_dv_validate() avoids multiple L3 layers case
> + * other than IPINIP. If attr->ipv6 set, ipv4 should
> + * be the IPINIP inner layer.
> + */
> + if (!attr->ipv6)
> + attr->ipv4 = 1;
> break;
> case RTE_FLOW_ITEM_TYPE_IPV6:
> - attr->ipv6 = 1;
> + /* If ipv4 set, ipv6 is the IPINIP inner layer. */
> + if (!attr->ipv4)
> + attr->ipv6 = 1;
> break;
> case RTE_FLOW_ITEM_TYPE_UDP:
> attr->udp = 1;
What are about udp\tcp?
They both can be in outer and inner.....
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [PATCH] net/mlx5: fix incorrect L3 layer chosen in TTL action
2019-11-21 7:39 ` Matan Azrad
@ 2019-11-21 9:41 ` Suanming Mou
0 siblings, 0 replies; 7+ messages in thread
From: Suanming Mou @ 2019-11-21 9:41 UTC (permalink / raw)
To: Matan Azrad, Slava Ovsiienko; +Cc: dev, stable, Dekel Peled
> -----Original Message-----
> From: Matan Azrad <matan@mellanox.com>
> Sent: Thursday, November 21, 2019 3:40 PM
> To: Suanming Mou <suanmingm@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Dekel Peled <dekelp@mellanox.com>
> Subject: RE: [PATCH] net/mlx5: fix incorrect L3 layer chosen in TTL action
>
>
> Hi Mou
>
> From: Suanming Mou
> > For IPINIP flow, there are two L3 layer match pattern items, the inner
> > layer follows the outer layer as the latter L3 layer item, the TTL
> > action handles the outer layer.
> >
> > Current the outer and inner L3 layers are both regared as the outer L3
> > layer, it caueses TTL action uses the incorrect latter inner protocal
> > in
> > flow_dv_convert_action_modify_ttl() for header modifier.
> >
> > Check former L3 outer layer existence avoid set the incorrect inner
> > layer to the flow attr.
> >
> > Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct
> > Verbs")
> > Cc: dekelp@mellanox.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
> > ---
> > drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> > b/drivers/net/mlx5/mlx5_flow_dv.c index c402a8d..7cef5d3 100644
> > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > @@ -84,10 +84,18 @@
> > for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
> > switch (item->type) {
> > case RTE_FLOW_ITEM_TYPE_IPV4:
> > - attr->ipv4 = 1;
> > + /*
> > + * flow_dv_validate() avoids multiple L3 layers case
> > + * other than IPINIP. If attr->ipv6 set, ipv4 should
> > + * be the IPINIP inner layer.
> > + */
> > + if (!attr->ipv6)
> > + attr->ipv4 = 1;
> > break;
> > case RTE_FLOW_ITEM_TYPE_IPV6:
> > - attr->ipv6 = 1;
> > + /* If ipv4 set, ipv6 is the IPINIP inner layer. */
> > + if (!attr->ipv4)
> > + attr->ipv6 = 1;
> > break;
> > case RTE_FLOW_ITEM_TYPE_UDP:
> > attr->udp = 1;
>
> What are about udp\tcp?
>
> They both can be in outer and inner.....
Good catch. Per the command below, the udp tcp should also need to be taken care in vxlan mode.
flow create 0 group 2 ingress pattern ipv4 src is 192.168.1.1 / udp src is 250 / vxlan vni is 125 / ipv4 src is 192.168.1.2 / tcp src is 135 / end actions set_tp_src port 125 / jump group 3 / end
Maybe we need a new patch named "net/mlx5: fix incorrect L3/L4 layer chosen in tunnel mode".
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-stable] [PATCH v2] net/mlx5: fix incorrect L3/L4 layer chosen with tunnel
2019-11-21 3:31 [dpdk-stable] [PATCH] net/mlx5: fix incorrect L3 layer chosen in TTL action Suanming Mou
2019-11-21 7:39 ` Matan Azrad
@ 2019-11-21 12:09 ` Suanming Mou
2019-11-22 1:29 ` [dpdk-stable] [dpdk-dev] " Suanming Mou
2019-11-24 9:15 ` Raslan Darawsheh
1 sibling, 2 replies; 7+ messages in thread
From: Suanming Mou @ 2019-11-21 12:09 UTC (permalink / raw)
To: dev; +Cc: dekelp, stable
For tunnel mode, there maybe two L3/L4 layer match pattern items,
the inner layer follows the outer layer as the latter layer item,
the TTL and port modify actions should handle the outermost layer.
Current the outer and inner L3/L4 layers are both regared as the
outer layer in flow_dv_attr_init(), it caueses actions may use the
incorrect latter inner protocal for header modifier.
Check former L3/L4 outer layer existence avoid set the incorrect inner
layer to the flow attr.
Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
Cc: dekelp@mellanox.com
Cc: stable@dpdk.org
Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
---
v2:
* Add L4 layer check.
---
drivers/net/mlx5/mlx5_flow_dv.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index c402a8d..688291f 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -73,6 +73,9 @@
/**
* Initialize flow attributes structure according to flow items' types.
*
+ * flow_dv_validate() avoids multiple L3/L4 layers cases other than tunnel
+ * mode. For tunnel mode, the items to be modified are the outermost ones.
+ *
* @param[in] item
* Pointer to item specification.
* @param[out] attr
@@ -84,16 +87,20 @@
for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
switch (item->type) {
case RTE_FLOW_ITEM_TYPE_IPV4:
- attr->ipv4 = 1;
+ if (!attr->ipv6)
+ attr->ipv4 = 1;
break;
case RTE_FLOW_ITEM_TYPE_IPV6:
- attr->ipv6 = 1;
+ if (!attr->ipv4)
+ attr->ipv6 = 1;
break;
case RTE_FLOW_ITEM_TYPE_UDP:
- attr->udp = 1;
+ if (!attr->tcp)
+ attr->udp = 1;
break;
case RTE_FLOW_ITEM_TYPE_TCP:
- attr->tcp = 1;
+ if (!attr->udp)
+ attr->tcp = 1;
break;
default:
break;
--
1.8.3.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v2] net/mlx5: fix incorrect L3/L4 layer chosen with tunnel
2019-11-21 12:09 ` [dpdk-stable] [PATCH v2] net/mlx5: fix incorrect L3/L4 layer chosen with tunnel Suanming Mou
@ 2019-11-22 1:29 ` Suanming Mou
2019-11-24 7:05 ` Matan Azrad
2019-11-24 9:15 ` Raslan Darawsheh
1 sibling, 1 reply; 7+ messages in thread
From: Suanming Mou @ 2019-11-22 1:29 UTC (permalink / raw)
To: dev, Matan Azrad, Slava Ovsiienko; +Cc: Dekel Peled, stable
On 11/21/2019 8:09 PM, Suanming Mou wrote:
> For tunnel mode, there maybe two L3/L4 layer match pattern items,
> the inner layer follows the outer layer as the latter layer item,
> the TTL and port modify actions should handle the outermost layer.
>
> Current the outer and inner L3/L4 layers are both regared as the
> outer layer in flow_dv_attr_init(), it caueses actions may use the
> incorrect latter inner protocal for header modifier.
>
> Check former L3/L4 outer layer existence avoid set the incorrect inner
> layer to the flow attr.
>
> Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
> Cc: dekelp@mellanox.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
> ---
>
> v2:
> * Add L4 layer check.
>
> ---
> drivers/net/mlx5/mlx5_flow_dv.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index c402a8d..688291f 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -73,6 +73,9 @@
> /**
> * Initialize flow attributes structure according to flow items' types.
> *
> + * flow_dv_validate() avoids multiple L3/L4 layers cases other than tunnel
> + * mode. For tunnel mode, the items to be modified are the outermost ones.
> + *
> * @param[in] item
> * Pointer to item specification.
> * @param[out] attr
> @@ -84,16 +87,20 @@
> for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
> switch (item->type) {
> case RTE_FLOW_ITEM_TYPE_IPV4:
> - attr->ipv4 = 1;
> + if (!attr->ipv6)
> + attr->ipv4 = 1;
> break;
> case RTE_FLOW_ITEM_TYPE_IPV6:
> - attr->ipv6 = 1;
> + if (!attr->ipv4)
> + attr->ipv6 = 1;
> break;
> case RTE_FLOW_ITEM_TYPE_UDP:
> - attr->udp = 1;
> + if (!attr->tcp)
> + attr->udp = 1;
> break;
> case RTE_FLOW_ITEM_TYPE_TCP:
> - attr->tcp = 1;
> + if (!attr->udp)
> + attr->tcp = 1;
> break;
> default:
> break;
Sorry for that v2 mail missed mail to Matan and Slava. Just add.
Thanks
SuanmingMou
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v2] net/mlx5: fix incorrect L3/L4 layer chosen with tunnel
2019-11-22 1:29 ` [dpdk-stable] [dpdk-dev] " Suanming Mou
@ 2019-11-24 7:05 ` Matan Azrad
0 siblings, 0 replies; 7+ messages in thread
From: Matan Azrad @ 2019-11-24 7:05 UTC (permalink / raw)
To: Suanming Mou, dev, Slava Ovsiienko; +Cc: Dekel Peled, stable
From: Suanming Mou
> On 11/21/2019 8:09 PM, Suanming Mou wrote:
> > For tunnel mode, there maybe two L3/L4 layer match pattern items, the
> > inner layer follows the outer layer as the latter layer item, the TTL
> > and port modify actions should handle the outermost layer.
> >
> > Current the outer and inner L3/L4 layers are both regared as the outer
> > layer in flow_dv_attr_init(), it caueses actions may use the incorrect
> > latter inner protocal for header modifier.
> >
> > Check former L3/L4 outer layer existence avoid set the incorrect inner
> > layer to the flow attr.
> >
> > Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct
> > Verbs")
> > Cc: dekelp@mellanox.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v2] net/mlx5: fix incorrect L3/L4 layer chosen with tunnel
2019-11-21 12:09 ` [dpdk-stable] [PATCH v2] net/mlx5: fix incorrect L3/L4 layer chosen with tunnel Suanming Mou
2019-11-22 1:29 ` [dpdk-stable] [dpdk-dev] " Suanming Mou
@ 2019-11-24 9:15 ` Raslan Darawsheh
1 sibling, 0 replies; 7+ messages in thread
From: Raslan Darawsheh @ 2019-11-24 9:15 UTC (permalink / raw)
To: Suanming Mou, dev; +Cc: Dekel Peled, stable
Hi,
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Suanming Mou
> Sent: Thursday, November 21, 2019 2:10 PM
> To: dev@dpdk.org
> Cc: Dekel Peled <dekelp@mellanox.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix incorrect L3/L4 layer chosen
> with tunnel
>
> For tunnel mode, there maybe two L3/L4 layer match pattern items,
> the inner layer follows the outer layer as the latter layer item,
> the TTL and port modify actions should handle the outermost layer.
>
> Current the outer and inner L3/L4 layers are both regared as the
> outer layer in flow_dv_attr_init(), it caueses actions may use the
> incorrect latter inner protocal for header modifier.
>
> Check former L3/L4 outer layer existence avoid set the incorrect inner
> layer to the flow attr.
>
> Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
> Cc: dekelp@mellanox.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
> ---
>
> v2:
> * Add L4 layer check.
>
> ---
> drivers/net/mlx5/mlx5_flow_dv.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index c402a8d..688291f 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -73,6 +73,9 @@
> /**
> * Initialize flow attributes structure according to flow items' types.
> *
> + * flow_dv_validate() avoids multiple L3/L4 layers cases other than tunnel
> + * mode. For tunnel mode, the items to be modified are the outermost
> ones.
> + *
> * @param[in] item
> * Pointer to item specification.
> * @param[out] attr
> @@ -84,16 +87,20 @@
> for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
> switch (item->type) {
> case RTE_FLOW_ITEM_TYPE_IPV4:
> - attr->ipv4 = 1;
> + if (!attr->ipv6)
> + attr->ipv4 = 1;
> break;
> case RTE_FLOW_ITEM_TYPE_IPV6:
> - attr->ipv6 = 1;
> + if (!attr->ipv4)
> + attr->ipv6 = 1;
> break;
> case RTE_FLOW_ITEM_TYPE_UDP:
> - attr->udp = 1;
> + if (!attr->tcp)
> + attr->udp = 1;
> break;
> case RTE_FLOW_ITEM_TYPE_TCP:
> - attr->tcp = 1;
> + if (!attr->udp)
> + attr->tcp = 1;
> break;
> default:
> break;
> --
> 1.8.3.1
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-11-24 9:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-21 3:31 [dpdk-stable] [PATCH] net/mlx5: fix incorrect L3 layer chosen in TTL action Suanming Mou
2019-11-21 7:39 ` Matan Azrad
2019-11-21 9:41 ` Suanming Mou
2019-11-21 12:09 ` [dpdk-stable] [PATCH v2] net/mlx5: fix incorrect L3/L4 layer chosen with tunnel Suanming Mou
2019-11-22 1:29 ` [dpdk-stable] [dpdk-dev] " Suanming Mou
2019-11-24 7:05 ` Matan Azrad
2019-11-24 9:15 ` Raslan Darawsheh
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).