skb_seq_read(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 skb_seq_read (9) β€” Kernel API Manual, bestie edition 🌸

okay so picture this: you're in the <pink>Kernel API Manual</pink>, it's giving very much "I need to walk through an skb piece by piece" energy, and this lil function is literally your main character. let's get into it πŸ’…


✨ NAME ✨

skb_seq_read β€” read skb data sequentially, one block at a time, no cap 🫢


✨ SYNOPSIS ✨

unsigned int skb_seq_read (unsigned int consumed , const u8 **data ,
struct skb_seq_state *st );

✨ ARGUMENTS ✨

  • consumed β€” how many bytes you (the caller) have already eaten so far. yes it's a tracker. keep it honest πŸ™ˆ
  • data β€” the destination pointer where the data to be returned gets dropped off. it's the delivery address, basically πŸŽ€
  • st β€” the state variable. the vibe holder. the memory of the whole operation ✨

✨ DESCRIPTION ✨

So this function reads a block of skb data at consumed, measured relative to the lower offset that you specified to skb_prepare_seq_read. It assigns the head of the data block to data and returns the length of the block β€” or 0 if you've hit the end of the skb data or the upper offset has been reached. that 0 is your "we're done here, go home" signal πŸ’€

Here's the cute part: the caller is not required to consume all of the data returned. like, consumed is typically set to the number of bytes already consumed, and the next call to skb_seq_read will hand you the remaining part of the block. so it's lowkey a "no pressure, take what you need, the rest will be here for you" situation 🫢

Note 1: The size of each block of data returned can be arbitrary. that's not a bug, that's the price of admission β€” it's literally the cost for zerocopy sequential reads of potentially non linear data. iconic tradeoff, honestly πŸ‘‘
Note 2: Fragment lists within fragments are not implemented at the moment. the manpage literally says state->root_skb could be replaced with a stack for this purpose. so like. future improvement noted, bestie πŸ“

✨ SEE ALSO ✨

Related reading, aka the whole extended friend group of skbuff functions, all from the Kernel file ./net/core/skbuff.c:

that's a whole friend group and you're invited to the group chat πŸ§šπŸ’œ


✨ and that's the whole page, bestie ✨ this one ships out of ./net/core and the version stamp on it is October 2026 β€” so go forth, read your skb data sequentially, remember to keep consumed accurate, and slay πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from