FD.io VPP  v17.10-9-gd594711
Vector Packet Processing
Api calls

Functions

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 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_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_buffer_free (memif_conn_handle_t conn, uint16_t qid, memif_buffer_t *bufs, uint16_t count, uint16_t *count_out)
 Memif buffer free. 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...
 

Detailed Description

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- minimal buffer size, 0 = standard buffer size
Returns
memif_err_t

Definition at line 1341 of file main.c.

+ Here is the caller graph for this function:

int memif_buffer_free ( 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 free.

Parameters
conn- memif conenction handle
qid- number indentifying queue
bufs- memif buffers
count- number of memif buffers to free
count_out- returns number of freed buffers
Returns
memif_err_t

Definition at line 1478 of file main.c.

+ Here is the caller graph for this function:

int memif_cleanup ( )

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

Memif cleanup.

Free libmemif internal allocations.

Returns
0

Definition at line 2075 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 770 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 526 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 1072 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 1932 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 2055 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 
)

#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

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 400 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 920 of file main.c.

+ Here is the call graph for this function:

+ 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 1768 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 508 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 148 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 1547 of file main.c.

+ Here is the caller graph for this function: