Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: tariqt@nvidia.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com,
	agoldberger@nvidia.com, gal@nvidia.com, jgg@ziepe.ca,
	leon@kernel.org, linux-rdma@vger.kernel.org, mbloch@nvidia.com,
	moshe@nvidia.com, ohartoov@nvidia.com, saeedm@nvidia.com,
	shayd@nvidia.com
Subject: Re: [PATCH net-next V2 5/5] net/mlx5: LAG, enable LAG over functions that do not represent a physical port
Date: Tue, 24 Nov 2026 08:32:54 +0000	[thread overview]
Message-ID: <179550917403.3135.6078772385370645877@kernel.org> (raw)
In-Reply-To: <20261120075959.2533702-6-tariqt@nvidia.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 2

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] mlx5_lag_add_mdev() now lets any VF/SF that passes
  mlx5_virt_lag_is_supported() into the LAG, and nothing caps how many…
- [Medium] net/mlx5: LAG, empty debugfs member list in members_show() for
  virt_lag
- [Low] For a virt LAG, vport speed aggregation does nothing at all.
- [Low] The commit message does not mention that the exported
  mlx5_lag_is_mpesw() changes meaning.

--

net/mlx5: LAG, enable LAG over functions that do not represent a physical port

This patch lets VF/SF functions that sit behind a multi_uplink_eswitch
(num_lag_ports < 2) join a LAG, using mlx5_virt_lag_is_supported() to
detect them. Such members are not marked as ports. They do not register
the PORT_CHANGE, netdev or multipath FIB notifiers, and they do not add
netdevs to the LAG.

The patch also widens mlx5_lag_get_filter() and mlx5_lag_is_mpesw() for
virt LAG, makes mlx5_lag_get_num_ports() return at least 1, and stops
RDMA from assigning a TX port affinity for these functions.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> index 193fbe47fef15..2cd2319f93189 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c

[ ... ]

> @@ -2398,7 +2404,7 @@ int mlx5_ldev_add_mdev(struct mlx5_lag *ldev,
>  	fn->group_id = group_id;
>  	dev->priv.lag = ldev;
>  
> -	if (group_id)
> +	if (group_id || ldev->virt_lag)
>  		return 0;
>  
>  	xa_set_mark(&ldev->fns, idx, MLX5_LAG_XA_MARK_PORT);

[Severity: Medium]
Does this early return also leave the lag/members debugfs file empty
for every virt LAG device?

mlx5_lag_add_mdev() now lets virt-LAG capable functions through. On
success it calls mlx5_ldev_add_debugfs(dev), which creates the lag
directory, including the members file.

members_show() in lag/debugfs.c lists the members with:

	mlx5_ldev_for_each(i, 0, ldev)
		seq_printf(file, "%s\n",
			   dev_name(mlx5_lag_fn(ldev, i)->dev->device));

mlx5_ldev_for_each() uses MLX5_LAG_FILTER_PORTS, so
mlx5_get_next_lag_func() only walks entries marked with
MLX5_LAG_XA_MARK_PORT. A virt-LAG member returns here before
xa_set_mark() runs, so no entry in ldev->fns carries the mark.
Reading lag/members on such a device then always prints nothing, even
when the LAG has members.

This patch already switched mlx5_lag_get_filter() to
MLX5_LAG_FILTER_ALL for virt LAG because its members are not marked
as ports. Should members_show() use the same per-device filter, or
MLX5_LAG_FILTER_ALL when ldev->virt_lag is set, so the file reports
the real members? Or is the members file not meant to exist for a
virt LAG?

[Severity: Low]
Because of this early return for virt_lag, no virt-LAG member ever gets
MLX5_LAG_XA_MARK_PORT or the PORT_CHANGE notifier. Does that leave vport
speed aggregation doing nothing for a virt LAG?

mlx5_lag_enable_mpesw() calls mlx5_lag_shared_fdb_create() with
MLX5_LAG_FILTER_ALL, and that function then does:

	if (filter == MLX5_LAG_FILTER_PORTS || filter == MLX5_LAG_FILTER_ALL)
		mlx5_lag_set_vports_agg_speed(ldev);

mlx5_lag_set_vports_agg_speed(), mlx5_lag_get_devices_oper_speed() and
mlx5_lag_get_devices_max_speed() all iterate with mlx5_ldev_for_each(),
which only visits PORT-marked entries. For a virt LAG the summed speed
is 0, and the loop that calls mlx5_lag_modify_device_vports_speed() runs
zero times.

The skipped notifier, mlx5_lag_mpesw_port_change_event(), is the only
place that queues speed_update_work. So nothing would refresh the speed
later either.

Other virt-LAG paths in this series were moved to MLX5_LAG_FILTER_ALL
(for example mlx5_lag_get_devcom_comp()). If speed aggregation is not
meant to apply to virt LAG, should mlx5_lag_shared_fdb_create() skip the
call explicitly? If it is meant to apply, should the speed helpers and
the refresh trigger cover all members?

> @@ -2547,7 +2553,7 @@ void mlx5_lag_add_mdev(struct mlx5_core_dev *dev)
>  {
>  	int err;
>  
> -	if (!mlx5_lag_is_supported(dev))
> +	if (!mlx5_lag_is_supported(dev) && !mlx5_virt_lag_is_supported(dev))
>  		return;
>  
>  	if (mlx5_lag_register_hca_devcom_comp(dev))

[Severity: Medium]
Can the retry loop below this check spin forever once a virt LAG has 255
members?

mlx5_lag_add_mdev() gives up only on -EOPNOTSUPP:

	if (err == -EOPNOTSUPP) {
		mlx5_lag_unregister_hca_devcom_comp(dev);
		return;
	}
	if (err) {
		msleep(100);
		goto recheck;
	}

The devcom match key comes from mlx5_query_nic_sw_system_image_guid().
It is the system image GUID plus the load_balance_id and VF/SF flag
bytes. So every virt-LAG capable SF (or VF) of the same NIC in the same
netns would join the same ldev through __mlx5_lag_dev_add_mdev().

mlx5_ldev_add_mdev() allocates the slot with:

	err = xa_alloc(&ldev->fns, &idx, fn, XA_LIMIT(0, U8_MAX - 1),
		       GFP_KERNEL);

After 255 members this returns -EBUSY, and __mlx5_lag_dev_add_mdev()
passes it back unchanged. This happens when MPESW is not yet active;
otherwise the late-joiner -EOPNOTSUPP check returns first. The xarray
stays full between iterations, so mlx5_load() for the 256th function
would sleep and retry until some other member unloads.

An earlier patch in this series ("net/mlx5: E-switch, add match-metadata
allocator for nested VF/SF eswitches") already mentions the 0-254 slot
limit from this xa_alloc(). Before this patch, only vport_group_manager
PFs with 2..MLX5_MAX_PORTS lag ports reached this path, so the limit
could not be hit.

Should a permanent capacity error end the LAG join the same way
-EOPNOTSUPP does, instead of being retried like a transient error?

[ ... ]

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
> index 2d3e61541d8a1..0ef2d13d00968 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
> @@ -336,7 +336,7 @@ bool mlx5_lag_is_mpesw(struct mlx5_core_dev *dev)
>  	struct mlx5_lag *ldev = mlx5_lag_dev(dev);
>  
>  	return ldev && ldev->mode == MLX5_LAG_MODE_MPESW &&
> -	       __mlx5_lag_dev_is_port(ldev, dev);
> +	       (ldev->virt_lag || __mlx5_lag_dev_is_port(ldev, dev));
>  }
>  EXPORT_SYMBOL(mlx5_lag_is_mpesw);

[Severity: Low]
This isn't a bug, but the commit message does not say that the exported
mlx5_lag_is_mpesw() now returns true for every virt-LAG member, not only
for port-marked ones.

It also does not mention the change in mlx5_lag_get_filter():

	if (fn && (fn->group_id || ldev->virt_lag))
		return MLX5_LAG_FILTER_ALL;

With this change, mlx5_lag_get_dev_seq(), mlx5_lag_get_next_peer_mdev()
and the related helpers walk all members of a virt LAG.

Several places call mlx5_lag_is_mpesw():

  - eswitch_offloads.c (uplink destination type)
  - en_tc.c
  - en/tc_tun.c
  - ib_rep.c
  - a devlink parameter getter in eswitch.c, which reports the value to
    user space

Their behavior for VF/SF functions now changes. Could the commit message
describe these two changes?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120075959.2533702-1-tariqt%40nvidia.com

  parent reply	other threads:[~2026-11-24  8:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  7:59 [PATCH net-next V2 0/5] net/mlx5: LAG over VFs/SFs (virtual LAG) Tariq Toukan
2026-11-20  7:59 ` [PATCH net-next V2 1/5] net/mlx5: E-switch, add match-metadata allocator for nested VF/SF eswitches Tariq Toukan
2026-11-21  8:02   ` sashiko-bot
2026-11-24  8:32   ` netdev-bot+sashiko
2026-11-20  7:59 ` [PATCH net-next V2 2/5] net/mlx5: E-switch, match master egress rule by vport metadata Tariq Toukan
2026-11-20  7:59 ` [PATCH net-next V2 3/5] net/mlx5: E-switch, drop master egress rule under a SW vport LAG Tariq Toukan
2026-11-24  8:32   ` netdev-bot+sashiko
2026-11-20  7:59 ` [PATCH net-next V2 4/5] net/mlx5e: Register eswitch-manager VF/SF self-port with switch-id Tariq Toukan
2026-11-21  8:02   ` sashiko-bot
2026-11-24  8:32   ` netdev-bot+sashiko
2026-11-20  7:59 ` [PATCH net-next V2 5/5] net/mlx5: LAG, enable LAG over functions that do not represent a physical port Tariq Toukan
2026-11-21  8:02   ` sashiko-bot
2026-11-24  8:32   ` netdev-bot+sashiko [this message]
2026-11-21  8:02 ` [PATCH net-next V2 0/5] net/mlx5: LAG over VFs/SFs (virtual LAG) sashiko-bot

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=179550917403.3135.6078772385370645877@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=agoldberger@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=gal@nvidia.com \
    --cc=jgg@ziepe.ca \
    --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=ohartoov@nvidia.com \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=shayd@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