* [dpdk-dev] [PATCH] net/mlx5: fix matching for UDP tunnels with verbs
@ 2020-05-05 9:42 Raslan Darawsheh
2020-05-05 9:45 ` [dpdk-dev] [PATCH v2] " Raslan Darawsheh
2020-05-05 11:37 ` [dpdk-dev] [PATCH] " Slava Ovsiienko
0 siblings, 2 replies; 6+ messages in thread
From: Raslan Darawsheh @ 2020-05-05 9:42 UTC (permalink / raw)
To: viacheslavo, matan; +Cc: dev, orika, stable
When creating flow rule with zero specs it will cause
matching all UDP packets like following:
eth / ipv4 / udp / vxlan / end
Such rule will match all udp packets.
This change the behavior to match the dv flow engine
which will automatically set the match on relative
outer UDP port if the user didn't specify any.
Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
drivers/net/mlx5/mlx5_flow_verbs.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 7efd97f54..9094fb70b 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -680,6 +680,26 @@ flow_verbs_translate_item_udp(struct mlx5_flow *dev_flow,
udp.val.src_port &= udp.mask.src_port;
udp.val.dst_port &= udp.mask.dst_port;
}
+
+ if ((item + 1) != NULL && !(udp.val.dst_port & udp.mask.dst_port)) {
+ switch((item + 1)->type) {
+ case RTE_FLOW_ITEM_TYPE_VXLAN:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_VXLAN);
+ udp.mask.dst_port = 0xffff;
+ break;
+ case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_VXLAN_GPE);
+ udp.mask.dst_port = 0xffff;
+ break;
+ case RTE_FLOW_ITEM_TYPE_MPLS:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_MPLS);
+ udp.mask.dst_port = 0xffff;
+ break;
+ default:
+ break;
+ }
+ }
+
flow_verbs_spec_add(&dev_flow->verbs, &udp, size);
}
--
2.26.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v2] net/mlx5: fix matching for UDP tunnels with verbs
2020-05-05 9:42 [dpdk-dev] [PATCH] net/mlx5: fix matching for UDP tunnels with verbs Raslan Darawsheh
@ 2020-05-05 9:45 ` Raslan Darawsheh
2020-05-06 6:48 ` [dpdk-dev] [PATCH v3] " Raslan Darawsheh
2020-05-06 6:57 ` [dpdk-dev] [PATCH v4] " Raslan Darawsheh
2020-05-05 11:37 ` [dpdk-dev] [PATCH] " Slava Ovsiienko
1 sibling, 2 replies; 6+ messages in thread
From: Raslan Darawsheh @ 2020-05-05 9:45 UTC (permalink / raw)
To: viacheslavo, matan; +Cc: dev, orika, stable
When creating flow rule with zero specs it will cause
matching all UDP packets like following:
eth / ipv4 / udp / vxlan / end
Such rule will match all udp packets.
This change the behavior to match the dv flow engine
which will automatically set the match on relative
outer UDP port if the user didn't specify any.
Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
v2: fixed checkpatch issues
---
drivers/net/mlx5/mlx5_flow_verbs.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 7efd97f54..d711466dd 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -680,6 +680,26 @@ flow_verbs_translate_item_udp(struct mlx5_flow *dev_flow,
udp.val.src_port &= udp.mask.src_port;
udp.val.dst_port &= udp.mask.dst_port;
}
+
+ if ((item + 1) != NULL && !(udp.val.dst_port & udp.mask.dst_port)) {
+ switch ((item + 1)->type) {
+ case RTE_FLOW_ITEM_TYPE_VXLAN:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_VXLAN);
+ udp.mask.dst_port = 0xffff;
+ break;
+ case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_VXLAN_GPE);
+ udp.mask.dst_port = 0xffff;
+ break;
+ case RTE_FLOW_ITEM_TYPE_MPLS:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_MPLS);
+ udp.mask.dst_port = 0xffff;
+ break;
+ default:
+ break;
+ }
+ }
+
flow_verbs_spec_add(&dev_flow->verbs, &udp, size);
}
--
2.26.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v3] net/mlx5: fix matching for UDP tunnels with verbs
2020-05-05 9:45 ` [dpdk-dev] [PATCH v2] " Raslan Darawsheh
@ 2020-05-06 6:48 ` Raslan Darawsheh
2020-05-06 6:57 ` [dpdk-dev] [PATCH v4] " Raslan Darawsheh
1 sibling, 0 replies; 6+ messages in thread
From: Raslan Darawsheh @ 2020-05-06 6:48 UTC (permalink / raw)
To: viacheslavo, matan; +Cc: dev, orika, stable
When creating flow rule with zero specs it will cause
matching all UDP packets like following:
eth / ipv4 / udp / vxlan / end
Such rule will match all udp packets.
This change the behavior to match the dv flow engine
which will automatically set the match on relative
outer UDP port if the user didn't specify any.
Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
v2: fixed checkpatch issues
v3: handled ITEM_VOID after udp item.
---
drivers/net/mlx5/mlx5_flow_verbs.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 7efd97f54..ac29c5d98 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -680,6 +680,28 @@ flow_verbs_translate_item_udp(struct mlx5_flow *dev_flow,
udp.val.src_port &= udp.mask.src_port;
udp.val.dst_port &= udp.mask.dst_port;
}
+ item ++;
+ while (item != NULL && (item->type == RTE_FLOW_ITEM_TYPE_VOID))
+ item ++;
+ if (item != NULL && !(udp.val.dst_port & udp.mask.dst_port)) {
+ switch ((item)->type) {
+ case RTE_FLOW_ITEM_TYPE_VXLAN:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_VXLAN);
+ udp.mask.dst_port = 0xffff;
+ break;
+ case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_VXLAN_GPE);
+ udp.mask.dst_port = 0xffff;
+ break;
+ case RTE_FLOW_ITEM_TYPE_MPLS:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_MPLS);
+ udp.mask.dst_port = 0xffff;
+ break;
+ default:
+ break;
+ }
+ }
+
flow_verbs_spec_add(&dev_flow->verbs, &udp, size);
}
--
2.26.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v4] net/mlx5: fix matching for UDP tunnels with verbs
2020-05-05 9:45 ` [dpdk-dev] [PATCH v2] " Raslan Darawsheh
2020-05-06 6:48 ` [dpdk-dev] [PATCH v3] " Raslan Darawsheh
@ 2020-05-06 6:57 ` Raslan Darawsheh
2020-05-11 11:46 ` Raslan Darawsheh
1 sibling, 1 reply; 6+ messages in thread
From: Raslan Darawsheh @ 2020-05-06 6:57 UTC (permalink / raw)
To: viacheslavo, matan; +Cc: dev, orika, stable
When creating flow rule with zero specs it will cause
matching all UDP packets like following:
eth / ipv4 / udp / vxlan / end
Such rule will match all udp packets.
This change the behavior to match the dv flow engine
which will automatically set the match on relative
outer UDP port if the user didn't specify any.
Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
v2: fixed checkpatch issues
v3: handled ITEM_VOID after udp item.
v4: removed extra unnecessary check for NULL
---
drivers/net/mlx5/mlx5_flow_verbs.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 7efd97f54..24d4a7203 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -680,6 +680,28 @@ flow_verbs_translate_item_udp(struct mlx5_flow *dev_flow,
udp.val.src_port &= udp.mask.src_port;
udp.val.dst_port &= udp.mask.dst_port;
}
+ item++;
+ while (item->type == RTE_FLOW_ITEM_TYPE_VOID)
+ item++;
+ if (!(udp.val.dst_port & udp.mask.dst_port)) {
+ switch ((item)->type) {
+ case RTE_FLOW_ITEM_TYPE_VXLAN:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_VXLAN);
+ udp.mask.dst_port = 0xffff;
+ break;
+ case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_VXLAN_GPE);
+ udp.mask.dst_port = 0xffff;
+ break;
+ case RTE_FLOW_ITEM_TYPE_MPLS:
+ udp.val.dst_port = htons(MLX5_UDP_PORT_MPLS);
+ udp.mask.dst_port = 0xffff;
+ break;
+ default:
+ break;
+ }
+ }
+
flow_verbs_spec_add(&dev_flow->verbs, &udp, size);
}
--
2.26.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v4] net/mlx5: fix matching for UDP tunnels with verbs
2020-05-06 6:57 ` [dpdk-dev] [PATCH v4] " Raslan Darawsheh
@ 2020-05-11 11:46 ` Raslan Darawsheh
0 siblings, 0 replies; 6+ messages in thread
From: Raslan Darawsheh @ 2020-05-11 11:46 UTC (permalink / raw)
To: Raslan Darawsheh, Slava Ovsiienko, Matan Azrad; +Cc: dev, Ori Kam, stable
Hi,
> -----Original Message-----
> From: Raslan Darawsheh <rasland@mellanox.com>
> Sent: Wednesday, May 6, 2020 9:58 AM
> To: Slava Ovsiienko <viacheslavo@mellanox.com>; Matan Azrad
> <matan@mellanox.com>
> Cc: dev@dpdk.org; Ori Kam <orika@mellanox.com>; stable@dpdk.org
> Subject: [PATCH v4] net/mlx5: fix matching for UDP tunnels with verbs
>
> When creating flow rule with zero specs it will cause
> matching all UDP packets like following:
> eth / ipv4 / udp / vxlan / end
> Such rule will match all udp packets.
>
> This change the behavior to match the dv flow engine
> which will automatically set the match on relative
> outer UDP port if the user didn't specify any.
>
> Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
> Cc: stable@dpdk.org
>
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
> v2: fixed checkpatch issues
> v3: handled ITEM_VOID after udp item.
> v4: removed extra unnecessary check for NULL
> ---
>
> drivers/net/mlx5/mlx5_flow_verbs.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index 7efd97f54..24d4a7203 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -680,6 +680,28 @@ flow_verbs_translate_item_udp(struct mlx5_flow
> *dev_flow,
> udp.val.src_port &= udp.mask.src_port;
> udp.val.dst_port &= udp.mask.dst_port;
> }
> + item++;
> + while (item->type == RTE_FLOW_ITEM_TYPE_VOID)
> + item++;
> + if (!(udp.val.dst_port & udp.mask.dst_port)) {
> + switch ((item)->type) {
> + case RTE_FLOW_ITEM_TYPE_VXLAN:
> + udp.val.dst_port = htons(MLX5_UDP_PORT_VXLAN);
> + udp.mask.dst_port = 0xffff;
> + break;
> + case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
> + udp.val.dst_port =
> htons(MLX5_UDP_PORT_VXLAN_GPE);
> + udp.mask.dst_port = 0xffff;
> + break;
> + case RTE_FLOW_ITEM_TYPE_MPLS:
> + udp.val.dst_port = htons(MLX5_UDP_PORT_MPLS);
> + udp.mask.dst_port = 0xffff;
> + break;
> + default:
> + break;
> + }
> + }
> +
> flow_verbs_spec_add(&dev_flow->verbs, &udp, size);
> }
>
> --
> 2.26.0
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix matching for UDP tunnels with verbs
2020-05-05 9:42 [dpdk-dev] [PATCH] net/mlx5: fix matching for UDP tunnels with verbs Raslan Darawsheh
2020-05-05 9:45 ` [dpdk-dev] [PATCH v2] " Raslan Darawsheh
@ 2020-05-05 11:37 ` Slava Ovsiienko
1 sibling, 0 replies; 6+ messages in thread
From: Slava Ovsiienko @ 2020-05-05 11:37 UTC (permalink / raw)
To: Raslan Darawsheh, Matan Azrad; +Cc: dev, Ori Kam, stable
> -----Original Message-----
> From: Raslan Darawsheh <rasland@mellanox.com>
> Sent: Tuesday, May 5, 2020 12:42
> To: Slava Ovsiienko <viacheslavo@mellanox.com>; Matan Azrad
> <matan@mellanox.com>
> Cc: dev@dpdk.org; Ori Kam <orika@mellanox.com>; stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix matching for UDP tunnels with verbs
>
> When creating flow rule with zero specs it will cause matching all UDP
> packets like following:
> eth / ipv4 / udp / vxlan / end
> Such rule will match all udp packets.
>
> This change the behavior to match the dv flow engine which will
> automatically set the match on relative outer UDP port if the user didn't
> specify any.
>
> Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
> Cc: stable@dpdk.org
>
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_flow_verbs.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index 7efd97f54..9094fb70b 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -680,6 +680,26 @@ flow_verbs_translate_item_udp(struct mlx5_flow
> *dev_flow,
> udp.val.src_port &= udp.mask.src_port;
> udp.val.dst_port &= udp.mask.dst_port;
> }
> +
> + if ((item + 1) != NULL && !(udp.val.dst_port & udp.mask.dst_port)) {
> + switch((item + 1)->type) {
> + case RTE_FLOW_ITEM_TYPE_VXLAN:
> + udp.val.dst_port =
> htons(MLX5_UDP_PORT_VXLAN);
> + udp.mask.dst_port = 0xffff;
> + break;
> + case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
> + udp.val.dst_port =
> htons(MLX5_UDP_PORT_VXLAN_GPE);
> + udp.mask.dst_port = 0xffff;
> + break;
> + case RTE_FLOW_ITEM_TYPE_MPLS:
> + udp.val.dst_port =
> htons(MLX5_UDP_PORT_MPLS);
> + udp.mask.dst_port = 0xffff;
> + break;
> + default:
> + break;
> + }
> + }
> +
> flow_verbs_spec_add(&dev_flow->verbs, &udp, size); }
>
> --
> 2.26.0
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-05-11 11:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 9:42 [dpdk-dev] [PATCH] net/mlx5: fix matching for UDP tunnels with verbs Raslan Darawsheh
2020-05-05 9:45 ` [dpdk-dev] [PATCH v2] " Raslan Darawsheh
2020-05-06 6:48 ` [dpdk-dev] [PATCH v3] " Raslan Darawsheh
2020-05-06 6:57 ` [dpdk-dev] [PATCH v4] " Raslan Darawsheh
2020-05-11 11:46 ` Raslan Darawsheh
2020-05-05 11:37 ` [dpdk-dev] [PATCH] " Slava Ovsiienko
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).