dwc3_gadget...tx_fifo_size(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 the fifo_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:


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