From owner-dev-commits-src-all@freebsd.org Fri Apr 9 21:21:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59FE35BE103; Fri, 9 Apr 2021 21:21:10 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FH9zT67jxz4dhD; Fri, 9 Apr 2021 21:21:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 99A2024E7D; Fri, 9 Apr 2021 21:21:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 139LL92u021710; Fri, 9 Apr 2021 21:21:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139LL9OP021709; Fri, 9 Apr 2021 21:21:09 GMT (envelope-from git) Date: Fri, 9 Apr 2021 21:21:09 GMT Message-Id: <202104092121.139LL9OP021709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 1a7fe55ab8ca - main - tcp_hostcache: make THC_LOCK/UNLOCK macros to work with hash head pointer. Not a functional change. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a7fe55ab8ca1e9c74a508c0c21ad0878d649a3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 21:21:10 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=1a7fe55ab8ca1e9c74a508c0c21ad0878d649a3f commit 1a7fe55ab8ca1e9c74a508c0c21ad0878d649a3f Author: Gleb Smirnoff AuthorDate: 2021-04-09 15:39:40 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-09 21:07:35 +0000 tcp_hostcache: make THC_LOCK/UNLOCK macros to work with hash head pointer. Not a functional change. --- sys/netinet/tcp_hostcache.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 49e9b0822592..25190697bdee 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -222,8 +222,8 @@ static MALLOC_DEFINE(M_HOSTCACHE, "hostcache", "TCP hostcache"); V_tcp_hostcache.hashsalt) & \ V_tcp_hostcache.hashmask) -#define THC_LOCK(lp) mtx_lock(lp) -#define THC_UNLOCK(lp) mtx_unlock(lp) +#define THC_LOCK(h) mtx_lock(&(h)->hch_mtx) +#define THC_UNLOCK(h) mtx_unlock(&(h)->hch_mtx) void tcp_hc_init(void) @@ -342,7 +342,7 @@ tcp_hc_lookup(struct in_conninfo *inc, bool update) * find an entry, otherwise the caller has to unlock after he is * done. */ - THC_LOCK(&hc_head->hch_mtx); + THC_LOCK(hc_head); /* * Iterate through entries in bucket row looking for a match. @@ -363,7 +363,7 @@ tcp_hc_lookup(struct in_conninfo *inc, bool update) /* * We were unsuccessful and didn't find anything. */ - THC_UNLOCK(&hc_head->hch_mtx); + THC_UNLOCK(hc_head); return (NULL); found: @@ -409,7 +409,7 @@ tcp_hc_insert(struct in_conninfo *inc) * find an entry, otherwise the caller has to unlock after he is * done. */ - THC_LOCK(&hc_head->hch_mtx); + THC_LOCK(hc_head); /* * If the bucket limit is reached, reuse the least-used element. @@ -427,7 +427,7 @@ tcp_hc_insert(struct in_conninfo *inc) * anything to replace. */ if (hc_entry == NULL) { - THC_UNLOCK(&hc_head->hch_mtx); + THC_UNLOCK(hc_head); return (NULL); } TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q); @@ -448,7 +448,7 @@ tcp_hc_insert(struct in_conninfo *inc) */ hc_entry = uma_zalloc(V_tcp_hostcache.zone, M_NOWAIT); if (hc_entry == NULL) { - THC_UNLOCK(&hc_head->hch_mtx); + THC_UNLOCK(hc_head); return (NULL); } } @@ -519,7 +519,7 @@ tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) /* * Unlock bucket row. */ - THC_UNLOCK(&hc_entry->rmx_head->hch_mtx); + THC_UNLOCK(hc_entry->rmx_head); } /* @@ -542,7 +542,7 @@ tcp_hc_getmtu(struct in_conninfo *inc) } mtu = hc_entry->rmx_mtu; - THC_UNLOCK(&hc_entry->rmx_head->hch_mtx); + THC_UNLOCK(hc_entry->rmx_head); return (mtu); } @@ -633,7 +633,7 @@ tcp_hc_update(struct in_conninfo *inc, struct hc_metrics_lite *hcml) TAILQ_REMOVE(&hc_entry->rmx_head->hch_bucket, hc_entry, rmx_q); TAILQ_INSERT_HEAD(&hc_entry->rmx_head->hch_bucket, hc_entry, rmx_q); - THC_UNLOCK(&hc_entry->rmx_head->hch_mtx); + THC_UNLOCK(hc_entry->rmx_head); } /* @@ -682,7 +682,7 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) #define msec(u) (((u) + 500) / 1000) for (i = 0; i < V_tcp_hostcache.hashsize; i++) { - THC_LOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); + THC_LOCK(&V_tcp_hostcache.hashbase[i]); TAILQ_FOREACH(hc_entry, &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q) { sbuf_printf(&sb, @@ -713,7 +713,7 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) #endif hc_entry->rmx_expire); } - THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); + THC_UNLOCK(&V_tcp_hostcache.hashbase[i]); sbuf_drain(&sb); } #undef msec @@ -774,7 +774,7 @@ tcp_hc_purge_internal(int all) int i; for (i = 0; i < V_tcp_hostcache.hashsize; i++) { - THC_LOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); + THC_LOCK(&V_tcp_hostcache.hashbase[i]); TAILQ_FOREACH_SAFE(hc_entry, &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q, hc_next) { KASSERT(V_tcp_hostcache.hashbase[i].hch_length > 0 && @@ -792,7 +792,7 @@ tcp_hc_purge_internal(int all) } else hc_entry->rmx_expire -= V_tcp_hostcache.prune; } - THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); + THC_UNLOCK(&V_tcp_hostcache.hashbase[i]); } }