From nobody Thu Oct 31 13:58:46 2024 X-Original-To: dev-commits-src-all@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 4XfQZZ3Fhfz5blXy; Thu, 31 Oct 2024 13:58:46 +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 4XfQZZ2kdCz40ph; Thu, 31 Oct 2024 13:58:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730383126; 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=7z1O+aPEaBbMXiDJnUpOb8XKLgSzzMV3s+MAmQiJ1Ns=; b=G0PsJ8DbONjdK/HrDOgcYVd6U3JZL4UZmlOquOP8mmLCMckG+ympLVztYTh0CE6xgfT5sO Ysl4s+x1xMTjyq7czZnj+GfvjkvdVQcPBBnOqO3Oa32dSw2pq18HjhSM2Brrns4/zPnARf +jAuapAy3CWYs9QCoCdGBHPqwhWB3fw5wiA0OuWeNvYKCnwnjn6sUM4rC+tr9A9p0i40ht ciYta1o+/0LBpLtMlnvXyzTfpVi8Xvh7BCgOdUzLLSAPQ1ls4qo2mKn4hE9s1U5ypou1ET /+L+5NAt9jVfNOxk9yyEC78oTA2rem2e+GWeLdtb8xq4Ix8NLqQG18pWUe3v8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730383126; 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=7z1O+aPEaBbMXiDJnUpOb8XKLgSzzMV3s+MAmQiJ1Ns=; b=izNoeBWj+j7EVvoJ0YToVK8OPOW2VPyDF84TEFyZzFewjnk+61c6Rv94Y6aXC9bKXget/b yuYM7LV7LVLQMgZX7BCvpcjsdcWUcsgH7OEZTwBiNyXmPcE+EAHtUcnzXKT1zRvn2l4BPs mBiDXYJ7xoICU/Nj2narBUYFceUEtU94DvRy8fSIy7WaRwozCU0vlrKW79t9pcCdsk0fQM KWFeUG1G/rHHinrNXqEjfXq8BoFykaJDKBk8XwMO5hdV6GeTXp3Jsu/2IDFLhVm7lerFFQ 5jPC1fHJ6KICiCQn7CILVKIDov192rmFsz32lyHY1DgO4Hj1Fm+e7Pmv7QAGUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730383126; a=rsa-sha256; cv=none; b=livC3/EmKoLgfu5+qFLiYH4SluJO2cacAKuG/e1EOpkNCiEnaOP4ll4y4GOcMhPx0+105Y ivwW1enG2Q9R5jmvEbvHjyjn8Lla1o14FTASnhkLr0k8Mj2Qybdj6cHhHC6/qBOcTTY7Oz uTdqpoaqXzIX2GgPWWSo5WbLip7Y3qFDe97/QrEz7Msh8kNiEeEUDiLl5OZFBP/LpdyONK tQEVcCxKwwMBq2jU6CWJtMnYRGG0LzapY++u4m48cYhSWvNcx6xl8ZmweahPlnDPTBsV+T e2nxSqcVaLR4rHvmX4PiwyoAWqr2reONG3AE4uyDpdRPOhu/RnbTdipnnkWQpQ== 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 4XfQZZ2L9xzfLN; Thu, 31 Oct 2024 13:58:46 +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 49VDwks7029951; Thu, 31 Oct 2024 13:58:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VDwkVn029948; Thu, 31 Oct 2024 13:58:46 GMT (envelope-from git) Date: Thu, 31 Oct 2024 13:58:46 GMT Message-Id: <202410311358.49VDwkVn029948@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: b785f83e987d - stable/14 - tcp: small cleanup List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b785f83e987dd59d4a2812fc2e300436c47e08c0 Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b785f83e987dd59d4a2812fc2e300436c47e08c0 commit b785f83e987dd59d4a2812fc2e300436c47e08c0 Author: Michael Tuexen AuthorDate: 2024-10-01 15:32:18 +0000 Commit: Michael Tuexen CommitDate: 2024-10-31 11:37:05 +0000 tcp: small cleanup No functional change intended. Reviewed by: cc, glebius, markj, rscheff Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46850 (cherry picked from commit 2eacb0841c7dfc92030abc433e53cd31383a0648) --- sys/netinet/tcp_syncache.c | 59 ++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 6d171b2b7ea6..15244a61d8da 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1577,49 +1577,46 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, goto donenoprobe; } - if (tfo_cookie_valid) { - bzero(&scs, sizeof(scs)); - sc = &scs; - goto skip_alloc; - } - + KASSERT(sc == NULL, ("sc(%p) != NULL", sc)); /* * Skip allocating a syncache entry if we are just going to discard * it later. */ - if (!locked) { + if (!locked || tfo_cookie_valid) { bzero(&scs, sizeof(scs)); sc = &scs; - } else - sc = uma_zalloc(V_tcp_syncache.zone, M_NOWAIT | M_ZERO); - if (sc == NULL) { - /* - * The zone allocator couldn't provide more entries. - * Treat this as if the cache was full; drop the oldest - * entry and insert the new one. - */ - TCPSTAT_INC(tcps_sc_zonefail); - if ((sc = TAILQ_LAST(&sch->sch_bucket, sch_head)) != NULL) { - sch->sch_last_overflow = time_uptime; - syncache_drop(sc, sch); - syncache_pause(inc); - } + } else { sc = uma_zalloc(V_tcp_syncache.zone, M_NOWAIT | M_ZERO); if (sc == NULL) { - if (V_tcp_syncookies) { - bzero(&scs, sizeof(scs)); - sc = &scs; - } else { - KASSERT(locked, - ("%s: bucket unexpectedly unlocked", - __func__)); - SCH_UNLOCK(sch); - goto done; + /* + * The zone allocator couldn't provide more entries. + * Treat this as if the cache was full; drop the oldest + * entry and insert the new one. + */ + TCPSTAT_INC(tcps_sc_zonefail); + sc = TAILQ_LAST(&sch->sch_bucket, sch_head); + if (sc != NULL) { + sch->sch_last_overflow = time_uptime; + syncache_drop(sc, sch); + syncache_pause(inc); + } + sc = uma_zalloc(V_tcp_syncache.zone, M_NOWAIT | M_ZERO); + if (sc == NULL) { + if (V_tcp_syncookies) { + bzero(&scs, sizeof(scs)); + sc = &scs; + } else { + KASSERT(locked, + ("%s: bucket unexpectedly unlocked", + __func__)); + SCH_UNLOCK(sch); + goto done; + } } } } -skip_alloc: + KASSERT(sc != NULL, ("sc == NULL")); if (!tfo_cookie_valid && tfo_response_cookie_valid) sc->sc_tfo_cookie = &tfo_response_cookie;