|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
19 #ifndef _MEMIF_PRIVATE_H_
20 #define _MEMIF_PRIVATE_H_
24 #include <sys/syscall.h>
28 #include <sys/timerfd.h>
34 #define MEMIF_NAME_LEN 32
36 "MEMIF_DEFAULT_APP_NAME max length is 32");
38 #define MEMIF_DEFAULT_SOCKET_PATH "/run/vpp/memif.sock"
39 #define MEMIF_DEFAULT_RING_SIZE 1024
40 #define MEMIF_DEFAULT_LOG2_RING_SIZE 10
41 #define MEMIF_DEFAULT_RX_QUEUES 1
42 #define MEMIF_DEFAULT_TX_QUEUES 1
43 #define MEMIF_DEFAULT_BUFFER_SIZE 2048
44 #define MEMIF_DEFAULT_RECONNECT_PERIOD_SEC 2
45 #define MEMIF_DEFAULT_RECONNECT_PERIOD_NSEC 0
47 #define MEMIF_MAX_M2S_RING 255
48 #define MEMIF_MAX_S2M_RING 255
49 #define MEMIF_MAX_REGION 255
50 #define MEMIF_MAX_LOG2_RING_SIZE 14
52 #define MEMIF_MAX_FDS 512
54 #define memif_min(a,b) (((a) < (b)) ? (a) : (b))
56 #define EXPECT_TRUE(x) __builtin_expect((x),1)
57 #define EXPECT_FALSE(x) __builtin_expect((x),0)
60 #define DBG(...) do { \
61 printf("MEMIF_DEBUG:%s:%s:%d: ", __FILE__, __func__, __LINE__); \
62 printf(__VA_ARGS__); \
78 if ((*dest++ = *s++) ==
'\0')
93 #include <bsd/string.h>
182 #define MEMIF_CONNECTION_FLAG_WRITE (1 << 0)
196 uint8_t filename[108];
262 #ifndef __NR_memfd_create
263 #if defined __x86_64__
264 #define __NR_memfd_create 319
265 #elif defined __arm__
266 #define __NR_memfd_create 385
267 #elif defined __aarch64__
268 #define __NR_memfd_create 279
270 #error "__NR_memfd_create unknown for this architecture"
274 #ifndef HAVE_MEMFD_CREATE
278 return syscall (__NR_memfd_create,
name,
flags);
290 #ifndef F_LINUX_SPECIFIC_BASE
291 #define F_LINUX_SPECIFIC_BASE 1024
294 #ifndef MFD_ALLOW_SEALING
295 #define MFD_ALLOW_SEALING 0x0002U
299 #define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
300 #define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
302 #define F_SEAL_SEAL 0x0001
303 #define F_SEAL_SHRINK 0x0002
304 #define F_SEAL_GROW 0x0004
305 #define F_SEAL_WRITE 0x0008
#define MEMIF_DEFAULT_APP_NAME
Default name of application using libmemif.
@ MEMIF_SOCKET_TYPE_LISTENER
memif_socket_handle_t default_socket
int memif_connect1(memif_connection_t *c)
int memif_disconnect_internal(memif_connection_t *c)
memif_add_external_region_t * add_external_region
memif_del_external_region_t * del_external_region
struct libmemif_main libmemif_main_t
uint16_t pending_list_len
void() memif_free_t(void *ptr)
Memif allocator free.
uint8_t app_name[MEMIF_NAME_LEN]
void *() memif_alloc_t(size_t size)
Memif allocator alloc.
uint32_t() memif_get_external_buffer_offset_t(void *private_ctx)
Get external buffer offset (optional)
memif_queue_t * tx_queues
Memif connection arguments.
int memif_syscall_error_handler(int err_code)
static void * memif_get_buffer(memif_connection_t *conn, memif_ring_t *ring, uint16_t index)
memif_get_external_buffer_offset_t * get_external_buffer_offset
memif_log2_ring_size_t log2_ring_size
libmemif_main_t * get_libmemif_main(memif_socket_t *ms)
memif_get_external_region_addr_t * get_external_region_addr
static size_t strlcpy(char *dest, const char *src, size_t len)
uint8_t remote_disconnect_string[96]
memif_region_index_t region
@ MEMIF_SOCKET_TYPE_CLIENT
memif_connection_update_t * on_connect
memif_realloc_t * realloc
int() memif_add_external_region_t(void **addr, uint32_t size, int *fd, void *private_ctx)
Add external region.
void * memif_socket_handle_t
Memif socket handle pointer of type void, pointing to internal structure.
struct memif_connection memif_connection_t
memif_list_elt_t * interface_list
memif_list_elt_t * pending_list
memif_list_elt_t * socket_list
int() memif_connection_update_t(memif_conn_handle_t conn, void *private_ctx)
Memif connection status update (callback function)
int get_list_elt(memif_list_elt_t **e, memif_list_elt_t *list, uint16_t len, int key)
void *() memif_realloc_t(void *ptr, size_t size)
Memif realloc.
memif_interrupt_t * on_interrupt
struct memif_msg_queue_elt memif_msg_queue_elt_t
struct libmemif_main * lm
int add_list_elt(libmemif_main_t *lm, memif_list_elt_t *e, memif_list_elt_t **list, uint16_t *len)
int() memif_del_external_region_t(void *addr, uint32_t size, int fd, void *private_ctx)
Delete external region.
memif_control_fd_update_t * control_fd_update
memif_conn_run_args_t run_args
libmemif_main_t libmemif_main
uint8_t remote_name[MEMIF_NAME_LEN]
struct itimerspec arm disarm
uint16_t control_list_len
uint8_t memif_log2_ring_size_t
struct memif_msg_queue_elt * next
int() memif_control_fd_update_t(int fd, uint8_t events, void *private_ctx)
Memif control file descriptor update (callback function)
uint16_t interface_list_len
void *() memif_get_external_region_addr_t(uint32_t size, int fd, void *private_ctx)
Get external region address.
int() memif_fn(memif_connection_t *conn)
int() memif_interrupt_t(memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
Memif interrupt occurred (callback function)
memif_list_elt_t * interrupt_list
memif_queue_t * rx_queues
memif_msg_queue_elt_t * msg_queue
uint16_t interrupt_list_len
memif_connection_update_t * on_disconnect
static int memfd_create(const char *name, unsigned int flags)
memif_region_offset_t offset
int memif_init_regions_and_queues(memif_connection_t *c)
memif_list_elt_t * control_list
uint8_t remote_if_name[MEMIF_NAME_LEN]
int free_list_elt(memif_list_elt_t *list, uint16_t len, int key)
vl_api_wireguard_peer_flags_t flags