- (tp->t_flagsext & TF_BWMEAS_INPROGRESS) == 0 &&
- (so->so_snd.sb_cc - (tp->snd_max - tp->snd_una)) >=
- tp->t_bwmeas->bw_minsize) {
- tp->t_bwmeas->bw_size = min(
- (so->so_snd.sb_cc - (tp->snd_max - tp->snd_una)),
- tp->t_bwmeas->bw_maxsize);
- tp->t_flagsext |= TF_BWMEAS_INPROGRESS;
- tp->t_bwmeas->bw_start = tp->snd_max;
- tp->t_bwmeas->bw_ts = tcp_now;
+ (tp->t_flagsext & TF_BWMEAS_INPROGRESS) == 0) {
+ tp->t_bwmeas->bw_size = min(min(
+ (so->so_snd.sb_cc - (tp->snd_max - tp->snd_una)),
+ tp->snd_cwnd), tp->snd_wnd);
+ if (tp->t_bwmeas->bw_minsize > 0 &&
+ tp->t_bwmeas->bw_size < tp->t_bwmeas->bw_minsize)
+ tp->t_bwmeas->bw_size = 0;
+ if (tp->t_bwmeas->bw_maxsize > 0)
+ tp->t_bwmeas->bw_size = min(tp->t_bwmeas->bw_size,
+ tp->t_bwmeas->bw_maxsize);
+ if (tp->t_bwmeas->bw_size > 0) {
+ tp->t_flagsext |= TF_BWMEAS_INPROGRESS;
+ tp->t_bwmeas->bw_start = tp->snd_max;
+ tp->t_bwmeas->bw_ts = tcp_now;
+ }