dwc3_gadget...tx_fifo_size(9)
β¨ dwc3_gadget...tx_fifo_size(9) β¨
okay bestie, so this page lives in the Kernel API Manual (yes the whole manual, we're fancy now π ) and it's all about one little function that does fifo math so you don't have to. let's get into it π«Ά
πΈ NAME πΈ
dwc3_gadget_calc_tx_fifo_size β the girlies that calculates the txfifo size value π literally her whole job.
π SYNOPSIS π
int dwc3_gadget_calc_tx_fifo_size (struct dwc3 *dwc , int mult );
π¦ ARGUMENTS π¦
dwcβ pointer to the DWC3 context, aka the main character of this whole operation πmultβ the multiplier to be used when calculating thefifo_size, it's giving "how many times we're doing this" energy β¨
π DESCRIPTION π
So the way that this works is it calculates the size value based on the equation below, and the equation depends on which DWC3 revision you're on. v intentional, v specific:
DWC3 revision 280A and prior:
fifo_size = mult * (max_packet / mdwidth) + 1;
DWC3 revision 290A and onwards:
fifo_size = mult * ((max_packet + mdwidth)/mdwidth + 1) + 1
and bestie, the max packet size is set to 1024, because the txfifo requirements mainly apply to super speed USB use cases π
ok but like β is overestimating a problem? no ma'am. it is safe to overestimate the fifo allocations for other scenarios, i.e. high speed USB. so we're just out here being generous with the fifo budget, no cap π
π SEE ALSO π
the whole squad fr fr, all hanging out in the kernel file ./drivers/usb/dwc3/gadget.c:
dwc3_gadget_set_test_mode(9)dwc3_gadget_get_link_state(9)dwc3_gadget_set_link_state(9)dwc3_ep_inc_trb(9)dwc3_ep_inc_enq(9)dwc3_ep_inc_deq(9)dwc3_gadget_giveback(9)dwc3_send_gadget_generic_command(9)dwc3_send_gadget_ep_cmd(9)dwc3_gadget_start_config(9)dwc3_gadget_calc_ram_depth(9)dwc3_gadget_clear_tx_fifos(9)__dwc3_gadget_ep_enable(9)__dwc3_gadget_ep_disable(9)dwc3_ep_prev_trb(9)dwc3_prepare_one_trb(9)dwc3_prepare_last_sg(9)__dwc3_stop_active_transfer(9)dwc3_gadget_start_isoc_quirk(9)dwc3_gadget_setup_nump(9)dwc3_gadget_check_config(9)dwc3_gadget_init(9)
ok that's the whole page bestie, mwah π this one came from ./drivers/usb/dwc3, dated October 2026 β go forth and allocate your fifos responsibly, ily π§π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms