FD.io VPP
v18.04-17-g3a0d853
Vector Packet Processing
|
Macros | |
#define | MEMIF_HAVE_CANCEL_POLL_EVENT 1 |
Send signal to stop concurrently running memif_poll_event(). More... | |
Functions | |
uint16_t | memif_get_version () |
Memif get version. More... | |
int | memif_get_queue_efd (memif_conn_handle_t conn, uint16_t qid, int *fd) |
Memif get queue event file descriptor More... | |
int | memif_set_rx_mode (memif_conn_handle_t conn, memif_rx_mode_t rx_mode, uint16_t qid) |
Memif set rx mode. More... | |
char * | memif_strerror (int err_code) |
Memif strerror. 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_init (memif_control_fd_update_t *on_control_fd_update, char *app_name, memif_alloc_t *memif_alloc, memif_free_t *memif_free) |
Memif initialization. More... | |
int | memif_cleanup () |
Memif cleanup. More... | |
int | memif_create (memif_conn_handle_t *conn, 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_control_fd_handler (int fd, uint8_t events) |
Memif control file descriptor handler. More... | |
int | memif_delete (memif_conn_handle_t *conn) |
Memif delete. More... | |
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_poll_event (int timeout) |
Memif poll event. More... | |
int | memif_cancel_poll_event () |
#define MEMIF_HAVE_CANCEL_POLL_EVENT 1 |
#include <extras/libmemif/src/libmemif.h>
Send signal to stop concurrently running memif_poll_event().
The function, however, does not wait for memif_poll_event() to stop. memif_poll_event() may still return simply because an event has occured or the timeout has elapsed, but if called repeatedly in an infinite loop, a canceled memif_poll_event() is guaranted to return MEMIF_ERR_POLL_CANCEL in the shortest possible time. This feature was not available in the first release. Use macro MEMIF_HAVE_CANCEL_POLL_EVENT to check if the feature is present.
Definition at line 519 of file libmemif.h.
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 | ||
) |
#include <extras/libmemif/src/libmemif.h>
Memif buffer alloc.
conn | - memif conenction handle |
qid | - number indentifying queue |
bufs | - memif buffers |
count | - number of memif buffers to allocate |
count_out | - returns number of allocated buffers |
size | - buffer size, may return chained buffers if size > buffer_size |
Definition at line 1534 of file main.c.
int memif_buffer_enq_tx | ( | memif_conn_handle_t | conn, |
uint16_t | qid, | ||
memif_buffer_t * | bufs, | ||
uint16_t | count, | ||
uint16_t * | count_out | ||
) |
#include <extras/libmemif/src/libmemif.h>
Memif buffer enq tx.
conn | - memif conenction handle |
qid | - number indentifying queue |
bufs | - memif buffers |
count | - number of memif buffers to enque |
count_out | - returns number of allocated buffers |
Slave is producer of buffers. If connection handle points to master returns MEMIF_ERR_INVAL_ARG.
Definition at line 1453 of file main.c.
int memif_cancel_poll_event | ( | ) |
#include <extras/libmemif/src/libmemif.h>
int memif_cleanup | ( | ) |
#include <extras/libmemif/src/libmemif.h>
Memif cleanup.
Free libmemif internal allocations.
Definition at line 2017 of file main.c.
int memif_control_fd_handler | ( | int | fd, |
uint8_t | events | ||
) |
#include <extras/libmemif/src/libmemif.h>
Memif control file descriptor handler.
fd | - file descriptor on which the event occured |
events | - event type(s) that occured |
If event occures on any control fd, call memif_control_fd_handler. Internal - lib will "identify" fd (timerfd, lsitener, control) and handle event accordingly.
FD-TYPE - TIMERFD - Every disconnected memif in slave mode will request connection. LISTENER or CONTROL - Handle socket messaging (internal connection establishment). INTERRUPT - Call on_interrupt callback (if set).
Definition at line 858 of file main.c.
int memif_create | ( | memif_conn_handle_t * | conn, |
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 | ||
) |
#include <extras/libmemif/src/libmemif.h>
Memory interface create function.
conn | - connection handle for user app |
args | - memory interface connection arguments |
on_connect | - inform user about connected status |
on_disconnect | - inform user about disconnected status |
on_interrupt | - informs user about interrupt, if set to null user will not be notified about interrupt, user can use memif_get_queue_efd call to get interrupt fd to poll for events |
private_ctx | - private contex passed back to user with callback |
Creates memory interface.
SLAVE-MODE - Start timer that will send events to timerfd. If this fd is passed to memif_control_fd_handler every disconnected memif in slave mode will send connection request. On success new fd is passed to user with memif_control_fd_update_t.
MASTER-MODE - Create listener socket and pass fd to user with memif_cntrol_fd_update_t. If this fd is passed to memif_control_fd_handler accept will be called and new fd will be passed to user with memif_control_fd_update_t.
Definition at line 593 of file main.c.
int memif_delete | ( | memif_conn_handle_t * | conn | ) |
#include <extras/libmemif/src/libmemif.h>
Memif delete.
conn | - pointer to memif connection handle |
disconnect session (free queues and regions, close file descriptors, unmap shared memory) set connection handle to NULL, to avoid possible double free
Definition at line 1183 of file main.c.
int memif_get_details | ( | memif_conn_handle_t | conn, |
memif_details_t * | md, | ||
char * | buf, | ||
ssize_t | buflen | ||
) |
#include <extras/libmemif/src/libmemif.h>
Memif get details.
conn | - memif conenction handle |
md | - pointer to memif details struct |
buf | - buffer containing details strings |
buflen | - length of buffer |
Definition at line 1870 of file main.c.
int memif_get_queue_efd | ( | memif_conn_handle_t | conn, |
uint16_t | qid, | ||
int * | fd | ||
) |
#include <extras/libmemif/src/libmemif.h>
Memif get queue event file descriptor
conn | - memif connection handle | |
qid | - queue id | |
[out] | fd | - returns event file descriptor |
Definition at line 1997 of file main.c.
uint16_t memif_get_version | ( | ) |
#include <extras/libmemif/src/libmemif.h>
Memif get version.
Definition at line 172 of file main.c.
int memif_init | ( | memif_control_fd_update_t * | on_control_fd_update, |
char * | app_name, | ||
memif_alloc_t * | memif_alloc, | ||
memif_free_t * | memif_free | ||
) |
#include <extras/libmemif/src/libmemif.h>
Memif initialization.
on_control_fd_update | - if control fd updates inform user to watch new fd |
app_name | - application name (will be truncated to 32 chars) |
memif_alloc | - cutom memory allocator, NULL = default |
memif_free | - custom memory free, NULL = default |
if param on_control_fd_update is set to NULL, libmemif will handle file descriptor event polling if a valid callback is set, file descriptor event polling needs to be done by user application, all file descriptors and event types will be passed in this callback to user application
Initialize internal libmemif structures. Create timerfd (used to periodically request connection by disconnected memifs in slave mode, with no additional API call). This fd is passed to user with memif_control_fd_update_t timer is inactive at this state. It activates with if there is at least one memif in slave mode.
Definition at line 427 of file main.c.
int memif_poll_event | ( | int | timeout | ) |
#include <extras/libmemif/src/libmemif.h>
Memif poll event.
timeout | - timeout in seconds |
Passive event polling - timeout = 0 - dont wait for event, check event queue if there is an event and return. timeout = -1 - wait until event
Definition at line 1008 of file main.c.
int memif_refill_queue | ( | memif_conn_handle_t | conn, |
uint16_t | qid, | ||
uint16_t | count, | ||
uint16_t | headroom | ||
) |
#include <extras/libmemif/src/libmemif.h>
Memif refill ring.
conn | - memif conenction handle |
qid | - number indentifying queue |
count | - number of buffers to be placed on ring |
headroom | - offset the buffer by headroom |
Definition at line 1663 of file main.c.
int memif_rx_burst | ( | memif_conn_handle_t | conn, |
uint16_t | qid, | ||
memif_buffer_t * | bufs, | ||
uint16_t | count, | ||
uint16_t * | rx | ||
) |
#include <extras/libmemif/src/libmemif.h>
Memif receive buffer burst.
conn | - memif conenction handle |
qid | - number indentifying queue |
bufs | - memif buffers |
count | - number of memif buffers to receive |
rx | - returns number of received buffers |
Definition at line 1785 of file main.c.
int memif_set_rx_mode | ( | memif_conn_handle_t | conn, |
memif_rx_mode_t | rx_mode, | ||
uint16_t | qid | ||
) |
#include <extras/libmemif/src/libmemif.h>
Memif set rx mode.
conn | - memif connection handle |
rx_mode | - receive mode |
qid | - queue id |
Definition at line 575 of file main.c.
char* memif_strerror | ( | int | err_code | ) |
#include <extras/libmemif/src/libmemif.h>
Memif strerror.
err_code | - error code |
Converts error code to error message.
Definition at line 155 of file main.c.
int memif_tx_burst | ( | memif_conn_handle_t | conn, |
uint16_t | qid, | ||
memif_buffer_t * | bufs, | ||
uint16_t | count, | ||
uint16_t * | tx | ||
) |
#include <extras/libmemif/src/libmemif.h>
Memif transmit buffer burst.
conn | - memif conenction handle |
qid | - number indentifying queue |
bufs | - memif buffers |
count | - number of memif buffers to transmit |
tx | - returns number of transmitted buffers |
Definition at line 1718 of file main.c.