From: Jiri Pirko <jiri@resnulli.us>
To: Adam Young <admiyo@os.amperecomputing.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [net-next v1.5] mlx5_core: fall back to dev->board_id for shd id
Date: Thu, 26 Mar 2026 06:27:42 +0100 [thread overview]
Message-ID: <pzmrqxtzpvmkxibv7uufya5wd2pw63idbj7upst6tieq4vxa3m@xfy2qfgitnsu> (raw)
In-Reply-To: <20260325221131.1001431-1-admiyo@os.amperecomputing.com>
Wed, Mar 25, 2026 at 11:11:31PM +0100, admiyo@os.amperecomputing.com wrote:
>Making the devlink device shared requires an identifier
>to uniquely related the netlink device and the physical
>board. The original code used the serial number, requested
>from the boards attributes. However, not all members of
>the family of cards expose that attribute. The module init
>will fail on these devices. As a fall back, the driver can
>use the board_id, which is guaranteed to be present, and
>which is unique for every board in a deployment.
>
>Signed-off-by: Adam Young <admiyo@os.amperecomputing.com>
>---
> drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.c
>index bc33f95302df..6fa691aca81f 100644
>--- a/drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.c
>+++ b/drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.c
>@@ -32,12 +32,14 @@ int mlx5_shd_init(struct mlx5_core_dev *dev)
> /* Fall-back to SN for older devices. */
> start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size,
> PCI_VPD_RO_KEYWORD_SERIALNO, &kw_len);
>- if (start < 0)
>- return -ENOENT;
> }
>- sn = kstrndup(vpd_data + start, kw_len, GFP_KERNEL);
>+ if (start < 0)
>+ sn = kstrndup(dev->board_id, MLX5_BOARD_ID_LEN, GFP_KERNEL);
Board id is PSID. That is not a serial, but rather type. That would
result in 2 nics of the same type to share 1 devlink instance, which is
wrong. Better to just don't create shared instance in case we can get
any identification in form of serial.
>+ else
>+ sn = kstrndup(vpd_data + start, kw_len, GFP_KERNEL);
> if (!sn)
> return -ENOMEM;
>+
> /* Firmware may return spaces at the end of the string, strip it. */
> end = strchrnul(sn, ' ');
> *end = '\0';
>--
>2.43.0
>
>
prev parent reply other threads:[~2026-03-26 5:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 22:11 [net-next v1.5] mlx5_core: fall back to dev->board_id for shd id Adam Young
2026-03-26 5:27 ` Jiri Pirko [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=pzmrqxtzpvmkxibv7uufya5wd2pw63idbj7upst6tieq4vxa3m@xfy2qfgitnsu \
--to=jiri@resnulli.us \
--cc=admiyo@os.amperecomputing.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mbloch@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