From nobody Tue Jun 23 20:53:06 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 4glHMl2jnKz6j6RJ for ; Tue, 23 Jun 2026 20:53:07 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4glHMk6448z3HVx for ; Tue, 23 Jun 2026 20:53:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782247986; 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=p8Uj6txK7SQeGeF7gQ+wi801CZFUMOQ5b6em0t+qw8o=; b=uMWzNXDK3L8M2etsbrh79pHhf4vDElV/vDJ8FrZQpN9Eij6u16FdyRQ8QnsgGSmA8J9XzJ H5G/FiOr3uIR3CNIYSGZ3THnOSkPmNNqqFed/n5dbHPmUaTKKBkDoWwuTK8d+wkemcVCLg HK0jQTKwBPVJVIBHfllG+uLWzehgLNdFWdRndByJvSFwI74vdyuM8hQL8pM0NdOH/raj+Q UyTYJnDmVm8hjREYlsIZ0c310p3fDULPnYXeeSjxnyLJwHb7Ruo31zJIEnhbq5rcV1osT4 ac38gqAYZxTTgUj1BAMez8Vpr8SWfBeM2nV0skX8A4U//8dUZYe9nftKR+25sg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782247986; a=rsa-sha256; cv=none; b=hD22pO+yAAZhc3LI2unWbN2G1URhcaZcZuxhkuo7E5AGY/AtrYMclqUehXBeI9BxuNuP+X h4GerzKFGatfnr8M8LUWmjbvftnJCL3c24eps63IlIJZku9jG8L537pa95eJb6GsXHEwTC RZHBc8clNcytzwAWwZ3SKQTr96R08zB5/t4ivtZvPQMm9EbQJZ2ET1RxwB4zGc3qXwwbIy tsCd3EsumNm4BKXvOawuPaPGKnA2sqIEd5npdOSSDFKiHyNnsOl0c5dUt3bW9nxqwXiyaB /gtfutSOw5FC2jx4lw0Nr/LEBA6VWF9IR8p66ThZ/ZhLXAdDUwsUvYg9mIXlQQ== 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=1782247986; 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=p8Uj6txK7SQeGeF7gQ+wi801CZFUMOQ5b6em0t+qw8o=; b=gR/A5dFxQcuWGsl6ZhpoagIgNMNALoDmMrkcrAXewdYlI74Liy8/c2mZwoFIZpGZtXnuVV ejisoQsu+tKf12AaYznOIzI5Uw5iCtC93FFp5VkMN1Wcd4vZJOCrTB0VmltixcrbRSVV0n WpM+bKLPbtXFzpi13MfsDQiMzbHjT3M5pNISh7ILw5roTPez5EYa3LbTkaGHzfs9G8udCs apwwa0lplQEwLiLEQQPOXLDpwwmGPq2tT/WAQQ1QNHzsmYO9Iw0DHOrbgWgQAMrSQQ8ox8 T2Pnc8cJQr12h3tPWqJlVUNB9NMEFI4qkqhBoqbYQHcXzJ3haMJYgQcCRQWVIQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4glHMk55Y0zr1g for ; Tue, 23 Jun 2026 20:53:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1c37b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 23 Jun 2026 20:53:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: ShengYi Hung Subject: git: df2d5780bf6b - stable/15 - 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/stable/15 X-Git-Reftype: branch X-Git-Commit: df2d5780bf6b27915af54ed3a3414d13be640ded Auto-Submitted: auto-generated Date: Tue, 23 Jun 2026 20:53:06 +0000 Message-Id: <6a3af232.1c37b.396f39fb@gitrepo.freebsd.org> The branch stable/15 has been updated by aokblast: URL: https://cgit.FreeBSD.org/src/commit/?id=df2d5780bf6b27915af54ed3a3414d13be640ded commit df2d5780bf6b27915af54ed3a3414d13be640ded Author: ShengYi Hung AuthorDate: 2026-05-21 12:49:42 +0000 Commit: ShengYi Hung CommitDate: 2026-06-23 20:52:08 +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 (cherry picked from commit 28d85db46b484589e2ee74cf4b270db066821de1) --- 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 788b2b718062..23ad3f86e46b 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; }