git: 973716df6c2e - stable/13 - tcp: Correctly compute the TCP goodput in bits per second by using SEQ_SUB().

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Thu, 30 Jun 2022 09:40:15 UTC
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=973716df6c2e960b90c9b0fe9e0dd6a978623c21

commit 973716df6c2e960b90c9b0fe9e0dd6a978623c21
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-06-16 02:42:46 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-06-30 09:39:43 +0000

    tcp: Correctly compute the TCP goodput in bits per second by using SEQ_SUB().
    
    TCP sequence number differences should be computed using SEQ_SUB().
    
    Differential Revision:  https://reviews.freebsd.org/D35505
    Reviewed by:    rscheff@
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit f5766992c0d0491d571cb6d1c47f373314f527a8)
---
 sys/netinet/tcp_input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 2c7d15368483..601b4a63716f 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -341,7 +341,7 @@ cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs,
 			/*
 			 * Compute goodput in bits per millisecond.
 			 */
-			gput = (((int64_t)(th->th_ack - tp->gput_seq)) << 3) /
+			gput = (((int64_t)SEQ_SUB(th->th_ack, tp->gput_seq)) << 3) /
 			    max(1, tcp_ts_getticks() - tp->gput_ts);
 			stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_GPUT,
 			    gput);