net/mlx5: fix NOP insertion for modify field read-write
PATCH 1/1 net/mlx5: fix NOP insertion for modify field read-write
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.
--- drivers/net/mlx5/mlx5_flow_hw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +4 -2
@@ -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
Signature · 1 line
2.25.1
Patch applied to next-net-mlx.
Thanks,
Raslan Darawsheh