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

(cherry picked from commit 27f70efebf)
This commit is contained in:
Mark Johnston 2025-03-29 04:52:06 -04:00 committed by Franco Fichtner
parent 5afe2ee090
commit 8c6ca73918
2 changed files with 3 additions and 2 deletions

View file

@ -2119,7 +2119,8 @@ VNET_DECLARE(struct pf_idhash *, pf_idhash);
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

@ -1683,7 +1683,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)