session: improve cli
[vpp.git] / src / vnet / session / transport.c
1 /*
2  * Copyright (c) 2017-2019 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #include <vnet/session/transport.h>
17 #include <vnet/session/session.h>
18 #include <vnet/fib/fib.h>
19
20 /**
21  * Per-type vector of transport protocol virtual function tables
22  */
23 transport_proto_vft_t *tp_vfts;
24
25 /*
26  * Port allocator seed
27  */
28 static u32 port_allocator_seed;
29
30 /*
31  * Local endpoints table
32  */
33 static transport_endpoint_table_t local_endpoints_table;
34
35 /*
36  * Pool of local endpoints
37  */
38 static transport_endpoint_t *local_endpoints;
39
40 /*
41  * Local endpoints pool lock
42  */
43 static clib_spinlock_t local_endpoints_lock;
44
45 /*
46  * Period used by transport pacers. Initialized by session layer
47  */
48 static double transport_pacer_period;
49
50 #define TRANSPORT_PACER_MIN_MSS         1460
51 #define TRANSPORT_PACER_MIN_BURST       TRANSPORT_PACER_MIN_MSS
52 #define TRANSPORT_PACER_MAX_BURST       (32 * TRANSPORT_PACER_MIN_MSS)
53
54 u8 *
55 format_transport_proto (u8 * s, va_list * args)
56 {
57   u32 transport_proto = va_arg (*args, u32);
58   switch (transport_proto)
59     {
60 #define _(sym, str, sstr)                       \
61     case TRANSPORT_PROTO_ ## sym:               \
62       s = format (s, str);                      \
63       break;
64       foreach_transport_proto
65 #undef _
66     default:
67       s = format (s, "UNKNOWN");
68       break;
69     }
70   return s;
71 }
72
73 u8 *
74 format_transport_proto_short (u8 * s, va_list * args)
75 {
76   u32 transport_proto = va_arg (*args, u32);
77   switch (transport_proto)
78     {
79 #define _(sym, str, sstr)                       \
80     case TRANSPORT_PROTO_ ## sym:               \
81       s = format (s, sstr);                     \
82       break;
83       foreach_transport_proto
84 #undef _
85     default:
86       s = format (s, "?");
87       break;
88     }
89   return s;
90 }
91
92 u8 *
93 format_transport_connection (u8 * s, va_list * args)
94 {
95   u32 transport_proto = va_arg (*args, u32);
96   u32 conn_index = va_arg (*args, u32);
97   u32 thread_index = va_arg (*args, u32);
98   u32 verbose = va_arg (*args, u32);
99   transport_proto_vft_t *tp_vft;
100   transport_connection_t *tc;
101   u32 indent;
102
103   tp_vft = transport_protocol_get_vft (transport_proto);
104   if (!tp_vft)
105     return s;
106
107   s = format (s, "%U", tp_vft->format_connection, conn_index, thread_index,
108               verbose);
109   tc = tp_vft->get_connection (conn_index, thread_index);
110   if (tc && transport_connection_is_tx_paced (tc) && verbose > 1)
111     {
112       indent = format_get_indent (s) + 1;
113       s = format (s, "%Upacer: %U\n", format_white_space, indent,
114                   format_transport_pacer, &tc->pacer);
115     }
116   return s;
117 }
118
119 u8 *
120 format_transport_listen_connection (u8 * s, va_list * args)
121 {
122   u32 transport_proto = va_arg (*args, u32);
123   transport_proto_vft_t *tp_vft;
124
125   tp_vft = transport_protocol_get_vft (transport_proto);
126   if (!tp_vft)
127     return s;
128
129   s = (tp_vft->format_listener) (s, args);
130   return s;
131 }
132
133 u8 *
134 format_transport_half_open_connection (u8 * s, va_list * args)
135 {
136   u32 transport_proto = va_arg (*args, u32);
137   u32 listen_index = va_arg (*args, u32);
138   transport_proto_vft_t *tp_vft;
139
140   tp_vft = transport_protocol_get_vft (transport_proto);
141   if (!tp_vft)
142     return s;
143
144   s = format (s, "%U", tp_vft->format_half_open, listen_index);
145   return s;
146 }
147
148 uword
149 unformat_transport_proto (unformat_input_t * input, va_list * args)
150 {
151   u32 *proto = va_arg (*args, u32 *);
152
153 #define _(sym, str, sstr)                                               \
154   if (unformat (input, str))                                            \
155     {                                                                   \
156       *proto = TRANSPORT_PROTO_ ## sym;                                 \
157       return 1;                                                         \
158     }
159   foreach_transport_proto
160 #undef _
161     return 0;
162 }
163
164 u32
165 transport_endpoint_lookup (transport_endpoint_table_t * ht, u8 proto,
166                            ip46_address_t * ip, u16 port)
167 {
168   clib_bihash_kv_24_8_t kv;
169   int rv;
170
171   kv.key[0] = ip->as_u64[0];
172   kv.key[1] = ip->as_u64[1];
173   kv.key[2] = (u64) port << 8 | (u64) proto;
174
175   rv = clib_bihash_search_inline_24_8 (ht, &kv);
176   if (rv == 0)
177     return kv.value;
178
179   return ENDPOINT_INVALID_INDEX;
180 }
181
182 void
183 transport_endpoint_table_add (transport_endpoint_table_t * ht, u8 proto,
184                               transport_endpoint_t * te, u32 value)
185 {
186   clib_bihash_kv_24_8_t kv;
187
188   kv.key[0] = te->ip.as_u64[0];
189   kv.key[1] = te->ip.as_u64[1];
190   kv.key[2] = (u64) te->port << 8 | (u64) proto;
191   kv.value = value;
192
193   clib_bihash_add_del_24_8 (ht, &kv, 1);
194 }
195
196 void
197 transport_endpoint_table_del (transport_endpoint_table_t * ht, u8 proto,
198                               transport_endpoint_t * te)
199 {
200   clib_bihash_kv_24_8_t kv;
201
202   kv.key[0] = te->ip.as_u64[0];
203   kv.key[1] = te->ip.as_u64[1];
204   kv.key[2] = (u64) te->port << 8 | (u64) proto;
205
206   clib_bihash_add_del_24_8 (ht, &kv, 0);
207 }
208
209 /**
210  * Register transport virtual function table.
211  *
212  * @param transport_proto - transport protocol type (i.e., TCP, UDP ..)
213  * @param vft - virtual function table for transport proto
214  * @param fib_proto - network layer protocol
215  * @param output_node - output node index that session layer will hand off
216  *                      buffers to, for requested fib proto
217  */
218 void
219 transport_register_protocol (transport_proto_t transport_proto,
220                              const transport_proto_vft_t * vft,
221                              fib_protocol_t fib_proto, u32 output_node)
222 {
223   u8 is_ip4 = fib_proto == FIB_PROTOCOL_IP4;
224
225   vec_validate (tp_vfts, transport_proto);
226   tp_vfts[transport_proto] = *vft;
227
228   session_register_transport (transport_proto, vft, is_ip4, output_node);
229 }
230
231 /**
232  * Get transport virtual function table
233  *
234  * @param type - session type (not protocol type)
235  */
236 transport_proto_vft_t *
237 transport_protocol_get_vft (transport_proto_t transport_proto)
238 {
239   if (transport_proto >= vec_len (tp_vfts))
240     return 0;
241   return &tp_vfts[transport_proto];
242 }
243
244 u8
245 transport_half_open_has_fifos (transport_proto_t tp)
246 {
247   return tp_vfts[tp].transport_options.half_open_has_fifos;
248 }
249
250 transport_service_type_t
251 transport_protocol_service_type (transport_proto_t tp)
252 {
253   return tp_vfts[tp].transport_options.service_type;
254 }
255
256 transport_tx_fn_type_t
257 transport_protocol_tx_fn_type (transport_proto_t tp)
258 {
259   return tp_vfts[tp].transport_options.tx_type;
260 }
261
262 void
263 transport_cleanup (transport_proto_t tp, u32 conn_index, u8 thread_index)
264 {
265   tp_vfts[tp].cleanup (conn_index, thread_index);
266 }
267
268 int
269 transport_connect (transport_proto_t tp, transport_endpoint_cfg_t * tep)
270 {
271   return tp_vfts[tp].connect (tep);
272 }
273
274 void
275 transport_close (transport_proto_t tp, u32 conn_index, u8 thread_index)
276 {
277   tp_vfts[tp].close (conn_index, thread_index);
278 }
279
280 void
281 transport_reset (transport_proto_t tp, u32 conn_index, u8 thread_index)
282 {
283   if (tp_vfts[tp].reset)
284     tp_vfts[tp].reset (conn_index, thread_index);
285   else
286     tp_vfts[tp].close (conn_index, thread_index);
287 }
288
289 u32
290 transport_start_listen (transport_proto_t tp, u32 session_index,
291                         transport_endpoint_t * tep)
292 {
293   return tp_vfts[tp].start_listen (session_index, tep);
294 }
295
296 u32
297 transport_stop_listen (transport_proto_t tp, u32 conn_index)
298 {
299   return tp_vfts[tp].stop_listen (conn_index);
300 }
301
302 u8
303 transport_protocol_is_cl (transport_proto_t tp)
304 {
305   return (tp_vfts[tp].transport_options.service_type == TRANSPORT_SERVICE_CL);
306 }
307
308 always_inline void
309 default_get_transport_endpoint (transport_connection_t * tc,
310                                 transport_endpoint_t * tep, u8 is_lcl)
311 {
312   if (is_lcl)
313     {
314       tep->port = tc->lcl_port;
315       tep->is_ip4 = tc->is_ip4;
316       clib_memcpy_fast (&tep->ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
317     }
318   else
319     {
320       tep->port = tc->rmt_port;
321       tep->is_ip4 = tc->is_ip4;
322       clib_memcpy_fast (&tep->ip, &tc->rmt_ip, sizeof (tc->rmt_ip));
323     }
324 }
325
326 void
327 transport_get_endpoint (transport_proto_t tp, u32 conn_index,
328                         u32 thread_index, transport_endpoint_t * tep,
329                         u8 is_lcl)
330 {
331   if (tp_vfts[tp].get_transport_endpoint)
332     tp_vfts[tp].get_transport_endpoint (conn_index, thread_index, tep,
333                                         is_lcl);
334   else
335     {
336       transport_connection_t *tc;
337       tc = transport_get_connection (tp, conn_index, thread_index);
338       default_get_transport_endpoint (tc, tep, is_lcl);
339     }
340 }
341
342 void
343 transport_get_listener_endpoint (transport_proto_t tp, u32 conn_index,
344                                  transport_endpoint_t * tep, u8 is_lcl)
345 {
346   if (tp_vfts[tp].get_transport_listener_endpoint)
347     tp_vfts[tp].get_transport_listener_endpoint (conn_index, tep, is_lcl);
348   else
349     {
350       transport_connection_t *tc;
351       tc = transport_get_listener (tp, conn_index);
352       default_get_transport_endpoint (tc, tep, is_lcl);
353     }
354 }
355
356 #define PORT_MASK ((1 << 16)- 1)
357
358 void
359 transport_endpoint_del (u32 tepi)
360 {
361   clib_spinlock_lock_if_init (&local_endpoints_lock);
362   pool_put_index (local_endpoints, tepi);
363   clib_spinlock_unlock_if_init (&local_endpoints_lock);
364 }
365
366 always_inline transport_endpoint_t *
367 transport_endpoint_new (void)
368 {
369   transport_endpoint_t *tep;
370   pool_get_zero (local_endpoints, tep);
371   return tep;
372 }
373
374 void
375 transport_endpoint_cleanup (u8 proto, ip46_address_t * lcl_ip, u16 port)
376 {
377   u32 tepi;
378   transport_endpoint_t *tep;
379
380   /* Cleanup local endpoint if this was an active connect */
381   tepi = transport_endpoint_lookup (&local_endpoints_table, proto, lcl_ip,
382                                     clib_net_to_host_u16 (port));
383   if (tepi != ENDPOINT_INVALID_INDEX)
384     {
385       tep = pool_elt_at_index (local_endpoints, tepi);
386       transport_endpoint_table_del (&local_endpoints_table, proto, tep);
387       transport_endpoint_del (tepi);
388     }
389 }
390
391 static void
392 transport_endpoint_mark_used (u8 proto, ip46_address_t * ip, u16 port)
393 {
394   transport_endpoint_t *tep;
395   clib_spinlock_lock_if_init (&local_endpoints_lock);
396   tep = transport_endpoint_new ();
397   clib_memcpy_fast (&tep->ip, ip, sizeof (*ip));
398   tep->port = port;
399   transport_endpoint_table_add (&local_endpoints_table, proto, tep,
400                                 tep - local_endpoints);
401   clib_spinlock_unlock_if_init (&local_endpoints_lock);
402 }
403
404 /**
405  * Allocate local port and add if successful add entry to local endpoint
406  * table to mark the pair as used.
407  */
408 int
409 transport_alloc_local_port (u8 proto, ip46_address_t * ip)
410 {
411   u16 min = 1024, max = 65535;  /* XXX configurable ? */
412   int tries, limit;
413   u32 tei;
414
415   limit = max - min;
416
417   /* Only support active opens from thread 0 */
418   ASSERT (vlib_get_thread_index () == 0);
419
420   /* Search for first free slot */
421   for (tries = 0; tries < limit; tries++)
422     {
423       u16 port = 0;
424
425       /* Find a port in the specified range */
426       while (1)
427         {
428           port = random_u32 (&port_allocator_seed) & PORT_MASK;
429           if (PREDICT_TRUE (port >= min && port < max))
430             break;
431         }
432
433       /* Look it up. If not found, we're done */
434       tei = transport_endpoint_lookup (&local_endpoints_table, proto, ip,
435                                        port);
436       if (tei == ENDPOINT_INVALID_INDEX)
437         {
438           transport_endpoint_mark_used (proto, ip, port);
439           return port;
440         }
441     }
442   return -1;
443 }
444
445 static clib_error_t *
446 transport_get_interface_ip (u32 sw_if_index, u8 is_ip4, ip46_address_t * addr)
447 {
448   if (is_ip4)
449     {
450       ip4_address_t *ip4;
451       ip4 = ip_interface_get_first_ip (sw_if_index, 1);
452       if (!ip4)
453         return clib_error_return (0, "no routable ip4 address on %U",
454                                   format_vnet_sw_if_index_name,
455                                   vnet_get_main (), sw_if_index);
456       addr->ip4.as_u32 = ip4->as_u32;
457     }
458   else
459     {
460       ip6_address_t *ip6;
461       ip6 = ip_interface_get_first_ip (sw_if_index, 0);
462       if (ip6 == 0)
463         return clib_error_return (0, "no routable ip6 addresses on %U",
464                                   format_vnet_sw_if_index_name,
465                                   vnet_get_main (), sw_if_index);
466       clib_memcpy_fast (&addr->ip6, ip6, sizeof (*ip6));
467     }
468   return 0;
469 }
470
471 static clib_error_t *
472 transport_find_local_ip_for_remote (u32 sw_if_index,
473                                     transport_endpoint_t * rmt,
474                                     ip46_address_t * lcl_addr)
475 {
476   fib_node_index_t fei;
477   fib_prefix_t prefix;
478
479   if (sw_if_index == ENDPOINT_INVALID_INDEX)
480     {
481       /* Find a FIB path to the destination */
482       clib_memcpy_fast (&prefix.fp_addr, &rmt->ip, sizeof (rmt->ip));
483       prefix.fp_proto = rmt->is_ip4 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6;
484       prefix.fp_len = rmt->is_ip4 ? 32 : 128;
485
486       ASSERT (rmt->fib_index != ENDPOINT_INVALID_INDEX);
487       fei = fib_table_lookup (rmt->fib_index, &prefix);
488
489       /* Couldn't find route to destination. Bail out. */
490       if (fei == FIB_NODE_INDEX_INVALID)
491         return clib_error_return (0, "no route to %U", format_ip46_address,
492                                   &rmt->ip, (rmt->is_ip4 == 0) + 1);
493
494       sw_if_index = fib_entry_get_resolving_interface (fei);
495       if (sw_if_index == ENDPOINT_INVALID_INDEX)
496         return clib_error_return (0, "no resolving interface for %U",
497                                   format_ip46_address, &rmt->ip,
498                                   (rmt->is_ip4 == 0) + 1);
499     }
500
501   clib_memset (lcl_addr, 0, sizeof (*lcl_addr));
502   return transport_get_interface_ip (sw_if_index, rmt->is_ip4, lcl_addr);
503 }
504
505 int
506 transport_alloc_local_endpoint (u8 proto, transport_endpoint_cfg_t * rmt_cfg,
507                                 ip46_address_t * lcl_addr, u16 * lcl_port)
508 {
509   transport_endpoint_t *rmt = (transport_endpoint_t *) rmt_cfg;
510   clib_error_t *error;
511   int port;
512   u32 tei;
513
514   /*
515    * Find the local address
516    */
517   if (ip_is_zero (&rmt_cfg->peer.ip, rmt_cfg->peer.is_ip4))
518     {
519       error = transport_find_local_ip_for_remote (rmt_cfg->peer.sw_if_index,
520                                                   rmt, lcl_addr);
521       if (error)
522         {
523           clib_error_report (error);
524           return -1;
525         }
526     }
527   else
528     {
529       /* Assume session layer vetted this address */
530       clib_memcpy_fast (lcl_addr, &rmt_cfg->peer.ip,
531                         sizeof (rmt_cfg->peer.ip));
532     }
533
534   /*
535    * Allocate source port
536    */
537   if (rmt_cfg->peer.port == 0)
538     {
539       port = transport_alloc_local_port (proto, lcl_addr);
540       if (port < 1)
541         {
542           clib_warning ("Failed to allocate src port");
543           return -1;
544         }
545       *lcl_port = port;
546     }
547   else
548     {
549       port = clib_net_to_host_u16 (rmt_cfg->peer.port);
550       tei = transport_endpoint_lookup (&local_endpoints_table, proto,
551                                        lcl_addr, port);
552       if (tei != ENDPOINT_INVALID_INDEX)
553         return -1;
554
555       transport_endpoint_mark_used (proto, lcl_addr, port);
556       *lcl_port = port;
557     }
558
559   return 0;
560 }
561
562 #define SPACER_CPU_TICKS_PER_PERIOD_SHIFT 10
563 #define SPACER_CPU_TICKS_PER_PERIOD (1 << SPACER_CPU_TICKS_PER_PERIOD_SHIFT)
564
565 u8 *
566 format_transport_pacer (u8 * s, va_list * args)
567 {
568   spacer_t *pacer = va_arg (*args, spacer_t *);
569
570   s = format (s, "bucket %u tokens/period %.3f last_update %x",
571               pacer->bucket, pacer->tokens_per_period, pacer->last_update);
572   return s;
573 }
574
575 static inline u32
576 spacer_max_burst (spacer_t * pacer, u64 norm_time_now)
577 {
578   u64 n_periods = norm_time_now - pacer->last_update;
579   u64 inc;
580
581   if (n_periods > 0 && (inc = n_periods * pacer->tokens_per_period) > 10)
582     {
583       pacer->last_update = norm_time_now;
584       pacer->bucket += inc;
585     }
586
587   return clib_min (pacer->bucket, TRANSPORT_PACER_MAX_BURST);
588 }
589
590 static inline void
591 spacer_update_bucket (spacer_t * pacer, u32 bytes)
592 {
593   ASSERT (pacer->bucket >= bytes);
594   pacer->bucket -= bytes;
595 }
596
597 static inline void
598 spacer_set_pace_rate (spacer_t * pacer, u64 rate_bytes_per_sec)
599 {
600   ASSERT (rate_bytes_per_sec != 0);
601   pacer->tokens_per_period = rate_bytes_per_sec / transport_pacer_period;
602 }
603
604 static inline u64
605 spacer_pace_rate (spacer_t * pacer)
606 {
607   return pacer->tokens_per_period * transport_pacer_period;
608 }
609
610 void
611 transport_connection_tx_pacer_reset (transport_connection_t * tc,
612                                      u32 rate_bytes_per_sec,
613                                      u32 start_bucket, u64 time_now)
614 {
615   spacer_t *pacer = &tc->pacer;
616   spacer_set_pace_rate (&tc->pacer, rate_bytes_per_sec);
617   pacer->last_update = time_now >> SPACER_CPU_TICKS_PER_PERIOD_SHIFT;
618   pacer->bucket = start_bucket;
619 }
620
621 void
622 transport_connection_tx_pacer_init (transport_connection_t * tc,
623                                     u32 rate_bytes_per_sec,
624                                     u32 initial_bucket)
625 {
626   vlib_main_t *vm = vlib_get_main ();
627   tc->flags |= TRANSPORT_CONNECTION_F_IS_TX_PACED;
628   transport_connection_tx_pacer_reset (tc, rate_bytes_per_sec,
629                                        initial_bucket,
630                                        vm->clib_time.last_cpu_time);
631 }
632
633 void
634 transport_connection_tx_pacer_update (transport_connection_t * tc,
635                                       u64 bytes_per_sec)
636 {
637   spacer_set_pace_rate (&tc->pacer, bytes_per_sec);
638 }
639
640 u32
641 transport_connection_tx_pacer_burst (transport_connection_t * tc,
642                                      u64 time_now)
643 {
644   time_now >>= SPACER_CPU_TICKS_PER_PERIOD_SHIFT;
645   return spacer_max_burst (&tc->pacer, time_now);
646 }
647
648 u32
649 transport_connection_snd_space (transport_connection_t * tc, u64 time_now,
650                                 u16 mss)
651 {
652   u32 snd_space, max_paced_burst;
653
654   snd_space = tp_vfts[tc->proto].send_space (tc);
655   if (transport_connection_is_tx_paced (tc))
656     {
657       time_now >>= SPACER_CPU_TICKS_PER_PERIOD_SHIFT;
658       max_paced_burst = spacer_max_burst (&tc->pacer, time_now);
659       max_paced_burst = (max_paced_burst < mss) ? 0 : max_paced_burst;
660       snd_space = clib_min (snd_space, max_paced_burst);
661       snd_space = snd_space - snd_space % mss;
662     }
663   return snd_space;
664 }
665
666 u64
667 transport_connection_tx_pacer_rate (transport_connection_t * tc)
668 {
669   return spacer_pace_rate (&tc->pacer);
670 }
671
672 void
673 transport_connection_update_tx_bytes (transport_connection_t * tc, u32 bytes)
674 {
675   if (transport_connection_is_tx_paced (tc))
676     spacer_update_bucket (&tc->pacer, bytes);
677 }
678
679 void
680 transport_connection_tx_pacer_update_bytes (transport_connection_t * tc,
681                                             u32 bytes)
682 {
683   spacer_update_bucket (&tc->pacer, bytes);
684 }
685
686 void
687 transport_init_tx_pacers_period (void)
688 {
689   f64 cpu_freq = os_cpu_clock_frequency ();
690   transport_pacer_period = cpu_freq / SPACER_CPU_TICKS_PER_PERIOD;
691 }
692
693 void
694 transport_update_time (f64 time_now, u8 thread_index)
695 {
696   transport_proto_vft_t *vft;
697   vec_foreach (vft, tp_vfts)
698   {
699     if (vft->update_time)
700       (vft->update_time) (time_now, thread_index);
701   }
702 }
703
704 void
705 transport_enable_disable (vlib_main_t * vm, u8 is_en)
706 {
707   transport_proto_vft_t *vft;
708   vec_foreach (vft, tp_vfts)
709   {
710     if (vft->enable)
711       (vft->enable) (vm, is_en);
712   }
713 }
714
715 void
716 transport_init (void)
717 {
718   vlib_thread_main_t *vtm = vlib_get_thread_main ();
719   session_main_t *smm = vnet_get_session_main ();
720   u32 num_threads;
721
722   if (smm->local_endpoints_table_buckets == 0)
723     smm->local_endpoints_table_buckets = 250000;
724   if (smm->local_endpoints_table_memory == 0)
725     smm->local_endpoints_table_memory = 512 << 20;
726
727   /* Initialize [port-allocator] random number seed */
728   port_allocator_seed = (u32) clib_cpu_time_now ();
729
730   clib_bihash_init_24_8 (&local_endpoints_table, "local endpoints table",
731                          smm->local_endpoints_table_buckets,
732                          smm->local_endpoints_table_memory);
733   num_threads = 1 /* main thread */  + vtm->n_threads;
734   if (num_threads > 1)
735     clib_spinlock_init (&local_endpoints_lock);
736 }
737
738 /*
739  * fd.io coding-style-patch-verification: ON
740  *
741  * Local Variables:
742  * eval: (c-set-style "gnu")
743  * End:
744  */