From nobody Mon Jan 29 19:03:12 2024 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 4TNyPD74krz59DcN; Mon, 29 Jan 2024 19:03:12 +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 4TNyPD41S2z40Y8; Mon, 29 Jan 2024 19:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706554992; 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=IujeVd7eirLoNzrcoi2Ww0wyLJBVjdfK6bTlTfChMt4=; b=gr6OqlwjGZDSnh8/ZAsDHJo2r9zdFtt8nqkY9Epu0VyC6TfhfXwV832dlmONiVjkG1FGSy FnuPlIIKNsaU2KVWBKzw3vMgCRG3vRcNU82eyn/I+R+fGm8KCCAeIUQcr3Ktw7zi6i46hs QJ88rZYJMcEL1XSYgA+wyKVSt5rDEc73Y2yzWCM9insO9I+EBAKU0wOXp0pILpuUawZLZM Q8ic/rRjuR2B7LHuCEBg33ohg9oLgWmwxzCZmCLKis+8nl+TNsZjL1L9z/5svDLjoXGGHo EB+OcE2oqNHCRwzTPMtHcKAGnnAEdxGM42TnvA9wuU0KhseL2RAaVG5TnRm0SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706554992; 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=IujeVd7eirLoNzrcoi2Ww0wyLJBVjdfK6bTlTfChMt4=; b=B2/a5vGlxHHdiHkN7YiCI+jgA23jOaVC76IV9xuL9xTGWeCyT9Ve4ktwRod2eBEyCleiV4 b6t2GkdKTzcpCzh1K/kX98h0d3k/tmw71qlI8W0FXdACJdSoYcw935ST+xPHYqxVdOzmlX fWNSlwCkrNXYrJcl4XcGcFFwQG42tUTL+YqdflvyyL7wWkwc/hjGiAh7Qk/jptxZ+gwVG+ b3bP637S791aUMhhqxkD5VRi/VXMKt/4s0C4599Yl3URSSZrmpTgr66N7xJMCBOdeqkFhr Vl9Z2MiDKTjv5qsJ68vqHu7HXXZavKqmkKtD4Zl47MFHA0mJYadcgAnJ9ZOEZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706554992; a=rsa-sha256; cv=none; b=o9uRTl9InOFBq+wYP2Gi9EcTXgaG/evEOrPCp4ZDh2O7AfkK8eRY9GRRKdtl7NeSkEWq+D qup9F8adsFjeyjs1gvFU1V2Q0oxm4SnYmEJQQsfvpWNCAfKDMSGzpjFNszBafZV83//QHS zS/JlrRGmc98fUwC+YrUr6GwEUHRYd6uY/au1LgTYXCYsWJ41r5wD3C1rLXM4kkmZ1mX1u R7s8lP7NdRMInbnTUf3uM7cmO7NNWBK1I4IFKt2xd1/OdHls5S0k2d7XG3Z7dxJu6oEa/g GVAlPe4Rcp8f4TDyV9vXCq4hjtLQrvCfVK4oQHysCnnFMzLchr/uk5vBLkaREw== 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 4TNyPD37WBz13Dw; Mon, 29 Jan 2024 19:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40TJ3Cqq058908; Mon, 29 Jan 2024 19:03:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40TJ3Cb0058905; Mon, 29 Jan 2024 19:03:12 GMT (envelope-from git) Date: Mon, 29 Jan 2024 19:03:12 GMT Message-Id: <202401291903.40TJ3Cb0058905@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c68ec278deb2 - main - nvmecontrol: Use NVMEF macro to construct fields 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c68ec278deb23fd90eb5506c9a6a4f7339784ff3 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c68ec278deb23fd90eb5506c9a6a4f7339784ff3 commit c68ec278deb23fd90eb5506c9a6a4f7339784ff3 Author: John Baldwin AuthorDate: 2024-01-29 19:01:46 +0000 Commit: John Baldwin CommitDate: 2024-01-29 19:01:46 +0000 nvmecontrol: Use NVMEF macro to construct fields Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D43606 --- sbin/nvmecontrol/ns.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/sbin/nvmecontrol/ns.c b/sbin/nvmecontrol/ns.c index a90692b9ed78..62923056bd4e 100644 --- a/sbin/nvmecontrol/ns.c +++ b/sbin/nvmecontrol/ns.c @@ -579,14 +579,12 @@ nscreate(const struct cmd *f, int argc, char *argv[]) /* Default to the first format, whatever it is. */ nsdata.flbas = 0; if (create_opt.lbaf != NONE) { - nsdata.flbas |= (create_opt.lbaf & - NVME_NS_DATA_FLBAS_FORMAT_MASK) - << NVME_NS_DATA_FLBAS_FORMAT_SHIFT; + nsdata.flbas |= NVMEF(NVME_NS_DATA_FLBAS_FORMAT, + create_opt.lbaf); } if (create_opt.mset != NONE) { - nsdata.flbas |= (create_opt.mset & - NVME_NS_DATA_FLBAS_EXTENDED_MASK) - << NVME_NS_DATA_FLBAS_EXTENDED_SHIFT; + nsdata.flbas |= NVMEF(NVME_NS_DATA_FLBAS_EXTENDED, + create_opt.mset); } } if (create_opt.dps != NONE) { @@ -595,22 +593,19 @@ nscreate(const struct cmd *f, int argc, char *argv[]) /* Default to protection disabled. */ nsdata.dps = 0; if (create_opt.pi != NONE) { - nsdata.dps |= (create_opt.pi & - NVME_NS_DATA_DPS_MD_START_MASK) - << NVME_NS_DATA_DPS_MD_START_SHIFT; + nsdata.dps |= NVMEF(NVME_NS_DATA_DPS_MD_START, + create_opt.pi); } if (create_opt.pil != NONE) { - nsdata.dps |= (create_opt.pil & - NVME_NS_DATA_DPS_PIT_MASK) - << NVME_NS_DATA_DPS_PIT_SHIFT; + nsdata.dps |= NVMEF(NVME_NS_DATA_DPS_PIT, + create_opt.pil); } } if (create_opt.nmic != NONE) { nsdata.nmic = create_opt.nmic; } else { /* Allow namespaces sharing if Multi-Path I/O is supported. */ - nsdata.nmic = cd.mic ? (NVME_NS_DATA_NMIC_MAY_BE_SHARED_MASK << - NVME_NS_DATA_NMIC_MAY_BE_SHARED_SHIFT) : 0; + nsdata.nmic = NVMEF(NVME_NS_DATA_NMIC_MAY_BE_SHARED, !!cd.mic); } nvme_namespace_data_swapbytes(&nsdata);