/* We should have enough space for 40 bytes of options */
ASSERT (tc->snd_mss > 45);
- /* If we use timestamp option, account for it */
+ /* If we use timestamp option, account for it and make sure
+ * the options are 4-byte aligned */
if (tcp_opts_tstamp (&tc->rcv_opts))
- tc->snd_mss -= TCP_OPTION_LEN_TIMESTAMP;
+ tc->snd_mss -= TCP_OPTION_LEN_TIMESTAMP + 2 /* alignment */;
}
/**
tc->iss = tcp_generate_random_iss (tc);
tc->snd_una = tc->iss;
tc->snd_nxt = tc->iss + 1;
- tc->snd_una_max = tc->snd_nxt;
tc->srtt = 0.1 * THZ; /* 100 ms */
if (!tcp_cfg.csum_offload)
{
int snd_space;
- if (PREDICT_FALSE (tcp_in_fastrecovery (tc)
+ /* Fast path is disabled when recovery is on. @ref tcp_session_custom_tx
+ * controls both retransmits and the sending of new data while congested
+ */
+ if (PREDICT_FALSE (tcp_in_cong_recovery (tc)
|| tc->state == TCP_STATE_CLOSED))
return 0;
continue;
/* Skip if the timer is not pending. Probably it was reset while
- * wating for dispatch */
+ * waiting for dispatch */
if (PREDICT_FALSE (!(tc->pending_timers & (1 << timer_id))))
continue;
vec_reset_length (wrk->pending_deq_acked);
vec_reset_length (wrk->pending_disconnects);
vec_reset_length (wrk->pending_resets);
- wrk->vm = vlib_mains[thread];
+ wrk->vm = vlib_get_main_by_index (thread);
wrk->max_timers_per_loop = 10;
if (thread > 0)
tcp_cfg.rwnd_min_update_ack = 1;
tcp_cfg.max_gso_size = TCP_MAX_GSO_SZ;
- /* Time constants defined as timer tick (100ms) multiples */
- tcp_cfg.delack_time = 1; /* 0.1s */
- tcp_cfg.closewait_time = 20; /* 2s */
- tcp_cfg.timewait_time = 100; /* 10s */
- tcp_cfg.finwait1_time = 600; /* 60s */
- tcp_cfg.lastack_time = 300; /* 30s */
- tcp_cfg.finwait2_time = 300; /* 30s */
- tcp_cfg.closing_time = 300; /* 30s */
+ /* Time constants defined as timer tick (100us) multiples */
+ tcp_cfg.closewait_time = 20000; /* 2s */
+ tcp_cfg.timewait_time = 100000; /* 10s */
+ tcp_cfg.finwait1_time = 600000; /* 60s */
+ tcp_cfg.lastack_time = 300000; /* 30s */
+ tcp_cfg.finwait2_time = 300000; /* 30s */
+ tcp_cfg.closing_time = 300000; /* 30s */
+
+ /* This value is seconds */
tcp_cfg.cleanup_time = 0.1; /* 100ms */
}