From nobody Tue Feb 01 15:24:38 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CEA6419171CF; Tue, 1 Feb 2022 15:24:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jp7yZ3NXKz3Fp6; Tue, 1 Feb 2022 15:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643729079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6pMrJ9IN7TNqi5R5+6QCTS9HvDdf92VmHUH1Ko6v52M=; b=AxRNbuWFfuHa7DM1nJ13dSC1Hg1nG78XMAYYKGQjxO7cVES9CchiAYcpfD8W9tVGQ5CE7+ A+MgSsx+YGLuvsYsYbg9lewj1agzaMKuLsV+Pj/IYLPnZiG0CxT1Kq6+YIdP7d1gXjMafl IJDBCrf+/6lUQnRaCkUoXwR6kQgR/kMPo1bzWmLBRWJbt1QqF7te2sKiXvkVXcXD3H33a5 y/RBc5W5BPkvwzjsn1j6qIYmnOjLldQCfmn3tJsIVv1J53UWl46eyCOfgm00jWfeVpsxXD YgSVoKXCGcC3QEEHWccWwlMPlq7wZJVawPeI5R3we6nFgTzW7mCBsJrG/Okjcw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BA2713425; Tue, 1 Feb 2022 15:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 211FOcpP051400; Tue, 1 Feb 2022 15:24:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 211FOcug051399; Tue, 1 Feb 2022 15:24:38 GMT (envelope-from git) Date: Tue, 1 Feb 2022 15:24:38 GMT Message-Id: <202202011524.211FOcug051399@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: e6d7ac1d03d1 - main - mlx5core: Set driver version into firmware. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e6d7ac1d03d12363916771f515ab88c384f8350b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643729079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6pMrJ9IN7TNqi5R5+6QCTS9HvDdf92VmHUH1Ko6v52M=; b=vmvMrnGIQJBEbtnf87t8gDkD1n+C5f0wt+1SvXFlfRdanlpr6zhr4sGO/9dYB+TXuprs5N QKWLYN0TesE/CDDVidYYSCJh9kiZ+tU+MrTrfHsjgoN0arJI/C43QQ7kGgGETNpAzyWRMF R+BT+4gXXfthKPAUjHD9/X5UDof+TN5MMjJDO2mjV8H5BITiZh+m5c4h0aJYzVbpzpz4EV 84fGfQ5t1REOiFeQ0Y7l4kyMG4YOBWI0f3Paw1mQxAUnnVEfA/bpZAGj+XEcm1NSEMzfsw pS6ezYhkI2H1MBY5Y24wZHO+zwsQh1ZBHbxUoMFP95AhwFrAVXxOK7cx93GCEw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643729079; a=rsa-sha256; cv=none; b=l2ZQdT2gLc/7opZY7NE88OzHRaenJqbuTgJITSqvYMANPz2/d7bjT4/qggl4iMAI//Hhpt S+YGvBPwRgd+Faq+WYcRGOf0b6sY3JsLOr6Nf9BTp1qUs3OWbuCvAMgfM9uexgOsGsFFIS WweYudg5e4NKIZGxAbZBQuX0q+KTp097w1NIBQietU8ygyT3mLFf3ERQ0EMh3Og59VaIiT MZqQZgtY/hAHJWyIIaW23pGaa5NmN1Ip+e7FEaPBYfvemMbBaiDvE+FDoob0lOYA41wEgl aFdRFGh9zvujhbm2gHf2ANX/2Nm3Ilmd2eouT/TxUBblmPT/wpHUMzn0Mf+ieQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e6d7ac1d03d12363916771f515ab88c384f8350b commit e6d7ac1d03d12363916771f515ab88c384f8350b Author: Hans Petter Selasky AuthorDate: 2022-02-01 15:20:16 +0000 Commit: Hans Petter Selasky 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))) {