Ensure that when using the TCP CDG congestion control and setting the

sysctl variable net.inet.tcp.cc.cdg.smoothing_factor to 0, the smoothing
is disabled. Without this patch, a division by zero orrurs.

PR:			193762
Reviewed by:		lstewart@, rrs@
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D19071
This commit is contained in:
Michael Tuexen 2019-02-08 20:42:49 +00:00
parent d533db848c
commit aa36fbd6fa

View File

@ -592,7 +592,11 @@ cdg_ack_received(struct cc_var *ccv, uint16_t ack_type)
qdiff_min = ((long)(cdg_data->minrtt_in_rtt -
cdg_data->minrtt_in_prevrtt) << D_P_E );
calc_moving_average(cdg_data, qdiff_max, qdiff_min);
if (cdg_data->sample_q_size == 0) {
cdg_data->max_qtrend = qdiff_max;
cdg_data->min_qtrend = qdiff_min;
} else
calc_moving_average(cdg_data, qdiff_max, qdiff_min);
/* Probabilistic backoff with respect to gradient. */
if (slowstart && qdiff_min > 0)