git: f5766992c0d0 - main - tcp: Correctly compute the TCP goodput in bits per second by using SEQ_SUB().

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Thu, 23 Jun 2022 19:12:01 UTC
The branch main has been updated by hselasky:

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

commit f5766992c0d0491d571cb6d1c47f373314f527a8
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-23 19:10:39 +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@
    MFC after:      1 week
    Sponsored by:   NVIDIA Networking
---
 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 be86ceca445c..92858291a05b 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -324,7 +324,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);