From nobody Thu Oct 31 16:59:15 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 4XfVZq70qlz5c2Cw; Thu, 31 Oct 2024 16:59:15 +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 4XfVZq4rzjz4lT1; Thu, 31 Oct 2024 16:59:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730393955; 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=EWj6IuxrCIOp8C7re8bnAKCKqlG+RjI6+/iUpHHHy1s=; b=bz5pFzTDWKUa4jUSRflQ9o1ZMB/q8GtK875kDl334Bi/p7/bfuwUnBkysUTKEMAWOv1HZw wbegUuMhtHU7N1boV7pcRtmkvBn3KT5cMqvsgCX+jPxb0cRSPkdQ/hGpamtXMknLY2eiHY lDLIusgO/3DdkdKDzxLpFzTzaIwE2P1zltVGdPMpTbJhdv3xLqTvF2xMlVWLXGLJu1I3aE XUa/e1rI3l8Z33ELc/nORTSu2x44sk0FpWU6j/QprNYVEedlkkocGNTvG4qzMP1OISnPDH EL4h/BEdFYU9LT7K7GmN6zoZXBaamfBtSn5+PloJ9Pt26yKFHH/dAZOfgH5gVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730393955; 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=EWj6IuxrCIOp8C7re8bnAKCKqlG+RjI6+/iUpHHHy1s=; b=JAvh912AyU26sta/93IRxZw40EJdc5mVfYzwwIp2p6qikf/My2k+KS2wdbEcNrGe3Se84P 3Vu/Mx8f6UgVgtW86oEJmZLqMXxh4rhsCLBDLKGG7WP2yid0vyS533jSXXZrCPnkMGL3I9 aEp9iDo7SQXH2Im14EvsXP7ISz5MdgwXprGj6H20w2LlTumGH7DFB/BD77TcBj695bHlJP ipyxCv7X9RXeivk58vsUo13YGY0lu6MZzdQOZByhKt7dsMlIKKwAcl7HGmUjlB2XQT6aRz +cRvwv/cfn+k53Wm9Z5QRMJ8W65KpkPY3rhyutuVSV0AaClOeMs5y+zp0Yp9Zw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730393955; a=rsa-sha256; cv=none; b=QnV89+sh7b6ov5mM1esrNUP9w4ztJfKaD/zDi51vsLFhnFugeCgDsm9ay2+Z/gdU4HeYc9 9S0hqiGSxNTsh444jvf9wMYhQm73wmtYrygeHMS5RH+2aPaV7l800/3NmCpoOgZLuhKRES cUW4fb7cnkrfUEY7yb0HoUAmY3PQGLsvy09kKsxbV90jK9o7XUhXkhBv77bK9+2+P0bu0v XGmeyUg0kFoz7TVqeJg+D8SLWp+uqasIXx3AMmde4aadaV7Z6SVsgFJZG2D4E398B5KDjv D7trPR5zIl7HSKVM/t6UizRziBYRBJRqnsRDperP6CMWF8ia5QaIdmEY5SskTw== 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 4XfVZq49LGzkbJ; Thu, 31 Oct 2024 16:59:15 +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 49VGxFCN072284; Thu, 31 Oct 2024 16:59:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VGxFdw072281; Thu, 31 Oct 2024 16:59:15 GMT (envelope-from git) Date: Thu, 31 Oct 2024 16:59:15 GMT Message-Id: <202410311659.49VGxFdw072281@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: 5818c74e34a8 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 5818c74e34a8e5139cda8d57cea51b23d24dfde5 Auto-Submitted: auto-generated The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=5818c74e34a8e5139cda8d57cea51b23d24dfde5 commit 5818c74e34a8e5139cda8d57cea51b23d24dfde5 Author: Michael Tuexen AuthorDate: 2024-10-01 15:32:18 +0000 Commit: Michael Tuexen CommitDate: 2024-10-31 16:58:53 +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 b5b7e90ebefd..f3d7d626b7ca 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1609,49 +1609,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;