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: [email protected]
Signed-off-by: Maayan Kashani <[email protected]>
Acked-by: Dariusz Sosnowski <[email protected]>
---
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