|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
16 #ifndef __included_nat44_ei_inlines_h__
17 #define __included_nat44_ei_inlines_h__
27 ASSERT (fib_index <= (1 << 14) - 1);
29 return (
u64)
addr.as_u32 << 32 | (
u64)
port << 16 | fib_index << 3 |
47 *fib_index =
key >> 3 & ((1 << 13) - 1);
75 return init_nat_k (kv, s->in2out.addr, s->in2out.port, s->in2out.fib_index,
83 init_nat_k (kv, s->in2out.addr, s->in2out.port, s->in2out.fib_index,
91 return init_nat_k (kv, s->out2in.addr, s->out2in.port, s->out2in.fib_index,
99 init_nat_k (kv, s->out2in.addr, s->out2in.port, s->out2in.fib_index,
107 return value->value >> 32;
118 u32 sw_if_index0,
u32 ip4_addr)
129 rt->cached_sw_if_index = ~0;
133 lm, ia, sw_if_index0, 1 , ({
135 hash_set (
rt->cached_presence_by_ip4_address,
a->as_u32, 1);
136 rt->cached_sw_if_index = sw_if_index0;
139 if (
rt->cached_sw_if_index == ~0)
143 ip4_addr_exists = !!
hash_get (
rt->cached_presence_by_ip4_address, ip4_addr);
156 if (s->last_heard > s->last_lru_update + 1)
161 s->per_user_list_head_index, s->per_user_index);
162 s->last_lru_update = s->last_heard;
173 u->nstaticsessions++;
188 if (u->nstaticsessions == 0 && u->nsessions == 0)
216 s->total_bytes += bytes;
217 nat_ha_sref (&s->out2in.addr, s->out2in.port, &s->ext_host_addr,
218 s->ext_host_port, s->nat_proto, s->out2in.fib_index,
220 &s->ha_last_refreshed,
now);
nat44_ei_main_per_thread_data_t * tnm
static u32 nat_value_get_thread_index(clib_bihash_kv_8_8_t *value)
vnet_interface_main_t * im
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
#define hash_set(h, key, value)
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
void nat_ha_sref(ip4_address_t *out_addr, u16 out_port, ip4_address_t *eh_addr, u16 eh_port, u8 proto, u32 fib_index, u32 total_pkts, u64 total_bytes, u32 thread_index, f64 *last_refreshed, f64 now)
Create session refresh HA event.
vlib_main_t vlib_node_runtime_t * node
#define pool_put(P, E)
Free an object E in pool P.
static void init_nat_i2o_kv(clib_bihash_kv_8_8_t *kv, nat44_ei_session_t *s, u32 thread_index, u32 session_index)
u32 max_translations_per_thread
#define pool_put_index(p, i)
Free pool element with given index.
nat44_ei_session_t * sessions
static void nat44_ei_session_update_lru(nat44_ei_main_t *nm, nat44_ei_session_t *s, u32 thread_index)
Per-user LRU list maintenance.
static u32 nat_value_get_session_index(clib_bihash_kv_8_8_t *value)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static void init_nat_kv(clib_bihash_kv_8_8_t *kv, ip4_address_t addr, u16 port, u32 fib_index, nat_protocol_t proto, u32 thread_index, u32 session_index)
#define static_always_inline
u32 max_translations_per_user
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
static void clib_dlist_remove(dlist_elt_t *pool, u32 index)
nat44_ei_main_per_thread_data_t * per_thread_data
static u8 nat44_ei_is_interface_addr(ip4_main_t *im, vlib_node_runtime_t *node, u32 sw_if_index0, u32 ip4_addr)
static void init_nat_o2i_kv(clib_bihash_kv_8_8_t *kv, nat44_ei_session_t *s, u32 thread_index, u32 session_index)
clib_bihash_8_8_t user_hash
static void vlib_set_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 value)
Set a simple counter.
static void nat44_ei_user_session_increment(nat44_ei_main_t *nm, nat44_ei_user_t *u, u8 is_static)
static u64 calc_nat_key(ip4_address_t addr, u16 port, u32 fib_index, u8 proto)
static void nat44_ei_delete_user_with_no_session(nat44_ei_main_t *nm, nat44_ei_user_t *u, u32 thread_index)
8 octet key, 8 octet key value pair
static uword pool_elts(void *v)
Number of active elements in a pool.
static_always_inline u8 nat44_ei_maximum_sessions_exceeded(nat44_ei_main_t *nm, u32 thread_index)
static void init_nat_i2o_k(clib_bihash_kv_8_8_t *kv, nat44_ei_session_t *s)
vnet_interface_output_runtime_t * rt
static void clib_dlist_addtail(dlist_elt_t *pool, u32 head_index, u32 new_index)
static void split_nat_key(u64 key, ip4_address_t *addr, u16 *port, u32 *fib_index, nat_protocol_t *proto)
vlib_simple_counter_main_t total_users
static void init_nat_o2i_k(clib_bihash_kv_8_8_t *kv, nat44_ei_session_t *s)
static void init_nat_k(clib_bihash_kv_8_8_t *kv, ip4_address_t addr, u16 port, u32 fib_index, nat_protocol_t proto)
static void nat44_ei_session_update_counters(nat44_ei_session_t *s, f64 now, uword bytes, u32 thread_index)