From nobody Sat Nov 14 20:54:39 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 4jRmb4212Tz70bpK for ; Sat, 14 Nov 2026 20:54:40 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jRmb404b1z4Fxj for ; Sat, 14 Nov 2026 20:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794689680; 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=i9Z6VkbQ20OAP2hh2DkotaFT1mmi+0FYTN3uwRKUhC0=; b=UTa2UQJn68ku/LsyWnqS9t51EkaFgGJFRiHOmmJEQ/xHJsW4zktHiJdLW99mIRmQZ5XLMc YcM+7tUpeseMNW+c1Y40JVWrHms53c8jLmYRMcTdWL6e6xTt+a4SfdEzeg/B6qLXeetedE rbjux5OJtmlKdD1dOJRgPr/oqPtiaLPFt/d3KES5Xh80N9wJ3Rc8EVIH09Z/3fezBm6GTB SFfnsIvVlo8fmTDF47QFk1GLNM4saeyzlHeWiK0l49dzQvqNyxj4qGegT2vc1rp4Qr9h/B Xurp3RRXmul6j4TLtPgJ+9tHdL4V76a3ur0PzLPvR9pJXovXOQir4j/AvfzaNA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794689680; b=BPqkWpGgw4Ax5l5maIOupYoGfo94LrUJhE+nN8MKlFWEIwkBjTM/Csg3+ZAT/0vZHS2hAJ s8YwFFYNG6kE2Iki71uR0jtU4RpkazFORSpeRIjF8+rFWHHBuL2e3WwEZZ84PcdryQoq6F PKz3TNDqOa7b1QQd22z4Wj2FpNY7AqJSifuTPSBM+iZDXinWkM9lTDPMPDjtsFiSpLUhU8 lQ2yX07b5MVivnS5Eh9s/r6iVF/6piEd028yflahT8fCA4CSWVYkGAWPTU0Hl8Q2h/ivWi FBQUzqKyoZSFZwg1u+gLRP7UU9j9A0fEB+1PNvGu4URqEiazsOjNYHbnZxz+zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794689680; 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=i9Z6VkbQ20OAP2hh2DkotaFT1mmi+0FYTN3uwRKUhC0=; b=uc0LrTxG6T1FdDoHCAaMVshGnbauha0/grgt3AqilJ1BZnRn9gWs/uqMncnZxg71jqfrC6 NRkSbbtYVMM558b3ECY8/MwJyUs/PvkQ44ZlqjwSUZCFkYFZFNFqpNimXsbrxVP2ELHMEW 8R3FEco6IXL8LQnwBThZJVXe/wn7RiNfPiit5KWnSz5TQyBOeyKPLYD+teIqUdE5Zfsl0g vZeD8yUe71wzrlx4UrSrKOoP7J+pz55XXwtu1qgegdGAVYJTZ4VAFpYmc6ApeL8LzeCgLQ oj8mEAoQwqodfM2xVRy7PgNxurac8Z7mPNsewNKzMYY1Z2FRXgLlZFYoPKE/dg== 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 4jRmb35dx4zcX9 for ; Sat, 14 Nov 2026 20:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 13088 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 14 Nov 2026 20:54:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: ShengYi Hung Subject: git: 3b795a9b0be5 - main - xhci: Enlarge total transfer number List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: aokblast X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b795a9b0be5f8a09d290cc147a0c0407f9f36ef Auto-Submitted: auto-generated Date: Sat, 14 Nov 2026 20:54:39 +0000 Message-Id: <6af8ca8f.13088.35168bd2@gitrepo.freebsd.org> The branch main has been updated by aokblast: URL: https://cgit.FreeBSD.org/src/commit/?id=3b795a9b0be5f8a09d290cc147a0c0407f9f36ef commit 3b795a9b0be5f8a09d290cc147a0c0407f9f36ef Author: ShengYi Hung AuthorDate: 2026-11-05 23:15:58 +0000 Commit: ShengYi Hung CommitDate: 2026-11-14 20:54:11 +0000 xhci: Enlarge total transfer number We enlarge the total number of queued transfer. Also, to make controller always busy. We enqueue the xfer as much as possible to the ring in multiple enter code. Differential Revision: https://reviews.freebsd.org/D61246 --- sys/dev/usb/controller/xhci.c | 29 +++++++++++++++-------------- sys/dev/usb/controller/xhci.h | 5 ++++- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index 5cc541b9f634..5807d2b1c15a 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -3183,7 +3183,10 @@ xhci_transfer_insert(struct usb_xfer *xfer) trb_limit = 1; break; default: - /* multi buffered */ + /* + * multi buffered, less the hardcoded LINK TRB and the + * chain end marker + */ trb_limit = (XHCI_MAX_TRANSFERS - 2); break; } @@ -3363,27 +3366,25 @@ xhci_device_generic_multi_enter(struct usb_endpoint *ep, /* * Check if the current transfer is started and then pickup - * the next one, if any. Else wait for next start event due to + * the next ones, if any. Else wait for next start event due to * block on failure feature. */ if (!xfer->flags_int.bandwidth_reclaimed) return; - xfer = TAILQ_FIRST(&ep->endpoint_q[stream_id].head); - if (xfer == NULL) { - /* - * In case of enter we have to consider that the - * transfer is queued by the USB core after the enter - * method is called. - */ - xfer = enter_xfer; - - if (xfer == NULL) + /* + * Try to multi buffer all waiting transfers, in order. + */ + TAILQ_FOREACH(xfer, &ep->endpoint_q[stream_id].head, wait_entry) { + if (xfer->flags_int.bandwidth_reclaimed) + continue; + if (xhci_transfer_insert(xfer) != 0 || + !xfer->flags_int.bandwidth_reclaimed) return; } - /* try to multi buffer */ - xhci_transfer_insert(xfer); + if (enter_xfer != NULL) + xhci_transfer_insert(enter_xfer); } static void diff --git a/sys/dev/usb/controller/xhci.h b/sys/dev/usb/controller/xhci.h index 6818f0e177e8..22a06a88df19 100644 --- a/sys/dev/usb/controller/xhci.h +++ b/sys/dev/usb/controller/xhci.h @@ -35,7 +35,7 @@ #define XHCI_MAX_EVENTS 232 #define XHCI_MAX_COMMANDS (16 * 1) #define XHCI_MAX_RSEG 1 -#define XHCI_MAX_TRANSFERS 4 +#define XHCI_MAX_TRANSFERS 8 #if USB_MAX_EP_STREAMS == 8 #define XHCI_MAX_STREAMS 8 #define XHCI_MAX_STREAMS_LOG 3 @@ -355,6 +355,9 @@ struct xhci_dev_endpoint_trbs { XHCI_MAX_TRANSFERS) + XHCI_MAX_STREAMS]; }; +/* The endpoint rings are addressed from a single physical page */ +CTASSERT(sizeof(struct xhci_dev_endpoint_trbs) <= 4096); + #if (USB_PAGE_SIZE < 4096) #error "The XHCI driver needs a pagesize above or equal to 4K" #endif