From nobody Sat Mar 29 08:53:21 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZPrlP5GFhz5sK26; Sat, 29 Mar 2025 08:53:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZPrlP3KrKz3QJV; Sat, 29 Mar 2025 08:53:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743238401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GUcHXZKoWcg5fxmcOKApPzusixql+b5qeXD/cDxwCjQ=; b=a5FM+msXcXrqjoGhR9nXbZX83e1lTNxiBz4yWCcczG7iUY3tpnWeyIJSEnvBtlZwLwfDCX dGwAbPIZ0ffv4016ASUX8/SVmdq6fktbuQ3+AwiAzjQ8khX7IGzKNm4QluL9l4weLb3zxN oISzDfbK09lB3prm9n6QOMMSUGAvbQx6KwxP62VCihQRoYd4l4EiuhvmGS07dWSnqIl+bn oD4BkiVTnw99pn98Bz1MggGjzRSgvYnfZyg2rURmKh2v+6Xn0DXe2a5I4VeupJO8gKcYGm MzwX6fwPQcjjRwnrbYrWDxMhQd2vDvvt0qOQLU0FPG+RB03+uo35hFCnTyBvQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1743238401; a=rsa-sha256; cv=none; b=g+1SmF0VY0RCxMTtztDXqU95CJuIc7K0+vxzJTrEaF2jh8aaztpIFQLcsjJblnbLm4ze+6 e+eHNE0Riho4jOGDfB0v71NlTiNpx9ItuKZTp/HQcCC+0PvJlvWk/NQs4Qsio5Tmpeb6Oy OpXZypGMSM2amdN3vlFyxitZDx5tq9TngojdRbnQSe38xRrzj9+79ynssXSfwR3WMGoeDe dArN0sUQf1to2cu7BcvZNWgyQp5OtASHy7yVxD4JRHD4NsEYhzWN+oK1TXZf1GTGZd/I64 WaxjW0436hbDhe5Z1ASDJvwo3j9eh+Fbw1crwuh4QLYExP7AC3ruEfBu29cU6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743238401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GUcHXZKoWcg5fxmcOKApPzusixql+b5qeXD/cDxwCjQ=; b=cORivO6+wwTEUL3fuTz53rkxcpDndBQpuugtFcziAxq6+ghSsbvTqgAZvL6hxf2z3fiH4I PkpdTveCqb/yJBrMCUav5BBss3R559dqn9KDqKa06yI1+OA19q2uz3vpjpWg6WJ33SYzVB Y/5fwSb8tnUcoLA5Mt8/JahajPP+T6vexKqbFHT/bRpI+fV2HXAIZ+9+LOdaJKTqoiuYJo RMIJtwpEkY5E+gAgS194xV38qnPDcJ3+5yloXM3UvfV7V01RDUIF21Iekm0X4eCP0gUO6/ qHRRHnkxo4CNXPi8gIIp02V6WG74G8cYLzJ8PLXfR40wvaDE10qHqJ4Gv5i0Bg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZPrlP173yz6Yg; Sat, 29 Mar 2025 08:53:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 52T8rLgu074888; Sat, 29 Mar 2025 08:53:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 52T8rLp3074885; Sat, 29 Mar 2025 08:53:21 GMT (envelope-from git) Date: Sat, 29 Mar 2025 08:53:21 GMT Message-Id: <202503290853.52T8rLp3074885@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 27f70efebf1d - main - pf: Use a macro to get the hash row in pf_find_state_byid() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 27f70efebf1d9424462f291e9d04e62272083aa7 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=27f70efebf1d9424462f291e9d04e62272083aa7 commit 27f70efebf1d9424462f291e9d04e62272083aa7 Author: Mark Johnston AuthorDate: 2025-03-29 08:52:06 +0000 Commit: Mark Johnston 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)