lpfc_mbuf_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– lpfc_mbuf_alloc(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual ✨ β€” yes we're in kernel-land today, and no, it's not scary, i promise 🫢 this one's from <rainbow>lpfc_mbuf_alloc(9)</rainbow> and it's literally just "gimme a buffer, pls" energy.


✨ NAME ✨

lpfc_mbuf_alloc β€” allocate an mbuf from the lpfc_mbuf_pool PCI pool πŸŽ€


🌸 SYNOPSIS 🌸

void * lpfc_mbuf_alloc (struct lpfc_hba *phba , int mem_flags ,
       dma_addr_t *handle );

like, that's the whole vibe. three args, one pointer back. slay. πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • phba β€” the HBA that owns the pool we're allocating from. it's giving "whose house are we raiding" energy πŸ‘‘
  • mem_flags β€” tells you if this is a priority (MEM_PRI) allocation. fancy mode, basically ✨
  • handle β€” used to return the DMA-mapped address of the mbuf back to you. it's the little messenger that brings the address home πŸŽ€

πŸ’œ DESCRIPTION πŸ’œ

so what does it actually do? it allocates a DMA-mapped buffer from the lpfc_mbuf_pool PCI pool. periodt. 🫢

here's the tea tho β€” the order of operations matters, iykyk: it allocates from the generic dma_pool_alloc function first, and if that fails and mem_flags has MEM_PRI set (which is, btw, the only defined flag πŸ‘€), then it returns an mbuf from the HBA's pool instead.

so it's like: try the normal spot, and if that's a flop and you flagged priority, fall back to the HBA's own stash. backup plan is iconic, honestly πŸ’…


πŸŽ€ NOTES πŸŽ€

bestie pls read this part, it's important 😭
  • Not interrupt-safe. like, do not come at this from interrupt context, fr fr πŸ’€
  • Must be called with no locks held. none. zero. zip. πŸ™ˆ
  • Takes phba->hbalock. yes, it takes it β€” that's why you don't. the way that it handles its own locking… main character energy tbh πŸ‘‘

⭐ RETURN ⭐

  • pointer to the allocated mbuf on success 🌈
  • NULL on failure πŸ’€

πŸ“ SEE ALSO πŸ“

kernel file ./drivers/scsi/lpfc/lpfc_mem.c plus the whole friend group 🫢:


and that's the page, bestie πŸ§šπŸ’– this lil gem lives under ./drivers/scsi/lpfc and it's dated October 2026 β€” so like, future vibes only 🌸⭐ go forth and allocate responsibly, mwah πŸ’‹

πŸ“¦ where this page comes from