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
This commit is contained in:
Hans Petter Selasky 2022-06-16 04:42:46 +02:00
parent 29afffb942
commit f5766992c0

View File

@ -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);