From: Ivan Vecera <ivecera@redhat.com>
To: netdev@vger.kernel.org
Cc: intel-wired-lan@lists.osuosl.org,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
linux-kernel@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"David S . Miller" <davem@davemloft.net>
Subject: [Intel-wired-lan] [PATCH net-next 5/5] i40e: Add PBA as board id info to devlink .info_get
Date: Fri, 13 Oct 2023 19:07:55 +0200 [thread overview]
Message-ID: <20231013170755.2367410-6-ivecera@redhat.com> (raw)
In-Reply-To: <20231013170755.2367410-1-ivecera@redhat.com>
Expose stored PBA ID string as unique board identifier via
devlink's .info_get command.
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
drivers/net/ethernet/intel/i40e/i40e_devlink.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_devlink.c b/drivers/net/ethernet/intel/i40e/i40e_devlink.c
index fb6144d74c98..9168ade8da47 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_devlink.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_devlink.c
@@ -29,7 +29,15 @@ static void i40e_info_fw_api(struct i40e_hw *hw, char *buf, size_t len)
snprintf(buf, len, "%u.%u", aq->api_maj_ver, aq->api_min_ver);
}
+static void i40e_info_pba(struct i40e_hw *hw, char *buf, size_t len)
+{
+ buf[0] = '\0';
+ if (hw->pba_id)
+ strscpy(buf, hw->pba_id, len);
+}
+
enum i40e_devlink_version_type {
+ I40E_DL_VERSION_FIXED,
I40E_DL_VERSION_RUNNING,
};
@@ -41,6 +49,8 @@ static int i40e_devlink_info_put(struct devlink_info_req *req,
return 0;
switch (type) {
+ case I40E_DL_VERSION_FIXED:
+ return devlink_info_version_fixed_put(req, key, value);
case I40E_DL_VERSION_RUNNING:
return devlink_info_version_running_put(req, key, value);
}
@@ -90,6 +100,12 @@ static int i40e_devlink_info_get(struct devlink *dl,
i40e_info_civd_ver(hw, buf, sizeof(buf));
err = i40e_devlink_info_put(req, I40E_DL_VERSION_RUNNING,
DEVLINK_INFO_VERSION_GENERIC_FW_UNDI, buf);
+ if (err)
+ return err;
+
+ i40e_info_pba(hw, buf, sizeof(buf));
+ err = i40e_devlink_info_put(req, I40E_DL_VERSION_FIXED,
+ DEVLINK_INFO_VERSION_GENERIC_BOARD_ID, buf);
return err;
}
--
2.41.0
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
next prev parent reply other threads:[~2023-10-13 17:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 17:07 [Intel-wired-lan] [PATCH net-next 0/5] i40e: Add basic devlink support Ivan Vecera
2023-10-13 17:07 ` [Intel-wired-lan] [PATCH net-next 1/5] i40e: Add initial " Ivan Vecera
2023-10-13 17:07 ` [Intel-wired-lan] [PATCH net-next 2/5] i40e: Split and refactor i40e_nvm_version_str() Ivan Vecera
2023-10-13 17:07 ` [Intel-wired-lan] [PATCH net-next 3/5] i40e: Add handler for devlink .info_get Ivan Vecera
2023-10-16 14:56 ` Jakub Kicinski
2023-10-17 9:56 ` Ivan Vecera
2023-10-17 15:21 ` Jakub Kicinski
2023-10-17 17:05 ` Jacob Keller
2023-10-17 17:17 ` Jacob Keller
2023-10-18 11:58 ` Ivan Vecera
2023-10-13 17:07 ` [Intel-wired-lan] [PATCH net-next 4/5] i40e: Refactor and rename i40e_read_pba_string() Ivan Vecera
2023-10-17 17:21 ` Jacob Keller
2023-10-13 17:07 ` Ivan Vecera [this message]
2023-10-15 13:40 ` [Intel-wired-lan] [PATCH net-next 0/5] i40e: Add basic devlink support 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=20231013170755.2367410-6-ivecera@redhat.com \
--to=ivecera@redhat.com \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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