From nobody Sat Mar 23 00:25:38 2024 X-Original-To: dev-commits-src-all@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 4V1g2p62HNz5Fl0J; Sat, 23 Mar 2024 00:25:38 +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 4V1g2p1Rb4z4YTC; Sat, 23 Mar 2024 00:25:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711153538; 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=eoauEh+QbmaNlydxjg/BAjoyqvaFqeqMM2iJsaRNDuI=; b=qyr0pLDtP7NzqArwQwCC7ESgnatVozy3W0E2SR/Oxd+El7hqbSsma35AkFD18nJ8jObF0Q YiPc+JEkNinOHAKQ5SN9nfRVYqFxTz6GREsLNQIfAyEQOr3iXRHph2143zZ2xIv+v4nrJE RHMwCl1Lur1zzQq1YOU8DK5cRuR5TpZfgaoTuN1rXCicZUijDWosTcZjOI7LQPChFaDCt2 uz0ycQyu5UIGc8GnKChTrvU+jc0mbwbwZJhCrhBhEXOiQbmVzsK1C6W6Q1CqDFMAK9eZgE hGtqnqb95XGZRqxWXhdjEWakrTHYdj3zVxsdKBggbUkh5wX2gtZ9GiEN68Bmqw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711153538; a=rsa-sha256; cv=none; b=aqRt2iwcIae3GD4F/fLsgAvsgiiWzyBoYVdv7e03WotYIoyP9tRVkk5xJ6qY9A6Od1kie+ XBYvP5kcIERRukG0FzlA+IWRoxXWnX4z8lj8Le9kQAv73UPFQCnVqefQ8fFKwnN0/4eoKq 65KIU73yGHbbW8jgd8ejwRgL5Oka57HIP8hafuv3MW0Y1w6so/FX3QT2YcU8GUIVmZxCeQ wHvrlYyePcQVAwkK84JtYEbkZhXIV8sZMhj2Jpb1PK0YAqGbvYnEgWxZoY2dg1uXFaUzZE ZYSVHUPhYMgKKlulo73ryZWLZvtlxqJDy6TlLTwm9R96bxc7SFEcZsYAo30LGA== 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=1711153538; 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=eoauEh+QbmaNlydxjg/BAjoyqvaFqeqMM2iJsaRNDuI=; b=M01RzTJZ5IWAqpypn1nCNr8fHsd0RwfDDHal2zhP/P05iqa3Y0626uuhvCTQ+U/xqJ6jIm OBMStejFWYBOy1pGPXm6XIC8d+Ns5F+ae8eqSDsT6RIQM+0FAvxZamdYcDDNz8xLgeSeLQ EkjpHlRkxw0lLQSq7O1/3P+WAxpL3LpF7bET0lf20gsMHMF6eyg5WWhzPh+l8l09P+wW0t uS+89nG91hQ0p1z+6XxKO/tx4ySDAP2NUm4vVyQSdDo3VViNp3lf2F3qdpx64KU1OI7ud3 YSgYXemZIfZfvEowp6sDbKpxhR3EJyqhFeUvBh/cpptW6AUOfNWk6RgbKKQC9Q== 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 4V1g2p0kKlzQth; Sat, 23 Mar 2024 00:25:38 +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 42N0PcBG005937; Sat, 23 Mar 2024 00:25:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42N0PcQH005934; Sat, 23 Mar 2024 00:25:38 GMT (envelope-from git) Date: Sat, 23 Mar 2024 00:25:38 GMT Message-Id: <202403230025.42N0PcQH005934@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: 88ecf154c7c5 - main - nvme: Add constants and types for the discovery log page List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 88ecf154c7c5a2e413a81ae1b0511b0295265b99 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=88ecf154c7c5a2e413a81ae1b0511b0295265b99 commit 88ecf154c7c5a2e413a81ae1b0511b0295265b99 Author: John Baldwin AuthorDate: 2024-03-23 00:24:18 +0000 Commit: John Baldwin CommitDate: 2024-03-23 00:24:18 +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 --- 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 ef262a864121..fcc96a26eeb1 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -1459,6 +1459,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, @@ -1591,6 +1592,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; @@ -2215,4 +2258,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__ */