Wed Oct 9 05:29:18 2019 UTC ()
 All of snd_wnd, snd_cwnd and snd_ssthresh in stuct tcpcb are u_long,
so use u_long and ulmin() instead of u_int and uimin(). Found by lgtm bot.

XXX TCP's sequence number is uint32_t, so it might be good to change some
entries in struct tcpcb to uint32_t instead of u_long. FreeBSD did it.


(msaitoh)
diff -r1.26 -r1.27 src/sys/netinet/tcp_congctl.c

cvs diff -r1.26 -r1.27 src/sys/netinet/tcp_congctl.c (expand / switch to context diff)
--- src/sys/netinet/tcp_congctl.c 2018/09/03 16:29:36 1.26
+++ src/sys/netinet/tcp_congctl.c 2019/10/09 05:29:18 1.27
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_congctl.c,v 1.26 2018/09/03 16:29:36 riastradh Exp $	*/
+/*	$NetBSD: tcp_congctl.c,v 1.27 2019/10/09 05:29:18 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2005, 2006 The NetBSD Foundation, Inc.
@@ -135,7 +135,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_congctl.c,v 1.26 2018/09/03 16:29:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_congctl.c,v 1.27 2019/10/09 05:29:18 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -427,12 +427,12 @@
 static void
 tcp_common_congestion_exp(struct tcpcb *tp, int betaa, int betab)
 {
-	u_int win;
+	u_long win;
 
 	/* 
 	 * Reduce the congestion window and the slow start threshold.
 	 */
-	win = uimin(tp->snd_wnd, tp->snd_cwnd) * betaa / betab / tp->t_segsz;
+	win = ulmin(tp->snd_wnd, tp->snd_cwnd) * betaa / betab / tp->t_segsz;
 	if (win < 2)
 		win = 2;
 
@@ -519,7 +519,7 @@
 static void
 tcp_reno_slow_retransmit(struct tcpcb *tp)
 {
-	u_int win;
+	u_long win;
 
 	/*
 	 * Close the congestion window down to one segment
@@ -546,7 +546,7 @@
 	 * to go below this.)
 	 */
 
-	win = uimin(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_segsz;
+	win = ulmin(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_segsz;
 	if (win < 2)
 		win = 2;
 	/* Loss Window MUST be one segment. */