]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
netfilter: nft_set_pipapo: increment data in one step
authorFlorian Westphal <fw@strlen.de>
Tue, 17 Mar 2026 14:50:08 +0000 (15:50 +0100)
committerFlorian Westphal <fw@strlen.de>
Wed, 8 Apr 2026 05:51:31 +0000 (07:51 +0200)
Since commit e807b13cb3e3 ("nft_set_pipapo: Generalise group size for buckets")
there is no longer a need to increment the data pointer in two steps.
Switch to a single invocation of NFT_PIPAPO_GROUPS_PADDED_SIZE() helper,
like the avx2 implementation.

[ Stefano: Improve commit message ]

Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nft_set_pipapo.c
net/netfilter/nft_set_pipapo.h

index 7fd24e0cc428717f4f5b1f2addce9008da70ec95..50d4a4f04309a9df7cb1434c3dc89d1ceac5bfbc 100644 (file)
@@ -452,8 +452,6 @@ static struct nft_pipapo_elem *pipapo_get_slow(const struct nft_pipapo_match *m,
                        pipapo_and_field_buckets_4bit(f, res_map, data);
                NFT_PIPAPO_GROUP_BITS_ARE_8_OR_4;
 
-               data += f->groups / NFT_PIPAPO_GROUPS_PER_BYTE(f);
-
                /* Now populate the bitmap for the next field, unless this is
                 * the last field, in which case return the matched 'ext'
                 * pointer if any.
@@ -498,7 +496,7 @@ next_match:
                map_index = !map_index;
                swap(res_map, fill_map);
 
-               data += NFT_PIPAPO_GROUPS_PADDING(f);
+               data += NFT_PIPAPO_GROUPS_PADDED_SIZE(f);
        }
 
        __local_unlock_nested_bh(&scratch->bh_lock);
index 9aee9a9eaeb759671db9af77504de09f1a7e2d2f..b82abb03576edd92d2d7c6c89b0572b19d8c27ed 100644 (file)
@@ -42,9 +42,6 @@
 /* Fields are padded to 32 bits in input registers */
 #define NFT_PIPAPO_GROUPS_PADDED_SIZE(f)                               \
        (round_up((f)->groups / NFT_PIPAPO_GROUPS_PER_BYTE(f), sizeof(u32)))
-#define NFT_PIPAPO_GROUPS_PADDING(f)                                   \
-       (NFT_PIPAPO_GROUPS_PADDED_SIZE(f) - (f)->groups /               \
-                                           NFT_PIPAPO_GROUPS_PER_BYTE(f))
 
 /* Number of buckets given by 2 ^ n, with n bucket bits */
 #define NFT_PIPAPO_BUCKETS(bb)         (1 << (bb))