|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
27 #include <sys/timerfd.h>
29 #define app_check_thread_and_barrier(_fn, _arg) \
30 if (!vlib_thread_is_main_w_barrier ()) \
32 vlib_rpc_call_main_thread (_fn, (u8 *) _arg, sizeof(*_arg)); \
39 struct itimerspec its;
41 its.it_value.tv_sec = 0;
42 its.it_value.tv_nsec = time_ns;
43 its.it_interval.tv_sec = 0;
44 its.it_interval.tv_nsec = its.it_value.tv_nsec;
46 if (timerfd_settime (
wrk->
timerfd, 0, &its, NULL) == -1)
113 a->sep.port = mp->
port;
114 a->sep.fib_index = mp->
vrf;
116 a->sep.transport_proto = mp->
proto;
119 a->sep_ext.transport_flags = mp->
flags;
150 a->uri = (
char *) mp->
uri;
173 a->sep.port = mp->
port;
174 a->sep.transport_proto = mp->
proto;
175 a->sep.peer.fib_index = mp->
vrf;
185 a->sep_ext.transport_flags = mp->
flags;
207 u32 max_connects = 32, n_connects = 0;
225 while (n_connects < max_connects &&
elt != he)
253 VLIB_NODE_STATE_POLLING);
265 VLIB_NODE_STATE_INTERRUPT);
329 a->uri = (
char *) mp->
uri;
471 (
u8 *) mp,
sizeof (*mp));
501 if (old_state >= SESSION_STATE_TRANSPORT_CLOSING)
529 if (!s || s->
session_state < SESSION_STATE_TRANSPORT_CLOSING)
562 session_event_t *evt;
577 clib_warning (
"could not disconnect session: %llu app: %u",
632 u32 owner_app_wrk_map;
633 session_event_t *evt;
712 session_event_t *evt;
739 session_event_t *evt;
793 s =
format (s,
"session index %d thread index %d",
798 #define foreach_session_queue_error \
799 _(TX, "Packets transmitted") \
800 _(TIMER, "Timer events") \
801 _(NO_BUFFER, "Out of buffers")
805 #define _(sym,str) SESSION_QUEUE_ERROR_##sym,
812 #define _(sym,string) string,
829 while (n_trace && n_segs)
853 u32 chain_bi0, to_deq, left_from_seg;
854 u16 len_to_deq, n_bytes_read;
857 b->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
863 to_deq = left_from_seg;
864 for (j = 1; j <
ctx->n_bufs_per_seg; j++)
870 chain_bi0 =
ctx->tx_buffers[*n_bufs];
877 ctx->sp.tx_offset, len_to_deq,
data);
878 ctx->sp.tx_offset += n_bytes_read;
882 if (
ctx->transport_vft->transport_options.tx_type ==
894 ASSERT (n_bytes_read > 0);
901 if (
ctx->left_to_snd > n_bytes_read)
905 else if (
ctx->left_to_snd == n_bytes_read)
913 ASSERT (n_bytes_read == len_to_deq);
919 prev_b->
flags |= VLIB_BUFFER_NEXT_PRESENT;
924 to_deq -= n_bytes_read;
930 ctx->left_to_snd -= left_from_seg;
945 b->
flags = VNET_BUFFER_F_LOCALLY_ORIGINATED;
955 ASSERT (n_bytes_read > 0);
958 ctx->sp.tx_offset += n_bytes_read;
974 ASSERT (n_bytes_read > 0);
986 if (
ctx->left_to_snd > n_bytes_read)
990 else if (
ctx->left_to_snd == n_bytes_read)
998 ASSERT (n_bytes_read > 0);
1002 ctx->left_to_snd -= n_bytes_read;
1026 (s->
flags & SESSION_F_CUSTOM_TX))
1030 else if (s->
session_state >= SESSION_STATE_TRANSPORT_CLOSED)
1035 && (s->
flags & SESSION_F_CUSTOM_TX))
1048 return ctx->transport_vft->get_connection (
ctx->s->connection_index,
1049 ctx->s->thread_index);
1053 if (
ctx->s->session_state == SESSION_STATE_LISTENING)
1054 return ctx->transport_vft->get_listener (
ctx->s->connection_index);
1057 return ctx->transport_vft->get_connection (
ctx->s->connection_index,
1058 ctx->s->thread_index);
1065 u32 max_segs,
u8 peek_data)
1067 u32 n_bytes_per_buf, n_bytes_per_seg;
1077 ctx->max_len_to_snd = 0;
1080 ctx->max_dequeue -=
ctx->sp.tx_offset;
1088 if (
ctx->max_dequeue <= sizeof (
ctx->hdr))
1090 ctx->max_len_to_snd = 0;
1097 len =
ctx->hdr.data_length -
ctx->hdr.data_offset;
1104 if (
ctx->hdr.data_length <= chain_limit)
1106 u32 first_dgram_len, dgram_len,
offset, max_offset;
1111 first_dgram_len =
len;
1112 max_offset =
clib_min (
ctx->max_dequeue, 16 << 10);
1114 while (
offset < max_offset)
1118 ASSERT (hdr.data_length > hdr.data_offset);
1119 dgram_len = hdr.data_length - hdr.data_offset;
1120 if (
len + dgram_len >
ctx->max_dequeue
1121 || first_dgram_len != dgram_len)
1124 offset +=
sizeof (hdr) + hdr.data_length;
1134 if (
ctx->max_dequeue <
ctx->sp.snd_space)
1137 ctx->max_len_to_snd = (
ctx->max_dequeue >
ctx->sp.snd_mss) ?
1138 (
ctx->max_dequeue - (
ctx->max_dequeue %
ctx->sp.snd_mss)) :
1145 ctx->max_len_to_snd =
ctx->sp.snd_space;
1149 ctx->n_segs_per_evt = ceil ((
f64)
ctx->max_len_to_snd /
ctx->sp.snd_mss);
1150 if (
ctx->n_segs_per_evt > max_segs)
1152 ctx->n_segs_per_evt = max_segs;
1153 ctx->max_len_to_snd = max_segs *
ctx->sp.snd_mss;
1157 if (
ctx->n_segs_per_evt > 1)
1159 u32 n_bytes_last_seg, n_bufs_last_seg;
1163 - ((
ctx->n_segs_per_evt - 1) *
ctx->sp.snd_mss);
1164 ctx->n_bufs_per_seg = ceil ((
f64) n_bytes_per_seg / n_bytes_per_buf);
1165 n_bufs_last_seg = ceil ((
f64) n_bytes_last_seg / n_bytes_per_buf);
1166 ctx->n_bufs_needed = ((
ctx->n_segs_per_evt - 1) *
ctx->n_bufs_per_seg)
1172 ctx->n_bufs_per_seg = ceil ((
f64) n_bytes_per_seg / n_bytes_per_buf);
1173 ctx->n_bufs_needed =
ctx->n_bufs_per_seg;
1199 int *n_tx_packets,
u8 peek_data)
1204 session_event_t *e = &
elt->evt;
1226 if (
ctx->transport_vft->flush_data)
1227 ctx->transport_vft->flush_data (
ctx->tc);
1231 if (
ctx->s->flags & SESSION_F_CUSTOM_TX)
1234 ctx->s->flags &= ~SESSION_F_CUSTOM_TX;
1235 ctx->sp.max_burst_size = max_burst;
1236 n_custom_tx =
ctx->transport_vft->custom_tx (
ctx->tc, &
ctx->sp);
1237 *n_tx_packets += n_custom_tx;
1239 (
ctx->s->session_state >= SESSION_STATE_TRANSPORT_CLOSED))
1241 max_burst -= n_custom_tx;
1242 if (!max_burst || (
ctx->s->flags & SESSION_F_CUSTOM_TX))
1251 if (!
ctx->sp.snd_space)
1277 snd_space =
clib_min (
ctx->sp.snd_space, snd_space);
1278 ctx->sp.snd_space = snd_space >=
ctx->sp.snd_mss ?
1279 snd_space - snd_space %
ctx->sp.snd_mss : snd_space;
1301 SESSION_QUEUE_ERROR_NO_BUFFER, 1);
1308 ctx->left_to_snd =
ctx->max_len_to_snd;
1316 pbi =
ctx->tx_buffers[n_bufs - 3];
1319 pbi =
ctx->tx_buffers[n_bufs - 4];
1323 bi0 =
ctx->tx_buffers[--n_bufs];
1324 bi1 =
ctx->tx_buffers[--n_bufs];
1332 ctx->transport_vft->push_header (
ctx->tc, b0);
1333 ctx->transport_vft->push_header (
ctx->tc, b1);
1349 pbi =
ctx->tx_buffers[n_bufs - 2];
1354 bi0 =
ctx->tx_buffers[--n_bufs];
1360 ctx->transport_vft->push_header (
ctx->tc, b0);
1370 ctx->n_segs_per_evt,
ctx->s, n_trace);
1375 *n_tx_packets +=
ctx->n_segs_per_evt;
1384 if (
ctx->max_len_to_snd <
ctx->max_dequeue)
1391 u32 n_dequeued =
ctx->max_len_to_snd;
1429 s->
flags &= ~SESSION_F_CUSTOM_TX;
1435 *n_tx_packets += n_packets;
1437 if (s->
flags & SESSION_F_CUSTOM_TX)
1470 void (*fp) (
void *);
1477 switch (e->event_type)
1480 fp = e->rpc_args.fp;
1481 (*fp) (e->rpc_args.arg);
1548 clib_warning (
"unhandled event type %d", e->event_type);
1576 switch (e->event_type)
1611 clib_warning (
"unhandled event type %d", e->event_type);
1624 #define _(symc, sym) \
1625 [SESSION_CTRL_EVT_ ## symc] = sizeof (session_ ## sym ##_msg_t),
1642 elt->evt.event_type = evt->event_type;
1674 u32 i, n_to_dequeue = 0;
1675 session_event_t *evt;
1678 for (
i = 0;
i < n_to_dequeue;
i++)
1686 return n_to_dequeue;
1701 VLIB_NODE_STATE_INTERRUPT);
1711 VLIB_NODE_STATE_POLLING);
1764 while (ei != old_ti)
1824 SESSION_QUEUE_ERROR_TX, n_tx_packets);
1831 return n_tx_packets;
1839 .name =
"session-queue",
1844 .state = VLIB_NODE_STATE_DISABLED,
1857 if (
rv < 0 && errno != EAGAIN)
1874 if ((
wrk->
timerfd = timerfd_create (CLOCK_MONOTONIC, TFD_NONBLOCK)) < 0)
1920 uword *event_data = 0;
1937 VLIB_NODE_STATE_DISABLED);
1955 .name =
"session-queue-process",
1956 .state = VLIB_NODE_STATE_DISABLED,
1976 .name =
"session-queue-main",
1977 .state = VLIB_NODE_STATE_DISABLED,
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
uword timerfd_file
Clib file for timerfd.
static u32 svm_msg_q_size(svm_msg_q_t *mq)
Check length of message queue.
int vnet_listen(vnet_listen_args_t *a)
u32 next_buffer
Next buffer for this linked-list of buffers.
@ SESSION_CTRL_EVT_SHUTDOWN
static void session_tx_trace_frame(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 *to_next, u16 n_segs, session_t *s, u32 n_trace)
@ TRANSPORT_SND_F_POSTPONE
static uword session_queue_run_on_main(vlib_main_t *vm)
static u8 svm_fifo_set_event(svm_fifo_t *f)
Set fifo event flag.
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
static u32 vlib_num_workers()
u32 wrk_index
Worker index in global worker pool.
clib_file_main_t file_main
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
static void ip46_address_mask_ip4(ip46_address_t *ip46)
#define clib_llist_next_index(E, name)
static void session_mq_shutdown_handler(void *data)
session_tx_context_t ctx
Context for session tx.
int vnet_connect(vnet_connect_args_t *a)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
int session_dequeue_notify(session_t *s)
#define clib_llist_remove(LP, name, E)
Remove entry from list.
static u64 session_wrk_tfd_timeout(session_wrk_state_t state, u32 thread_index)
transport_proto_vft_t * transport_protocol_get_vft(transport_proto_t transport_proto)
Get transport virtual function table.
u32 session_index
Index in thread pool where session was allocated.
static void svm_fifo_unset_event(svm_fifo_t *f)
Unset fifo event flag.
#define clib_memcpy(d, s, n)
void svm_msg_q_add_and_unlock(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Producer enqueue one message to queue with mutex held.
void session_transport_half_close(session_t *s)
Notify transport the session can be half-disconnected.
nat44_ei_hairpin_src_next_t next_index
transport_send_params_t sp
@ VLIB_NODE_TYPE_PRE_INPUT
static clib_error_t * session_queue_exit(vlib_main_t *vm)
vlib_node_registration_t session_queue_pre_input_node
(constructor) VLIB_REGISTER_NODE (session_queue_pre_input_node)
@ SESSION_CTRL_EVT_WORKER_UPDATE
static void session_parse_handle(session_handle_t handle, u32 *index, u32 *thread_index)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
int vnet_unlisten(vnet_unlisten_args_t *a)
int timerfd
Timerfd used to periodically signal wrk session queue node.
static void session_wrk_update_time(session_worker_t *wrk, f64 now)
void transport_update_time(clib_time_type_t time_now, u8 thread_index)
@ SESSION_CTRL_EVT_DISCONNECTED
struct session_dgram_header_ session_dgram_hdr_t
void * svm_msg_q_msg_data(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Get data for message in queue.
int svm_fifo_peek(svm_fifo_t *f, u32 offset, u32 len, u8 *dst)
Peek data from fifo.
static void clib_mem_free(void *p)
static void app_mq_detach_handler(void *data)
static u8 svm_fifo_needs_deq_ntf(svm_fifo_t *f, u32 n_last_deq)
Check if fifo needs dequeue notification.
@ SESSION_CTRL_EVT_CONNECT
vlib_main_t vlib_node_runtime_t * node
static void session_mq_connect_one(session_connect_msg_t *mp)
u64 session_segment_handle(session_t *s)
static void session_mq_worker_update_handler(void *data)
static void session_mq_unlisten_handler(session_worker_t *wrk, session_evt_elt_t *elt)
static u8 transport_connection_is_tx_paced(transport_connection_t *tc)
Check if transport connection is paced.
int vnet_connect_uri(vnet_connect_args_t *a)
static uword session_queue_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
int ct_session_connect_notify(session_t *ss, session_error_t err)
static void session_mq_disconnect_handler(void *data)
static void session_tx_maybe_reschedule(session_worker_t *wrk, session_tx_context_t *ctx, session_evt_elt_t *elt)
static_always_inline uword session_queue_pre_input_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u32 app_index
App index in app pool.
int vnet_application_detach(vnet_app_detach_args_t *a)
Detach application from vpp.
u8 thread_index
Index of the thread that allocated the session.
session_type_t session_type
Type built from transport and network protocol types.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
@ SESSION_Q_PROCESS_RUN_ON_MAIN
@ SESSION_IO_EVT_BUILTIN_TX
#define clib_llist_elts(LP)
Get number of elements in supporting container.
vl_api_dhcp_client_state_t state
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
static char * session_queue_error_strings[]
struct _vnet_unlisten_args_t vnet_unlisten_args_t
#define SESSION_NODE_FRAME_SIZE
static u32 session_thread_from_handle(session_handle_t handle)
u32 * session_type_to_next
Per session type output nodes.
struct _vnet_app_detach_args_t vnet_app_detach_args_t
struct _transport_connection transport_connection_t
void transport_connection_tx_pacer_update_bytes(transport_connection_t *tc, u32 bytes)
static int svm_fifo_is_empty_prod(svm_fifo_t *f)
Check if fifo is empty optimized for producer.
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
void session_wrk_enable_adaptive_mode(session_worker_t *wrk)
static void session_wrk_set_state(session_worker_t *wrk, session_wrk_state_t state)
#define clib_llist_add_tail(LP, name, E, H)
Add entry after tail.
clib_llist_index_t new_head
Head of list of elements.
#define clib_unix_warning(format, args...)
u32 transport_connection_tx_pacer_burst(transport_connection_t *tc)
Get tx pacer max burst.
void fifo_segment_collect_chunk(fifo_segment_t *fs, u32 slice_index, svm_fifo_chunk_t *c)
#define SESSION_CONN_HDR_LEN
static session_evt_elt_t * session_evt_alloc_new(session_worker_t *wrk)
static void session_evt_add_old(session_worker_t *wrk, session_evt_elt_t *elt)
static void session_tx_fill_buffer(vlib_main_t *vm, session_tx_context_t *ctx, vlib_buffer_t *b, u16 *n_bufs, u8 peek_data)
session_worker_t * wrk
Worker contexts.
struct _vnet_shutdown_args_t vnet_shutdown_args_t
static void * session_evt_ctrl_data(session_worker_t *wrk, session_evt_elt_t *elt)
vlib_node_registration_t session_queue_node
(constructor) VLIB_REGISTER_NODE (session_queue_node)
clib_time_type_t last_vlib_time
vlib_time_now last time around the track
int session_wrk_handle_mq(session_worker_t *wrk, svm_msg_q_t *mq)
struct _svm_fifo svm_fifo_t
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
void session_transport_close(session_t *s)
Notify transport the session can be disconnected.
#define clib_llist_put(LP, E)
Free element.
#define CLIB_PREFETCH(addr, size, type)
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type,...
u32 * pending_tx_buffers
Vector of buffers to be sent.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
u32 no_connect_loops
Main thread loops in poll mode without a connect.
u32 app_wrk_index
Index of the app worker that owns the session.
@ TRANSPORT_SND_F_DESCHED
@ SESSION_CTRL_EVT_TRANSPORT_ATTR_REPLY
void svm_fifo_overwrite_head(svm_fifo_t *f, u8 *src, u32 len)
Overwrite fifo head with new data.
svm_fifo_t * rx_fifo
Pointers to rx/tx buffers.
static void session_mq_listen_uri_handler(void *data)
@ SESSION_CTRL_EVT_UNLISTEN
@ SESSION_IO_EVT_BUILTIN_RX
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
int session_tx_fifo_dequeue_and_snd(session_worker_t *wrk, vlib_node_runtime_t *node, session_evt_elt_t *e, int *n_tx_packets)
static const u32 session_evt_msg_sizes[]
static session_main_t * vnet_get_session_main()
void transport_connection_tx_pacer_reset_bucket(transport_connection_t *tc, u32 bucket)
Reset tx pacer bucket.
static void session_tx_set_dequeue_params(vlib_main_t *vm, session_tx_context_t *ctx, u32 max_segs, u8 peek_data)
struct _vnet_disconnect_args_t vnet_disconnect_args_t
@ SESSION_CTRL_EVT_HALF_CLOSE
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static uword session_queue_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
void session_node_enable_disable(u8 is_en)
#define clib_llist_elt_is_linked(E, name)
Check if element is linked in a list.
static u32 vlib_last_vectors_per_main_loop(vlib_main_t *vm)
static __clib_warn_unused_result u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
int svm_fifo_dequeue(svm_fifo_t *f, u32 len, u8 *dst)
Dequeue data from fifo.
#define ENDPOINT_INVALID_INDEX
struct clib_bihash_value offset
template key/value backing page structure
int app_worker_close_notify(app_worker_t *app_wrk, session_t *s)
@ SESSION_CTRL_EVT_LISTEN_URI
#define vlib_worker_thread_barrier_sync(X)
static_always_inline uword vlib_get_thread_index(void)
static void session_mq_connect_handler(session_worker_t *wrk, session_evt_elt_t *elt)
static void session_evt_add_to_list(session_worker_t *wrk, session_event_t *evt)
#define clib_llist_entry_index(LP, E)
Get list entry index.
struct _vnet_bind_args_t vnet_listen_args_t
static_always_inline void vlib_buffer_enqueue_to_next_vec(vlib_main_t *vm, vlib_node_runtime_t *node, u32 **buffers, u16 **nexts, uword count)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static u32 transport_connection_snd_params(transport_connection_t *tc, transport_send_params_t *sp)
Get send parameters for transport connection.
session_fifo_rx_fn ** session_tx_fns
Per transport rx function that can either dequeue or peek.
#define static_always_inline
@ SESSION_CTRL_EVT_LISTEN
fifo_segment_t * application_get_rx_mqs_segment(application_t *app)
#define clib_llist_next(LP, name, E)
Get next pool entry.
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
@ SESSION_IO_EVT_TX_FLUSH
int session_tx_fifo_peek_and_snd(session_worker_t *wrk, vlib_node_runtime_t *node, session_evt_elt_t *e, int *n_tx_packets)
@ SESSION_CTRL_EVT_DISCONNECTED_REPLY
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static session_evt_elt_t * session_evt_alloc_ctrl(session_worker_t *wrk)
static void session_mq_accepted_reply_handler(void *data)
transport_endpt_attr_t attr
static u32 session_evt_ctrl_data_alloc(session_worker_t *wrk)
session_main_t session_main
u32 client_index
app client index
void session_send_rpc_evt_to_thread(u32 thread_index, void *fp, void *rpc_args)
int svm_fifo_dequeue_drop(svm_fifo_t *f, u32 len)
Dequeue and drop bytes from fifo.
#define VLIB_NODE_FLAG_TRACE_SUPPORTED
static int transport_custom_tx(transport_proto_t tp, void *s, transport_send_params_t *sp)
static session_t * session_get_from_handle_if_valid(session_handle_t handle)
session_wrk_flag_t flags
Worker flags.
static u8 * format_session_queue_trace(u8 *s, va_list *args)
static int transport_app_rx_evt(transport_proto_t tp, u32 conn_index, u32 thread_index)
@ SESSION_CTRL_EVT_APP_DETACH
#define app_check_thread_and_barrier(_fn, _arg)
@ SESSION_CTRL_EVT_REQ_WORKER_UPDATE
svm_msg_q_t * event_queue
Application listens for events on this svm queue.
static void session_evt_add_head_old(session_worker_t *wrk, session_evt_elt_t *elt)
int session_tx_fifo_dequeue_internal(session_worker_t *wrk, vlib_node_runtime_t *node, session_evt_elt_t *elt, int *n_tx_packets)
#define CLIB_CACHE_LINE_BYTES
static void vlib_set_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt, u32 count)
static void session_mq_reset_reply_handler(void *data)
struct _vlib_node_registration vlib_node_registration_t
int vnet_disconnect_session(vnet_disconnect_args_t *a)
static clib_error_t * session_wrk_tfd_read_ready(clib_file_t *cf)
u16 current_length
Nbytes between current data and the end of this buffer.
static void session_tx_fifo_chain_tail(vlib_main_t *vm, session_tx_context_t *ctx, vlib_buffer_t *b, u16 *n_bufs, u8 peek_data)
#define TRANSPORT_MAX_HDRS_LEN
svm_msg_q_t * vpp_event_queue
vpp event message queue for worker
u32 wrk_index
dst worker index
#define foreach_session_queue_error
static void session_mq_free_ext_config(application_t *app, uword offset)
#define TRANSPORT_PACER_MAX_BURST_PKTS
@ SESSION_CTRL_EVT_RESET_REPLY
static u8 session_tx_not_ready(session_t *s, u8 peek_data)
session_evt_elt_t * event_elts
Pool of session event list elements.
enum session_wrk_state_ session_wrk_state_t
static void session_mq_listen_handler(void *data)
void svm_msg_q_free_msg(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Free message buffer.
template key/value backing page structure
@ TRANSPORT_TX_DGRAM
datagram mode
static void session_evt_ctrl_data_free(session_worker_t *wrk, session_evt_elt_t *elt)
static void session_mq_unlisten_rpc(session_unlisten_msg_t *mp)
application_t * application_lookup(u32 api_client_index)
static clib_error_t * session_wrk_tfd_write_ready(clib_file_t *cf)
static transport_endpt_ext_cfg_t * session_mq_get_ext_config(application_t *app, uword offset)
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
description fragment has unexpected format
void mq_send_unlisten_reply(app_worker_t *app_wrk, session_handle_t sh, u32 context, int rv)
static u8 * format_session_error(u8 *s, va_list *args)
static session_t * session_get_if_valid(u64 si, u32 thread_index)
static_always_inline u32 vlib_buffer_get_default_data_size(vlib_main_t *vm)
static int session_tx_fifo_read_and_snd_i(session_worker_t *wrk, vlib_node_runtime_t *node, session_evt_elt_t *elt, int *n_tx_packets, u8 peek_data)
static transport_connection_t * session_tx_get_transport(session_tx_context_t *ctx, u8 peek_data)
void ip_copy(ip46_address_t *dst, ip46_address_t *src, u8 is_ip4)
static void * vlib_buffer_make_headroom(vlib_buffer_t *b, u8 size)
Make head room, typically for packet headers.
static void vlib_node_set_interrupt_pending(vlib_main_t *vm, u32 node_index)
int app_worker_lock_and_send_event(app_worker_t *app, session_t *s, u8 evt_type)
Send event to application.
enum _transport_proto transport_proto_t
app_worker_t * app_worker_get(u32 wrk_index)
vlib_main_t * vm
Convenience pointer to this worker's vlib_main.
static void session_mq_disconnected_handler(void *data)
int vnet_shutdown_session(vnet_shutdown_args_t *a)
app_worker_t * application_get_worker(application_t *app, u32 wrk_map_index)
static vlib_main_t * vlib_get_main_by_index(u32 thread_index)
transport_endpt_attr_t attr
struct _vnet_connect_args vnet_connect_args_t
static uword pool_elts(void *v)
Number of active elements in a pool.
void vlib_rpc_call_main_thread(void *callback, u8 *args, u32 arg_size)
@ SESSION_CTRL_EVT_APP_WRK_RPC
static uword clib_file_add(clib_file_main_t *um, clib_file_t *template)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
static session_t * session_event_get_session(session_worker_t *wrk, session_event_t *e)
void session_transport_reset(session_t *s)
Force transport close.
#define TRANSPORT_PACER_MIN_BURST
static void session_event_dispatch_ctrl(session_worker_t *wrk, session_evt_elt_t *elt)
u16 * pending_tx_nexts
Vector of nexts for the pending tx buffers.
clib_llist_index_t pending_connects
List of pending connects for first worker.
static u8 transport_connection_is_cless(transport_connection_t *tc)
session_t * sessions
Worker session pool.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static svm_fifo_chunk_t * fs_chunk_ptr(fifo_segment_header_t *fsh, fs_sptr_t cp)
int svm_msg_q_lock_and_alloc_msg_w_ring(svm_msg_q_t *mq, u32 ring_index, u8 noblock, svm_msg_q_msg_t *msg)
Lock message queue and allocate message buffer on ring.
clib_llist_index_t old_head
Head of list of pending events.
static u32 vlib_get_n_threads()
static transport_proto_t session_get_transport_proto(session_t *s)
#define foreach_session_ctrl_evt
u32 wrk_map_index
Worker index in app's map pool.
int mq_send_session_connected_cb(u32 app_wrk_index, u32 api_context, session_t *s, session_error_t err)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static vlib_main_t * vlib_get_main(void)
int vnet_bind_uri(vnet_listen_args_t *a)
static void session_wrk_update_state(session_worker_t *wrk)
@ SESSION_CTRL_EVT_CONNECT_URI
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vnet_interface_output_runtime_t * rt
@ SESSION_CTRL_EVT_TRANSPORT_ATTR
static void session_mq_app_wrk_rpc_handler(void *data)
u32 n_pending_connects
Flag that is set if main thread signaled to handle connects.
@ SESSION_CTRL_EVT_DISCONNECT
transport_snd_flags_t flags
#define clib_warning(format, args...)
@ SESSION_CTRL_EVT_ACCEPTED_REPLY
static void session_mq_transport_attr_handler(void *data)
int app_worker_builtin_rx(app_worker_t *app_wrk, session_t *s)
static f64 vlib_time_now(vlib_main_t *vm)
uword fifo_segment_fifo_offset(svm_fifo_t *f)
#define VLIB_MAIN_LOOP_EXIT_FUNCTION(x)
static void session_wrk_timerfd_update(session_worker_t *wrk, u64 time_ns)
@ SVM_Q_WAIT
blocking call - best used in combination with condvars, for eventfds we don't yield the cpu
u32 app_index
Index of owning app.
vlib_node_registration_t session_queue_process_node
(constructor) VLIB_REGISTER_NODE (session_queue_process_node)
session_wrk_state_t state
Worker state.
static u8 session_has_transport(session_t *s)
static void session_flush_pending_tx_buffers(session_worker_t *wrk, vlib_node_runtime_t *node)
static __clib_warn_unused_result int vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
fifo_segment_header_t * h
fifo segment data
@ SESSION_MQ_CTRL_EVT_RING
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
static u32 svm_fifo_max_dequeue_cons(svm_fifo_t *f)
Fifo max bytes to dequeue optimized for consumer.
int svm_msg_q_sub_raw(svm_msg_q_t *mq, svm_msg_q_msg_t *elem)
Consumer dequeue one message from queue.
int session_transport_attribute(session_t *s, u8 is_get, transport_endpt_attr_t *attr)
@ SESSION_CTRL_EVT_WORKER_UPDATE_REPLY
static void session_event_dispatch_io(session_worker_t *wrk, vlib_node_runtime_t *node, session_evt_elt_t *elt, int *n_tx_packets)
int session_send_io_evt_to_thread(svm_fifo_t *f, session_evt_type_t evt_type)
volatile u8 session_state
State in session layer state machine.
static session_worker_t * session_main_get_worker(u32 thread_index)
static int svm_fifo_is_empty(svm_fifo_t *f)
Check if fifo is empty.
int app_worker_own_session(app_worker_t *app_wrk, session_t *s)
u32 connection_index
Index of the transport connection associated to the session.
static void * clib_mem_alloc(uword size)
#define clib_llist_prev_index(E, name)
static void session_mq_handle_connects_rpc(void *arg)
static void session_mq_disconnected_reply_handler(void *data)
u8 session_is_valid(u32 si, u8 thread_index)
int mq_send_session_bound_cb(u32 app_wrk_index, u32 api_context, session_handle_t handle, int rv)
static void session_mq_connect_uri_handler(void *data)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
void session_send_rpc_evt_to_thread_force(u32 thread_index, void *fp, void *rpc_args)
#define VLIB_REGISTER_NODE(x,...)
clib_llist_index_t ctrl_head
Head of control events list.
#define clib_llist_elt(LP, EI)
Get list elt at index.
#define SESSION_EVT(_evt, _args...)
static void transport_connection_deschedule(transport_connection_t *tc)