FreeBSD/sys/netinet/cc/cc_vegas.c
/*
 * The vegas window adjustment is done once every RTT, as indicated by the
 * ERTT_NEW_MEASUREMENT flag. This flag is reset once the new measurment data
 * has been used.
 */
The vegas window adjustment is done once every RTT, as indicated by the
ERTT_NEW_MEASUREMENT flag. This flag is reset once the new measurment data
has been used.
The vegas window adjustment is done once every RTT as indicated by the ERTT_NEW_MEASUREMENT flag . This flag is reset once the new measurment data has been used .
static void
vegas_ack_received(struct cc_var *ccv, uint16_t ack_type)
{
	struct ertt *e_t;
	struct vegas *vegas_data;
	long actual_tx_rate, expected_tx_rate, ndiff;
	e_t = khelp_get_osd(CCV(ccv, osd), ertt_id);
	vegas_data = ccv->cc_data;
	if (e_t->flags & ERTT_NEW_MEASUREMENT) { 
		if (e_t->minrtt && e_t->markedpkt_rtt) {
			expected_tx_rate = e_t->marked_snd_cwnd / e_t->minrtt;
			actual_tx_rate = e_t->bytes_tx_in_marked_rtt /
			    e_t->markedpkt_rtt;
			ndiff = (expected_tx_rate - actual_tx_rate) *
			    e_t->minrtt / CCV(ccv, t_maxseg);
			if (ndiff < V_vegas_alpha) {
				if (CCV(ccv, snd_cwnd) <=
				    CCV(ccv, snd_ssthresh)) {
					vegas_data->slow_start_toggle =
					    vegas_data->slow_start_toggle ?
					    0 : 1;
				} else {
					vegas_data->slow_start_toggle = 0;
					CCV(ccv, snd_cwnd) =
					    min(CCV(ccv, snd_cwnd) +
					    CCV(ccv, t_maxseg),
					    TCP_MAXWIN << CCV(ccv, snd_scale));
				}
			} else if (ndiff > V_vegas_beta) {
				vegas_cong_signal(ccv, CC_VEGAS_RATE);
				vegas_data->slow_start_toggle = 0;
			}
		}
		e_t->flags &= ~ERTT_NEW_MEASUREMENT;
	}
	if (vegas_data->slow_start_toggle)
		newreno_cc_algo.ack_received(ccv, ack_type);
}
static void vegas_ack_received ( struct cc_var * ccv , uint16_t ack_type ) { struct ertt * e_t ; struct vegas * vegas_data ; long actual_tx_rate , expected_tx_rate , ndiff ; e_t = khelp_get_osd ( CCV ( ccv , osd ) , ertt_id ) ; vegas_data = ccv -> cc_data ; if ( e_t -> flags & ERTT_NEW_MEASUREMENT ) { if ( e_t -> minrtt && e_t -> markedpkt_rtt ) { expected_tx_rate = e_t -> marked_snd_cwnd / e_t -> minrtt ; actual_tx_rate = e_t -> bytes_tx_in_marked_rtt / e_t -> markedpkt_rtt ; ndiff = ( expected_tx_rate - actual_tx_rate ) * e_t -> minrtt / CCV ( ccv , t_maxseg ) ; if ( ndiff < V_vegas_alpha ) { if ( CCV ( ccv , snd_cwnd ) <= CCV ( ccv , snd_ssthresh ) ) { vegas_data -> slow_start_toggle = vegas_data -> slow_start_toggle ? 0 : 1 ; } else { vegas_data -> slow_start_toggle = 0 ; CCV ( ccv , snd_cwnd ) = min ( CCV ( ccv , snd_cwnd ) + CCV ( ccv , t_maxseg ) , TCP_MAXWIN << CCV ( ccv , snd_scale ) ) ; } } else if ( ndiff > V_vegas_beta ) { vegas_cong_signal ( ccv , CC_VEGAS_RATE ) ; vegas_data -> slow_start_toggle = 0 ; } } e_t -> flags &= ~ ERTT_NEW_MEASUREMENT ; } if ( vegas_data -> slow_start_toggle ) newreno_cc_algo . ack_received ( ccv , ack_type ) ; }
The vegas window adjustment is done once every RTT, as indicated by the
 ERTT_NEW_MEASUREMENT flag.
The vegas window adjustment is done once every RTT as indicated by the ERTT_NEW_MEASUREMENT flag .
/* Once per RTT. */ /* Rate-based congestion. */