All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tariq Toukan" <tariqt@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net] net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit
Date: Thu, 26 Nov 2026 11:58:56 +0000	[thread overview]
Message-ID: <sashiko-outbox-235455@kernel.org> (raw)
In-Reply-To: <20261125115815.87909-1-tariqt@nvidia.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] net/mlx5: off-by-one FDB sub-namespace priority in
  esw_chains_create() [1]
--

commit 60c8dade186c303e933b7f1b16d70cd37bc59342
Author: Tariq Toukan <tariqt@nvidia.com>

net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit

This commit sets the nf flowtable as the chains end table before creating
the root flow table in esw_chains_create(), ensuring the root table's miss
rule points to the nf flowtable chain rather than the slow path.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> index 4747841310914..f71cd03035924 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> @@ -1693,6 +1693,11 @@ esw_chains_create(struct mlx5_eswitch *esw, struct mlx5_flow_table *miss_fdb)
>  		goto nf_ft_err;
>  	}
>  
> +	/* Set the end table before opening the root, so that the root's
> +	 * miss rule goes to the nf flowtable chain, not to the slow path.
> +	 */
> +	mlx5_chains_set_end_ft(chains, nf_ft);
> +
>  	/* Always open the root for fast path */
>  	ft = mlx5_chains_get_table(chains, 0, 1, 0);
>  	if (IS_ERR(ft)) {
> @@ -1707,8 +1712,6 @@ esw_chains_create(struct mlx5_eswitch *esw, struct mlx5_flow_table *miss_fdb)
>  			goto level_1_err;
>  	}
>  
> -	mlx5_chains_set_end_ft(chains, nf_ft);
> -
>  	return 0;
>  
>  level_1_err:

[Severity: High]
This problem wasn't introduced by this patch, but does setting
attr.fs_base_prio to FDB_BYPASS_PATH (1) earlier in esw_chains_create()
cause an off-by-one priority lookup [1] when mlx5_chains_get_table()
creates managed FDB tables?

When mlx5_chains_create_table() creates a managed table in
MLX5_FLOW_NAMESPACE_FDB (the root table at chain 0, prio 1, level 0, or any
table when ignore_flow_level is not supported), it looks up the per-chain
sub-namespace and adds chains->fs_base_prio:

drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c:mlx5_chains_create_table() {
    ...
	if (!mlx5_chains_ignore_flow_level_supported(chains) ||
	    (chain == 0 && prio == 1 && level == 0)) {
		ft_attr.level = chains->fs_base_level;
		ft_attr.prio = chains->fs_base_prio + prio - 1;
		ns = (chains->ns == MLX5_FLOW_NAMESPACE_FDB) ?
			mlx5_get_fdb_sub_ns(chains->dev, chain) :
			mlx5_get_flow_namespace(chains->dev, chains->ns);
    ...
}

However, create_fdb_sub_ns_prio_chain() initializes each FDB sub-namespace
with 0-based priorities 0 through FDB_TC_MAX_PRIO - 1 (0..15).  Adding
FDB_BYPASS_PATH (1) places the root table at sub-namespace priority 1
instead of 0, and on devices without ignore_flow_level support, creating a
table at the maximum priority FDB_TC_MAX_PRIO (16) asks for ft_attr.prio =
16 and fails in find_prio() with -EINVAL.

[1] https://sashiko.dev/#/bug/linux-9702e5c8-96e6-42e9-a756-b9f79ba339e1

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125115815.87909-1-tariqt@nvidia.com?part=1

  reply	other threads:[~2026-11-26 11:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 11:58 [PATCH net] net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit Tariq Toukan
2026-11-26 11:58 ` sashiko-bot [this message]
2026-11-26 13:38 ` Daniel Machon
2026-11-30  3:50 ` patchwork-bot+netdevbpf

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=sashiko-outbox-235455@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.