net/mlx5: HWS, handle modify header actions dependency
authorYevgeny Kliteynik <kliteyn@nvidia.com>
Tue, 20 May 2025 18:46:42 +0000 (21:46 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 22 May 2025 03:44:21 +0000 (20:44 -0700)
commit01e035fd0380b285d72725adb5a45f1d73549db8
tree9939fd07e24b934292931a7c0e912b6aa5d20a5a
parent0b6e452caf03da63aeb2e84475771d6fb6d6cd99
net/mlx5: HWS, handle modify header actions dependency

Having adjacent accelerated modify header actions (so-called
pattern-argument actions) may result in inconsistent outcome.
These inconsistencies can take the form of writes to the same
field or a read coupled with a write to the same field. The
solution is to detect such dependencies and insert nops between
the offending actions.

The existing implementation had a few issues, which pretty much
required a complete rewrite of the code that handles these
dependencies.

In the new implementation we're doing the following:

* Checking any two adjacent actions for conflicts (not just
  odd-even pairs).
* Marking 'set' and 'add' action fields as destination, rather
  than source, for the purposes of checking for conflicts.
* Checking all types of actions ('add', 'set', 'copy') for
  dependencies.
* Managing offsets of the args in the buffer - copy the action
  args to the right place in the buffer.
* Checking that after inserting nops we're still within the number
  of supported actions - return an error otherwise.

Signed-off-by: Vlad Dogaru <vdogaru@nvidia.com>
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/1747766802-958178-5-git-send-email-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.h