|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
19 #include <sys/types.h>
20 #include <sys/socket.h>
23 #include <netinet/in.h>
132 clib_warning(
"Message ID %d has wrong length: %d\n",
id, l);
145 vl_api_memclnt_keepalive_reply_t *rmp;
151 q =
am->vl_input_queue;
159 case VL_API_RX_THREAD_EXIT:
170 case VL_API_MEMCLNT_RX_THREAD_SUSPEND:
180 case VL_API_MEMCLNT_READ_TIMEOUT:
181 clib_warning(
"Received read timeout in async thread\n");
185 case VL_API_MEMCLNT_KEEPALIVE:
189 rmp->_vl_msg_id =
ntohs(VL_API_MEMCLNT_KEEPALIVE_REPLY);
191 shmem_hdr =
am->shmem_hdr;
220 gettimeofday(&tv, NULL);
229 ep->_vl_msg_id =
ntohs(VL_API_MEMCLNT_READ_TIMEOUT);
251 ep->_vl_msg_id =
ntohs(VL_API_MEMCLNT_RX_THREAD_SUSPEND);
277 return (
am->msg_index_by_name_and_crc);
297 if (chroot_prefix != NULL)
371 ep->_vl_msg_id =
ntohs(VL_API_RX_THREAD_EXIT);
377 gettimeofday(&tv, NULL);
378 ts.tv_sec = tv.tv_sec + 5;
416 vl_api_memclnt_keepalive_reply_t *rmp;
429 if (
am->our_pid == 0)
436 q =
am->vl_input_queue;
445 case VL_API_RX_THREAD_EXIT:
448 case VL_API_MEMCLNT_RX_THREAD_SUSPEND:
450 case VL_API_MEMCLNT_READ_TIMEOUT:
452 case VL_API_MEMCLNT_KEEPALIVE:
457 rmp->_vl_msg_id =
ntohs(VL_API_MEMCLNT_KEEPALIVE_REPLY);
459 shmem_hdr =
am->shmem_hdr;
472 fprintf(stderr,
"Unregistered API message: %d\n", msg_id);
480 fprintf(stderr,
"Read failed with %d\n",
rv);
506 vac_client_index (
void)
522 if (!mp)
return (-1);
525 mp->client_index = vac_client_index();
526 q =
am->shmem_hdr->vl_input_queue;
529 fprintf(stderr,
"vpe_api_write fails: %d\n",
rv);
550 if (hp->
value[0] > max)
pthread_cond_t suspend_cv
pthread_cond_t timeout_cv
pthread_t rx_thread_handle
static uword * vac_msg_table_get_hash(void)
static clib_mem_heap_t * clib_mem_get_heap(void)
void vl_client_api_unmap(void)
pthread_t timeout_thread_handle
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
struct _svm_queue svm_queue_t
static uword hash_elts(void *v)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u32 data_len
message length not including header
int vac_msg_table_size(void)
int vl_client_disconnect(void)
static CLIB_NOSANITIZE_ADDR void VL_MSG_API_UNPOISON(const void *a)
int vl_client_api_map(const char *region_name)
int vac_read(char **p, int *l, u16 timeout)
pthread_cond_t terminate_cv
static void unset_timeout(void)
bool timeout_thread_cancelled
svm_queue_t * vl_input_queue
void vl_set_memory_root_path(const char *name)
static api_main_t * vlibapi_get_main(void)
u32 vl_msg_api_get_msg_index(u8 *name_and_crc)
__clib_export void clib_error_register_handler(clib_error_handler_func_t func, void *arg)
void vac_rx_suspend(void)
pthread_mutex_t queue_lock
typedef VL_API_PACKED(struct _vl_api_header { u16 _vl_msg_id;u32 client_index;})
int vac_msg_table_max_index(void)
API main structure, used by both vpp and binary API clients.
int svm_queue_add(svm_queue_t *q, u8 *elem, int nowait)
void vl_msg_api_free(void *)
void(* vac_error_callback_t)(void *, unsigned char *, int)
void vac_mem_init(size_t size)
int vac_get_msg_index(char *name)
pthread_mutex_t timeout_lock
static void set_timeout(unsigned short timeout)
Message header structure.
void * clib_mem_init(void *base, uword size)
void vlib_cli_output(struct vlib_main_t *vm, char *fmt,...)
vac_callback_t vac_callback
void vac_set_error_handler(vac_error_callback_t cb)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
int vac_write(char *p, int l)
void vl_msg_api_send_shmem(svm_queue_t *q, u8 *elem)
static void * vac_rx_thread_fn(void *arg)
#define clib_warning(format, args...)
int svm_queue_sub(svm_queue_t *q, u8 *elem, svm_q_conditional_wait_t cond, u32 time)
static void cleanup(void)
static void * vac_timeout_thread_fn(void *arg)
@ SVM_Q_WAIT
blocking call - best used in combination with condvars, for eventfds we don't yield the cpu
pthread_cond_t timeout_cancel_cv
static void vac_api_handler(void *msg)
int vl_client_connect(const char *name, int ctx_quota, int input_queue_size)
void(* vac_callback_t)(unsigned char *data, int len)
void * vl_msg_api_alloc(int nbytes)
int vac_connect(char *name, char *chroot_prefix, vac_callback_t cb, int rx_qlen)