net/mlx5: avoid wildcard drop flow in priority discovery
PATCH 1/1 net/mlx5: avoid wildcard drop flow in priority discovery
From: Wei Yan <[email protected]>
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.
--- drivers/net/mlx5/mlx5_flow_dv.c | 18 ++++++++++++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 8 ++++++++ 2 files changed, 26 insertions(+)
drivers/net/mlx5/mlx5_flow_dv.c +18 -0
@@ -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 = ð, + .mask = ð, + }; + +memset (ð,0 ,sizeof (eth)); +memset (ð.hdr.dst_addr,0xff ,sizeof (eth.hdr.dst_addr)); +memset (ð.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 (ð,0 ,sizeof (eth)); +memset (ð.hdr.dst_addr,0xff ,sizeof (eth.hdr.dst_addr)); +memset (ð.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 );
drivers/net/mlx5/mlx5_flow_verbs.c +8 -0
@@ -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),
Signature · 1 line
2.27.0
13/07/2026 06:18, Gavin Hu:
Quoted 10 lines
From: Wei Yan <[email protected]>
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.
PATCH v2 1/1 net/mlx5: avoid wildcard drop flow in priority discovery
In reply to Gavin HuFrom: Wei Yan <[email protected]>
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.
---
+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(+)
drivers/net/mlx5/mlx5_flow_dv.c +18 -0
@@ -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 = ð, + .mask = ð, + }; + +memset (ð,0 ,sizeof (eth)); +memset (ð.hdr.dst_addr,0xff ,sizeof (eth.hdr.dst_addr)); +memset (ð.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 (ð,0 ,sizeof (eth)); +memset (ð.hdr.dst_addr,0xff ,sizeof (eth.hdr.dst_addr)); +memset (ð.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 );
drivers/net/mlx5/mlx5_flow_verbs.c +8 -0
@@ -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),
Signature · 1 line
2.27.0
Quoted 25 lines
-----Original Message-----
From: Gavin Hu <[email protected]>
Sent: Tuesday, July 14, 2026 2:08 PM
To: [email protected]
Cc: Wei Yan <[email protected]>; [email protected]; Dariusz Sosnowski <[email protected]>; Slava Ovsiienko <[email protected]>; Bing Zhao <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>; Ophir Munk <[email protected]>; Dmitry Kozlyuk <[email protected]>
Subject: [PATCH v2] net/mlx5: avoid wildcard drop flow in priority discoveryFrom: Wei Yan <[email protected]>
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.
Quoted 6 lines
Fixes 3eca5f8a610e ("net/mlx5: move flow priority discovery to Verbs file")Fixes c5042f93a425 ("net/mlx5: discover max flow priority using DevX")Signed-off-by Wei Yan <[email protected]>Signed-off-by Gavin Hu <[email protected]>
Thanks
Hi,
Quoted 19 lines · Gavin Hu
From: Wei Yan <[email protected]>
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")Signed-off-by Wei Yan <[email protected]>Signed-off-by Gavin Hu <[email protected]>---
Review
Quoted 2 lines
(quoted diff) +2
-0+v2: +* Fixed the compiling issue by some compilers in mlx5_flow_verbs.c.
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh