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.
This commit is contained in:
parent
916f96072a
commit
53950d8632
|
@ -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.
|
* Copyright (c) 1997, 1998, 1999, 2001, 2005, 2006 The NetBSD Foundation, Inc.
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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
|
#ifdef _KERNEL_OPT
|
||||||
#include "opt_inet.h"
|
#include "opt_inet.h"
|
||||||
|
@ -427,12 +427,12 @@ tcp_congctl_fillnames(void)
|
||||||
static void
|
static void
|
||||||
tcp_common_congestion_exp(struct tcpcb *tp, int betaa, int betab)
|
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.
|
* 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)
|
if (win < 2)
|
||||||
win = 2;
|
win = 2;
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ tcp_reno_fast_retransmit(struct tcpcb *tp, const struct tcphdr *th)
|
||||||
static void
|
static void
|
||||||
tcp_reno_slow_retransmit(struct tcpcb *tp)
|
tcp_reno_slow_retransmit(struct tcpcb *tp)
|
||||||
{
|
{
|
||||||
u_int win;
|
u_long win;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close the congestion window down to one segment
|
* Close the congestion window down to one segment
|
||||||
|
@ -546,7 +546,7 @@ tcp_reno_slow_retransmit(struct tcpcb *tp)
|
||||||
* to go below this.)
|
* 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)
|
if (win < 2)
|
||||||
win = 2;
|
win = 2;
|
||||||
/* Loss Window MUST be one segment. */
|
/* Loss Window MUST be one segment. */
|
||||||
|
|
Loading…
Reference in New Issue