write_wr_hdr_sgl(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… write_wr_hdr_sgl(9) β€” the kernel API manual, but make it cute ✨

okay so bestie, listen. this is the write_wr_hdr_sgl manual page from the Kernel API Manual, and it's literally about writing a WR header and, optionally, an SGL. we're in the net driver trenches and it's giving very much "I know what I'm doing" energy. let's get into it 🫢


🌸 SYNOPSIS 🌸

void write_wr_hdr_sgl (unsigned int ndesc , struct sk_buff *skb , struct
tx_desc *d , unsigned int pidx , const struct sge_txq *q , const struct
sg_ent *sgl , unsigned int flits , unsigned int sgl_flits , unsigned int
gen , __be32 wr_hi , __be32 wr_lo );

that's the whole signature, no cap. memorize it or at least keep it in a pinned tab πŸ’–


πŸŽ€ ARGUMENTS πŸŽ€

  • ndesc β€” how many Tx descriptors the SGL spans. yes, the actual count, be precise bestie πŸ’…
  • skb β€” the packet that corresponds to the WR. it's the main character, give it respect ✨
  • d β€” the first Tx descriptor to be written. this is where the magic starts πŸͺ„
  • pidx β€” the index of those descriptors above. yes, the index. not optional, keep track πŸ”₯
  • q β€” the SGE Tx queue. the whole energy of this operation lives here πŸ‘‘
  • sgl β€” the SGL itself. the icon, the moment πŸ’«
  • flits β€” number of flits to the start of the SGL in the first descriptor. count them, don't guess 🧚
  • sgl_flits β€” the SGL size in flits. also flits, also matters, we love consistency 🌈
  • gen β€” the Tx descriptor generation. gotta know which generation we're in, iykyk πŸ’œ
  • wr_hi β€” top 32 bits of the WR header, based on WR type, big endian. important: big endian, don't @ me πŸ’€
  • wr_lo β€” low 32 bits of the WR header, based on WR type, big endian. same vibe, other half πŸ“

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: this function writes a work request header and an associated SGL. no biggie, just very important kernel stuff ✨

if the SGL is small enough to fit into one Tx descriptor, it's already been written. so at that point we just need to write the WR header. easy, slay, done πŸ’…

otherwise β€” and this is the highkey part β€” we have to distribute the SGL across the number of descriptors it spans. yes, spread it out, because we're not monsters, we're kernel devs 🫢

ngl, this is the kind of function where you really do need to know what you're doing. it's not vibes-only, bestie. but you've got this πŸ’–

πŸ’€ SEE ALSO πŸ’€

okay this list is long, but every single one matters. no skipping, no summarizing, we list them all because that's the assignment. here we go:

Kernel file ./drivers/net/ethernet/chelsio/cxgb3/sge.c and these functions:

refill_rspq(9), need_skb_unmap(9), unmap_skb(9), free_tx_desc(9), reclaim_completed_tx(9), should_restart_tx(9), free_rx_bufs(9), add_one_rx_buf(9), refill_fl(9), recycle_rx_buf(9), alloc_ring(9), t3_reset_qset(9), t3_free_qset(9), init_qset_cntxt(9), sgl_len(9), flits_to_desc(9), get_packet(9), get_packet_pg(9), get_imm_packet(9), calc_tx_descs(9), write_sgl(9), check_ring_tx_db(9), write_tx_pkt_wr(9), t3_eth_xmit(9), write_imm(9), check_desc_avail(9), reclaim_completed_tx_imm(9), ctrl_xmit(9), restart_ctrlq(9), deferred_unmap_destructor(9), write_ofld_wr(9), calc_tx_descs_ofld(9), ofld_xmit(9), restart_offloadq(9), queue_set(9), is_ctrl_pkt(9), t3_offload_tx(9), offload_enqueue(9), deliver_partial_bundle(9), ofld_poll(9), rx_offload(9), restart_tx(9), cxgb3_arp_process(9), rx_eth(9), lro_add_page(9), handle_rsp_cntrl_info(9), check_ring_db(9), is_new_response(9), process_responses(9), napi_rx_handler(9), process_pure_responses(9), handle_responses(9), t3_intr_handler(9), t3_sge_err_intr_handler(9), sge_timer_tx, sge_timer_rx(9), t3_update_qset_coalesce(9), t3_sge_alloc_qset(9), t3_start_sge_timers(9), t3_stop_sge_timers(9), t3_free_sge_resources(9), t3_sge_start(9), t3_sge_stop_dma(9), t3_sge_stop(9), t3_sge_init(9), t3_sge_prep(9)

that's the whole friend group, go say hi 😭🌸


🌟 little sign-off 🌟

this page lives in ./drivers/net/ethernet/chelsio..., it's dated October 2026, and it's part of the write_wr_hdr_sgl(9) manual. stay hydrated, read your man pages, and remember: every detail matters, even the flits πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from