Page MenuHomeFreeBSD

xhci: Only reset the data toggle value when the USB stack asks for it
ClosedPublic

Authored by aokblast on Aug 25 2026, 7:24 PM.
Tags
None
Referenced Files
F174267282: D59186.diff
Thu, Oct 1, 9:09 PM
F174240839: D59186.diff
Thu, Oct 1, 3:46 PM
Unknown Object (File)
Wed, Sep 30, 5:56 PM
Unknown Object (File)
Wed, Sep 30, 11:36 AM
Unknown Object (File)
Tue, Sep 29, 9:56 AM
Unknown Object (File)
Sat, Sep 26, 8:06 AM
Unknown Object (File)
Fri, Sep 25, 4:38 PM
Unknown Object (File)
Wed, Sep 23, 8:53 AM
Subscribers

Details

Summary

The previous patch assumes that we don't want to reset toggle bit in
STOPPED_STEP. However, a device can explicitly call
usbd_clear_data_toggle if necessary. As a result, instead of not
dropping the bit unconditionally, we added a field in xhci to specify
that we want to drop it, so that usbd_clear_data_toggle can handle it
correctly.

Fixes: 28d85db46b48 ("xhci: Do not drop and add bits in xhci")
MFC after: 2 weeks

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aokblast added a subscriber: kevans.

@kevans Could you please check if there is any regression on your yubikey? Thanks!

@kevans Could you please check if there is any regression on your yubikey? Thanks!

Sure thing, I am working on getting this patch to my two test machines now.

The USB key mentioned in D57146 does work with this patch on stable/15 (132e609c2ce5c72e9e04a5d6f3e0e9140e06ebd8)
Thank you.

This LGTM and also tests fine with my Yubikey. My test setup is naive, but just to document it:

kevans@rex:~/.ssh$ while true; do env -i ssh -i id_yubikey_sk 10.9.0.1 date;  done   
Wed Aug 26 08:20:37 CDT 2026
Wed Aug 26 08:20:38 CDT 2026
Wed Aug 26 08:20:39 CDT 2026
Wed Aug 26 08:20:40 CDT 2026
[...]

This reliably locks up after either two or three iterations if we get this wrong. I run this test with both a Yubikey and a Solo key, and on both my frame.work laptop and a Minisforum unit that have demonstrated problems with the test due to two separate issues.

This revision is now accepted and ready to land.Aug 26 2026, 1:25 PM

CC releng because this should go into 14.5, IMO, which might mean an expedited MFC. I think this is reasonably safe.

CC releng because this should go into 14.5, IMO, which might mean an expedited MFC. I think this is reasonably safe.

Thanks for helping me test this! The previous problematic device is left in Taiwan and I don't have it now.
I set MFC after to 3 days after. Hope everything works well.