From nobody Sun Jul 12 03:21:35 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 4gyW7j29xCz6kbKJ; Sun, 12 Jul 2026 03:21:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyW7j1bnqz3Fqq; Sun, 12 Jul 2026 03:21:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783826497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6YKiQMqYlo1P0yPqmd2iwfcTCjybPGdtjB15i38WPeU=; b=PVZS6raTh1HXMrXSfQVLUmc6WKSmbYw+FttQ3AZKxnXlwHcVMmSTmLi2L8c5bpD+C/b8oK QUchdqRvOeWsDKZaI+GLS6kv534kk6J8sgHPpWm9vJ+/fhRJGUYDNnh2epKNg78xky82Mk fjbOWUdg8pxqpOBZQzoQFz34CYjziXlnsXUizdzVHuvAj5WK4PwZmdB+lzx8dpHauH3/xi Z4A5z3spYqiqV4/ukaTgBX4rt1QffFo6kEjPEiv82Quh/SoXMq4GE7z/mk7Yn4+5FPKsnf +NJzPghmV+TdWygtu/r1oSCaa8SOy9ybb7bS4Nznz2m9tJvMU3p7WuTf7vD78w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783826497; a=rsa-sha256; cv=none; b=OMknZUSjefeCSRjrC5ixtXnCZvT2QzVBSr7GUfVUYfCmaUlSequndqKLc7nX+zWtjFDZfM VqlgxA9XTXxJkyJ8x/wkoEhx/QVUK51w7734WrPEBHMt6xzNqwBE+HMlDvJnvldt95xiwr MrchRmrUssgyDVZQRzrfMymwpQygxZ7b69zo4LQBJakuBxR6/+XYFXHedsOp+ZVmAY5PXz PKfT8Ld7flZVWGvuiNdRLWGghbaf9/2gs+nObeAnbpQyr2rgseIWRoTOOD4tEh7QKC6OSP IZssQgZrilVzyWibyuD7SKaRc7wB+WvmHHA8Kd3HJYhXKVOc6XADjahDMlKnMQ== 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=1783826497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6YKiQMqYlo1P0yPqmd2iwfcTCjybPGdtjB15i38WPeU=; b=wBEU7+G3+s9jdBCwsJCn+LicadRRmknvZ2auZ5qYkuc1A/c9zLZtUZ2Z4e49oK2Z7LMMe7 38FYCsItz+VjiPBH1NXfsrO5iOlZqqd1EAN/Erzynzndwdcsdo5Yut1v/ZmfblfnjIIVtV GHdZW1Vuhh1Sozly3s90B2y9hJ1Q5pwyD7HRQSBepLrPu/zltZfeDd3yMMx+iOPbs1J+/y aYUlM7X592xum/45KaFaG0Ki0HOGskHJIuI0YUhn6XAjKmXqho/oEW6FHfWEt4tklHZuuH K1X/lidNpurERqqA24aVWrmPi52uKgeU6IurLxktu8FKoAbbTRBzwUjKw0DZaQ== Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gyW7h4q4Qzqtn; Sun, 12 Jul 2026 03:21:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: <49761290-2d6c-403f-acdd-48b5b536804c@FreeBSD.org> Date: Sat, 11 Jul 2026 22:21:35 -0500 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 User-Agent: Mozilla Thunderbird From: Kyle Evans Subject: Re: git: 28d85db46b48 - main - xhci: Do not drop and add bits in xhci To: ShengYi Hung , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <6a1008a0.3f79c.1d455f29@gitrepo.freebsd.org> Content-Language: en-US Cc: Vladimir Kondratyev In-Reply-To: <6a1008a0.3f79c.1d455f29@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/22/26 02:41, ShengYi Hung wrote: > 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(-) > Hi, This patch reliably fixes a bug I've been trying to track down in a u2f(4) patch that I've been testing, and I'm wondering if you can help connect the dots. I have a Solo2 u2f(4) key that I find will inconsistently desync (for other reasons) and hang, and the solution for *that* is to release this NOT_YET block[0] in u2f_dtor(). The problem I was hunting down is that doing so subsequently broke my Yubikey in a way that this patch alone seems to fix. It would hang on every other ssh attempt, as long as we issued usbd_transfer_stop on our interrupt endpoints upon last-close. It was known to work with uhid(4) reliably which issues a stop as well, and that's the thing I can't really explain. Is there something that uhid(4) / usb_dev.c is doing that might have accidentally worked around this? This was the only commit that looked relevant in the fast-forward I did for my latest round of testing from 9c18d55a768a3 to 707ee7ff952c5, and reverting just this patch reliably re-introduces the problem I was having with the Yubikey. Thanks, Kyle Evans [0] https://cgit.freebsd.org/src/tree/sys/dev/hid/u2f.c#n303 > 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; > } >