18 #ifndef __included_ed_inlines_h__ 19 #define __included_ed_inlines_h__ 32 s->lru_index = lru_list_elt - tsm->
lru_pool;
41 case IP_PROTOCOL_ICMP:
50 s->last_lru_update = now;
56 u32 thread_index,
int lru_delete
77 snat_session_t *s = NULL;
79 f64 sess_timeout_time;
83 if (~0 != oldest_index)
90 if (now >= sess_timeout_time
91 || (s->tcp_closed_timestamp && now >= s->tcp_closed_timestamp))
111 if ((rc = nat_lru_free_one_with_head (sm, thread_index, now, \ 112 tsm->p##_lru_head_index))) \ 138 s->ha_last_refreshed = now;
151 per_vrf_sessions_t *per_vrf_sessions;
152 u32 *to_free = 0, *
i;
156 if (per_vrf_sessions->expired)
158 if (per_vrf_sessions->ses_count == 0)
183 per_vrf_sessions_t *per_vrf_sessions;
192 if (per_vrf_sessions->expired)
195 if ((s->in2out.fib_index == per_vrf_sessions->rx_fib_index) &&
196 (s->out2in.fib_index == per_vrf_sessions->tx_fib_index))
200 if ((s->in2out.fib_index == per_vrf_sessions->tx_fib_index) &&
201 (s->out2in.fib_index == per_vrf_sessions->rx_fib_index))
209 clib_memset (per_vrf_sessions, 0,
sizeof (*per_vrf_sessions));
211 per_vrf_sessions->rx_fib_index = s->in2out.fib_index;
212 per_vrf_sessions->tx_fib_index = s->out2in.fib_index;
216 per_vrf_sessions->ses_count++;
225 per_vrf_sessions_t *per_vrf_sessions;
227 ASSERT (s->per_vrf_sessions_index != ~0);
231 s->per_vrf_sessions_index);
233 ASSERT (per_vrf_sessions->ses_count != 0);
235 per_vrf_sessions->ses_count--;
236 s->per_vrf_sessions_index = ~0;
245 per_vrf_sessions_t *per_vrf_sessions;
247 ASSERT (s->per_vrf_sessions_index != ~0);
251 s->per_vrf_sessions_index);
252 return per_vrf_sessions->expired;
static u32 nat44_session_get_timeout(snat_main_t *sm, snat_session_t *s)
static_always_inline int nat_lru_free_one_with_head(snat_main_t *sm, int thread_index, f64 now, u32 head_index)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
per_vrf_sessions_t * per_vrf_sessions_vec
void nat_free_session_data(snat_main_t *sm, snat_session_t *s, u32 thread_index, u8 is_ha)
Free NAT44 session data (lookup keys, external address port)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static_always_inline void per_vrf_sessions_register_session(snat_session_t *s, u32 thread_index)
static_always_inline void per_vrf_sessions_cleanup(u32 thread_index)
static void nat_ed_session_delete(snat_main_t *sm, snat_session_t *ses, u32 thread_index, int lru_delete)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define static_always_inline
static_always_inline u8 per_vrf_sessions_is_expired(snat_session_t *s, u32 thread_index)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void clib_dlist_addtail(dlist_elt_t *pool, u32 head_index, u32 new_index)
#define pool_put(P, E)
Free an object E in pool P.
#define vec_del1(v, i)
Delete the element at index I.
static void vlib_set_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 value)
Set a simple counter.
static_always_inline int nat_ed_lru_insert(snat_main_per_thread_data_t *tsm, snat_session_t *s, f64 now, u8 proto)
static_always_inline snat_session_t * nat_ed_session_alloc(snat_main_t *sm, u32 thread_index, f64 now, u8 proto)
static void clib_dlist_addhead(dlist_elt_t *pool, u32 head_index, u32 new_index)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
#define pool_put_index(p, i)
Free pool element with given index.
static void clib_dlist_remove(dlist_elt_t *pool, u32 index)
u32 unk_proto_lru_head_index
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 tcp_trans_lru_head_index
snat_main_per_thread_data_t * per_thread_data
#define vec_foreach(var, vec)
Vector iterator.
static_always_inline int nat_lru_free_one(snat_main_t *sm, int thread_index, f64 now)
vlib_simple_counter_main_t total_sessions
snat_session_t * sessions
static_always_inline void per_vrf_sessions_unregister_session(snat_session_t *s, u32 thread_index)
static u32 clib_dlist_remove_head(dlist_elt_t *pool, u32 head_index)
static uword pool_elts(void *v)
Number of active elements in a pool.