From: Shay Drory <shayd@nvidia.com>
To: <netdev-bot+sashiko@kernel.org>
Cc: <tariqt@nvidia.com>, <andrew+netdev@lunn.ch>,
<davem@davemloft.net>, <edumazet@kernel.org>, <kuba@kernel.org>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>,
<cjubran@nvidia.com>, <cratiu@nvidia.com>, <gal@nvidia.com>,
<leon@kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-rdma@vger.kernel.org>, <mbloch@nvidia.com>,
<moshe@nvidia.com>, <ohartoov@nvidia.com>, <phaddad@nvidia.com>,
<saeedm@nvidia.com>, <udar@nvidia.com>
Subject: Re: [PATCH net-next V2 01/10] net/mlx5: Distinguish VFs/SFs in the SW system image GUID for LAG grouping
Date: Thu, 19 Nov 2026 09:40:37 +0200 [thread overview]
Message-ID: <20261119074037.1583630-1-shayd@nvidia.com> (raw)
In-Reply-To: <179499791273.3136.2247906810795336370@kernel.org>
On Wed, 18 Nov 2026 10:31:52 +0000, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
>
> 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] The patch changes the SW system image GUID of a VF/SF that
> passes mlx5_virt_lag_is_supported(): mlx5_sw_guid_vf() or…
>
> --
>
> net/mlx5: Distinguish VFs/SFs in the SW system image GUID for LAG grouping
>
> This patch changes mlx5_query_nic_sw_system_image_guid() so that each
> discriminator byte after the FW system image GUID has a fixed position,
> and trailing zero fields are trimmed. It adds VF and SF marker bytes that
> are only set when mlx5_virt_lag_is_supported() is true, and it raises
> MLX5_SW_IMAGE_GUID_MAX_BYTES from 9 to 11.
>
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
> > index 78f3d15b599d0..bab43df6a7d72 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
> > @@ -1308,10 +1308,37 @@ u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev)
> > }
> > EXPORT_SYMBOL_GPL(mlx5_query_nic_system_image_guid);
> >
> > +static u8 mlx5_sw_guid_load_balance(const struct mlx5_core_dev *mdev)
> > +{
> > + if (MLX5_CAP_GEN_2(mdev, load_balance_id) &&
> > + MLX5_CAP_GEN_2(mdev, lag_per_mp_group))
> > + return MLX5_CAP_GEN_2(mdev, load_balance_id);
> > + return 0;
> > +}
> > +
> > +static u8 mlx5_sw_guid_sf(const struct mlx5_core_dev *mdev)
> > +{
> > + return mlx5_core_is_sf(mdev) && mlx5_virt_lag_is_supported(mdev);
> > +}
> > +
> > +static u8 mlx5_sw_guid_vf(const struct mlx5_core_dev *mdev)
> > +{
> > + return mlx5_core_is_vf(mdev) && mlx5_virt_lag_is_supported(mdev);
> > +}
>
> [Severity: Medium]
> Does this break the same-HW check between a PF and a VF/SF that passes
> mlx5_virt_lag_is_supported()?
>
> Suppose the VF/SF's own caps report multi_uplink_eswitch=1, lag_master=1
> and num_lag_ports < 2. The VF key then becomes guid + [lb|0] + 0x01, which
> is 10 bytes. The SF key becomes guid + [lb|0] + 0x00 + 0x01, which is 11
> bytes. A PF never sets either marker, so its key is still 8 or 9 bytes.
>
> mlx5_same_hw_devs() requires the lengths to match:
>
> drivers/net/ethernet/mellanox/mlx5/core/dev.c:mlx5_same_hw_devs() {
> ...
> return plen && flen && flen == plen &&
> !memcmp(fsystem_guid, psystem_guid, flen);
> }
>
> That means it now returns false for any PF paired with such a VF/SF.
>
> mlx5e_tc_is_vf_tunnel() only reaches that comparison when out_mdev is a
> PF and route_mdev is a VF/SF:
>
> drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:mlx5e_tc_is_vf_tunnel() {
> ...
> if (route_mdev->coredev_type != MLX5_COREDEV_VF &&
> route_mdev->coredev_type != MLX5_COREDEV_SF)
> return false;
>
> return mlx5e_same_hw_devs(out_priv, route_priv);
> }
>
> For a virt-LAG-capable VF/SF route device, will it now always return
> false? These are the paths that would be affected:
>
> mlx5e_set_vf_tunnel()
> mlx5e_tc_is_vf_tunnel()
> mlx5e_same_hw_devs()
> mlx5_same_hw_devs()
>
> - In mlx5e_set_vf_tunnel() the check fails and the code jumps to out with
> err = 0. The encap flow is still offloaded, but without the VF vport
> source port rewrite (MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE plus the
> VPORT_TO_REG metadata). The encapsulated packet then goes straight to
> the uplink and skips FDB processing of the VF vport.
>
> - mlx5e_update_vf_tunnel() returns -ENODEV on route updates.
>
> - On decap, mlx5e_tc_tun_route_lookup() no longer sets
> rx_tun_attr->decap_vport to the VF vport.
>
> - In mirred_nic.c, the NIC-mode redirect check
>
> if (priv->netdev->netdev_ops != out_dev->netdev_ops ||
> !mlx5e_same_hw_devs(priv, netdev_priv(out_dev))) {
>
> now rejects redirects between a PF netdev and such a VF/SF netdev with
> "devices are not on same switch HW".
>
> The commit message says:
>
> "so a VF/SF that cannot join a virt LAG keeps its current key and is
> still identified as the same HW as its PF."
>
> That covers VFs/SFs that cannot join a virt LAG. It doesn't cover the
> ones that can, and none of the consumers above are updated.
>
> Should mlx5_same_hw_devs() compare without the VF/SF markers? Or should
> the LAG grouping key be kept separate from the key used for same-HW
> detection?
No, this is the point of the patch. A VF/SF that reports
multi_uplink_eswitch and lag_master (and num_lag_ports < 2) is a nested
eswitch manager. That makes it a different switch domain from its
PF, not one more vport of the PF's FDB, so it must not be identified as
the same HW as the PF. Without the marker it would also be grouped into
the PF's LAG, which is what the patch prevents.
A VF/SF that does not report these caps, i.e. every VF/SF that exists
today, keeps its key unchanged and is still the same HW as its PF, as
the commit message says. Dropping the markers inside mlx5_same_hw_devs()
would make a nested eswitch manager the same HW as its PF again, i.e.
undo the patch.
> > +
> > +static u8 (* const mlx5_sw_guid_fields[])(const struct mlx5_core_dev *mdev) = {
> > + mlx5_sw_guid_load_balance,
> > + mlx5_sw_guid_vf,
> > + mlx5_sw_guid_sf,
> > + /* New fields should be added at the end */
> > +};
>
> [ ... ]
>
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116103010.1129666-1-tariqt%40nvidia.com
next prev parent reply other threads:[~2026-11-19 7:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 10:30 [PATCH net-next V2 00/10] net/mlx5: LAG, preparations for LAG over VFs/SFs Tariq Toukan
2026-11-16 10:30 ` [PATCH net-next V2 01/10] net/mlx5: Distinguish VFs/SFs in the SW system image GUID for LAG grouping Tariq Toukan
2026-11-18 10:31 ` netdev-bot+sashiko
2026-11-19 7:40 ` Shay Drory [this message]
2026-11-16 10:30 ` [PATCH net-next V2 02/10] net/mlx5: LAG, select the MPESW master from the live member snapshot Tariq Toukan
2026-11-16 10:30 ` [PATCH net-next V2 03/10] net/mlx5: LAG, skip phys LAG prerequisites for a virt LAG Tariq Toukan
2026-11-16 10:30 ` [PATCH net-next V2 04/10] net/mlx5: LAG, treat virt LAG as a software managed LAG Tariq Toukan
2026-11-16 10:30 ` [PATCH net-next V2 05/10] net/mlx5: LAG, decouple iteration end-of-walk from MLX5_MAX_PORTS Tariq Toukan
2026-11-18 10:31 ` netdev-bot+sashiko
2026-11-19 8:10 ` Shay Drory
2026-11-16 10:30 ` [PATCH net-next V2 06/10] net/mlx5: LAG, rename PF naming to fn Tariq Toukan
2026-11-18 10:31 ` netdev-bot+sashiko
2026-11-16 10:30 ` [PATCH net-next V2 07/10] net/mlx5: LAG, resolve affinity indices only in queue-affinity mode Tariq Toukan
2026-11-16 10:30 ` [PATCH net-next V2 08/10] net/mlx5: LAG: replace fixed MLX5_MAX_PORTS arrays with dynamic allocation Tariq Toukan
2026-11-18 10:31 ` netdev-bot+sashiko
2026-11-16 10:30 ` [PATCH net-next V2 09/10] net/mlx5: LAG, drop MLX5_MAX_PORTS scratch array from device rescan Tariq Toukan
2026-11-18 10:31 ` netdev-bot+sashiko
2026-11-16 10:30 ` [PATCH net-next V2 10/10] net/mlx5: LAG, do not add a device to an already-active virt LAG Tariq Toukan
2026-11-18 10:32 ` netdev-bot+sashiko
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=20261119074037.1583630-1-shayd@nvidia.com \
--to=shayd@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=cjubran@nvidia.com \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gal@nvidia.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=moshe@nvidia.com \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ohartoov@nvidia.com \
--cc=pabeni@redhat.com \
--cc=phaddad@nvidia.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=udar@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