31 #define udp_error(n,s) s, 51 s =
format (s,
"UDP_INPUT: connection %d, disposition %d, thread %d",
56 #define foreach_udp_input_next \ 57 _ (DROP, "error-drop") 61 #define _(s, n) UDP_INPUT_NEXT_##s, 83 u32 n_left_from, *from;
84 u32 errors, *first_buffer;
90 while (n_left_from > 0)
94 u32 error0 = UDP_ERROR_ENQUEUED;
103 void *rmt_addr, *lcl_addr;
125 udp0->src_port, TRANSPORT_PROTO_UDP);
135 udp0->src_port, TRANSPORT_PROTO_UDP);
142 error0 = UDP_ERROR_NO_LISTENER;
204 child0->c_lcl_port = udp0->
dst_port;
205 child0->c_rmt_port = udp0->
src_port;
206 child0->c_is_ip4 =
is_ip4;
207 child0->c_fib_index = tc0->fib_index;
211 tc0->s_index, tc0->thread_index, 1))
213 error0 = UDP_ERROR_CREATE_SESSION;
216 s0 =
session_get (child0->c_s_index, child0->c_thread_index);
220 error0 = UDP_ERROR_LISTENER;
225 error0 = UDP_ERROR_NOT_READY;
233 error0 = UDP_ERROR_FIFO_FULL;
272 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
302 .name =
"udp4-input",
303 .vector_size =
sizeof (
u32),
310 #define _(s, n) [UDP_INPUT_NEXT_##s] = n, 328 .name =
"udp6-input",
329 .vector_size =
sizeof (
u32),
336 #define _(s, n) [UDP_INPUT_NEXT_##s] = n, u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
u32 connection_index
Index of the transport connection associated to the session.
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
static u32 svm_fifo_max_enqueue_prod(svm_fifo_t *f)
Maximum number of bytes that can be enqueued into fifo.
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
u32 session_index
Index in thread pool where session was allocated.
transport_connection_t * listen_session_get_transport(session_t *s)
static udp_connection_t * udp_get_connection_from_transport(transport_connection_t *tc)
void ip_set(ip46_address_t *dst, void *src, u8 is_ip4)
session_t * session_lookup_safe4(u32 fib_index, ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
Lookup session with ip4 and transport layer information.
transport_connection_t * session_get_transport(session_t *s)
svm_fifo_t * rx_fifo
Pointers to rx/tx buffers.
int session_enqueue_dgram_connection(session_t *s, session_dgram_hdr_t *hdr, vlib_buffer_t *b, u8 proto, u8 queue_event)
u16 current_length
Nbytes between current data and the end of this buffer.
int session_main_flush_enqueue_events(u8 transport_proto, u32 thread_index)
Flushes queue of sessions that are to be notified of new data enqueued events.
static void session_pool_remove_peeker(u32 thread_index)
static session_t * session_get(u32 si, u32 thread_index)
session_t * session_lookup_safe6(u32 fib_index, ip6_address_t *lcl, ip6_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
Lookup session with ip6 and transport layer information.
vlib_error_t * errors
Vector of errors for this node.
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
udp_connection_t * udp_connection_alloc(u32 thread_index)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost...
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
int session_dgram_connect_notify(transport_connection_t *tc, u32 old_thread_index, session_t **new_session)
Move dgram session to the right thread.
struct _transport_connection transport_connection_t
vlib_main_t vlib_node_runtime_t * node
u8 thread_index
Index of the thread that allocated the session.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
transport_connection_t connection
must be first
clib_spinlock_t rx_lock
rx fifo lock
volatile u8 session_state
State in session layer state machine.
int session_enqueue_notify(session_t *s)
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static int svm_fifo_has_event(svm_fifo_t *f)
Check if fifo has io event.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
u16 flags
Copy of main node flags.
static udp_connection_t * udp_connection_clone_safe(u32 connection_index, u32 thread_index)
int session_stream_accept(transport_connection_t *tc, u32 listener_index, u32 thread_index, u8 notify)
Accept a stream session.
#define VLIB_NODE_FLAG_TRACE
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.