pipapo_lt_4b_to_8b(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… pipapo_lt_4b_to_8b(9) β€” bestie's guide to the glow-up

okay so this is a page from the Kernel API Manual (yes, that manual, the one for people who write kernel code, iykyk) and the function we're stanning today is pipapo_lt_4b_to_8b ✨


🌸 NAME 🌸

pipapo_lt_4b_to_8b β€” switch that lookup table group width from 4 bits to 8 bits, no cap πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

void pipapo_lt_4b_to_8b (int old_groups , int bsize , unsigned long
*old_lt , unsigned long *new_lt );

she returns nothing (void, so mysterious of her), she just Does The Thing 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • old_groups β€” the number of current groups. like, how many groups you have right now, before the glow-up.
  • bsize β€” size of one bucket, and the units are longs. yes, measured in longs, not bytes. iconic but also read carefully 🌈
  • old_lt β€” pointer to the current lookup table (the before picture πŸ₯Ί).
  • new_lt β€” pointer to the new, pre-allocated lookup table (the after picture πŸ”₯). note the pre-allocated part, she does NOT allocate it for you, so don't come for her.

πŸ’œ DESCRIPTION πŸ’œ

So here's the tea β˜• β€” every bucket with index b in the new lookup table, belonging to group g, gets filled with the bit intersection between:

  • the bucket whose index is given by the upper 4 bits of b, from group g, and
  • the bucket whose index is given by the lower 4 bits of b, from group g + 1

like it's mashing two old buckets together to make one new one. very demure, very mindful 🧚

So given buckets from the new lookup table N(x, y) and the old lookup table O(x, y), with x as the bucket index and y as the group index:

N(b, g) := O(b / 16, g) & O(b % 16, g + 1)

periodt πŸ’€ that & is doing all the heavy lifting and she ate.

This ensures equivalence of the matching results on lookup β€” that's the whole point, bestie, the lookups gotta give the same answer before and after πŸ‘‘

Two examples in pictures (yes the original really drew these, I'm not making it up 😭):

       bucket group  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18
... 254 255 0                ^ 1                |
       ^ ...             ( & )                                               |
       /                                                   | /
       .-( & )-.  /  bucket                                         |       |
       group  0 / 1   2   3  4   5   6   7   8   9  10  11  12  13 |14  15 | 0
       /                                                   |       | 1
                                            |       | 2
       |     --' 3                                                          '-
       ...

she's abstract, she's artistic, she's giving main character energy 🌸


⭐ SEE ALSO ⭐

Go check out the kernel file ./net/netfilter/nft_set_pipapo.c (specifically its Theory of Operation(9) section, lowkey a must-read), plus the whole friend group: pipapo_refill(9), pipapo_get_slow(9), pipapo_get(9), nft_pipapo_lookup(9), nft_pipapo_get(9), pipapo_realloc_mt(9), lt_calculate_size(9), pipapo_resize(9), pipapo_bucket_set(9), pipapo_lt_8b_to_4b(9), pipapo_lt_bits_adjust(9), pipapo_insert(9), pipapo_step_diff(9), pipapo_step_after_end(9), pipapo_base_sum(9), pipapo_expand(9), pipapo_map(9), pipapo_free_scratch(9), pipapo_realloc_scratch(9), pipapo_maybe_clone(9), nft_pipapo_insert(9), pipapo_clone(9), pipapo_rules_same_key(9), pipapo_unmap(9), pipapo_drop(9), pipapo_gc_scan(9), pipapo_gc_queue(9), pipapo_free_fields(9), pipapo_reclaim_match(9), nft_pipapo_commit(9), nft_pipapo_activate(9), nft_pipapo_deactivate(9), nft_pipapo_flush(9), pipapo_get_boundaries(9), pipapo_match_field(9), nft_pipapo_remove(9), nft_pipapo_do_walk(9), nft_pipapo_walk(9), nft_pipapo_privsize(9), nft_pipapo_estimate(9), nft_pipapo_init(9), nft_set_pipapo_match_destroy(9), nft_pipapo_destroy(9), and nft_pipapo_gc_init(9). that's a whole group chat right there, go say hi to all of them πŸ’–


ok that's the page!! she lives in ./net/netfilter, this version is from October 2026, and honestly? obsessed with her. go forth and resize your lookup tables bestie, ily, mwah πŸŽ€πŸ¦‹πŸ’œ
πŸ“¦ where this page comes from