git: 0950ab7d7695 - main - tcp sack: improve computation of delivered_data

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Wed, 06 Aug 2025 08:35:40 UTC
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=0950ab7d76951ea8e65f25a68511dc809339e802

commit 0950ab7d76951ea8e65f25a68511dc809339e802
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-08-06 10:33:17 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-08-06 10:33:17 +0000

    tcp sack: improve computation of delivered_data
    
    delivered_data is the number of bytes, which have newly been
    delivered to the peer. This includes the number of bytes
    cumulatively acknowledged and selectively acknowledged.
    
    Reviewed by:            rscheff
    MFC after:              1 week
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D51718
---
 sys/netinet/tcp_sack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c
index f48e60207cc2..66275cb04bdd 100644
--- a/sys/netinet/tcp_sack.c
+++ b/sys/netinet/tcp_sack.c
@@ -583,6 +583,7 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack)
 	 */
 	if (SEQ_LT(tp->snd_una, th_ack) && !TAILQ_EMPTY(&tp->snd_holes)) {
 		left_edge_delta = th_ack - tp->snd_una;
+		delivered_data += left_edge_delta;
 		sack_blocks[num_sack_blks].start = tp->snd_una;
 		sack_blocks[num_sack_blks++].end = th_ack;
 		/*
@@ -590,7 +591,6 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack)
 		 * due to DSACK blocks
 		 */
 		if (SEQ_LT(tp->snd_fack, th_ack)) {
-			delivered_data += th_ack - tp->snd_una;
 			tp->snd_fack = th_ack;
 			sack_changed = SACK_CHANGE;
 		}