alloc_long_term_buff(9)
π alloc_long_term_buff(9) π
okay so this is a page from the Kernel API Manual, and it's all about alloc_long_term_buff β the function that grabs you a long term buffer (aka an LTB, bestie, keep up π
). Let's get into it.
β¨ SYNOPSIS β¨
int alloc_long_term_buff (struct ibmvnic_adapter *adapter , struct
ibmvnic_long_term_buff *ltb , int size );
that's the whole vibe. three args, one int coming back at you π«Ά
π ARGUMENTS π
adapterβ theibmvnicadapter that this LTB is attached to. like, which one are we doing this for, yk?ltbβ the container object for the LTB. this is where the buffer lives πΈsizeβ how big the LTB is. the actual size. of the LTB. yes π
π¦ DESCRIPTION π¦
So the whole point: allocate an LTB of the size you specified, and then notify the VIOS. that's it, that's the job. β¨
Now here's the smart part, and honestly? iconic. If the ltb you handed in already has the correct size, we just reuse it. no allocation, no drama. BUT β if it's non-NULL and the size is wrong, we free it first. then we allocate a brand new one at the correct size. π₯ Either way, we notify the VIOS, because we might now be working with a new VIOS. so like, always notify. periodt.
β οΈ real talk, this part matters: allocating larger chunks of memory during resets β especially LPM, or when you're under low memory situations β can cause resets to fail/timeout, and the LPAR can lose connectivity. π so we hold onto the LTB even if we fail to communicate with the VIOS, and we reuse it on the next open. the LTB only gets freed when the adapter is closed. that's the rule, no cap.
π RETURN π
0β we allocated the LTB AND notified the VIOS. slay π- a negative value β literally anything else went wrong π
π SEE ALSO π
Kernel file:
./drivers/net/ethernet/ibm/ibmvnic.c
and the whole friend group π«Ά (all of these are (9) sections, iykyk):
ibmvnic_wait_for_completion(9)reuse_ltb(9)free_ltb_set(9)alloc_ltb_set(9)map_rxpool_buf_to_ltb(9)map_txpool_buf_to_ltb(9)release_rx_pools(9)reuse_rx_pools(9)init_rx_pools(9)release_tx_pools(9)reuse_tx_pools(9)init_tx_pools(9)get_hdr_lens(9)create_hdr_descs(9)build_hdr_descs_arr(9)do_passive_init(9)
and that's the page!! sourced from ./drivers/net/ethernet/ibm, dated October 2026 β go read it, it's giving documentation main character energy ππ
π¦ 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