All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tariq Toukan" <tariqt@nvidia.com>
Cc: linux-pci@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH net V2 1/4] {RDMA,net}/mlx5: cache and use TX-enabled aggregate speed for vports
Date: Fri, 23 Oct 2026 19:32:03 +0000	[thread overview]
Message-ID: <sashiko-outbox-183120@kernel.org> (raw)
In-Reply-To: <20261022193053.3815866-2-tariqt@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net/mlx5: lag: missing agg_speed_mbps reset on MPESW and mode-change teardown
--

commit ce16ef57f040ab430add649db26c3f383cbab840
Author: Or Har-Toov <ohartoov@nvidia.com>

{RDMA,net}/mlx5: cache and use TX-enabled aggregate speed for vports

This commit caches the calculated operational TX-enabled aggregate speed in
struct mlx5_lag and exposes mlx5_lag_query_aggregated_speed() to query it
instead of the bond speed. It also resets the cached speed to SPEED_UNKNOWN
via mlx5_lag_reset_agg_speed() when resetting vports speed.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> index 4e173b08cb37a..57755ceab8a75 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c

[ ... ]

> @@ -1594,6 +1625,7 @@ void mlx5_lag_reset_vports_speed(struct mlx5_lag *ldev)
>  	int pf_idx;
>  	int ret;
>  
> +	mlx5_lag_reset_agg_speed(ldev);
>  	mlx5_ldev_for_each(pf_idx, 0, ldev) {
>  		pf = mlx5_lag_pf(ldev, pf_idx);
>  		if (!pf)

[Severity: Medium]
Does calling mlx5_lag_reset_agg_speed() only from
mlx5_lag_reset_vports_speed() miss resetting ldev->agg_speed_mbps (and vport
speeds) when LAG is torn down via MPESW disable or mode changes?

Currently, mlx5_lag_reset_vports_speed() is only called from mlx5_do_bond()
when mlx5_lag_should_disable_lag() returns true:

drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c:mlx5_do_bond() {
	...
	} else if (mlx5_lag_should_disable_lag(ldev, do_bond)) {
		mlx5_lag_reset_vports_speed(ldev);
		mlx5_disable_lag(ldev);
	}
}

where mlx5_lag_should_disable_lag() checks:

	return !do_bond && __mlx5_lag_is_active(ldev) &&
	       ldev->mode != MLX5_LAG_MODE_MPESW;

When MPESW LAG is enabled via mlx5_lag_enable_mpesw() ->
mlx5_lag_shared_fdb_create(), mlx5_lag_set_vports_agg_speed() populates
ldev->agg_speed_mbps (and mlx5_mpesw_speed_update_work() updates it).
However, when MPESW is torn down via mlx5_lag_disable_mpesw():

drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c:mlx5_lag_disable_mpesw() {
	if (ldev->mode != MLX5_LAG_MODE_MPESW)
		return;

	mlx5_mpesw_metadata_cleanup(ldev);
	mlx5_lag_shared_fdb_destroy(ldev, MLX5_LAG_FILTER_ALL);
	if (mlx5_lag_has_sd_group(ldev))
		mlx5_mpesw_restore_sd_fdb(ldev);
}

neither mlx5_lag_reset_vports_speed() nor mlx5_lag_reset_agg_speed() is
called, and mlx5_lag_should_disable_lag() explicitly excludes
MLX5_LAG_MODE_MPESW.

Similarly, during eswitch mode or SR-IOV changes, mlx5_lag_disable_change()
disables an active LAG directly without calling
mlx5_lag_reset_vports_speed() or mlx5_lag_reset_agg_speed():

drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c:mlx5_lag_disable_change() {
	...
	ldev->mode_changes_in_progress++;
	if (__mlx5_lag_is_active(ldev)) {
		if (ldev->mode == MLX5_LAG_MODE_MPESW)
			mlx5_lag_disable_mpesw(ldev);
		else
			mlx5_disable_lag(ldev);
	}
}

Because mlx5_disable_lag() -> mlx5_deactivate_lag() clears ldev->mode to
MLX5_LAG_MODE_NONE, when mlx5_lag_enable_change() later runs mlx5_do_bond(),
__mlx5_lag_is_active(ldev) is already false. If do_bond is false (for
example, if mlx5_lag_check_prereq(ldev) is now false after a mode change or
if the bond was removed during the transition), mlx5_lag_should_disable_lag()
evaluates to false and the reset never runs.

Wouldn't this leave a stale speed in ldev->agg_speed_mbps (and stale vport
rate limits) after teardown, causing mlx5_lag_query_aggregated_speed() to
return the old speed instead of -ENODATA, and in the subsequent patch
("{RDMA,net}/mlx5: notify IB uplink on LAG aggregate speed change") causing
mlx5_lag_update_agg_speed() to compare against the stale old_speed and
suppress IB_EVENT_DEVICE_SPEED_CHANGE if LAG is re-activated at the same
aggregate speed?

[ ... ]

>
>
>

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

  reply	other threads:[~2026-10-23 19:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 19:30 [PATCH net V2 0/4] net/mlx5: fixes for LAG max_tx_speed update flow Tariq Toukan
2026-10-22 19:30 ` [PATCH net V2 1/4] {RDMA,net}/mlx5: cache and use TX-enabled aggregate speed for vports Tariq Toukan
2026-10-23 19:32   ` sashiko-bot [this message]
2026-10-28 17:57     ` Or Har-Toov
2026-10-26 20:32   ` netdev-bot+sashiko
2026-10-28 18:06     ` Or Har-Toov
2026-10-22 19:30 ` [PATCH net V2 2/4] net/mlx5: Lag, limit aggregated TX speed by PCIe bandwidth Tariq Toukan
2026-10-23 19:32   ` sashiko-bot
2026-10-23 20:06   ` Bjorn Helgaas
2026-10-28 18:08     ` Or Har-Toov
2026-10-26 20:32   ` netdev-bot+sashiko
2026-10-22 19:30 ` [PATCH net V2 3/4] {RDMA,net}/mlx5: notify IB uplink on LAG aggregate speed change Tariq Toukan
2026-10-23 19:32   ` sashiko-bot
2026-10-26 20:32   ` netdev-bot+sashiko
2026-10-22 19:30 ` [PATCH net V2 4/4] net/mlx5: Lag, save and restore vport max_tx_speed across LAG Tariq Toukan
2026-10-23 19:32   ` sashiko-bot
2026-10-26 20:32   ` netdev-bot+sashiko
2026-10-22 19:37 ` [PATCH net V2 0/4] net/mlx5: fixes for LAG max_tx_speed update flow netdev-bot+sinfo
2026-10-25 14:59   ` Or Har-Toov

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-183120@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.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.