#include <vppinfra/elog.h>
#include <vppinfra/bihash_8_8.h>
#include <vppinfra/bihash_16_8.h>
+#include <vppinfra/hash.h>
#include <vppinfra/dlist.h>
#include <vppinfra/error.h>
#include <vlibapi/api.h>
/* per vrf sessions index */
u32 per_vrf_sessions_index;
+ u32 thread_index;
}) snat_session_t;
typedef struct
struct snat_main_s;
-/* Return worker thread index for given packet */
-typedef u32 (snat_get_worker_in2out_function_t) (vlib_buffer_t *b,
- ip4_header_t *ip,
- u32 rx_fib_index,
- u8 is_output);
-
-typedef u32 (snat_get_worker_out2in_function_t) (vlib_buffer_t * b,
- ip4_header_t * ip,
- u32 rx_fib_index,
- u8 is_output);
+u32 nat44_ed_get_in2out_worker_index (vlib_buffer_t *b, ip4_header_t *ip,
+ u32 rx_fib_index, u8 is_output);
+u32 nat44_ed_get_out2in_worker_index (vlib_buffer_t *b, ip4_header_t *ip,
+ u32 rx_fib_index, u8 is_output);
+/* Return worker thread index for given packet */
/* NAT address and port allocation function */
typedef int (nat_alloc_out_addr_and_port_function_t) (snat_address_t *
addresses,
u32 num_workers;
u32 first_worker_index;
u32 *workers;
- snat_get_worker_in2out_function_t *worker_in2out_cb;
- snat_get_worker_out2in_function_t *worker_out2in_cb;
u16 port_per_thread;
/* Per thread data */
/* counters */
vlib_simple_counter_main_t total_sessions;
+ u32 max_cfg_sessions_gauge; /* Index of max configured sessions gauge in
+ stats */
#define _(x) vlib_simple_counter_main_t x;
struct
typedef struct
{
u32 cached_sw_if_index;
- u32 cached_ip4_address;
+ uword *cached_presence_by_ip4_address;
} snat_runtime_t;
extern snat_main_t snat_main;
*/
int snat_set_workers (uword * bitmap);
-/**
- * @brief Set NAT plugin number of frame queue elements
- *
- * @param frame_queue_nelts number of worker handoff frame queue elements
- *
- * @return 0 on success, non-zero value otherwise
- */
-int snat_set_frame_queue_nelts (u32 frame_queue_nelts);
-
/**
* @brief Enable/disable NAT44 feature on the interface
*
} nat_translation_error_e;
nat_translation_error_e
-nat_6t_flow_buf_translate (snat_main_t *sm, vlib_buffer_t *b, ip4_header_t *ip,
- nat_6t_flow_t *f, nat_protocol_t proto,
- int is_output_feature);
+nat_6t_flow_buf_translate_i2o (snat_main_t *sm, vlib_buffer_t *b,
+ ip4_header_t *ip, nat_6t_flow_t *f,
+ nat_protocol_t proto, int is_output_feature);
+
+nat_translation_error_e
+nat_6t_flow_buf_translate_o2i (snat_main_t *sm, vlib_buffer_t *b,
+ ip4_header_t *ip, nat_6t_flow_t *f,
+ nat_protocol_t proto, int is_output_feature);
void nat_6t_l3_l4_csum_calc (nat_6t_flow_t *f);