Skip to content

Commit 27f70ef

Browse files
committed
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
1 parent 674701e commit 27f70ef

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

sys/net/pfvar.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2226,7 +2226,8 @@ VNET_DECLARE(struct pf_udpendpointhash *, pf_udpendpointhash);
22262226
VNET_DECLARE(struct pf_srchash *, pf_srchash);
22272227
#define V_pf_srchash VNET(pf_srchash)
22282228

2229-
#define PF_IDHASH(s) (be64toh((s)->id) % (V_pf_hashmask + 1))
2229+
#define PF_IDHASHID(id) (be64toh(id) % (V_pf_hashmask + 1))
2230+
#define PF_IDHASH(s) PF_IDHASHID((s)->id)
22302231

22312232
VNET_DECLARE(void *, pf_swi_cookie);
22322233
#define V_pf_swi_cookie VNET(pf_swi_cookie)

sys/netpfil/pf/pf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,7 @@ pf_find_state_byid(uint64_t id, uint32_t creatorid)
18641864

18651865
pf_counter_u64_add(&V_pf_status.fcounters[FCNT_STATE_SEARCH], 1);
18661866

1867-
ih = &V_pf_idhash[(be64toh(id) % (V_pf_hashmask + 1))];
1867+
ih = &V_pf_idhash[PF_IDHASHID(id)];
18681868

18691869
PF_HASHROW_LOCK(ih);
18701870
LIST_FOREACH(s, &ih->states, entry)

0 commit comments

Comments
 (0)