get_packet_pg(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– get_packet_pg(9) β€” like, the whole vibe πŸ’–

okay bestie, gather round, because we're diving into the Kernel API Manual and this one is genuinely a little icon. so sit down, hydrate, and let's talk about get_packet_pg 🫢


✨ NAME ✨

get_packet_pg β€” returns the next ingress packet buffer from a free list. that's it, that's the whole job. no cap. πŸ’…


🌸 SYNOPSIS 🌸

struct sk_buff * get_packet_pg (struct adapter *adap , struct sge_fl *fl
, struct sge_rspq *q , unsigned int len , unsigned int drop_thres );

look at that signature. it's giving "i take my arguments very seriously." slay. ⭐


πŸ¦‹ ARGUMENTS πŸ¦‹

  • adap β€” the adapter that received the packet. like, the origin story of the packet. who brought it here. πŸ‘‘
  • fl β€” the SGE free list holding the packet. this is where the packet's been chilling. πŸŽ€
  • q β€” the queue. yes. just the queue. it's that girl. 🌈
  • len β€” the packet length including any SGE padding. so don't come at it with the unpadded number, okay? the padding counts. πŸ™ˆ
  • drop_thres β€” the # of remaining buffers before we start dropping packets. think of it as the "uh oh, getting low" line. when we dip below it, things get real. πŸ’€

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea. this function grabs the next packet off a free list β€” except this free list is populated with page chunks, which is a whole different situation from the usual. 🧚

if the packet is small, we make a copy and recycle the original buffer. easy, cute, low effort, love that for us. πŸ’–

but if it's not small? then we attach the original buffer as a page fragment to a fresh sk_buff instead. no copying, just attaching. main character energy, honestly. πŸ”₯

and now the spicy part β€” if a positive drop threshold is supplied, packets get dropped and their buffers recycled when:

  • (a) the number of remaining buffers is under the threshold and the packet is too big to copy, or
  • (b) there's no system memory. 😭

both of those are valid reasons to bail. it's not being dramatic, it's being correct.


πŸ“ NOTE πŸ“

this function is similar to get_packet, but it deals with Rx buffers that are page chunks rather than sk_buffs. so like, same energy, different situation. don't confuse them, bestie, i'm begging. πŸ™


πŸ‘‘ SEE ALSO πŸ‘‘

the kernel file ./drivers/net/ethernet/chelsio/cxgb3/sge.c, plus literally the entire extended universe:

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_imm_packet(9), calc_tx_descs(9), write_sgl(9), check_ring_tx_db(9), write_wr_hdr_sgl(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(9), 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)

like i said. the whole universe. go read them, iykyk. πŸ“šβœ¨


aaaand that's the page, bestie!! πŸŽ€ this little gem lives in the Kernel API Manual, sourced from ./drivers/net/ethernet/chelsio..., dated October 2026. now go forth and slay those ingress packet buffers πŸ’…πŸ’–

πŸ“¦ where this page comes from