From nobody Tue Aug 27 01:06:42 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 4Wt8Wl1mb5z5TjLs; Tue, 27 Aug 2024 01:06:43 +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 4Wt8Wl063Lz4m7k; Tue, 27 Aug 2024 01:06:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724720803; 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=2uIpMSeYUfoAiobLBOZcFfn3712IAiV5jw0KWYT6DNk=; b=vR/eRDM1Khq/YJuRq5CC/RAF8Hpc8Db0Bz7tiVcm42dF8k+2MSofaPnt8Nmi6GJYYdT+0i 3TnwAUitM/vJ5DML65Fb4tKBemYc5b5n6kj2JD7X36aho+i/LiJcTnRdgjeAlmXm8PIO7+ vUQv6FkRQJR3FWmUdOizi6cZiJCUuFH0nOGKf8TPkseKEXVE/nNkS2TjVCn3It2+QXmOyG eubdmJAh99j2eM9BUzD8JFwH8z6RXDilR5SN9lotc3NEXgqKQgzcOM8kgQAVZkDltM9XVV O8THL0VoEgy1rDtPgzZNJwM86dYIyO8b3aPXBjJcLD07zx2Pc+QMdDBCk9czzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724720803; a=rsa-sha256; cv=none; b=R/YkDd5wjMrNYI5uNumEY9HEWOo6KQf8fzEtPK5C/oFx3/ji8s0AT3cMGgoq+W1adKYquG OnzkCuKGirE5foXd5W3MFMcGp/tAmRsQtdyR6dppw84+Ql6jqBTzfWMwLO/L+vh12F2qoV YRYz4leFuR3WSeeIWHKIZL4YNq5272xQdYtb6o1e14fz+ApYYj5NOIpdy1bOCzs17RnPLs htl5wi07IqFcf0bA4uh2MtPfK9LsIJ1ooZyAceGF5kt5fVqRkyr0joJjRO+MuFoalHJqSl lIKTQL2NLdTcpRuAR9sFANgh1y+Gi3r+YJwYLwHFAIvus9l09uXoaUpYnw/HiQ== 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=1724720803; 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=2uIpMSeYUfoAiobLBOZcFfn3712IAiV5jw0KWYT6DNk=; b=t/Qjb3LFNafzTis6MjU6h/Ik0PL3utUIfMl8jM8BI1c/veKZYbzxB7QnyzBAdjTdClVlBI gwP4eg9HKPmSq5ceAphacQwgNVDc9oONgQxY0Ol9lulfpMM8CP39zwJdI6l3ZrRWEx0lpB Ib/UaAO1hr2h3UITud6ymSL1J22wVzER5eo17wxNNHozPYbVdI+rShVQE5V4i5OWCqEZjr YjQLSPycSIqEeNLw5UukF+fIUgqn8v8GXRLHHrQlYY9tv3kJs8XrxqM12vma9P28al2LHD KbljnDdjukyk+Yccj73kE6SCoOySunQbXKI/Hmlc49BD/wY53Kkd5DABNfby+g== 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 4Wt8Wk5Gk2zT9W; Tue, 27 Aug 2024 01:06:42 +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 47R16g2U057265; Tue, 27 Aug 2024 01:06:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47R16guu057262; Tue, 27 Aug 2024 01:06:42 GMT (envelope-from git) Date: Tue, 27 Aug 2024 01:06:42 GMT Message-Id: <202408270106.47R16guu057262@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: 067abd7d0b06 - stable/14 - nvmecontrol: Move self test status page printing to little endian orderinng 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/stable/14 X-Git-Reftype: branch X-Git-Commit: 067abd7d0b0678cba0dede7e1813660e9e269d6e Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=067abd7d0b0678cba0dede7e1813660e9e269d6e commit 067abd7d0b0678cba0dede7e1813660e9e269d6e Author: Warner Losh AuthorDate: 2024-04-16 22:36:19 +0000 Commit: John Baldwin CommitDate: 2024-08-26 18:31:02 +0000 nvmecontrol: Move self test status page printing to little endian orderinng Also, add printing vnedor_specific field, which doesn't have a valid bit, so is always valid. Sponsored by: Netflix Reviewed by: chuck Differential Revision: https://reviews.freebsd.org/D44654 (cherry picked from commit 98f841efd8ce387d9cd060174b9dcc9ff9850648) --- sbin/nvmecontrol/logpage.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c index 845dad0cd539..897bb7a59118 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -220,10 +220,6 @@ read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp, /* Convert data to host endian */ switch (log_page) { - case NVME_LOG_DEVICE_SELF_TEST: - nvme_device_self_test_swapbytes( - (struct nvme_device_self_test_page *)payload); - break; case NVME_LOG_COMMAND_EFFECT: nvme_command_effects_page_swapbytes( (struct nvme_command_effects_page *)payload); @@ -574,13 +570,14 @@ print_log_self_test_status(const struct nvme_controller_data *cdata __unused, { struct nvme_device_self_test_page *dst; uint32_t r; + uint16_t vs; dst = buf; printf("Device Self-test Status\n"); printf("=======================\n"); printf("Current Operation: "); - switch (dst->curr_operation) { + switch (letoh(dst->curr_operation)) { case 0x0: printf("No device self-test operation in progress\n"); break; @@ -594,19 +591,20 @@ print_log_self_test_status(const struct nvme_controller_data *cdata __unused, printf("Vendor specific\n"); break; default: - printf("Reserved (0x%x)\n", dst->curr_operation); + printf("Reserved (0x%x)\n", letoh(dst->curr_operation)); } - if (dst->curr_operation != 0) - printf("Current Completion: %u%%\n", dst->curr_compl & 0x7f); + if (letoh(dst->curr_operation) != 0) + printf("Current Completion: %u%%\n", letoh(dst->curr_compl) & 0x7f); printf("Results\n"); for (r = 0; r < 20; r++) { uint64_t failing_lba; - uint8_t code, res; + uint8_t code, res, status; - code = (dst->result[r].status >> 4) & 0xf; - res = dst->result[r].status & 0xf; + status = letoh(dst->result[r].status); + code = (status >> 4) & 0xf; + res = status & 0xf; if (res == 0xf) continue; @@ -631,21 +629,24 @@ print_log_self_test_status(const struct nvme_controller_data *cdata __unused, printf(" Reserved status 0x%x", res); if (res == 7) - printf(" starting in segment %u", dst->result[r].segment_num); + printf(" starting in segment %u", + letoh(dst->result[r].segment_num)); #define BIT(b) (1 << (b)) - if (dst->result[r].valid_diag_info & BIT(0)) - printf(" NSID=0x%x", dst->result[r].nsid); - if (dst->result[r].valid_diag_info & BIT(1)) { + if (letoh(dst->result[r].valid_diag_info) & BIT(0)) + printf(" NSID=0x%x", letoh(dst->result[r].nsid)); + if (letoh(dst->result[r].valid_diag_info) & BIT(1)) { memcpy(&failing_lba, dst->result[r].failing_lba, sizeof(failing_lba)); - printf(" FLBA=0x%jx", failing_lba); + printf(" FLBA=0x%jx", (uintmax_t)letoh(failing_lba)); } - if (dst->result[r].valid_diag_info & BIT(2)) - printf(" SCT=0x%x", dst->result[r].status_code_type); - if (dst->result[r].valid_diag_info & BIT(3)) - printf(" SC=0x%x", dst->result[r].status_code); + if (letoh(dst->result[r].valid_diag_info) & BIT(2)) + printf(" SCT=0x%x", letoh(dst->result[r].status_code_type)); + if (letoh(dst->result[r].valid_diag_info) & BIT(3)) + printf(" SC=0x%x", letoh(dst->result[r].status_code)); #undef BIT + memcpy(&vs, dst->result[r].vendor_specific, sizeof(vs)); + printf(" VENDOR_SPECIFIC=0x%x", letoh(vs)); printf("\n"); } }