FD.io VPP  v21.06-1-gbb7418cf9
Vector Packet Processing
nat44_ei_hairpinning.h
Go to the documentation of this file.
1 #ifndef __included_nat44_ei_hairpinning_h__
2 #define __included_nat44_ei_hairpinning_h__
3 
5 
6 #define foreach_nat44_ei_hairpinning_handoff_error \
7  _ (CONGESTION_DROP, "congestion drop")
8 
9 typedef enum
10 {
11 #define _(sym, str) NAT44_EI_HAIRPINNING_HANDOFF_ERROR_##sym,
13 #undef _
16 
18 #define _(sym, string) string,
20 #undef _
21 };
22 
23 typedef struct
24 {
27 
28 static u8 *
30 {
31  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
32  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
34  va_arg (*args, nat44_ei_hairpinning_handoff_trace_t *);
35 
36  s = format (s, "nat44-ei-hairpinning-handoff: next-worker %d",
38 
39  return s;
40 }
41 
45  vlib_frame_t *frame, u32 fq_index)
46 {
48  u32 n_enq, n_left_from, *from;
49  u16 thread_indices[VLIB_FRAME_SIZE], *ti;
50 
51  from = vlib_frame_vector_args (frame);
52  n_left_from = frame->n_vectors;
53  vlib_get_buffers (vm, from, bufs, n_left_from);
54 
55  b = bufs;
56  ti = thread_indices;
57 
58  while (n_left_from > 0)
59  {
60  ti[0] = vnet_buffer (b[0])->snat.required_thread_index;
61 
62  if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
63  (b[0]->flags & VLIB_BUFFER_IS_TRACED)))
64  {
66  vlib_add_trace (vm, node, b[0], sizeof (*t));
67  t->next_worker_index = ti[0];
68  }
69 
70  n_left_from -= 1;
71  ti += 1;
72  b += 1;
73  }
74  n_enq = vlib_buffer_enqueue_to_thread (vm, node, fq_index, from,
75  thread_indices, frame->n_vectors, 1);
76 
77  if (n_enq < frame->n_vectors)
79  vm, node->node_index, NAT44_EI_HAIRPINNING_HANDOFF_ERROR_CONGESTION_DROP,
80  frame->n_vectors - n_enq);
81  return frame->n_vectors;
82 }
83 
84 #endif // __included_nat44_ei_hairpinning_h__
85 
86 /*
87  * fd.io coding-style-patch-verification: ON
88  *
89  * Local Variables:
90  * eval: (c-set-style "gnu")
91  * End:
92  */
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:133
#define CLIB_UNUSED(x)
Definition: clib.h:90
static uword nat44_ei_hairpinning_handoff_fn_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u32 fq_index)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
Definition: nat44_ei.c:3048
NAT44 endpoint independent plugin declarations.
unsigned char u8
Definition: types.h:56
vlib_buffer_t ** b
unsigned int u32
Definition: types.h:88
vlib_get_buffers(vm, from, b, n_left_from)
return frame n_vectors
description fragment has unexpected format
Definition: map.api:433
#define VLIB_FRAME_SIZE
Definition: node.h:369
unsigned short u16
Definition: types.h:57
#define PREDICT_FALSE(x)
Definition: clib.h:124
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
u32 node_index
Node index.
Definition: node.h:479
static u8 * format_nat44_ei_hairpinning_handoff_trace(u8 *s, va_list *args)
static char * nat44_ei_hairpinning_handoff_error_strings[]
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
Definition: node_funcs.h:1244
u16 n_vectors
Definition: node.h:388
u32 ti
nat44_ei_hairpinning_handoff_error_t
#define always_inline
Definition: rdma_mlx5dv.h:23
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
VLIB buffer representation.
Definition: buffer.h:111
u64 uword
Definition: types.h:112
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:301
#define vnet_buffer(b)
Definition: buffer.h:437
#define foreach_nat44_ei_hairpinning_handoff_error
u16 flags
Copy of main node flags.
Definition: node.h:492
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace.c:628
#define VLIB_NODE_FLAG_TRACE
Definition: node.h:292
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
static_always_inline u32 vlib_buffer_enqueue_to_thread(vlib_main_t *vm, vlib_node_runtime_t *node, u32 frame_queue_index, u32 *buffer_indices, u16 *thread_indices, u32 n_packets, int drop_on_congestion)
Definition: buffer_node.h:358