FD.io VPP  v18.07-34-g55fbdb9
Vector Packet Processing
Api calls
+ Collaboration diagram for Api calls:

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 ()
 

Detailed Description

Macro Definition Documentation

#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.

Returns
memif_err_t

Definition at line 519 of file libmemif.h.

Function Documentation

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.

Parameters
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
Returns
memif_err_t

Definition at line 1533 of file main.c.

+ Here is the caller graph for this function:

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.

Parameters
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.

Returns
memif_err_t

Definition at line 1454 of file main.c.

+ Here is the caller graph for this function:

int memif_cancel_poll_event ( )

#include <extras/libmemif/src/libmemif.h>

Definition at line 1050 of file main.c.

int memif_cleanup ( )

#include <extras/libmemif/src/libmemif.h>

Memif cleanup.

Free libmemif internal allocations.

Returns
0

Definition at line 2013 of file main.c.

+ Here is the caller graph for this function:

int memif_control_fd_handler ( int  fd,
uint8_t  events 
)

#include <extras/libmemif/src/libmemif.h>

Memif control file descriptor handler.

Parameters
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).

Returns
memif_err_t

Definition at line 859 of file main.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
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.

Returns
memif_err_t

Definition at line 595 of file main.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int memif_delete ( memif_conn_handle_t conn)

#include <extras/libmemif/src/libmemif.h>

Memif delete.

Parameters
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

Returns
memif_err_t

Definition at line 1184 of file main.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
conn- memif conenction handle
md- pointer to memif details struct
buf- buffer containing details strings
buflen- length of buffer
Returns
memif_err_t

Definition at line 1866 of file main.c.

+ Here is the caller graph for this function:

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

Parameters
conn- memif connection handle
qid- queue id
[out]fd- returns event file descriptor
Returns
memif_err_t

Definition at line 1993 of file main.c.

+ Here is the caller graph for this function:

uint16_t memif_get_version ( )

#include <extras/libmemif/src/libmemif.h>

Memif get version.

Returns
((MEMIF_VERSION_MAJOR << 8) | MEMIF_VERSION_MINOR)

Definition at line 174 of file main.c.

+ Here is the caller graph for this function:

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.

Parameters
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.

Returns
memif_err_t

Definition at line 429 of file main.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int memif_poll_event ( int  timeout)

#include <extras/libmemif/src/libmemif.h>

Memif poll event.

Parameters
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

Returns
memif_err_t

Definition at line 1009 of file main.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
conn- memif conenction handle
qid- number indentifying queue
count- number of buffers to be placed on ring
headroom- offset the buffer by headroom
Returns
memif_err_t

Definition at line 1659 of file main.c.

+ Here is the caller graph for this function:

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.

Parameters
conn- memif conenction handle
qid- number indentifying queue
bufs- memif buffers
count- number of memif buffers to receive
rx- returns number of received buffers
Returns
memif_err_t

Definition at line 1781 of file main.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
conn- memif connection handle
rx_mode- receive mode
qid- queue id
Returns
memif_err_t

Definition at line 577 of file main.c.

+ Here is the caller graph for this function:

char* memif_strerror ( int  err_code)

#include <extras/libmemif/src/libmemif.h>

Memif strerror.

Parameters
err_code- error code

Converts error code to error message.

Returns
Error string

Definition at line 157 of file main.c.

+ Here is the caller graph for this function:

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.

Parameters
conn- memif conenction handle
qid- number indentifying queue
bufs- memif buffers
count- number of memif buffers to transmit
tx- returns number of transmitted buffers
Returns
memif_err_t

Definition at line 1714 of file main.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function: