sgl_len(9)
π sgl_len β a Gen Z girl's guide to the kernel API manual, bestie β¨
okay so real talk, this is a page from the Kernel API Manual (that's the manual name, iykyk π«Ά), and it's about one tiny little function that does one tiny little math thing. but we're gonna understand it properly, because that's just how we are. πΈ
β¨ NAME β¨
sgl_len β lowkey just calculates the size of an SGL of the given capacity, and honestly? that's the whole vibe. π
π¦ SYNOPSIS π¦
unsigned int sgl_len (unsigned int n );
π ARGUMENTS π
nβ the number of SGL entries. that's it. that's the whole argument bestie, she's a simple queen π
π DESCRIPTION π
okay so here's the tea, no cap: sgl_len calculates the number of flits needed for a Direct Scatter/Gather List that can hold the given number of entries. π§
and a flit, before you even ask, is an 8-byte unit. literally eight bytes. that's the unit of measurement. periodt. β
so likeβ¦ you give it n (how many entries your SGL needs to hold), it hands back how many 8-byte units of space the Direct Scatter/Gather List is gonna take up. it's giving capacity planning main character energy. π
π SEE ALSO π
honey. buckle up. π
first up, the kernel file this whole thing lives near:
Kernel file ./drivers/net/ethernet/chelsio/cxgb4vf/sge.c
and then the entire friend group, every single one, in order, don't skip a single bestie π:
get_buf_addr(9)is_buf_mapped(9)need_skb_unmap(9)txq_avail(9)fl_cap(9)fl_starving(9)map_skb(9)free_tx_desc(9)reclaim_completed_tx(9)get_buf_size(9)free_rx_bufs(9)unmap_rx_buf(9)ring_fl_db(9)set_rx_sw_desc(9)refill_fl(9)alloc_ring(9)flits_to_desc(9)is_eth_imm(9)calc_tx_flits(9)write_sgl(9)ring_tx_db(9)inline_tx_skb(9)t4vf_eth_xmit(9)copy_frags(9)t4vf_pktgl_to_skb(9)t4vf_pktgl_free(9)do_gro(9)t4vf_ethrx_handler(9)is_new_response(9)restore_rx_bufs(9)rspq_next(9)process_responses(9)napi_rx_handler(9)t4vf_intr_handler(9)sge_rx_timer_cb(9)sge_tx_timer_cb(9)bar2_address(9)t4vf_sge_alloc_rxq(9)t4vf_sge_alloc_eth_txq(9)t4vf_free_sge_resources(9)t4vf_sge_start(9)t4vf_sge_stop(9)t4vf_sge_init(9)
likeβ¦ that's 43 functions. forty-three. an entire friend group chat and they ALL ate. π₯
ngl if you're reading this page to understand one of those you're already in the cxgb4vf/sge.c cinematic universe, so maybe just go read the file too. kudos to whoever kept this index this tidy though, fr fr π
and that's the page, bestie!! the source line at the bottom is a cute little truncated path β ./drivers/net/ethernet/chelsio... β and the version/date stamp says October 2026, so this manual page is basically from the future and we respect her for it. πβ¨π«Ά
π¦ 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