From nobody Wed Apr 17 03:33:47 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 4VK62N0LTSz5HjWd; Wed, 17 Apr 2024 03:33:48 +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 4VK62M5h8Sz4Qrh; Wed, 17 Apr 2024 03:33:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713324827; 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=dvyIJWMi0APUYT5kRfYGJTVJfZFhpC5vOUCeyZQ2DJ4=; b=oR8CSiaWaXqj+b8YMPXl5oA4ZbIT+1HANVUUfWO6p8qvXg8PRVanJWYKnj2TfvNIgXtXn5 RNxZwrlwhXtkR1sXuBeHQt6fjqe5O2KQvhpkGeMGJEOFAsyED92gXHQZj8UGm+A4KMCxXy LKavDlH+zjYsWdpbPi1IB1MywpQsb0pobcTcyBaE6R1L38ZlBA/iDj9J+kcCYd4Ypfke+h 2942xpKXGcPCxy8FPOyvq70nCdTFByuCBOVIT5bxvwzD0iYih5BL/sNv85fyx/e83Bj/og 3k/x/mHRqrWrScT5IUXo5qWn2njP/WX3Cd6YKNbdqHCV1buDDPFzYD/fO+w00w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713324827; a=rsa-sha256; cv=none; b=Yo9OHRW8CE9a+/Y3xVmFaUQEqyY6bRCqwE8HIhyHizdhIeCtiKG04ea6gqQDA+bmxjUB5T v/kyMluJ+ZKu2S87ZZr3ngdNHGVQHU+89JPcH3pDGvGKClFWuUfBZS0hnlcBuzVldHVLit A/iTrGr4B1p+8y3Wk4XmZikoed9henEG5LQv7TPx2hcMfPwTTifcxCVFyiFJ7ou0rtCN1N mOapaj7iVgA3zIbwjSb9TeH1+r7k8YIAq6wWYs/x9D1XimFn6unkSG24CxXAIQt4y8rNLJ v3DzDRcU31AeXtrXkGPF6enjf7e9mutSOIlufZMaU1VxxI/IVRETP9uOx2tWiw== 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=1713324827; 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=dvyIJWMi0APUYT5kRfYGJTVJfZFhpC5vOUCeyZQ2DJ4=; b=KRgCL8tIhWHYvf0+ERmCwnQp4cwZqZAypg5dUUjsxnKfLgHhK0hGDm5KSaw6NDmdqqKfTq j0GADor+4z61q/+JENoPyQLSUuvL/+xwXW6gp3Mp/kbgkQdWINIlHw5xKExEZYIAZayK0q XkKrUEArIge9ZcXQBfA9cm/9jvSLCwr3+qrpLU6ocBQXtlZpQqhviPR1Zd/ZJjiozr3tsk LTlIAkm3+hzYFXkA5hjiWWwdpUNi275Hg+qGqU6c7Hureo6PLcJPeRVvVbx1UgtDJxQJ/w 4HotNW5jajt6MRh/4t0rGLFFrE9dtTi2c+f9DPnMoacCl3OAZbYKF8l3sZwV/w== 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 4VK62M5GmBz18vL; Wed, 17 Apr 2024 03:33:47 +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 43H3Xlh0086935; Wed, 17 Apr 2024 03:33:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43H3Xl3F086932; Wed, 17 Apr 2024 03:33:47 GMT (envelope-from git) Date: Wed, 17 Apr 2024 03:33:47 GMT Message-Id: <202404170333.43H3Xl3F086932@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 98f841efd8ce - main - nvmecontrol: Move self test status page printing to little endian orderinng 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98f841efd8ce387d9cd060174b9dcc9ff9850648 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=98f841efd8ce387d9cd060174b9dcc9ff9850648 commit 98f841efd8ce387d9cd060174b9dcc9ff9850648 Author: Warner Losh AuthorDate: 2024-04-16 22:36:19 +0000 Commit: Warner Losh CommitDate: 2024-04-17 03:30:18 +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 --- 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 0cf6e5f9fa94..9a8aa691d5db 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -219,10 +219,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); @@ -573,13 +569,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; @@ -593,19 +590,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; @@ -630,21 +628,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"); } }