dwc2_wait_timer_fn(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, welcome to dwc2_wait_timer_fn(9) from the Kernel API Manual β€” this one is a little timer cutie and she has lore πŸ’…βœ¨

🌸 NAME 🌸

dwc2_wait_timer_fn β€” timer function to re-queue after waiting πŸ‘‘

πŸ¦‹ SYNOPSIS πŸ¦‹

enum hrtimer_restart dwc2_wait_timer_fn (struct hrtimer *t );

πŸŽ€ ARGUMENTS πŸŽ€

  • t β€” pointer to wait_timer in a qh. that's the whole vibe 🫢

πŸ’– DESCRIPTION πŸ’–

So per the spec, a NAK means: "a function is temporarily unable to transmit or receive data, but will eventually be able to do so without need of host intervention". Translation: they're not ghosting forever, they just can't rn 😭

Which means when we hit a NAK, we're supposed to retry. periodt.

...but bestie, if we retry right away β€” like, straight from the interrupt handler that saw the NAK β€” we can end up with an interrupt storm if the other side keeps NAKing us. Why? Because on slow enough CPUs it could take us longer to get out of the interrupt routine than it takes for the device to send another NAK. That leads to a constant stream of NAK interrupts and the CPU locks πŸ’€

...so instead of retrying immediately when we get a NAK, we set a timer to retry some time later. This function handles that timer, moves the qh back to the "inactive" list, then queues transactions. iconic behavior honestly ✨

⭐ RETURN ⭐

HRTIMER_NORESTART β€” so this timer does not automatically restart. no cap 🫢

🌈 SEE ALSO 🌈

Kernel file: ./drivers/usb/dwc2/hcd_queue.c

Also go give these icons a look πŸ‘‘: dwc2_periodic_channel_available(9), dwc2_check_periodic_bandwidth(9), pmap_schedule(9), pmap_unschedule(9), dwc2_get_ls_map(9), dwc2_qh_print(9), dwc2_qh_schedule_print(9), dwc2_ls_pmap_schedule(9), dwc2_ls_pmap_unschedule(9), dwc2_hs_pmap_schedule(9), dwc2_hs_pmap_unschedule(9), dwc2_uframe_schedule_split(9), dwc2_uframe_schedule_hs(9), dwc2_uframe_schedule_ls(9), dwc2_uframe_schedule(9), dwc2_uframe_unschedule(9), dwc2_pick_first_frame(9), dwc2_do_reserve(9), dwc2_do_unreserve(9), dwc2_unreserve_timer_fn(9), dwc2_check_max_xfer_size(9), dwc2_schedule_periodic(9), dwc2_deschedule_periodic(9), dwc2_qh_init(9), dwc2_hcd_qh_create(9), dwc2_hcd_qh_free(9), dwc2_hcd_qh_add(9), dwc2_hcd_qh_unlink(9), dwc2_next_for_periodic_split(9), dwc2_next_periodic_start(9), dwc2_hcd_qtd_init(9), dwc2_hcd_qtd_add(9).


mwah πŸ’‹ this page came from source/version ./drivers/usb/dwc2 and is dated October 2026 β€” slay and goodbye bestie πŸŽ€

πŸ“¦ where this page comes from