write_sgl(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… write_sgl(9) β€” Kernel API Manual πŸ’…

okay so bestie, this is the write_sgl(9) page from the Kernel API Manual, and it's lowkey all about filling in a Scatter/Gather List for a packet. iconic behavior, honestly. 🫢


✨ NAME ✨

write_sgl β€” populate a Scatter/Gather List for a packet. that's the whole name, no cap. πŸ’–


🫢 SYNOPSIS 🫢

void write_sgl (const struct sk_buff *skb , struct sge_txq *tq , struct
ulptx_sgl *sgl , u64 *end , unsigned int start , const dma_addr_t *addr
);

πŸ’– ARGUMENTS πŸ’–

  • skb β€” the packet. the main character, the whole reason we're here. πŸ“¦
  • tq β€” the TX queue we are writing into. yes ma'am, that queue. πŸŽ€
  • sgl β€” starting location for writing the SGL. your writing spot, bestie. ✨
  • end β€” points right after the end of the SGL. it's giving boundary marker energy. πŸ¦‹
  • start β€” start offset into skb main-body data to include in the SGL. we skip ahead by this much. ⭐
  • addr β€” the list of DMA bus addresses for the SGL elements. the address besties. πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

So write_sgl generates a Scatter/Gather List for the buffers that make up a packet. periodt. 🌸

⚠️ the caller must provide adequate space for the SGL that will be written. this is a real must, bestie, not a cute suggestion. 😭

The SGL includes all of the packet's page fragments and the data in its main body except for the first start bytes. yes, we leave those first bytes out of the SGL party. πŸ™ˆ

πŸŽ€ pos must be 16-byte aligned and within a TX descriptor with available space. alignment check: slay. 🧚

And about end: it points write after the end of the SGL, but it does not account for any potential wrap around, i.e., end > tq->stat. that wrap-around situation is not its business, okay? πŸ’€


🌈 SEE ALSO 🌈

Kernel file: ./drivers/net/ethernet/chelsio/cxgb4vf/sge.c β€” go read the source, iykyk. πŸ”₯


xoxo, this page is from the Kernel API Manual, source/version line ./drivers/net/ethernet/chelsio..., dated October 2026 β€” and yes, it's write_sgl(9) signing off πŸ’…βœ¨

πŸ“¦ where this page comes from