vlib: introduce vlib_get_main_by_index(), vlib_get_n_threads()
[vpp.git] / src / vnet / tcp / tcp.c
index d94da2c..72161ec 100644 (file)
@@ -657,9 +657,10 @@ tcp_init_mss (tcp_connection_t * tc)
   /* 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 */;
 }
 
 /**
@@ -680,7 +681,6 @@ tcp_init_snd_vars (tcp_connection_t * tc)
   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)
@@ -1330,7 +1330,7 @@ tcp_main_enable (vlib_main_t * vm)
       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)
@@ -1425,7 +1425,6 @@ tcp_configuration_init (void)
   tcp_cfg.max_gso_size = TCP_MAX_GSO_SZ;
 
   /* Time constants defined as timer tick (100us) multiples */
-  tcp_cfg.delack_time = 1000;  /* 0.1s */
   tcp_cfg.closewait_time = 20000;      /* 2s */
   tcp_cfg.timewait_time = 100000;      /* 10s */
   tcp_cfg.finwait1_time = 600000;      /* 60s */