/* Initialize the congestion window for a connection or * handles connections that have been idle for * some time. In this state, no acks are * expected to clock out any data we send -- * slow start to get ack "clock" running again. * * Set the slow-start flight size depending on whether * this is a local network or not. */ void tcp_newreno_cwnd_init_or_reset(struct tcpcb *tp) { tcp_cc_cwnd_init_or_reset(tp); /* If stretch ack was auto disabled, re-evaluate the situation */ tcp_cc_after_idle_stretchack(tp); }
/* * Initialize the congestion window at the beginning of a connection or * after idle time */ static void tcp_cubic_cwnd_init_or_reset(struct tcpcb *tp) { VERIFY(tp->t_ccstate != NULL); tcp_cubic_clear_state(tp); tcp_cc_cwnd_init_or_reset(tp); /* * slow start threshold could get initialized to a lower value * when there is a cached value in the route metrics. In this case, * the connection can enter congestion avoidance without any packet * loss and Cubic will enter steady-state too early. It is better * to always probe to find the initial slow-start threshold. */ if (tp->t_inpcb->inp_stat->txbytes <= TCP_CC_CWND_INIT_BYTES && tp->snd_ssthresh < (TCP_MAXWIN << TCP_MAX_WINSHIFT)) tp->snd_ssthresh = TCP_MAXWIN << TCP_MAX_WINSHIFT; /* Initialize cubic last max to be same as ssthresh */ tp->t_ccstate->cub_last_max = tp->snd_ssthresh; /* If stretch ack was auto-disabled, re-evaluate it */ tcp_cc_after_idle_stretchack(tp); }