Two non-functional fixes for nft_set_pipapo
Subsystems (2)
cover Two non-functional fixes for nft_set_pipapo
Patch 1/2 fixes examples of mapping table values in comments, patch 2/2 drops an abuse of unlikely(), both reported by Pablo.
No functional changes are intended here. I'm not entirely sure these should be for nf-next, but I guess so as they don't carry any functional fix.
Stefano Brivio (2):
netfilter: nft_set_pipapo: Fix mapping table example in comments
netfilter: nft_set_pipapo: Don't abuse unlikely() in pipapo_refill()
net/netfilter/nft_set_pipapo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.0
PATCH 1/2 netfilter: nft_set_pipapo: Fix mapping table example in comments
In both insertion and lookup examples, the two element pointers of rule mapping tables were swapped. Fix that.
--- net/netfilter/nft_set_pipapo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nft_set_pipapo.c +2 -2
@@ -203,7 +203,7 @@* :: * * rule indices in last field: 0 1 -* map to elements: 0x42 0x66 +* map to elements: 0x66 0x42 * * * Matching
@@ -298,7 +298,7 @@* :: * * rule indices in last field: 0 1 -* map to elements: 0x42 0x66 +* map to elements: 0x66 0x42 * * the matching element is at 0x42. *
Signature · 1 line
2.25.0
PATCH 2/2 netfilter: nft_set_pipapo: Don't abuse unlikely() in pipapo_refill()
In reply to Stefano BrivioI originally used unlikely() in the if (match_only) clause, which we hit on the mapping table for the last field in a set, to ensure we avoid branching to the rest of for loop body, which is executed more frequently.
However, Pablo reports, this is confusing as it gives the impression that this is not a common case, and it's actually not the intended usage of unlikely().
I couldn't observe any statistical difference in matching rates on x864_64 and aarch64 without it, so just drop it.
--- net/netfilter/nft_set_pipapo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nft_set_pipapo.c +1 -1
@@ -503,7 +503,7 @@ static int pipapo_refill(unsigned long *map, int len, int rules,return -1 ; } -if (unlikely (match_only)) { +if (match_only) {bitmap_clear (map, i,1 );return i; }
Signature · 1 line
2.25.0
Pablo Neira Ayuso
maintainerQuoted 6 lines · Stefano Brivio
Patch 1/2 fixes examples of mapping table values in comments, patch 2/2 drops an abuse of
unlikely(), both reported by Pablo.No functional changes are intended here. I'm not entirely sure these should be for nf-next, but I guess so as they don't carry any functional fix.
These are small, they can be placed into nf.git and I think they qualify as fixes.
Thanks.
Quoted 6 lines · Stefano Brivio
Patch 1/2 fixes examples of mapping table values in comments, patch 2/2 drops an abuse of
unlikely(), both reported by Pablo.No functional changes are intended here. I'm not entirely sure these should be for nf-next, but I guess so as they don't carry any functional fix.
Applied this fixes to nf.git. Thanks.