Skip to content

Commit ba94179

Browse files
nizhen-tFlorian Westphal
authored andcommitted
netfilter: ipset: Remove unused htable_bits in macro ahash_region
Since the ahash_region() macro was redefined to calculate the region index solely from HTABLE_REGION_BITS, the htable_bits parameter became unused. Remove the unused htable_bits argument and its call sites, simplifying the code without changing semantics. Fixes: 8478a72 ("netfilter: ipset: fix region locking in hash types") Signed-off-by: Zhen Ni <[email protected]> Reviewed-by: Phil Sutter <[email protected]> Signed-off-by: Florian Westphal <[email protected]>
1 parent 496a6ed commit ba94179

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/netfilter/ipset/ip_set_hash_gen.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct hbucket {
6363
: jhash_size((htable_bits) - HTABLE_REGION_BITS))
6464
#define ahash_sizeof_regions(htable_bits) \
6565
(ahash_numof_locks(htable_bits) * sizeof(struct ip_set_region))
66-
#define ahash_region(n, htable_bits) \
66+
#define ahash_region(n) \
6767
((n) / jhash_size(HTABLE_REGION_BITS))
6868
#define ahash_bucket_start(h, htable_bits) \
6969
((htable_bits) < HTABLE_REGION_BITS ? 0 \
@@ -702,7 +702,7 @@ mtype_resize(struct ip_set *set, bool retried)
702702
#endif
703703
key = HKEY(data, h->initval, htable_bits);
704704
m = __ipset_dereference(hbucket(t, key));
705-
nr = ahash_region(key, htable_bits);
705+
nr = ahash_region(key);
706706
if (!m) {
707707
m = kzalloc(sizeof(*m) +
708708
AHASH_INIT_SIZE * dsize,
@@ -852,7 +852,7 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,
852852
rcu_read_lock_bh();
853853
t = rcu_dereference_bh(h->table);
854854
key = HKEY(value, h->initval, t->htable_bits);
855-
r = ahash_region(key, t->htable_bits);
855+
r = ahash_region(key);
856856
atomic_inc(&t->uref);
857857
elements = t->hregion[r].elements;
858858
maxelem = t->maxelem;
@@ -1050,7 +1050,7 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,
10501050
rcu_read_lock_bh();
10511051
t = rcu_dereference_bh(h->table);
10521052
key = HKEY(value, h->initval, t->htable_bits);
1053-
r = ahash_region(key, t->htable_bits);
1053+
r = ahash_region(key);
10541054
atomic_inc(&t->uref);
10551055
rcu_read_unlock_bh();
10561056

0 commit comments

Comments
 (0)