From nobody Thu Jan 15 13:32:38 2026 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 4dsP6v1jR5z6P066 for ; Thu, 15 Jan 2026 13:32:39 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dsP6t6bvhz4MjJ for ; Thu, 15 Jan 2026 13:32:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768483958; 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=Zxx1rAg3vTPJ7ZsXQiFBSxKMB8T3juvsRVwc0NIg2xE=; b=EToiyE01wsiSz5d2XS0J45ovIA2R84elr8bj36VzpaVvqXk/kH9wZSoh1zHwwhz4tq1CMQ 1oLoDJTquAbU0kiPEH/2p5zGYKrXAJYqa1ExmHvSHQCCdj5PCFvS7L5GiC99oY1xcKC3vs MMq7kRSVzdxmWefC+psAAOottlCoDA18imFSKeDzrble+aYNsH8JhrF8p+ql1BMuavUbqd UQxsqNmggzjxFiWpBAVLSUfiMNPuTWDlO5uKkoE9cOqQk/bayMgxge83alMCXZsnDjV979 KiL/0SM1vRhNa0ISHqKKs8Q5EDSPkJdLtfE81Kl0HAamAL9p1qaGbPX/av8qvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768483958; 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=Zxx1rAg3vTPJ7ZsXQiFBSxKMB8T3juvsRVwc0NIg2xE=; b=nnMGYRipnba0LnDSMxolFJ1R8YtuJZ7GzmDHoZoFpnNZidg7VO+BeibeNTBSBWYzWB3LND 3lWJFjMcnni/QPBNN3HQ62n1mfwfR7f5iuXnOvPMnp7jMKG4+G4mNZlNX/VM7Yl4Vwa32F Avht48dJxkvigZNyR6/UtZx3IuvRQlKO3afVIs4gcO6QIk3fGswdhjbhrogXAZg2Afjqgx CymwrKkY2NGEYM5T+EMcvXkzHM34gyQ46vieDtG8ILRySNHbZQrvHEiDowQG8DEUBAgfEL 2q76gzuwtm7Zn0fg6X02tX4sOwLHAmKtTFSR4PpLomTAVFMMhw1++CDcznoZeg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768483958; a=rsa-sha256; cv=none; b=jnGaRn/kJKZlghTQmSjPdLnD5Lpq+mL43mpr702q5NAgnD9q4dQwiJ7o275coLd8TUugeg fzSinRJv8diM8s22PUukxakz4o3m9rKwbVmtdeZzSCwaDsycGMKaAApzv4H4L//NpVN5vX UEVZHeuXNq0APyVREL8LHdIwyuut2Wr3wYj6e5O9vQZB7QiP2Toq7a+osoWDVe3W9AS9P8 UIS5IaKfr7x+gXrkR3Eys2PYyhX9H8/+4Kv0ljLL6lz5ju8PrpWx6/E7gt3mbkyAs25dQM +dBUyPIdSDULbTyZZF2YiFym7LlXWU5Xya8qbSQ3w0uFoTIQiGZ7htO+TWbE7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dsP6t5MY3zV16 for ; Thu, 15 Jan 2026 13:32:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id b894 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 15 Jan 2026 13:32:38 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 73c921ef1d44 - main - nvme: Add ability to override ioq to put the request on 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 73c921ef1d44f6e1590957a4beb48a967e3ca8c8 Auto-Submitted: auto-generated Date: Thu, 15 Jan 2026 13:32:38 +0000 Message-Id: <6968ec76.b894.1a50b1d3@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=73c921ef1d44f6e1590957a4beb48a967e3ca8c8 commit 73c921ef1d44f6e1590957a4beb48a967e3ca8c8 Author: Warner Losh AuthorDate: 2026-01-15 13:31:53 +0000 Commit: Warner Losh CommitDate: 2026-01-15 13:31:53 +0000 nvme: Add ability to override ioq to put the request on Sometimes the client device needs to manage the IOQ the request goes to. Expand the interface we have for the request to allow it to be set for this special use case. Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D54714 --- sys/dev/nvme/nvme_ctrlr.c | 4 +++- sys/dev/nvme/nvme_private.h | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 26194ccbb8f8..b75033300061 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1877,8 +1877,10 @@ nvme_ctrlr_submit_io_request(struct nvme_controller *ctrlr, struct nvme_request *req) { struct nvme_qpair *qpair; + int32_t ioq; - qpair = &ctrlr->ioq[QP(ctrlr, curcpu)]; + ioq = req->ioq == NVME_IOQ_DEFAULT ? QP(ctrlr, curcpu) : req->ioq; + qpair = &ctrlr->ioq[ioq]; nvme_qpair_submit_request(qpair, req); } diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 8837275e2ed5..b520b9946f7b 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -112,7 +112,9 @@ struct nvme_request { struct memdesc payload; nvme_cb_fn_t cb_fn; void *cb_arg; - int32_t retries; + int16_t retries; + uint16_t ioq; +#define NVME_IOQ_DEFAULT 0xffff bool payload_valid; bool timeout; bool spare[2]; /* Future use */ @@ -491,6 +493,7 @@ _nvme_allocate_request(const int how, nvme_cb_fn_t cb_fn, void *cb_arg) req = malloc(sizeof(*req), M_NVME, how | M_ZERO); if (req != NULL) { + req->ioq = NVME_IOQ_DEFAULT; req->cb_fn = cb_fn; req->cb_arg = cb_arg; req->timeout = true; @@ -551,6 +554,21 @@ nvme_allocate_request_ccb(union ccb *ccb, const int how, nvme_cb_fn_t cb_fn, #define nvme_free_request(req) free(req, M_NVME) +static __inline void +nvme_request_set_ioq(struct nvme_controller *ctrlr, struct nvme_request *req, unt16_t ioq) +{ + /* + * Note: NVMe queues are numbered 1-65535. The ioq here is numbered + * 0-65534 to avoid off-by-one bugs, with 65535 being reserved for + * DEFAULT. + */ + KASSERT(ioq == NVME_IOQ_DEFAULT || ioq < ctrlr->num_io_queues, + ("ioq %d out of range 0..%d", ioq, ctrlr->num_io_queues)); + if (ioq < 0 || ioq >= ctrlr->num_io_queues) + ioq = NVME_IOQ_DEFAULT; + req->ioq = ioq; +} + void nvme_notify_async(struct nvme_controller *ctrlr, const struct nvme_completion *async_cpl, uint32_t log_page_id, void *log_page_buffer,