lan78xx_con..._flowcontrol(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’… lan78xx_configure_flowcontrol โ€” the Kernel API Manual glow-up ๐ŸŽ€

okay so bestie, welcome to the LAN78xx flow control page โœจ this is from the Kernel API Manual and it's literally all about telling the chip when to send pause frames and when to chill. stay with me, it's giving hardware tea โ˜•


โœจ NAME โœจ

lan78xx_configure_flowcontrol โ€” set MAC and FIFO flow control configuration ๐Ÿฆ‹


๐ŸŒธ SYNOPSIS ๐ŸŒธ

int lan78xx_configure_flowcontrol (struct lan78xx_net *dev , bool
tx_pause , bool rx_pause );

๐Ÿงš ARGUMENTS ๐Ÿงš

  • dev โ€” pointer to the LAN78xx device structure. that's your main character right there ๐Ÿ‘‘
  • tx_pause โ€” enable transmission of pause frames (yes, we're sending them ๐Ÿ“ค)
  • rx_pause โ€” enable reception of pause frames (and yes, we're receiving them ๐Ÿ“ฅ)

๐Ÿ”ฅ DESCRIPTION ๐Ÿ”ฅ

So this function configures the LAN78xx flow control settings by writing to the FLOW and FCT_FLOW registers. no cap, that's the whole job ๐Ÿ’…

The pause time is set to the maximum allowed value (65535 quanta). FIFO thresholds are selected based on USB speed. slay.

The Pause Time field is measured in units of 512-bit times (quanta):

  • At 1 Gbps: 1 quanta = 512 ns โ†’ max ~33.6 ms pause โšก
  • At 100 Mbps: 1 quanta = 5.12 ยตs โ†’ max ~335 ms pause ๐ŸŒธ
  • At 10 Mbps: 1 quanta = 51.2 ยตs โ†’ max ~3.3 s pause ๐Ÿข

Flow control thresholds (FCT_FLOW) are used to trigger pause/resume:

  • RXUSED is the number of bytes used in the RX FIFO
  • Flow is turned ON when RXUSED โ‰ฅ FLOW_ON threshold ๐ŸŸข
  • Flow is turned OFF when RXUSED โ‰ค FLOW_OFF threshold ๐Ÿ”ด
  • Both thresholds are encoded in units of 512 bytes (rounded up) ๐Ÿงฎ

Thresholds differ by USB speed because available USB bandwidth affects how fast packets can be drained from the RX FIFO:

  • USB 3.x (SuperSpeed): FLOW_ON = 9216 bytes โ†’ 18 units, FLOW_OFF = 4096 bytes โ†’ 8 units ๐Ÿš€
  • USB 2.0 (High-Speed): FLOW_ON = 8704 bytes โ†’ 17 units, FLOW_OFF = 1024 bytes โ†’ 2 units ๐ŸŒ

๐Ÿ’€ NOTE ๐Ÿ’€

The FCT_FLOW register must be configured before enabling TX pause (i.e., before setting FLOW_CR_TX_FCEN_), as required by the hardware. like, the hardware said what it said and we are NOT arguing ๐Ÿ™ˆ do it in that order, fr fr.

โญ RETURN โญ

0 on success or a negative error code on failure. that's it, that's the vibe check โœ…


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

Kernel file ./drivers/net/usb/lan78xx.c, plus these icons:

go read them, iykyk ๐Ÿซถ


and that's the whole page, bestie ๐Ÿ’œ this lil' icon lives in ./drivers/net/usb, dated October 2026 โ€” go off, periodt ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from