From nobody Mon Aug 07 22:45:37 2023 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 4RKWcf0b8yz4mSxM; Mon, 7 Aug 2023 22:45: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 4RKWcf01Frz4NqJ; Mon, 7 Aug 2023 22:45:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691448338; 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=0s8o3DTPK01NAVjU+LdnUfGcNK3Z9gY9NsFnAgzaTBk=; b=aQZG2+bgcsxyEwfUr2YAW+YJB0We9qz1yk8Rxg5I9VN/uuiMC7lKtkmv1zwnQwfAaamSAR OZhZUMpXBiK8Cc0cEvaEKUyrS5fTHUJqt+x+xMlijudzW8y8OcA6ThGYiyke0DjggxS83V hzB9NaH5kgCMkDgEikMxrVq5nLWXUz26z+tici5/qAAX8befthwZ6QFGtAcDrZBpVtvZYU bHFwnT1zG+zpfStz/GN5b0h1f+r4ILsFaD+eDIyBprsP+TYFAUJYFtnJ0kt+LfQfSF/eNz LisS811VCJQNNCh2zda7dvufa9FCpXKlY/C2nm0tSqf9SOK0ahJ1OxXjE2X04Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691448338; 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=0s8o3DTPK01NAVjU+LdnUfGcNK3Z9gY9NsFnAgzaTBk=; b=RiESjHyGcAxDdhiP1louz31gLjfyhSshIxxE5WH7v+8LPB0yuI+WDQEdu8WeMR4x1N+4vc aivd87IvwevH9UC1jzPpLe/KU106MhPuTVAsm/ycDhdi0oJyXTY/GzqkCAhCHuqsKD/wjR kv55fwrCQGiRzdPtepWqTnu+B3cjuGFaCG6iomNOlBDxnefVgHXLRPeKX3RPXF1nbtXaGD mpHvbr4IM6a4hYGjmu0C3Gtxvnpi5nz8XPf8XMZDi0dUlLxNJ/mjPuqzYBM4aciZBfDRqv WyDnUuHHbb3dcewrI3vsguhcxUAssvbZYK/i6aUMfhOCbur2eENzsYEp88v8kQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691448338; a=rsa-sha256; cv=none; b=Y9vhlp90N22ra69UwJySYs9zecBLaErtdsIYCY33s4pOVb0Dti4nIHPNLwyl7/9DfvrJbu 1v8iH9mUj4nk049C90AdnqPmnugTicZrFBjT6wb8L6FBEDm8HQqa/6dVlXHk6XFTEvnodX Xvb8I4TC3EbuSgZNdgKES5rcyRW9rNpCISixSNtMXtZ4Vk9F6LCgDdLLu7MGYwEhGPxrAB 8SiXRmaCGvdDBNvxW/jqfStLiP5B13WINMEqX8rhFIZoHuFuwiGHQ9GjB0D4vVPoA+IyUu eXQETxfV38JApGjJxfVycbQMmUA5hKT6B1NcdiZGvPV1Hq0476kg4wwAzaZuyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RKWcd67btz18jB; Mon, 7 Aug 2023 22:45:37 +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 377Mjb8u058590; Mon, 7 Aug 2023 22:45:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 377Mjbbv058589; Mon, 7 Aug 2023 22:45:37 GMT (envelope-from git) Date: Mon, 7 Aug 2023 22:45:37 GMT Message-Id: <202308072245.377Mjbbv058589@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: 6f76d493864b - main - nvme: Remove duplicate completion printing routine 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f76d493864b976d1eaea22eba59407319f6e327 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6f76d493864b976d1eaea22eba59407319f6e327 commit 6f76d493864b976d1eaea22eba59407319f6e327 Author: Warner Losh AuthorDate: 2023-08-07 22:34:25 +0000 Commit: Warner Losh CommitDate: 2023-08-07 22:44:30 +0000 nvme: Remove duplicate completion printing routine Both nvme_dump_completion and nvme_qpair_print_completion print completions. The latter is better. Recode the two instances of nvme_dump_completion to use nvme_qpair_print_completion and delete the former. No sense having two nearly identical routines. A future commit will convert this to sbuf. Sponsored by: Netflix Reviewed by: chuck Differential Revision: https://reviews.freebsd.org/D41308 --- sys/dev/nvme/nvme.c | 21 --------------------- sys/dev/nvme/nvme_private.h | 3 ++- sys/dev/nvme/nvme_qpair.c | 13 +++++++------ sys/dev/nvme/nvme_sysctl.c | 2 +- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 316cd8934036..22d197dc9367 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -95,27 +95,6 @@ nvme_dump_command(struct nvme_command *cmd) le32toh(cmd->cdw13), le32toh(cmd->cdw14), le32toh(cmd->cdw15)); } -void -nvme_dump_completion(struct nvme_completion *cpl) -{ - uint8_t p, sc, sct, crd, m, dnr; - uint16_t status; - - status = le16toh(cpl->status); - - p = NVME_STATUS_GET_P(status); - sc = NVME_STATUS_GET_SC(status); - sct = NVME_STATUS_GET_SCT(status); - crd = NVME_STATUS_GET_CRD( status); - m = NVME_STATUS_GET_M(status); - dnr = NVME_STATUS_GET_DNR(status); - - printf("cdw0:%08x sqhd:%04x sqid:%04x " - "cid:%04x p:%x sc:%02x sct:%x crd:%x m:%x dnr:%x\n", - le32toh(cpl->cdw0), le16toh(cpl->sqhd), le16toh(cpl->sqid), - cpl->cid, p, sc, sct, crd, m, dnr); -} - int nvme_attach(device_t dev) { diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 370bd0dccf20..95915902642e 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -444,7 +444,8 @@ void nvme_ns_destruct(struct nvme_namespace *ns); void nvme_sysctl_initialize_ctrlr(struct nvme_controller *ctrlr); void nvme_dump_command(struct nvme_command *cmd); -void nvme_dump_completion(struct nvme_completion *cpl); +void nvme_qpair_print_completion(struct nvme_qpair *qpair, + struct nvme_completion *cpl); int nvme_attach(device_t dev); int nvme_shutdown(device_t dev); diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index dffbaba8deca..a09be6bba7d9 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -341,21 +341,22 @@ get_status_string(uint16_t sct, uint16_t sc) return (entry->str); } -static void +void nvme_qpair_print_completion(struct nvme_qpair *qpair, struct nvme_completion *cpl) { - uint8_t sct, sc, crd, m, dnr; + uint8_t sct, sc, crd, m, dnr, p; sct = NVME_STATUS_GET_SCT(cpl->status); sc = NVME_STATUS_GET_SC(cpl->status); crd = NVME_STATUS_GET_CRD(cpl->status); m = NVME_STATUS_GET_M(cpl->status); dnr = NVME_STATUS_GET_DNR(cpl->status); + p = NVME_STATUS_GET_P(cpl->status); - nvme_printf(qpair->ctrlr, "%s (%02x/%02x) crd:%x m:%x dnr:%x " + nvme_printf(qpair->ctrlr, "%s (%02x/%02x) crd:%x m:%x dnr:%x p:%d " "sqid:%d cid:%d cdw0:%x\n", - get_status_string(sct, sc), sct, sc, crd, m, dnr, + get_status_string(sct, sc), sct, sc, crd, m, dnr, p, cpl->sqid, cpl->cid, cpl->cdw0); } @@ -654,8 +655,8 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) nvme_printf(qpair->ctrlr, "cpl (cid = %u) does not map to outstanding cmd\n", cpl.cid); - /* nvme_dump_completion expects device endianess */ - nvme_dump_completion(&qpair->cpl[qpair->cq_head]); + nvme_qpair_print_completion(qpair, + &qpair->cpl[qpair->cq_head]); KASSERT(0, ("received completion for unknown cmd")); } diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c index c238c86af5a2..a48dad04d90f 100644 --- a/sys/dev/nvme/nvme_sysctl.c +++ b/sys/dev/nvme/nvme_sysctl.c @@ -65,7 +65,7 @@ nvme_dump_queue(struct nvme_qpair *qpair) for (i = 0; i < qpair->num_entries; i++) { cpl = &qpair->cpl[i]; printf("%05d: ", i); - nvme_dump_completion(cpl); + nvme_qpair_print_completion(qpair, cpl); } printf("Submission queue:\n");