From: Yevgeny Kliteynik <kliteyn@nvidia.com>
To: Alexandre Cassen <acassen@corp.free.fr>,
Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Moshe Shemesh <moshe@nvidia.com>,
Hamdan Agbariya <hamdani@nvidia.com>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH net v3 2/2] net/mlx5: HWS, fix modify header pool match for copy actions
Date: Mon, 19 Oct 2026 17:49:46 +0300 [thread overview]
Message-ID: <e8623784-820f-4bb2-b097-f94ffd6bca95@nvidia.com> (raw)
In-Reply-To: <20261019133159.1742411-3-acassen@corp.free.fr>
On 19-Oct-26 16:31, Alexandre Cassen wrote:
> mlx5_fs_hws_mh_pool_match() compares a single dword of each action
> since rules pass their values as arguments. Copy and add_field actions
> keep their destination in the second dword and HWS reads them from the
> pattern alone. Two modify headers whose copies differ only in
> destination then share a pool and the second rule writes to the wrong
> field.
>
> Use the HWS core comparison that checks these actions in full.
>
> Found while checking a Sashiko AI review report and confirmed against
> the HWS pattern code. Not reproduced. No in-kernel user puts such
> actions on the FDB but RDMA flow actions can. Tested for regressions on
> ConnectX-7 with firmware 28.48.1000 on a little-endian host.
>
> Fixes: b36315ca69cb ("net/mlx5: fs, add HWS modify header API function")
> Signed-off-by: Alexandre Cassen <acassen@corp.free.fr>
> ---
> .../mellanox/mlx5/core/steering/hws/fs_hws_pools.c | 11 ++++-------
> .../mellanox/mlx5/core/steering/hws/pat_arg.c | 8 ++++----
> .../mellanox/mlx5/core/steering/hws/pat_arg.h | 5 +++++
> 3 files changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.c
> index 86828e329187..05aa143fa088 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.c
> @@ -3,6 +3,7 @@
>
> #include <mlx5_core.h>
> #include "fs_hws_pools.h"
> +#include "internal.h"
>
> #define MLX5_FS_HWS_DEFAULT_BULK_LEN 65536
> #define MLX5_FS_HWS_POOL_MAX_THRESHOLD BIT(18)
> @@ -389,7 +390,7 @@ bool mlx5_fs_hws_mh_pool_match(struct mlx5_fs_pool *mh_pool,
> struct mlx5hws_action_mh_pattern *pattern)
> {
> struct mlx5hws_action_mh_pattern *pool_pattern;
> - int num_actions, i;
> + int num_actions;
>
> pool_pattern = mh_pool->pool_ctx;
> if (WARN_ON_ONCE(!pool_pattern))
> @@ -398,12 +399,8 @@ bool mlx5_fs_hws_mh_pool_match(struct mlx5_fs_pool *mh_pool,
> if (pattern->sz != pool_pattern->sz)
> return false;
> num_actions = pattern->sz / MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto);
> - for (i = 0; i < num_actions; i++) {
> - if ((__force __be32)pattern->data[i] !=
> - (__force __be32)pool_pattern->data[i])
> - return false;
> - }
> - return true;
> + return mlx5hws_pat_compare_pattern(num_actions, pool_pattern->data,
> + num_actions, pattern->data);
> }
>
> struct mlx5hws_action *mlx5_fc_get_hws_action(struct mlx5hws_context *ctx,
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
> index 512299b59fd0..a49115f04025 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
> @@ -96,10 +96,10 @@ void mlx5hws_pat_uninit_pattern_cache(struct mlx5hws_pattern_cache *cache)
> kfree(cache);
> }
>
> -static bool mlx5hws_pat_compare_pattern(int cur_num_of_actions,
> - __be64 cur_actions[],
> - int num_of_actions,
> - __be64 actions[])
> +bool mlx5hws_pat_compare_pattern(int cur_num_of_actions,
> + __be64 cur_actions[],
> + int num_of_actions,
> + __be64 actions[])
> {
> int i;
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.h
> index 7fbd8dc7aa18..2be7787104e1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.h
> @@ -49,6 +49,11 @@ int mlx5hws_pat_init_pattern_cache(struct mlx5hws_pattern_cache **cache);
>
> void mlx5hws_pat_uninit_pattern_cache(struct mlx5hws_pattern_cache *cache);
>
> +bool mlx5hws_pat_compare_pattern(int cur_num_of_actions,
> + __be64 cur_actions[],
> + int num_of_actions,
> + __be64 actions[]);
> +
> bool mlx5hws_pat_verify_actions(struct mlx5hws_context *ctx, __be64 pattern[], size_t sz);
>
> int mlx5hws_arg_create(struct mlx5hws_context *ctx,
Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
prev parent reply other threads:[~2026-10-19 14:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 13:31 [PATCH net v3 0/2] net/mlx5: HWS, fix modify header pattern compare Alexandre Cassen
2026-10-19 13:31 ` [PATCH net v3 1/2] net/mlx5: HWS, fix modify header pattern compare on big-endian Alexandre Cassen
2026-10-19 14:49 ` Yevgeny Kliteynik
2026-10-19 13:31 ` [PATCH net v3 2/2] net/mlx5: HWS, fix modify header pool match for copy actions Alexandre Cassen
2026-10-19 14:49 ` Yevgeny Kliteynik [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e8623784-820f-4bb2-b097-f94ffd6bca95@nvidia.com \
--to=kliteyn@nvidia.com \
--cc=acassen@corp.free.fr \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hamdani@nvidia.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox