From nobody Tue Aug 27 01:06:29 2024 X-Original-To: dev-commits-src-branches@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 4Wt8WV4WDhz5TjQt; Tue, 27 Aug 2024 01:06:30 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wt8WV1NfDz4lSq; Tue, 27 Aug 2024 01:06:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724720790; 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=c4CwoUaXihNKWnfBf+hSqNRQ3vAWdwJTxopvDGs5eGA=; b=VzvDuZMbVz4YtCpw9v351k2nLZvUgCwZIe3h2qhDkHFO2bH1HFkImtvejvsUgGee3t1FII c6fmt/BA4lTIvUvUkD6kofv/bphO+7SAWv63Or0LpcX7yU1kytjfxYuS8+JHfX/rzLQjkV k1/1daR/rUh7oa9xDHebv97/ezRCCNnXZJEU8PPbFNoYdRDdDXxCTXTuFu+Hpd6oO+1OYh 9dFjxc0kER8NoftiziapORMkkXBR0Zq8kx4dWXCHlFflqAVD7F2YX9tdHhY5Hi6ri4Nbn0 WhgDGSVA+/clh9rmzb+KbelasSBPLpXgJ4pO9Speh+nYF5UZpSq2Ym9oY+b48A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724720790; a=rsa-sha256; cv=none; b=f6LfXG6d+Dh4YkHtZ3+UMu3RU8xW7GITCvJ1qvSqNV3I4AZFmfjRf5hkhrF4DCKGnzKrNO tLAPzahaHTpUvfmptKgWp7qLqaCQkDdjF9YXv+KL4ItdxjMWbQXhqSeBEDE2W3QUECDzY3 kEK6bDMFd8cft72CxQYLvnr97nSu7/iYavXzRRKdGOvK7jdzrfymDp4fZa2vMCLPs96J4H UyevdViFrFchltmLdt6r5OiaGb7S5imPDeXkDwBHl80Ntxg0/2M3HYC8zXTkWdyDxAlinS uu43sdZH/0DhZ34GOpaRj2sd0tb5rEtN0E5qyugNCHF7SDMTTfl5/INxfyVSGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724720790; 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=c4CwoUaXihNKWnfBf+hSqNRQ3vAWdwJTxopvDGs5eGA=; b=xcaB1p81hJ5JHGbIBHTHzCBWtjvsthGG+wKmdf/91n1ohx33EEaNCRYB+pEFclUyVFaStN oJRo2KlT97UjjLBbHb60RBcmcfchTiunqWdnAj4y+SM2uAkgFRcMyfRW8CXl4W8vDxQa66 ocQLKa5Oc1PW6ISGWDE7j6a9WCqcDIhKC4528Vq04xzI6kxUOsCg+M8LMBAJVhAU0g1qFP 3d9p5lFWIirjRAkIctr45Y8m67rmqrTf7AvrYiSirkJcg+OmIx3eRmKrkpCUypwNoRCVVe R7vOjknOcRoNXAImJVUwXkI+0yKgz5+HzewBgirGsm12Dxu8Idz+OqaX+qSJcQ== 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 4Wt8WV0f3QzTjZ; Tue, 27 Aug 2024 01:06:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47R16Tht056670; Tue, 27 Aug 2024 01:06:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47R16T11056667; Tue, 27 Aug 2024 01:06:29 GMT (envelope-from git) Date: Tue, 27 Aug 2024 01:06:29 GMT Message-Id: <202408270106.47R16T11056667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 759864ad7ad6 - stable/14 - nvme: Add constants and types for the discovery log page List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 759864ad7ad6f7ee949f496cc46ff906be9afcea Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=759864ad7ad6f7ee949f496cc46ff906be9afcea commit 759864ad7ad6f7ee949f496cc46ff906be9afcea Author: John Baldwin AuthorDate: 2024-03-23 00:24:18 +0000 Commit: John Baldwin CommitDate: 2024-08-26 18:27:53 +0000 nvme: Add constants and types for the discovery log page This is used in NVMe over Fabrics to enumerate a list of available controllers. Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D44446 (cherry picked from commit 88ecf154c7c5a2e413a81ae1b0511b0295265b99) --- sys/dev/nvme/nvme.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index b738ab902f89..3bbb1c326efd 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -1458,6 +1458,7 @@ enum nvme_log_page { NVME_LOG_PERSISTENT_EVENT_LOG = 0x0d, NVME_LOG_LBA_STATUS_INFORMATION = 0x0e, NVME_LOG_ENDURANCE_GROUP_EVENT_AGGREGATE = 0x0f, + NVME_LOG_DISCOVERY = 0x70, /* 0x06-0x7F - reserved */ /* 0x80-0xBF - I/O command set specific */ NVME_LOG_RES_NOTIFICATION = 0x80, @@ -1590,6 +1591,48 @@ struct nvme_device_self_test_page { _Static_assert(sizeof(struct nvme_device_self_test_page) == 564, "bad size for nvme_device_self_test_page"); +struct nvme_discovery_log_entry { + uint8_t trtype; + uint8_t adrfam; + uint8_t subtype; + uint8_t treq; + uint16_t portid; + uint16_t cntlid; + uint16_t aqsz; + uint8_t reserved1[22]; + uint8_t trsvcid[32]; + uint8_t reserved2[192]; + uint8_t subnqn[256]; + uint8_t traddr[256]; + union { + struct { + uint8_t rdma_qptype; + uint8_t rdma_prtype; + uint8_t rdma_cms; + uint8_t reserved[5]; + uint16_t rdma_pkey; + } rdma; + struct { + uint8_t sectype; + } tcp; + uint8_t reserved[256]; + } tsas; +} __packed __aligned(4); + +_Static_assert(sizeof(struct nvme_discovery_log_entry) == 1024, + "bad size for nvme_discovery_log_entry"); + +struct nvme_discovery_log { + uint64_t genctr; + uint64_t numrec; + uint16_t recfmt; + uint8_t reserved[1006]; + struct nvme_discovery_log_entry entries[]; +} __packed __aligned(4); + +_Static_assert(sizeof(struct nvme_discovery_log) == 1024, + "bad size for nvme_discovery_log"); + struct nvme_res_notification_page { uint64_t log_page_count; uint8_t log_page_type; @@ -2214,4 +2257,27 @@ nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __unused) } #endif } + +static inline void +nvme_discovery_log_entry_swapbytes(struct nvme_discovery_log_entry *s __unused) +{ +#if _BYTE_ORDER != _LITTLE_ENDIAN + s->portid = le16toh(s->portid); + s->cntlid = le16toh(s->cntlid); + s->aqsz = le16toh(s->aqsz); + if (s->trtype == 0x01 /* RDMA */) { + s->tsas.rdma.rdma_pkey = le16toh(s->tsas.rdma.rdma_pkey); + } +#endif +} + +static inline void +nvme_discovery_log_swapbytes(struct nvme_discovery_log *s __unused) +{ +#if _BYTE_ORDER != _LITTLE_ENDIAN + s->genctr = le64toh(s->genctr); + s->numrec = le64toh(s->numrec); + s->recfmt = le16toh(s->recfmt); +#endif +} #endif /* __NVME_H__ */