nft_pipapo_avx2_lookup_4b_2(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… nft_pipapo_avx2_lookup_4b_2 β€” from the Kernel API Manual (yes bestie, we're in the kernel docs now ✨)

okay so picture this: you're deep in the netfilter guts, AVX2 registers are humming, and this little icon is the one doing the 2-four-bit-group lookups. no cap, she's niche, but she eats. πŸ“


✨ NAME ✨

nft_pipapo_avx2_lookup_4b_2 β€” the AVX2-based lookup for 2 four-bit groups, periodt. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

int nft_pipapo_avx2_lookup_4b_2 (unsigned long *map , unsigned long
*fill , const struct nft_pipapo_field *f , int offset , const u8 *pkt ,
bool first , bool last );

🌸 ARGUMENTS 🌸

like, every single one, because we don't skip πŸ’…

  • map β€” the previous match result, used as the initial bitmap. it's the receipts from last time, basically.
  • fill β€” the destination bitmap that gets filled with the current match result. main character of the output, lowkey.
  • f β€” the field, holding the lookup and mapping tables. she's got the lore.
  • offset β€” ignore buckets before this index; no bits are filled there. respectfully, everything before it is not invited to the function. πŸ™ˆ
  • pkt β€” the packet data, a pointer to the input nftables register. the raw tea itself.
  • first β€” if this is the first field, don't source the previous result. fresh start energy ✨
  • last β€” last field: stop at the first match and return that bit index. wrap it up, we're done here πŸ”₯

πŸ’œ DESCRIPTION πŸ’œ

so here's the vibe: you load buckets from the lookup table corresponding to the values of each 4-bit group of packet bytes, and then you do a bitwise intersection between them. that's it, that's the whole personality. 🧚

if this is the first field in the set, you simply AND the buckets together β€” which is literally equivalent to using an all-ones starting bitmap, iykyk β€” and otherwise you use the provided starting bitmap. then you call nft_pipapo_avx2_refill to generate the next working bitmap, fill. slay, pipeline complete. 🫢

this one is used for 8-bit fields (i.e. protocol numbers). yes, 4b_2 serving the 8-bit fields, don't ask, it's giving family dynamics 😭

⚠️ okay this part is important bestie: out-of-order (and superscalar) execution is vital here, so it's critical to avoid false data dependencies. the CPU and compiler could (mostly) take care of this on their own β€” but the operation ordering is explicitly given here with a likely execution order in mind, specifically to highlight possible stalls. that's why a number of logically distinct operations (i.e. loading buckets, intersecting buckets) are interleaved. it's choreography, not chaos. πŸ’€

πŸ‘‘ RETURN πŸ‘‘

  • -1 on no match 🚫
  • the rule index of the match if last 🌟
  • otherwise, the first long word index to be checked next (i.e. the first filled word) ⭐

🌈 SEE ALSO 🌈

kernel file ./net/netfilter/nft_set_pipapo_avx2.c β€” go read her, she's iconic:

the whole friend group, honestly. πŸŽ€


and that's the page, bestie πŸ’– came out of ./net/netfilter, dated October 2026 β€” go forth and look up those four-bit groups, you absolute legend πŸ¦‹βœ¨

πŸ“¦ where this page comes from