DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix NOP insertion for modify field read-write
@ 2026-11-09 12:50 Maayan Kashani
  2026-11-11 13:10 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Maayan Kashani @ 2026-11-09 12:50 UTC (permalink / raw)
  To: dev
  Cc: dsosnowski, viacheslavo, bingz, orika, suanmingm, matan,
	Maayan Kashani, stable

In HWS non-root groups, modify field actions are compiled into a
modify header pattern. When a COPY or ADD_FIELD reads a field and the
next SET or ADD writes that same field, no NOP was inserted between
them. Firmware rejects the resulting pattern at template table
creation with syndrome 0xa0a3a8.

flow_hw_should_insert_nop() only compared the new command's
destination with the previous command's destination. After a
COPY or ADD_FIELD it never compared against the previous source
field, which is the one that was read.

Extend the checks so a NOP is inserted when:
- a SET or ADD writes a field read by the previous COPY or ADD_FIELD,
- a COPY or ADD_FIELD writes a field read by the previous COPY or
  ADD_FIELD.

Two consecutive reads of the same field still do not need a NOP.

Fixes: 0f4aa72b99da ("net/mlx5: support flow modify field with HWS")
Cc: stable@dpdk.org

Signed-off-by: Maayan Kashani <mkashani@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 8b74f66770b..acbbeb4002f 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -1572,7 +1572,8 @@ flow_hw_should_insert_nop(const struct mlx5_hw_modify_header_action *mhdr,
 			should_insert = new_cmd.field == last_cmd.field;
 		else if (last_type == MLX5_MODIFICATION_TYPE_COPY ||
 			 last_type == MLX5_MODIFICATION_TYPE_ADD_FIELD)
-			should_insert = new_cmd.field == last_cmd.dst_field;
+			should_insert = (new_cmd.field == last_cmd.dst_field ||
+					 new_cmd.field == last_cmd.field);
 		else if (last_type == MLX5_MODIFICATION_TYPE_NOP)
 			should_insert = false;
 		else
@@ -1587,7 +1588,8 @@ flow_hw_should_insert_nop(const struct mlx5_hw_modify_header_action *mhdr,
 		else if (last_type == MLX5_MODIFICATION_TYPE_COPY ||
 			 last_type == MLX5_MODIFICATION_TYPE_ADD_FIELD)
 			should_insert = (new_cmd.field == last_cmd.dst_field ||
-					 new_cmd.dst_field == last_cmd.dst_field);
+					 new_cmd.dst_field == last_cmd.dst_field ||
+					 new_cmd.dst_field == last_cmd.field);
 		else if (last_type == MLX5_MODIFICATION_TYPE_NOP)
 			should_insert = false;
 		else
-- 
2.25.1


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

end of thread, other threads:[~2026-11-11 13:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09 12:50 [PATCH] net/mlx5: fix NOP insertion for modify field read-write Maayan Kashani
2026-11-11 13:10 ` Raslan Darawsheh

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