git: e6d7ac1d03d1 - main - mlx5core: Set driver version into firmware.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 01 Feb 2022 15:24:38 UTC
The branch main has been updated by hselasky:
URL: https://cgit.FreeBSD.org/src/commit/?id=e6d7ac1d03d12363916771f515ab88c384f8350b
commit e6d7ac1d03d12363916771f515ab88c384f8350b
Author: Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-02-01 15:20:16 +0000
Commit: Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-02-01 15:21:17 +0000
mlx5core: Set driver version into firmware.
If the driver_version capability bit is enabled, send the driver
version to firmware after the init HCA command, for display purposes.
Example of driver version: "FreeBSD,mlx5_core,14.0.0,3.x-xxx"
Linux commits:
012e50e109fd27ff989492ad74c50ca7ab21e6a1
MFC after: 1 week
Sponsored by: NVIDIA Networking
---
sys/dev/mlx5/mlx5_core/mlx5_main.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c
index aaa8f657432a..d9f9831b43e6 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_main.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c
@@ -178,6 +178,30 @@ static struct mlx5_profile profiles[] = {
},
};
+static void mlx5_set_driver_version(struct mlx5_core_dev *dev)
+{
+ const size_t driver_ver_sz =
+ MLX5_FLD_SZ_BYTES(set_driver_version_in, driver_version);
+ u8 in[MLX5_ST_SZ_BYTES(set_driver_version_in)] = {};
+ u8 out[MLX5_ST_SZ_BYTES(set_driver_version_out)] = {};
+ char *string;
+
+ if (!MLX5_CAP_GEN(dev, driver_version))
+ return;
+
+ string = MLX5_ADDR_OF(set_driver_version_in, in, driver_version);
+
+ snprintf(string, driver_ver_sz, "FreeBSD,mlx5_core,%u.%u.%u," DRIVER_VERSION,
+ __FreeBSD_version / 100000, (__FreeBSD_version / 1000) % 100,
+ __FreeBSD_version % 1000);
+
+ /* Send the command */
+ MLX5_SET(set_driver_version_in, in, opcode,
+ MLX5_CMD_OP_SET_DRIVER_VERSION);
+
+ mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
+}
+
#ifdef PCI_IOV
static const char iov_mac_addr_name[] = "mac-addr";
static const char iov_node_guid_name[] = "node-guid";
@@ -1108,6 +1132,8 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
goto reclaim_boot_pages;
}
+ mlx5_set_driver_version(dev);
+
mlx5_start_health_poll(dev);
if (boot && (err = mlx5_init_once(dev, priv))) {