From nobody Mon Jan 13 18:15:20 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 4YX0mT4Jxdz5kd05; Mon, 13 Jan 2025 18:15: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX0mT1m6Kz3LCY; Mon, 13 Jan 2025 18:15:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792121; 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=hkDzCs/nDMLxYCQSAgq1ZqQrnlXtgclp/wscZbWFnLU=; b=A2TqX0qlqbCLP0qJ1evQpNYVVoZB4sujRZgyRK1QWRcHJIEVkzrSz02QCbfrzadSiobqtr 09lmV04h2naLv9+nzvhdOXfVKbRhVQ60JEAllnQelhKY3C2z1s+lG2m8RDtygGUipqHNQB 6r5hxJpPYY2Pd8gR4sDCh9FmH3a6kXi7FyYZJ6O3os1TugbM8IWYS1xiXeHcIX1OXIo5+U MotDvlUGC9ZTwLZdAipTwrdliJxW/RV3wZ3gh2zfCLltchbSS8xtHscIS7lPKCOvA0r8Dk mKt9KCUNwDAK+Gss+i4q2xsZEt4+kFxan7suJegvAiAkqda/FLtN9RIXYRrIKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792121; 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=hkDzCs/nDMLxYCQSAgq1ZqQrnlXtgclp/wscZbWFnLU=; b=ANYJOagESx8Idf/IyyjGCXQ6jigvg/R2TJMYOLZ6RIICaEN+70mJG/gKE4dCkQuLYvIyDy 3iRT+14x9gquS8lvpSAezHShwkK2kfCRSjaZcvAWMk1vgqLA4cFYkfz2LKFFIwFf5HlFke GhhUzwgm3JmRz0RPegmFu50fDyD4Ny4e6A/hkTZ521y1Ul6uEq+9qGXrykfF+NtiLRiBlN /2Wg6Ih+mjMZvrayH8Cg3BFrAAdIe0+EjKDL0XubUlxdq4xRepKNw07LvyS+KUysuYQyLW XngmJmN+ltvQnWboul4uKqyKFYrr873QlGbOUuI+mtkTZsS2TF0GlBow0BX4Vg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736792121; a=rsa-sha256; cv=none; b=NRkswQ6aOWhXIRC04c7q2J6hqDixJnITnxNB+Bxw4fvq0cK/1ZlApIG8b4jdEgZlpokhCt y0+iPrRbSpdaWvEQG6jY3thICxByCyZDzcQ0tIWcWRtS9zG1RkUbteP0ptY352wXzdLYCb YZfagiZ2NudmeL1J+fmt5KIGjV2FN5xuLFBWwWAYRoHZErcRIrv7mj4Q6c1XC+S/VXh1Tn xYlbDtLiHUtDuv4Z7S+XWuE76aCwQ95qGsivqy2f7ybhQ4R/TctiuBx+oG+LcyvYyFAxyo Tqf/9PxI3p92GDiY0YexSFjZkgpB8okal21RQLSGWcW3IYQKwuAMG6Cg1/t7rg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YX0mS6W9Szj24; Mon, 13 Jan 2025 18:15:20 +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 50DIFK5j008034; Mon, 13 Jan 2025 18:15:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DIFKZN008031; Mon, 13 Jan 2025 18:15:20 GMT (envelope-from git) Date: Mon, 13 Jan 2025 18:15:20 GMT Message-Id: <202501131815.50DIFKZN008031@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: 72c11c40ab5b - main - tcp: make sack_rxmit in tcp_output() a bool 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 72c11c40ab5b091a30cddbd4b8d007ac7c29fcf9 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=72c11c40ab5b091a30cddbd4b8d007ac7c29fcf9 commit 72c11c40ab5b091a30cddbd4b8d007ac7c29fcf9 Author: Gleb Smirnoff AuthorDate: 2025-01-13 18:13:30 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-13 18:13:30 +0000 tcp: make sack_rxmit in tcp_output() a bool Also make this variable initialization, as well as accompanying sackhole pointer, slightly more readable. NFC. Reviewed by: rscheff, tuexen, rrs Differential Revision: https://reviews.freebsd.org/D48235 --- sys/netinet/tcp_output.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 9df5b3dd42b0..74a229012508 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -203,7 +203,7 @@ tcp_default_output(struct tcpcb *tp) unsigned ipoptlen, optlen, hdrlen, ulen; unsigned ipsec_optlen = 0; int idle, sendalot, curticks; - int sack_rxmit, sack_bytes_rxmt; + int sack_bytes_rxmt; struct sackhole *p; int tso, mtu; struct tcpopt to; @@ -211,6 +211,7 @@ tcp_default_output(struct tcpcb *tp) struct tcp_log_buffer *lgb; unsigned int wanted_cookie = 0; unsigned int dont_sendalot = 0; + bool sack_rxmit; #ifdef INET6 struct ip6_hdr *ip6 = NULL; const bool isipv6 = (inp->inp_vflag & INP_IPV6) != 0; @@ -287,10 +288,8 @@ again: /* * Still in sack recovery , reset rxmit flag to zero. */ - sack_rxmit = 0; sack_bytes_rxmt = 0; len = 0; - p = NULL; if ((tp->t_flags & TF_SACK_PERMIT) && (IN_FASTRECOVERY(tp->t_flags) || (SEQ_LT(tp->snd_nxt, tp->snd_max) && (tp->t_dupacks >= tcprexmtthresh))) && @@ -317,6 +316,7 @@ again: * moves past p->rxmit. */ p = NULL; + sack_rxmit = false; goto after_sack_rexmit; } else { /* Can rexmit part of the current hole */ @@ -343,12 +343,15 @@ again: * Wouldn't be here if there would have been * nothing in the scoreboard to transmit. */ - sack_rxmit = 1; if (len > 0) { off = SEQ_SUB(p->rxmit, tp->snd_una); KASSERT(off >= 0,("%s: sack block to the left of una : %d", __func__, off)); } + sack_rxmit = true; + } else { + p = NULL; + sack_rxmit = false; } after_sack_rexmit: /* @@ -409,7 +412,7 @@ after_sack_rexmit: * If sack_rxmit is true we are retransmitting from the scoreboard * in which case len is already set. */ - if (sack_rxmit == 0) { + if (!sack_rxmit) { if ((sack_bytes_rxmt == 0) || SEQ_LT(tp->snd_nxt, tp->snd_max)) { len = imin(sbavail(&so->so_snd), sendwin) - off; } else { @@ -557,7 +560,7 @@ after_sack_rexmit: if ((tp->t_flags & TF_TSO) && V_tcp_do_tso && len > tp->t_maxseg && (tp->t_port == 0) && ((tp->t_flags & TF_SIGNATURE) == 0) && - ((sack_rxmit == 0) || V_tcp_sack_tso) && + (!sack_rxmit || V_tcp_sack_tso) && (ipoptlen == 0 || (ipoptlen == ipsec_optlen && (tp->t_flags2 & TF2_IPSEC_TSO) != 0)) && !(flags & TH_SYN)) @@ -981,7 +984,7 @@ send: */ SOCK_SENDBUF_UNLOCK(so); error = EMSGSIZE; - sack_rxmit = 0; + sack_rxmit = false; goto out; } len = tp->t_maxseg - optlen - ipoptlen; @@ -1063,7 +1066,7 @@ send: if (m == NULL) { SOCK_SENDBUF_UNLOCK(so); error = ENOBUFS; - sack_rxmit = 0; + sack_rxmit = false; goto out; } @@ -1107,7 +1110,7 @@ send: SOCK_SENDBUF_UNLOCK(so); (void) m_free(m); error = ENOBUFS; - sack_rxmit = 0; + sack_rxmit = false; goto out; } } @@ -1136,7 +1139,7 @@ send: m = m_gethdr(M_NOWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; - sack_rxmit = 0; + sack_rxmit = false; goto out; } #ifdef INET6 @@ -1233,7 +1236,7 @@ send: * case, since we know we aren't doing a retransmission. * (retransmit and persist are mutually exclusive...) */ - if (sack_rxmit == 0) { + if (!sack_rxmit) { if (len || (flags & (TH_SYN|TH_FIN)) || tcp_timer_active(tp, TT_PERSIST)) th->th_seq = htonl(tp->snd_nxt);