cnat: Prepare extended snat policies
[vpp.git] / src / plugins / cnat / cnat_types.c
index c15c2f6..837f400 100644 (file)
@@ -18,7 +18,6 @@
 cnat_main_t cnat_main;
 fib_source_t cnat_fib_source;
 cnat_timestamp_t *cnat_timestamps;
-throttle_t cnat_throttle;
 
 char *cnat_error_strings[] = {
 #define cnat_error(n,s) s,
@@ -144,15 +143,12 @@ format_cnat_endpoint (u8 * s, va_list * args)
 static clib_error_t *
 cnat_types_init (vlib_main_t * vm)
 {
-  vlib_thread_main_t *tm = &vlib_thread_main;
-  u32 n_vlib_mains = tm->n_vlib_mains;
   cnat_fib_source = fib_source_allocate ("cnat",
                                         CNAT_FIB_SOURCE_PRIORITY,
                                         FIB_SOURCE_BH_SIMPLE);
 
 
   clib_rwlock_init (&cnat_main.ts_lock);
-  throttle_init (&cnat_throttle, n_vlib_mains, 1e-3);
 
   return (NULL);
 }
@@ -185,10 +181,12 @@ cnat_config (vlib_main_t * vm, unformat_input_t * input)
   cm->translation_hash_buckets = CNAT_DEFAULT_TRANSLATION_BUCKETS;
   cm->snat_hash_memory = CNAT_DEFAULT_SNAT_MEMORY;
   cm->snat_hash_buckets = CNAT_DEFAULT_SNAT_BUCKETS;
+  cm->snat_if_map_length = CNAT_DEFAULT_SNAT_IF_MAP_LEN;
   cm->scanner_timeout = CNAT_DEFAULT_SCANNER_TIMEOUT;
   cm->session_max_age = CNAT_DEFAULT_SESSION_MAX_AGE;
   cm->tcp_max_age = CNAT_DEFAULT_TCP_MAX_AGE;
   cm->default_scanner_state = CNAT_SCANNER_ON;
+  cm->maglev_len = CNAT_DEFAULT_MAGLEV_LEN;
   cm->lazy_init_done = 0;
 
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -207,6 +205,8 @@ cnat_config (vlib_main_t * vm, unformat_input_t * input)
        ;
       else if (unformat (input, "snat-db-buckets %u", &cm->snat_hash_buckets))
        ;
+      else if (unformat (input, "snat-if-map-len %u", &cm->snat_if_map_length))
+       ;
       else if (unformat (input, "snat-db-memory %U",
                         unformat_memory_size, &cm->snat_hash_memory))
        ;
@@ -221,6 +221,8 @@ cnat_config (vlib_main_t * vm, unformat_input_t * input)
        ;
       else if (unformat (input, "tcp-max-age %u", &cm->tcp_max_age))
        ;
+      else if (unformat (input, "maglev-len %u", &cm->maglev_len))
+       ;
       else
        return clib_error_return (0, "unknown input '%U'",
                                  format_unformat_error, input);