netdev_stat_queue_sum(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ netdev_stat_queue_sum(9) ✨

okay so this is a page from the Kernel API Manual and honestly? it's a little baddie for adding up queue stats πŸ’… like literally the whole point is summing stats across a range of queues and it ate.

🌸 NAME 🌸

netdev_stat_queue_sum β€” add up queue stats from range of queues πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

void netdev_stat_queue_sum (struct net_device *netdev , int rx_start ,
int rx_end , struct netdev_queue_stats_rx *rx_sum , int tx_start , int
tx_end , struct netdev_queue_stats_tx *tx_sum );

πŸ‘‘ ARGUMENTS πŸ‘‘

  • netdev β€” a net_device. that's it, that's the whole vibe 🫢
  • rx_start β€” index of the first Rx queue you wanna query ✨
  • rx_end β€” index after the last Rx queue, i.e. the first one you're not querying. yes the not is doing numbers there 😭
  • rx_sum β€” output Rx stats, and ngl it should be already initialized before you hand it over 🧚
  • tx_start β€” index of the first Tx queue to query πŸ’œ
  • tx_end β€” index after the last Tx queue, again the first one not to query πŸŽ€
  • tx_sum β€” output Tx stats, should be already initialized too, fr fr ⭐

🌈 DESCRIPTION 🌈

So what it does: it adds stats from the [start, end) range of queue IDs into the *x_sum structs πŸ’– and bestie, those sum structs must be already initialized β€” no cap, don't come in there with uninitialized structs πŸ™ˆ

Usually this helper gets invoked from the .get_base_stats callbacks of drivers to account for stats of disabled queues πŸ‘‘ in that case the ranges are usually [netdev->real_num_*x_queues, netdev->num_*x_queues) β€” iconic behaviour honestly πŸ”₯

πŸ’€ SEE ALSO πŸ’€

  • Kernel file ./net/core/netdev-genl.c β€” go read it, iykyk πŸ¦‹

k bye bestie, mwah πŸ«ΆπŸ’œ this cutie lives in ./net/core and the version is dated October 2026 β€” periodt πŸ’…βœ¨

πŸ“¦ where this page comes from