30 #ifndef CLIB_MARCH_VARIANT 40 s =
format (s,
"CT6_IN2OUT: sw_if_index %d, next index %d session %d\n",
49 #define foreach_ct6_in2out_error \ 50 _(PROCESSED, "ct6 packets processed") \ 51 _(CREATED, "ct6 sessions created") \ 52 _(RECYCLED, "ct6 sessions recycled") 56 #define _(sym,str) CT6_IN2OUT_ERROR_##sym, 62 #ifndef CLIB_MARCH_VARIANT 64 #define _(sym,string) string, 76 #ifndef CLIB_MARCH_VARIANT 80 u32 my_thread_index,
u32 * recyclep,
100 s0 - cmp->
sessions[my_thread_index],
113 s0 - cmp->
sessions[my_thread_index]);
127 memset (s0, 0,
sizeof (*s0));
132 clib_bihash_add_del_48_8 (&cmp->
session_hash, kvpp, 1 );
143 u32 n_left_from, *from;
160 while (n_left_from >= 4)
183 if (b[0]->
flags & VLIB_BUFFER_IS_TRACED)
186 t->next_index = next[0];
189 if (b[1]->
flags & VLIB_BUFFER_IS_TRACED)
192 t->next_index = next[1];
195 if (b[2]->
flags & VLIB_BUFFER_IS_TRACED)
198 t->next_index = next[2];
201 if (b[3]->
flags & VLIB_BUFFER_IS_TRACED)
204 t->next_index = next[3];
215 while (n_left_from > 0)
218 ct6_session_key_t *key0;
220 u32 session_index0 = ~0;
245 delta0 =
sizeof (*e0);
246 delta0 += (e0->
type == clib_net_to_host_u16 (ETHERNET_TYPE_VLAN))
248 delta0 += (e0->
type == clib_net_to_host_u16 (ETHERNET_TYPE_DOT1AD))
253 if (e0->
type != clib_host_to_net_u16 (ETHERNET_TYPE_IP6))
259 if (*tagged_etype_ptr != clib_host_to_net_u16 (ETHERNET_TYPE_IP6))
283 key0 = (ct6_session_key_t *) & kvp0;
295 if (clib_bihash_search_48_8 (&cmp->
session_hash, &kvp0, &kvp0) < 0)
299 &recycled, &created);
300 session_index0 = kvp0.
value;
305 session_index0 = kvp0.
value;
312 if (b[0]->
flags & VLIB_BUFFER_IS_TRACED)
330 CT6_IN2OUT_ERROR_PROCESSED, frame->
n_vectors);
332 CT6_IN2OUT_ERROR_CREATED, created);
334 CT6_IN2OUT_ERROR_RECYCLED, recycled);
349 #ifndef CLIB_MARCH_VARIANT 352 .name =
"ct6-in2out",
353 .vector_size =
sizeof (
u32),
static char * ct6_in2out_error_strings[]
static void ct6_lru_remove(ct6_main_t *cmp, ct6_session_t *s0)
#define clib_memcpy_fast(a, b, c)
static f64 vlib_time_now(vlib_main_t *vm)
vlib_node_registration_t ct6_in2out_node
(constructor) VLIB_REGISTER_NODE (ct6_in2out_node)
#define VLIB_NODE_FN(node)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static void ct6_lru_add(ct6_main_t *cmp, ct6_session_t *s0, f64 now)
ct6_session_t ** sessions
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vl_api_fib_path_type_t type
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u32 node_index
Node index.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
static_always_inline void vlib_buffer_enqueue_to_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 *nexts, uword count)
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
#define clib_warning(format, args...)
#define foreach_ct6_in2out_error
static void * ip6_next_header(ip6_header_t *i)
static void ct6_update_session_hit(ct6_main_t *cmp, ct6_session_t *s0, f64 now)
static uword ct6_in2out_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_trace)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
static uword ip6_address_is_global_unicast(const ip6_address_t *a)
ct6_session_t * ct6_create_or_recycle_session(ct6_main_t *cmp, clib_bihash_kv_48_8_t *kvpp, f64 now, u32 my_thread_index, u32 *recyclep, u32 *createp)
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
clib_bihash_48_8_t session_hash
static u8 * format_ct6_in2out_trace(u8 *s, va_list *args)
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
u32 max_sessions_per_worker
f64 session_timeout_interval
uword unformat_ethernet_header(unformat_input_t *input, va_list *args)
static uword pool_elts(void *v)
Number of active elements in a pool.