19 #ifndef _MEMIF_PRIVATE_H_ 20 #define _MEMIF_PRIVATE_H_ 24 #include <sys/syscall.h> 28 #include <sys/timerfd.h> 32 #define MEMIF_DEFAULT_SOCKET_DIR "/run/vpp" 33 #define MEMIF_DEFAULT_SOCKET_FILENAME "memif.sock" 34 #define MEMIF_DEFAULT_RING_SIZE 1024 35 #define MEMIF_DEFAULT_LOG2_RING_SIZE 10 36 #define MEMIF_DEFAULT_RX_QUEUES 1 37 #define MEMIF_DEFAULT_TX_QUEUES 1 38 #define MEMIF_DEFAULT_BUFFER_SIZE 2048 40 #define MEMIF_MAX_M2S_RING 255 41 #define MEMIF_MAX_S2M_RING 255 42 #define MEMIF_MAX_REGION 255 43 #define MEMIF_MAX_LOG2_RING_SIZE 14 45 #define MEMIF_MAX_FDS 512 47 #define memif_min(a,b) (((a) < (b)) ? (a) : (b)) 50 #define DBG(...) do { \ 51 printf("MEMIF_DEBUG:%s:%s:%d: ", __FILE__, __func__, __LINE__); \ 52 printf(__VA_ARGS__); \ 56 #define DBG_UNIX(...) do { \ 57 printf("MEMIF_DEBUG_UNIX:%s:%s:%d: ", __FILE__, __func__, __LINE__); \ 58 printf(__VA_ARGS__); \ 62 #define error_return_unix(...) do { \ 63 DBG_UNIX(__VA_ARGS__); \ 66 #define error_return(...) do { \ 73 #define error_return_unix(...) do { \ 76 #define error_return(...) do { \ 145 uint8_t remote_if_name[32];
146 uint8_t remote_name[32];
147 uint8_t remote_disconnect_string[96];
155 #define MEMIF_CONNECTION_FLAG_WRITE (1 << 0) 187 struct itimerspec arm, disarm;
224 uint16_t len,
int key);
228 #ifndef __NR_memfd_create 229 #if defined __x86_64__ 230 #define __NR_memfd_create 319 231 #elif defined __arm__ 232 #define __NR_memfd_create 385 233 #elif defined __aarch64__ 234 #define __NR_memfd_create 279 236 #error "__NR_memfd_create unknown for this architecture" 243 return syscall (__NR_memfd_create, name, flags);
250 return (conn->regions[ring->
desc[index].
region].shm +
254 #ifndef F_LINUX_SPECIFIC_BASE 255 #define F_LINUX_SPECIFIC_BASE 1024 257 #define MFD_ALLOW_SEALING 0x0002U 258 #define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9) 259 #define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10) 261 #define F_SEAL_SEAL 0x0001 262 #define F_SEAL_SHRINK 0x0002 263 #define F_SEAL_GROW 0x0004 264 #define F_SEAL_WRITE 0x0008
int memif_init_regions_and_queues(memif_connection_t *c)
memif_queue_t * rx_queues
int( memif_fn)(memif_connection_t *conn)
memif_list_elt_t * pending_list
int get_list_elt(memif_list_elt_t **e, memif_list_elt_t *list, uint16_t len, int key)
int( memif_control_fd_update_t)(int fd, uint8_t events)
Memif control file descriptor update (callback function)
memif_control_fd_update_t * control_fd_update
memif_list_elt_t * interface_list
int on_connect(memif_conn_handle_t conn, void *private_ctx)
memif_connection_update_t * on_disconnect
libmemif_main_t libmemif_main
memif_list_elt_t * listener_list
int free_list_elt(memif_list_elt_t *list, uint16_t len, int key)
int add_list_elt(memif_list_elt_t *e, memif_list_elt_t **list, uint16_t *len)
memif_list_elt_t * interrupt_list
memif_region_index_t region
struct memif_msg_queue_elt memif_msg_queue_elt_t
int( memif_interrupt_t)(memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
Memif interrupt occured (callback function)
struct memif_connection memif_connection_t
uint8_t memif_log2_ring_size_t
int( memif_connection_update_t)(memif_conn_handle_t conn, void *private_ctx)
Memif connection status update (callback function)
int memif_connect1(memif_connection_t *c)
memif_queue_t * tx_queues
struct memif_msg_queue_elt * next
int memif_disconnect_internal(memif_connection_t *c)
int memif_syscall_error_handler(int err_code)
memif_msg_queue_elt_t * msg_queue
static int memfd_create(const char *name, unsigned int flags)
static void * memif_get_buffer(memif_connection_t *conn, memif_ring_t *ring, uint16_t index)
uint16_t interrupt_list_len
memif_conn_run_args_t run_args
memif_region_offset_t offset
memif_interrupt_t * on_interrupt
uint16_t pending_list_len
memif_list_elt_t * control_list
memif_log2_ring_size_t log2_ring_size
uint16_t control_list_len
uint16_t listener_list_len
Memif connection arguments.
uint16_t interface_list_len