Date: Sat, 29 Mar 2025 08:53:21 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 27f70efebf1d - main - pf: Use a macro to get the hash row in pf_find_state_byid() Message-ID: <202503290853.52T8rLp3074885@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=27f70efebf1d9424462f291e9d04e62272083aa7 commit 27f70efebf1d9424462f291e9d04e62272083aa7 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2025-03-29 08:52:06 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2025-03-29 08:52:25 +0000 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 --- sys/net/pfvar.h | 3 ++- sys/netpfil/pf/pf.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 2aaef12e3431..39ca13c89379 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -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) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index d3c857a66b85..ef86d70db760 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202503290853.52T8rLp3074885>