pf: Use a macro to get the hash row in pf_find_state_byid()

This seems a bit preferable to open-coding it.  No functional change
intended.

Reviewed by:	kp, glebius
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D49518
This commit is contained in:
Mark Johnston 2025-03-29 04:52:06 -04:00
parent 674701e2b6
commit 27f70efebf
2 changed files with 3 additions and 2 deletions

View file

@ -2226,7 +2226,8 @@ VNET_DECLARE(struct pf_udpendpointhash *, pf_udpendpointhash);
VNET_DECLARE(struct pf_srchash *, pf_srchash);
#define V_pf_srchash VNET(pf_srchash)
#define PF_IDHASH(s) (be64toh((s)->id) % (V_pf_hashmask + 1))
#define PF_IDHASHID(id) (be64toh(id) % (V_pf_hashmask + 1))
#define PF_IDHASH(s) PF_IDHASHID((s)->id)
VNET_DECLARE(void *, pf_swi_cookie);
#define V_pf_swi_cookie VNET(pf_swi_cookie)

View file

@ -1864,7 +1864,7 @@ pf_find_state_byid(uint64_t id, uint32_t creatorid)
pf_counter_u64_add(&V_pf_status.fcounters[FCNT_STATE_SEARCH], 1);
ih = &V_pf_idhash[(be64toh(id) % (V_pf_hashmask + 1))];
ih = &V_pf_idhash[PF_IDHASHID(id)];
PF_HASHROW_LOCK(ih);
LIST_FOREACH(s, &ih->states, entry)