From nobody Tue Oct 01 15:34:43 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 4XJ2772Ttgz5Y0sB; Tue, 01 Oct 2024 15:34:43 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XJ2771lbkz4Fkc; Tue, 1 Oct 2024 15:34:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727796883; 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=VuB1cSxMXAUm6x1t2cGNMwrRz2dOZHtdjSfI7v7ksFM=; b=dIk3kP+tGRjXWEcKLpPGyPw8vReDJj0CcuWsRtgI9KFYo+XK0BgpwRN7KiaOwmxMxHPkFZ nnFD+0NRe23h+dIw0p+qmAOigXhOIVGcWFrHInNrHA3O1oTgpUUQTwh7Bs/QebDzZcMjWR Jg7qJAL4PJvpU32tVkwPByqg0jJWRgVmgCZDkzsJpvW1VX8qW6CYg/YB+uNht6kp5n71vR 6FqqFYKCAwk9uPMHelyF93KzTvMnCcBmtpflMN/Fyewz2fyVsNdXieeczqQXTe//wAp4db jqlTH2IQCt2k84BS5GFxFllfQJmAiB5EZyk/GETqA0a+6TT5KQc084XsD50EvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727796883; 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=VuB1cSxMXAUm6x1t2cGNMwrRz2dOZHtdjSfI7v7ksFM=; b=UEN1Eye7UveajmE53bzMMdRXF7oNhmdUQEuiATw8sIN1UYJ2UjSuOZizdKTKQrCG014ye+ FgspVX3vbg624vImKTs3tANfrvnAPJjEugaNEjuUJwr78loUBGfUFQwbca1D9VcJUFLIXy e/oqqTwGCIJsNuAjpVUxMa0Yoch9f9bOlP9WZHjFwdttZrCsZIX+AkHnYpyXpjus7Wl0/z eUA2aaVD7dvhIlBNjFGFu52BeYZmCJEJnDl7X30ydHhvZjwVbBqinhwVduhQbZxyfJU9wN pEKFglB/hwKjkW8PCNMXF8heXG0V8Fcag8zZMVEN/i8XaR5gvqoBmL3pZ6bzxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727796883; a=rsa-sha256; cv=none; b=HQjGz1pvNnwG5nHqf/2WBFlXlUCzHZ1au4yGzOiEHBWb+G8EbiI+D9mROiXqlAluSMVkIH 5Uw5h+QiQtClCuxDzfW+f4+AOBVpB1Nz1ICcLsxoq7uEwLEoopV/XZEmivJinPXPVdQCgj LPxRGiEPc4/eOALmRtE7YEqTFVO2PSEQXh9gzqdSLV5PETc6q8vEHmD2GIb2zPTs3D+4g9 iG10sGkLNlnkCDFRB9O4h3vkWZP+ARWyxdWflLYNhpWBpqzcWXcT91BU76Jd8Kx3RVA1vY XFLV8eUP3lmqryKuSBpkJ3nCsbpbUqNL5uASn5ZY3FwlkWwMkEKmnBo6c/rZHw== 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 4XJ27710lCzjxN; Tue, 1 Oct 2024 15:34:43 +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 491FYhYE074344; Tue, 1 Oct 2024 15:34:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 491FYhdV074341; Tue, 1 Oct 2024 15:34:43 GMT (envelope-from git) Date: Tue, 1 Oct 2024 15:34:43 GMT Message-Id: <202410011534.491FYhdV074341@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 2eacb0841c7d - main - 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/main X-Git-Reftype: branch X-Git-Commit: 2eacb0841c7dfc92030abc433e53cd31383a0648 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=2eacb0841c7dfc92030abc433e53cd31383a0648 commit 2eacb0841c7dfc92030abc433e53cd31383a0648 Author: Michael Tuexen AuthorDate: 2024-10-01 15:32:18 +0000 Commit: Michael Tuexen CommitDate: 2024-10-01 15:34:35 +0000 tcp: small cleanup No functional change intended. Reviewed by: cc, glebius, markj, rscheff MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46850 --- 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 cb175d07c4d2..d0068a9d313b 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1567,49 +1567,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;