public inbox for netfilter-devel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf-next] netfilter: nft_set_pipapo: increment data in one step
@ 2026-03-18 13:38 Florian Westphal
  2026-03-21 14:25 ` Stefano Brivio
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2026-03-18 13:38 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Stefano Brivio, Florian Westphal

For unkown reason the C version increments the data pointer in two steps.
Switch to a single invocation of NFT_PIPAPO_GROUPS_PADDED_SIZE() helper,
like the avx2 implementation.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nft_set_pipapo.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c
index 7fd24e0cc428..50d4a4f04309 100644
--- a/net/netfilter/nft_set_pipapo.c
+++ b/net/netfilter/nft_set_pipapo.c
@@ -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 @@ static struct nft_pipapo_elem *pipapo_get_slow(const struct nft_pipapo_match *m,
 		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);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nf-next] netfilter: nft_set_pipapo: increment data in one step
  2026-03-18 13:38 [PATCH nf-next] netfilter: nft_set_pipapo: increment data in one step Florian Westphal
@ 2026-03-21 14:25 ` Stefano Brivio
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Brivio @ 2026-03-21 14:25 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel

On Wed, 18 Mar 2026 14:38:34 +0100
Florian Westphal <fw@strlen.de> wrote:

> For unkown reason the C version increments the data pointer in two steps.

That's because before commit e807b13cb3e3 ("nft_set_pipapo: Generalise
group size for buckets") pipapo_get() contained the whole lookup
implementation with __bitmap_and(), and 'data' was used as pointer to
move between bit groups, and incremented as we went through them.

With that commit, we don't need to keep 'data' updated during the
lookup anymore, so I just replaced the initial increment, but I didn't
notice that 'data' isn't used at all before the second increment now,
and that the two increments could be merged.

> Switch to a single invocation of NFT_PIPAPO_GROUPS_PADDED_SIZE() helper,
> like the avx2 implementation.
> 
> Signed-off-by: Florian Westphal <fw@strlen.de>

Reviewed-by: Stefano Brivio <sbrivio@redhat.com>

-- 
Stefano


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-21 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 13:38 [PATCH nf-next] netfilter: nft_set_pipapo: increment data in one step Florian Westphal
2026-03-21 14:25 ` Stefano Brivio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox