FD.io VPP  v21.01.1
Vector Packet Processing
main.c File Reference
+ Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define ERRLIST_LEN   40
 
#define MAX_ERRBUF_LEN   256
 
#define MEMIF_MEMORY_BARRIER()   __sync_synchronize ()
 
#define MEMIF_ERR_UNDEFINED   "undefined error"
 
#define DBG_TX_BUF   (0)
 
#define DBG_RX_BUF   (1)
 

Functions

char * memif_strerror (int err_code)
 Memif strerror. More...
 
uint16_t memif_get_version ()
 Memif get version. More...
 
int memif_syscall_error_handler (int err_code)
 
libmemif_main_tget_libmemif_main (memif_socket_t *ms)
 
static int memif_add_epoll_fd (libmemif_main_t *lm, int fd, uint32_t events)
 
static int memif_mod_epoll_fd (libmemif_main_t *lm, int fd, uint32_t events)
 
static int memif_del_epoll_fd (libmemif_main_t *lm, int fd)
 
int memif_control_fd_update (int fd, uint8_t events, void *private_ctx)
 
int add_list_elt (libmemif_main_t *lm, memif_list_elt_t *e, memif_list_elt_t **list, uint16_t *len)
 
int get_list_elt (memif_list_elt_t **e, memif_list_elt_t *list, uint16_t len, int key)
 
int free_list_elt (memif_list_elt_t *list, uint16_t len, int key)
 
int free_list_elt_ctx (memif_list_elt_t *list, uint16_t len, memif_connection_t *ctx)
 
static void memif_control_fd_update_register (libmemif_main_t *lm, memif_control_fd_update_t *cb)
 
void memif_register_external_region (memif_add_external_region_t *ar, memif_get_external_region_addr_t *gr, memif_del_external_region_t *dr, memif_get_external_buffer_offset_t *go)
 Register external region. More...
 
static void memif_alloc_register (libmemif_main_t *lm, memif_alloc_t *ma)
 
static void memif_realloc_register (libmemif_main_t *lm, memif_realloc_t *mr)
 
static void memif_free_register (libmemif_main_t *lm, memif_free_t *mf)
 
int memif_set_connection_request_timer (struct itimerspec timer)
 Set connection request timer value. More...
 
int memif_per_thread_set_connection_request_timer (memif_per_thread_main_handle_t pt_main, struct itimerspec timer)
 Set connection request timer value. More...
 
int memif_init (memif_control_fd_update_t *on_control_fd_update, char *app_name, memif_alloc_t *memif_alloc, memif_realloc_t *memif_realloc, memif_free_t *memif_free)
 Memif initialization. More...
 
int memif_per_thread_init (memif_per_thread_main_handle_t *pt_main, void *private_ctx, memif_control_fd_update_t *on_control_fd_update, char *app_name, memif_alloc_t *memif_alloc, memif_realloc_t *memif_realloc, memif_free_t *memif_free)
 Memif per thread initialization. More...
 
static memif_ring_tmemif_get_ring (memif_connection_t *conn, memif_ring_type_t type, uint16_t ring_num)
 
int memif_set_rx_mode (memif_conn_handle_t c, memif_rx_mode_t rx_mode, uint16_t qid)
 Memif set rx mode. More...
 
static int memif_socket_start_listening (memif_socket_t *ms)
 
int memif_create_socket (memif_socket_handle_t *sock, const char *filename, void *private_ctx)
 Create memif socket. More...
 
int memif_per_thread_create_socket (memif_per_thread_main_handle_t pt_main, memif_socket_handle_t *sock, const char *filename, void *private_ctx)
 Create memif socket. More...
 
int memif_create (memif_conn_handle_t *c, memif_conn_args_t *args, memif_connection_update_t *on_connect, memif_connection_update_t *on_disconnect, memif_interrupt_t *on_interrupt, void *private_ctx)
 Memory interface create function. More...
 
int memif_request_connection (memif_conn_handle_t c)
 Send connection request. More...
 
int memif_control_fd_handler (int fd, uint8_t events)
 Memif control file descriptor handler. More...
 
int memif_per_thread_control_fd_handler (memif_per_thread_main_handle_t pt_main, int fd, uint8_t events)
 Memif per thread control file descriptor handler. More...
 
int memif_poll_event (int timeout)
 Memif poll event. More...
 
int memif_per_thread_poll_event (memif_per_thread_main_handle_t pt_main, int timeout)
 Memif per thread poll event. More...
 
int memif_cancel_poll_event ()
 
int memif_per_thread_cancel_poll_event (memif_per_thread_main_handle_t pt_main)
 Send signal to stop concurrently running memif_poll_event(). More...
 
static void memif_msg_queue_free (libmemif_main_t *lm, memif_msg_queue_elt_t **e)
 
int memif_disconnect_internal (memif_connection_t *c)
 
const char * memif_get_socket_filename (memif_socket_handle_t sock)
 Get socket filename. More...
 
int memif_delete_socket (memif_socket_handle_t *sock)
 Delete memif socket. More...
 
int memif_delete (memif_conn_handle_t *conn)
 Memif delete. More...
 
int memif_connect1 (memif_connection_t *c)
 
static int memif_add_region (libmemif_main_t *lm, memif_connection_t *conn, uint8_t has_buffers)
 
static int memif_init_queues (libmemif_main_t *lm, memif_connection_t *conn)
 
int memif_init_regions_and_queues (memif_connection_t *conn)
 
int memif_buffer_enq_tx (memif_conn_handle_t conn, uint16_t qid, memif_buffer_t *bufs, uint16_t count, uint16_t *count_out)
 Memif buffer enq tx. More...
 
int memif_buffer_alloc (memif_conn_handle_t conn, uint16_t qid, memif_buffer_t *bufs, uint16_t count, uint16_t *count_out, uint16_t size)
 Memif buffer alloc. More...
 
int memif_refill_queue (memif_conn_handle_t conn, uint16_t qid, uint16_t count, uint16_t headroom)
 Memif refill ring. More...
 
int memif_tx_burst (memif_conn_handle_t conn, uint16_t qid, memif_buffer_t *bufs, uint16_t count, uint16_t *tx)
 Memif transmit buffer burst. More...
 
int memif_rx_burst (memif_conn_handle_t conn, uint16_t qid, memif_buffer_t *bufs, uint16_t count, uint16_t *rx)
 Memif receive buffer burst. More...
 
int memif_get_details (memif_conn_handle_t conn, memif_details_t *md, char *buf, ssize_t buflen)
 Memif get details. More...
 
int memif_get_queue_efd (memif_conn_handle_t conn, uint16_t qid, int *efd)
 Memif get queue event file descriptor. More...
 
int memif_cleanup ()
 Memif cleanup. More...
 
int memif_per_thread_cleanup (memif_per_thread_main_handle_t *pt_main)
 Memif per thread cleanup. More...
 

Variables

libmemif_main_t libmemif_main
 
static char memif_buf [MAX_ERRBUF_LEN]
 
const char * memif_errlist [ERRLIST_LEN]
 

Macro Definition Documentation

◆ DBG_RX_BUF

#define DBG_RX_BUF   (1)

Definition at line 180 of file main.c.

◆ DBG_TX_BUF

#define DBG_TX_BUF   (0)

Definition at line 179 of file main.c.

◆ ERRLIST_LEN

#define ERRLIST_LEN   40

Definition at line 59 of file main.c.

◆ MAX_ERRBUF_LEN

#define MAX_ERRBUF_LEN   256

Definition at line 60 of file main.c.

◆ MEMIF_ERR_UNDEFINED

#define MEMIF_ERR_UNDEFINED   "undefined error"

Definition at line 154 of file main.c.

◆ MEMIF_MEMORY_BARRIER

#define MEMIF_MEMORY_BARRIER ( )    __sync_synchronize ()

Definition at line 65 of file main.c.

Function Documentation

◆ add_list_elt()

int add_list_elt ( libmemif_main_t lm,
memif_list_elt_t e,
memif_list_elt_t **  list,
uint16_t *  len 
)

Definition at line 330 of file main.c.

+ Here is the caller graph for this function:

◆ free_list_elt()

int free_list_elt ( memif_list_elt_t list,
uint16_t  len,
int  key 
)

Definition at line 390 of file main.c.

+ Here is the caller graph for this function:

◆ free_list_elt_ctx()

int free_list_elt_ctx ( memif_list_elt_t list,
uint16_t  len,
memif_connection_t ctx 
)

Definition at line 407 of file main.c.

+ Here is the caller graph for this function:

◆ get_libmemif_main()

libmemif_main_t* get_libmemif_main ( memif_socket_t ms)

Definition at line 239 of file main.c.

+ Here is the caller graph for this function:

◆ get_list_elt()

int get_list_elt ( memif_list_elt_t **  e,
memif_list_elt_t list,
uint16_t  len,
int  key 
)

Definition at line 366 of file main.c.

+ Here is the caller graph for this function:

◆ memif_add_epoll_fd()

static int memif_add_epoll_fd ( libmemif_main_t lm,
int  fd,
uint32_t  events 
)
static

Definition at line 247 of file main.c.

+ Here is the caller graph for this function:

◆ memif_add_region()

static int memif_add_region ( libmemif_main_t lm,
memif_connection_t conn,
uint8_t  has_buffers 
)
inlinestatic

Definition at line 1962 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ memif_alloc_register()

static void memif_alloc_register ( libmemif_main_t lm,
memif_alloc_t ma 
)
static

Definition at line 447 of file main.c.

+ Here is the caller graph for this function:

◆ memif_connect1()

int memif_connect1 ( memif_connection_t c)

Definition at line 1880 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ memif_control_fd_update()

int memif_control_fd_update ( int  fd,
uint8_t  events,
void *  private_ctx 
)

Definition at line 308 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ memif_control_fd_update_register()

static void memif_control_fd_update_register ( libmemif_main_t lm,
memif_control_fd_update_t cb 
)
static

Definition at line 427 of file main.c.

+ Here is the caller graph for this function:

◆ memif_del_epoll_fd()

static int memif_del_epoll_fd ( libmemif_main_t lm,
int  fd 
)
static

Definition at line 289 of file main.c.

+ Here is the caller graph for this function:

◆ memif_disconnect_internal()

int memif_disconnect_internal ( memif_connection_t c)

Definition at line 1665 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ memif_free_register()

static void memif_free_register ( libmemif_main_t lm,
memif_free_t mf 
)
static

Definition at line 459 of file main.c.

+ Here is the caller graph for this function:

◆ memif_get_ring()

static memif_ring_t* memif_get_ring ( memif_connection_t conn,
memif_ring_type_t  type,
uint16_t  ring_num 
)
inlinestatic

Definition at line 825 of file main.c.

+ Here is the caller graph for this function:

◆ memif_init_queues()

static int memif_init_queues ( libmemif_main_t lm,
memif_connection_t conn 
)
inlinestatic

Definition at line 2012 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ memif_init_regions_and_queues()

int memif_init_regions_and_queues ( memif_connection_t conn)

Definition at line 2113 of file main.c.

+ Here is the call graph for this function:

◆ memif_mod_epoll_fd()

static int memif_mod_epoll_fd ( libmemif_main_t lm,
int  fd,
uint32_t  events 
)
static

Definition at line 268 of file main.c.

+ Here is the caller graph for this function:

◆ memif_msg_queue_free()

static void memif_msg_queue_free ( libmemif_main_t lm,
memif_msg_queue_elt_t **  e 
)
static

Definition at line 1653 of file main.c.

+ Here is the caller graph for this function:

◆ memif_realloc_register()

static void memif_realloc_register ( libmemif_main_t lm,
memif_realloc_t mr 
)
static

Definition at line 453 of file main.c.

+ Here is the caller graph for this function:

◆ memif_socket_start_listening()

static int memif_socket_start_listening ( memif_socket_t ms)
static

Definition at line 858 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ memif_syscall_error_handler()

int memif_syscall_error_handler ( int  err_code)

Definition at line 202 of file main.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ libmemif_main

Definition at line 68 of file main.c.

◆ memif_buf

char memif_buf[MAX_ERRBUF_LEN]
static

Definition at line 70 of file main.c.

◆ memif_errlist

const char* memif_errlist[ERRLIST_LEN]

Definition at line 72 of file main.c.