netif_txq_maybe_stop(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… netif_txq_maybe_stop(9) ✨

okay so bestie, welcome to the netif_txq_maybe_stop(9) page β€” that's the kernel API manual, and this function is literally the "should I stop this Tx queue or not" bouncer. locklessly, no cap.


🌸 NAME 🌸

netif_txq_maybe_stop β€” locklessly stop a Tx queue, if needed πŸŽ€

like, only if needed. it does a vibe check first.


πŸ¦‹ SYNOPSIS πŸ¦‹

netif_txq_maybe_stop (txq , get_desc , stop_thrs , start_thrs );

✨ ARGUMENTS ✨

  • txq β€” the struct netdev_queue you're stopping/starting. main character energy, honestly.
  • get_desc β€” grabs the current number of free descriptors. ⚠️ but read the requirements below, fr fr, don't skip them!
  • stop_thrs β€” the minimal number of available descriptors for the queue to be left enabled. cross below this and it's giving "stopped".
  • start_thrs β€” the minimal number of descriptors needed to re-enable the queue. it can be equal to stop_thrs, or higher if you wanna avoid that annoying frequent waking situation πŸ™ˆ

πŸ’– DESCRIPTION πŸ’–

heads up, and this is the important bit: all arguments may be evaluated multiple times, so beware of side effects!! 😭 not me warning you twice.

get_desc must be a formula or a function call, and it must always return up-to-date information when evaluated! like, always. no stale data, no vibes-based guesswork.

it's expected to be used from ndo_start_xmit β€” see the comment on top of the file, iykyk. πŸ“Œ


πŸ”₯ RETURN πŸ”₯

  • 0 β€” the queue was stopped πŸ›‘
  • 1 β€” the queue was left enabled βœ…
  • -1 β€” the queue was re-enabled (it raced with waking πŸ‘€)

πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./include/net/netdev_queues.h
  • struct netdev_config(9)
  • struct netdev_stat_ops(9)
  • struct netdev_queue_mgmt_ops(9)
  • Lockless queue stopping / waking helpers.(9)
  • __netif_txq_completed_wake(9)

🌈 go read the actual header file too, bestie, it's lowkey iconic.

that's the whole page, periodt πŸ’… β€” shoutout to ./include/net for hosting this masterpiece, Kernel API Manual on the tin, dated October 2026. mwah πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from