Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet All of snd_wnd, snd_cwnd and snd_ssthresh in stu...



details:   https://anonhg.NetBSD.org/src/rev/fb754ac5480e
branches:  trunk
changeset: 845620:fb754ac5480e
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Oct 09 05:29:18 2019 +0000

description:
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.

diffstat:

 sys/netinet/tcp_congctl.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r 2405ff717471 -r fb754ac5480e sys/netinet/tcp_congctl.c
--- a/sys/netinet/tcp_congctl.c Wed Oct 09 01:43:35 2019 +0000
+++ b/sys/netinet/tcp_congctl.c Wed Oct 09 05:29:18 2019 +0000
@@ -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. */



Home | Main Index | Thread Index | Old Index