netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, saeedm@nvidia.com, leon@kernel.org,
	tariqt@nvidia.com, andrew+netdev@lunn.ch, horms@kernel.org,
	donald.hunter@gmail.com, parav@nvidia.com
Subject: Re: [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info
Date: Tue, 25 Mar 2025 04:46:53 -0700	[thread overview]
Message-ID: <20250325044653.52fea697@kernel.org> (raw)
In-Reply-To: <20250320085947.103419-3-jiri@resnulli.us>

On Thu, 20 Mar 2025 09:59:45 +0100 Jiri Pirko wrote:
> +	start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size,
> +					     PCI_VPD_RO_KEYWORD_SERIALNO, &kw_len);
> +	if (start >= 0) {
> +		str = kstrndup(vpd_data + start, kw_len, GFP_KERNEL);
> +		if (!str) {
> +			err = -ENOMEM;
> +			goto end;
> +		}
> +		end = strchrnul(str, ' ');
> +		*end = '\0';
> +		err = devlink_info_board_serial_number_put(req, str);
> +		kfree(str);
> +	}
> +
> +	start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size, "V3", &kw_len);
> +	if (start >= 0) {
> +		str = kstrndup(vpd_data + start, kw_len, GFP_KERNEL);
> +		if (!str) {
> +			err = -ENOMEM;
> +			goto end;
> +		}
> +		err = devlink_info_serial_number_put(req, str);
> +		kfree(str);
> +	}

I suppose you only expect one of the fields to be populated but 
the code as is doesn't express that.

  parent reply	other threads:[~2025-03-25 11:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-20  8:59 [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Jiri Pirko
2025-03-20  8:59 ` [PATCH net-next v2 1/4] ynl: devlink: add missing board-serial-number Jiri Pirko
2025-03-23 17:47   ` Simon Horman
2025-03-24  4:08   ` Kalesh Anakkur Purayil
2025-03-20  8:59 ` [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info Jiri Pirko
2025-03-23 17:47   ` Simon Horman
2025-03-24  4:07   ` Kalesh Anakkur Purayil
2025-03-25 11:46   ` Jakub Kicinski [this message]
2025-03-31 13:06     ` Jiri Pirko
2025-03-31 16:22       ` Jakub Kicinski
2025-04-01  9:01         ` Jiri Pirko
2025-04-01 14:52           ` Jakub Kicinski
2025-03-20  8:59 ` [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info Jiri Pirko
2025-03-23 17:47   ` Simon Horman
2025-03-24  4:06   ` Kalesh Anakkur Purayil
2025-03-25 11:49   ` Jakub Kicinski
2025-03-20  8:59 ` [PATCH net-next v2 4/4] net/mlx5: Expose function UID in devlink info Jiri Pirko
2025-03-23 17:48   ` Simon Horman
2025-03-24  4:05   ` Kalesh Anakkur Purayil
2025-03-23 12:00 ` [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Tariq Toukan
2025-03-25 12:00 ` 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=20250325044653.52fea697@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=leon@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parav@nvidia.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;
as well as URLs for NNTP newsgroup(s).