From nobody Fri May 22 07:41:20 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 4gMHJx12rDz6f3rk for ; Fri, 22 May 2026 07:41:21 +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" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gMHJw6yRgz3LFf for ; Fri, 22 May 2026 07:41:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779435681; 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=ILYoAFYHXhilPCVWKSwpIzqJaBg1CFfueo3aR0heQ5s=; b=c0t8l5A+zM7ekYzhkn3z0au+5mcu1y1dPA2J+wJpTjHBK0rb/7cZMNKl8wvFgf3tm27Ra7 awJcK/ttycWLZhT0GW5L9/8ls1PWRSKzt7HDBBLN0pkI2C/Qy4eokshDLqlW18TYWV+Gsy 9mnKQ8/VlUyXbhIQXhGJlAR4kVOspY3q9UIfAHvjy1ulg1JPeSeUPzM2fYkKjFqUF5cetT TkEU/Pwvrdm3EwFCt5hfapd5TAbAQ0Z/oHcPez9VAe3Lu+nO67MpnBA34e0AuFlJHHvMrk lWvzb719zFtkR1vPhAvN2E5+ejAg+49824Tb6OjbBW1wnOCLGixnLFZ3kXqcNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779435681; a=rsa-sha256; cv=none; b=TO9JZ1TTm6sJxD6QOYJxOGql/vi5MXvf5AWKvcJka/Z7ZqtQU1WYQc7r4TW+ZpGUkjFAHN r2stFpx9Spr2NiyMtJ++MC6kHri11UqgQCcDRGiQgcIbdOIpCNcWJjWWh8U4D45p+Ic8Ta ycO2Wy7iNc/0xSkr81hBDxjhh5APgZ0RyZ5CikOExFjWe3Cj3RPU7FJuZu9CGukGdYACJd Y064K+k/QG6j7h0i1zphPlr8NvQLWpeQzMggjRM+Q6qL0zk2O2EPNRmQ9c/GskAGyd4iuz yJXgZ8CV/scwoOH6BOJv/dXF3TLAWTzykVq8lse9cF5Dt8yKaL5xQ7oMKRSyOg== 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=1779435681; 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=ILYoAFYHXhilPCVWKSwpIzqJaBg1CFfueo3aR0heQ5s=; b=X2xJSMT/2o2IqpW+lKWgHbhDMr2+iCeOyYuXB/rTQr312QqJLReghQGc245xaH+TmIYxz0 IhznKgWGpZH1PjbSf9/ouBWfn4e4Hrzb8SbEJgMi4sVCF54aVTAaqZD2xVHsAB/JBv9rPs X/B2LbWOQv7F8yv3ipxp38hqujlQkE6sshgehqzJG/UeXxqRtqqDi/IQgjYyMEU/ivwAiM zah9i1ekPmLW/9ggHWiLWO+fk2u5voYNWGcnhZTGsAEOUSJgcIuIh97hM4PeNP7jsger9W +cvA2S6+nGwbzW+rWi8kQdcaHGChmScALNyaarqzCPvG5NxbdEEkZizj5ty0DQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gMHJw6G4kz19Lg for ; Fri, 22 May 2026 07:41:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f79c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 22 May 2026 07:41:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: ShengYi Hung Subject: git: 28d85db46b48 - main - xhci: Do not drop and add bits in xhci 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 List-Id: 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: 28d85db46b484589e2ee74cf4b270db066821de1 Auto-Submitted: auto-generated Date: Fri, 22 May 2026 07:41:20 +0000 Message-Id: <6a1008a0.3f79c.1d455f29@gitrepo.freebsd.org> The branch main has been updated by aokblast: URL: https://cgit.FreeBSD.org/src/commit/?id=28d85db46b484589e2ee74cf4b270db066821de1 commit 28d85db46b484589e2ee74cf4b270db066821de1 Author: ShengYi Hung AuthorDate: 2026-05-21 12:49:42 +0000 Commit: ShengYi Hung CommitDate: 2026-05-22 07:41:07 +0000 xhci: Do not drop and add bits in xhci Drop and Add bits reset the data toggle for high-speed devices in XHCI. The toggle bit represents the sequence number in USB 2.0 transfers. However, a device can only recognize that the toggle bit has been reset while in the HALT state. As a result, the host and device toggle values may become mismatched, causing xHCI to reject the packet. This issue was observed while testing the EZ-USB FX2 device. The transfer may then return to the original value after a bi-directional TD because the toggle field is only one bit wide. This explains the reson that we can only receive packets bi-transfer in some case. Therefore, we do not reset the toggle bit here. Reviewed by: adrian MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57146 --- sys/dev/usb/controller/xhci.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index 3dad0985b39d..b522c5fdc5a3 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -3898,10 +3898,8 @@ xhci_configure_reset_endpoint(struct usb_xfer *xfer) */ switch (xhci_get_endpoint_state(udev, epno)) { case XHCI_EPCTX_0_EPSTATE_DISABLED: - drop = 0; - break; case XHCI_EPCTX_0_EPSTATE_STOPPED: - drop = 1; + drop = 0; break; case XHCI_EPCTX_0_EPSTATE_HALTED: err = xhci_cmd_reset_ep(sc, 0, epno, index); @@ -3910,9 +3908,15 @@ xhci_configure_reset_endpoint(struct usb_xfer *xfer) DPRINTF("Could not reset endpoint %u\n", epno); break; default: - drop = 1; + /* + * xHCI spec 4.6.8: + * The Drop and Add operation resets the toggle bit, which can + * cause a toggle mismatch between the device and host. As a + * result, xHCI may refuse to receive or process the packet. + */ err = xhci_cmd_stop_ep(sc, 0, epno, index); - if (err != 0) + drop = (err != 0); + if (drop) DPRINTF("Could not stop endpoint %u\n", epno); break; }