Date: Mon, 13 Jan 2025 18:15:20 GMT From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 72c11c40ab5b - main - tcp: make sack_rxmit in tcp_output() a bool Message-ID: <202501131815.50DIFKZN008031@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=72c11c40ab5b091a30cddbd4b8d007ac7c29fcf9 commit 72c11c40ab5b091a30cddbd4b8d007ac7c29fcf9 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2025-01-13 18:13:30 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501131815.50DIFKZN008031>