DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: avoid wildcard drop flow in priority discovery
@ 2026-07-13  4:18 Gavin Hu
  2026-07-13 10:56 ` Thomas Monjalon
  2026-07-14  6:07 ` [PATCH v2] " Gavin Hu
  0 siblings, 2 replies; 5+ messages in thread
From: Gavin Hu @ 2026-07-13  4:18 UTC (permalink / raw)
  To: dev
  Cc: Wei Yan, stable, Dariusz Sosnowski, Viacheslav Ovsiienko,
	Bing Zhao, Ori Kam, Suanming Mou, Matan Azrad, Ophir Munk,
	Dmitry Kozlyuk

From: Wei Yan <yanwei.wy@bytedance.com>

Priority discovery installs temporary drop flows to probe supported flow
priorities. These flows match a wildcard Ethernet pattern, so they can
also match real traffic while discovery is running. On shared devices this
may temporarily drop kernel traffic and cause TCP connection timeouts.

Constrain the probe flows to match both source and destination MAC
addresses as ff:ff:ff:ff:ff:ff. This keeps the rule valid for discovery
while avoiding matches on normal Ethernet traffic.

Fixes: 3eca5f8a610e ("net/mlx5: move flow priority discovery to Verbs file")
Fixes: c5042f93a425 ("net/mlx5: discover max flow priority using DevX")
Cc: stable@dpdk.org

Signed-off-by: Wei Yan <yanwei.wy@bytedance.com>
Signed-off-by: Gavin Hu <gahu@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c    | 18 ++++++++++++++++++
 drivers/net/mlx5/mlx5_flow_verbs.c |  8 ++++++++
 2 files changed, 26 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 58ebcf87eb..9cb7c59b83 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -19794,6 +19794,22 @@ mlx5_flow_discover_dr_action_support(struct rte_eth_dev *dev)
 	void *matcher = NULL;
 	void *flow = NULL;
 	int ret = -1;
+	struct rte_flow_item_eth eth;
+	struct rte_flow_item item = {
+		.type = RTE_FLOW_ITEM_TYPE_ETH,
+		.spec = &eth,
+		.mask = &eth,
+	};
+
+	memset(&eth, 0, sizeof(eth));
+	memset(&eth.hdr.dst_addr, 0xff, sizeof(eth.hdr.dst_addr));
+	memset(&eth.hdr.src_addr, 0xff, sizeof(eth.hdr.src_addr));
+	flow_dv_translate_item_eth(mask.buf, &item,
+				   /* inner */ false, /* group */ 0,
+				   MLX5_SET_MATCHER_SW_M);
+	flow_dv_translate_item_eth(value.buf, &item,
+				   /* inner */ false, /* group */ 0,
+				   MLX5_SET_MATCHER_SW_V);
 
 	tbl = mlx5_flow_dv_tbl_resource_get(dev, 0, 0, 0, false, NULL,
 					    0, 0, 0, NULL);
@@ -20683,6 +20699,8 @@ flow_dv_discover_priorities(struct rte_eth_dev *dev,
 	flow.dv.actions[0] = action;
 	flow.dv.actions_n = 1;
 	memset(&eth, 0, sizeof(eth));
+	memset(&eth.hdr.dst_addr, 0xff, sizeof(eth.hdr.dst_addr));
+	memset(&eth.hdr.src_addr, 0xff, sizeof(eth.hdr.src_addr));
 	flow_dv_translate_item_eth(matcher.mask.buf, &item,
 				   /* inner */ false, /* group */ 0,
 				   MLX5_SET_MATCHER_SW_M);
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index bb240d38d9..f92258cb5a 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -65,6 +65,14 @@ flow_verbs_discover_priorities(struct rte_eth_dev *dev,
 		.eth = {
 			.type = IBV_FLOW_SPEC_ETH,
 			.size = sizeof(struct ibv_flow_spec_eth),
+			.val = {
+				.dst_mac = "\xff\xff\xff\xff\xff\xff",
+				.src_mac = "\xff\xff\xff\xff\xff\xff",
+			},
+			.mask = {
+				.dst_mac = "\xff\xff\xff\xff\xff\xff",
+				.src_mac = "\xff\xff\xff\xff\xff\xff",
+			},
 		},
 		.drop = {
 			.size = sizeof(struct ibv_flow_spec_action_drop),
-- 
2.27.0


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

* Re: [PATCH] net/mlx5: avoid wildcard drop flow in priority discovery
  2026-07-13  4:18 [PATCH] net/mlx5: avoid wildcard drop flow in priority discovery Gavin Hu
@ 2026-07-13 10:56 ` Thomas Monjalon
  2026-07-14  6:07 ` [PATCH v2] " Gavin Hu
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2026-07-13 10:56 UTC (permalink / raw)
  To: dev, Gavin Hu
  Cc: Wei Yan, stable, Dariusz Sosnowski, Viacheslav Ovsiienko,
	Bing Zhao, Ori Kam, Suanming Mou, Matan Azrad, Ophir Munk,
	Dmitry Kozlyuk

13/07/2026 06:18, Gavin Hu:
> From: Wei Yan <yanwei.wy@bytedance.com>
> 
> Priority discovery installs temporary drop flows to probe supported flow
> priorities. These flows match a wildcard Ethernet pattern, so they can
> also match real traffic while discovery is running. On shared devices this
> may temporarily drop kernel traffic and cause TCP connection timeouts.
> 
> Constrain the probe flows to match both source and destination MAC
> addresses as ff:ff:ff:ff:ff:ff. This keeps the rule valid for discovery
> while avoiding matches on normal Ethernet traffic.

It does not compile in all conditions.
Please check CI results.



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

* [PATCH v2] net/mlx5: avoid wildcard drop flow in priority discovery
  2026-07-13  4:18 [PATCH] net/mlx5: avoid wildcard drop flow in priority discovery Gavin Hu
  2026-07-13 10:56 ` Thomas Monjalon
@ 2026-07-14  6:07 ` Gavin Hu
  2026-07-20  5:42   ` Suanming Mou
  2026-08-03  9:18   ` Raslan Darawsheh
  1 sibling, 2 replies; 5+ messages in thread
From: Gavin Hu @ 2026-07-14  6:07 UTC (permalink / raw)
  To: dev
  Cc: Wei Yan, stable, Dariusz Sosnowski, Viacheslav Ovsiienko,
	Bing Zhao, Ori Kam, Suanming Mou, Matan Azrad, Ophir Munk,
	Dmitry Kozlyuk

From: Wei Yan <yanwei.wy@bytedance.com>

Priority discovery installs temporary drop flows to probe supported flow
priorities. These flows match a wildcard Ethernet pattern, so they can
also match real traffic while discovery is running. On shared devices this
may temporarily drop kernel traffic and cause TCP connection timeouts.

Constrain the probe flows to match both source and destination MAC
addresses as ff:ff:ff:ff:ff:ff. This keeps the rule valid for discovery
while avoiding matches on normal Ethernet traffic.

Fixes: 3eca5f8a610e ("net/mlx5: move flow priority discovery to Verbs file")
Fixes: c5042f93a425 ("net/mlx5: discover max flow priority using DevX")
Cc: stable@dpdk.org

Signed-off-by: Wei Yan <yanwei.wy@bytedance.com>
Signed-off-by: Gavin Hu <gahu@nvidia.com>
---
+v2:
+* Fixed the compiling issue by some compilers in mlx5_flow_verbs.c.

 drivers/net/mlx5/mlx5_flow_dv.c    | 18 ++++++++++++++++++
 drivers/net/mlx5/mlx5_flow_verbs.c |  8 ++++++++
 2 files changed, 26 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 58ebcf87eb..9cb7c59b83 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -19794,6 +19794,22 @@ mlx5_flow_discover_dr_action_support(struct rte_eth_dev *dev)
 	void *matcher = NULL;
 	void *flow = NULL;
 	int ret = -1;
+	struct rte_flow_item_eth eth;
+	struct rte_flow_item item = {
+		.type = RTE_FLOW_ITEM_TYPE_ETH,
+		.spec = &eth,
+		.mask = &eth,
+	};
+
+	memset(&eth, 0, sizeof(eth));
+	memset(&eth.hdr.dst_addr, 0xff, sizeof(eth.hdr.dst_addr));
+	memset(&eth.hdr.src_addr, 0xff, sizeof(eth.hdr.src_addr));
+	flow_dv_translate_item_eth(mask.buf, &item,
+				   /* inner */ false, /* group */ 0,
+				   MLX5_SET_MATCHER_SW_M);
+	flow_dv_translate_item_eth(value.buf, &item,
+				   /* inner */ false, /* group */ 0,
+				   MLX5_SET_MATCHER_SW_V);
 
 	tbl = mlx5_flow_dv_tbl_resource_get(dev, 0, 0, 0, false, NULL,
 					    0, 0, 0, NULL);
@@ -20683,6 +20699,8 @@ flow_dv_discover_priorities(struct rte_eth_dev *dev,
 	flow.dv.actions[0] = action;
 	flow.dv.actions_n = 1;
 	memset(&eth, 0, sizeof(eth));
+	memset(&eth.hdr.dst_addr, 0xff, sizeof(eth.hdr.dst_addr));
+	memset(&eth.hdr.src_addr, 0xff, sizeof(eth.hdr.src_addr));
 	flow_dv_translate_item_eth(matcher.mask.buf, &item,
 				   /* inner */ false, /* group */ 0,
 				   MLX5_SET_MATCHER_SW_M);
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index bb240d38d9..eb576f73d4 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -65,6 +65,14 @@ flow_verbs_discover_priorities(struct rte_eth_dev *dev,
 		.eth = {
 			.type = IBV_FLOW_SPEC_ETH,
 			.size = sizeof(struct ibv_flow_spec_eth),
+			.val = {
+				.dst_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+				.src_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+			},
+			.mask = {
+				.dst_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+				.src_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+			},
 		},
 		.drop = {
 			.size = sizeof(struct ibv_flow_spec_action_drop),
-- 
2.27.0


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

* RE: [PATCH v2] net/mlx5: avoid wildcard drop flow in priority discovery
  2026-07-14  6:07 ` [PATCH v2] " Gavin Hu
@ 2026-07-20  5:42   ` Suanming Mou
  2026-08-03  9:18   ` Raslan Darawsheh
  1 sibling, 0 replies; 5+ messages in thread
From: Suanming Mou @ 2026-07-20  5:42 UTC (permalink / raw)
  To: Gavin Hu, dev@dpdk.org
  Cc: Wei Yan, stable@dpdk.org, Dariusz Sosnowski, Slava Ovsiienko,
	Bing Zhao, Ori Kam, Matan Azrad, Ophir Munk, Dmitry Kozlyuk



> -----Original Message-----
> From: Gavin Hu <gahu@nvidia.com>
> Sent: Tuesday, July 14, 2026 2:08 PM
> To: dev@dpdk.org
> Cc: Wei Yan <yanwei.wy@bytedance.com>; stable@dpdk.org; Dariusz
> Sosnowski <dsosnowski@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Bing Zhao <bingz@nvidia.com>; Ori Kam
> <orika@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; Ophir Munk <ophirmu@nvidia.com>; Dmitry
> Kozlyuk <dmitry.kozliuk@gmail.com>
> Subject: [PATCH v2] net/mlx5: avoid wildcard drop flow in priority discovery
> 
> From: Wei Yan <yanwei.wy@bytedance.com>
> 
> Priority discovery installs temporary drop flows to probe supported flow
> priorities. These flows match a wildcard Ethernet pattern, so they can also
> match real traffic while discovery is running. On shared devices this may
> temporarily drop kernel traffic and cause TCP connection timeouts.
> 
> Constrain the probe flows to match both source and destination MAC
> addresses as ff:ff:ff:ff:ff:ff. This keeps the rule valid for discovery while
> avoiding matches on normal Ethernet traffic.
> 
> Fixes: 3eca5f8a610e ("net/mlx5: move flow priority discovery to Verbs file")
> Fixes: c5042f93a425 ("net/mlx5: discover max flow priority using DevX")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Yan <yanwei.wy@bytedance.com>
> Signed-off-by: Gavin Hu <gahu@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>

Thanks

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

* Re: [PATCH v2] net/mlx5: avoid wildcard drop flow in priority discovery
  2026-07-14  6:07 ` [PATCH v2] " Gavin Hu
  2026-07-20  5:42   ` Suanming Mou
@ 2026-08-03  9:18   ` Raslan Darawsheh
  1 sibling, 0 replies; 5+ messages in thread
From: Raslan Darawsheh @ 2026-08-03  9:18 UTC (permalink / raw)
  To: Gavin Hu, dev
  Cc: Wei Yan, stable, Dariusz Sosnowski, Viacheslav Ovsiienko,
	Bing Zhao, Ori Kam, Suanming Mou, Matan Azrad, Ophir Munk,
	Dmitry Kozlyuk

Hi,


On 14/07/2026 9:07 AM, Gavin Hu wrote:
> From: Wei Yan <yanwei.wy@bytedance.com>
> 
> Priority discovery installs temporary drop flows to probe supported flow
> priorities. These flows match a wildcard Ethernet pattern, so they can
> also match real traffic while discovery is running. On shared devices this
> may temporarily drop kernel traffic and cause TCP connection timeouts.
> 
> Constrain the probe flows to match both source and destination MAC
> addresses as ff:ff:ff:ff:ff:ff. This keeps the rule valid for discovery
> while avoiding matches on normal Ethernet traffic.
> 
> Fixes: 3eca5f8a610e ("net/mlx5: move flow priority discovery to Verbs file")
> Fixes: c5042f93a425 ("net/mlx5: discover max flow priority using DevX")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Yan <yanwei.wy@bytedance.com>
> Signed-off-by: Gavin Hu <gahu@nvidia.com>
> ---
> +v2:
> +* Fixed the compiling issue by some compilers in mlx5_flow_verbs.c.
> 

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh


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

end of thread, other threads:[~2026-08-03  9:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13  4:18 [PATCH] net/mlx5: avoid wildcard drop flow in priority discovery Gavin Hu
2026-07-13 10:56 ` Thomas Monjalon
2026-07-14  6:07 ` [PATCH v2] " Gavin Hu
2026-07-20  5:42   ` Suanming Mou
2026-08-03  9:18   ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox