21 #define MEMIF_DEFAULT_SOCKET_FILENAME "memif.sock" 22 #define MEMIF_DEFAULT_RING_SIZE 1024 23 #define MEMIF_DEFAULT_RX_QUEUES 1 24 #define MEMIF_DEFAULT_TX_QUEUES 1 25 #define MEMIF_DEFAULT_BUFFER_SIZE 2048 27 #define MEMIF_MAX_M2S_RING (vec_len (vlib_mains)) 28 #define MEMIF_MAX_S2M_RING 256 29 #define MEMIF_MAX_REGION 256 30 #define MEMIF_MAX_LOG2_RING_SIZE 14 33 #define memif_log_debug(dev, f, ...) do { \ 34 memif_if_t *_dev = (memif_if_t *) dev; \ 36 vlib_log(VLIB_LOG_LEVEL_DEBUG, memif_main.log_class, "%U: " f, \ 37 format_vnet_hw_if_index_name, vnet_get_main(), \ 38 _dev->hw_if_index, ##__VA_ARGS__); \ 40 vlib_log(VLIB_LOG_LEVEL_DEBUG, memif_main.log_class, f, \ 44 #define memif_log_warn(dev, f, ...) do { \ 45 memif_if_t *_dev = (memif_if_t *) dev; \ 47 vlib_log(VLIB_LOG_LEVEL_WARNING, memif_main.log_class, "%U: " f, \ 48 format_vnet_hw_if_index_name, vnet_get_main(), \ 49 _dev->hw_if_index, ##__VA_ARGS__); \ 51 vlib_log(VLIB_LOG_LEVEL_WARNING, memif_main.log_class, f, \ 55 #define memif_log_err(dev, f, ...) do { \ 56 memif_if_t *_dev = (memif_if_t *) dev; \ 58 vlib_log(VLIB_LOG_LEVEL_ERR, memif_main.log_class, "%U: " f, \ 59 format_vnet_hw_if_index_name, vnet_get_main(), \ 60 _dev->hw_if_index, ##__VA_ARGS__); \ 62 vlib_log(VLIB_LOG_LEVEL_ERR, memif_main.log_class, f, \ 66 #define memif_file_add(a, b) do { \ 67 *a = clib_file_add (&file_main, b); \ 68 memif_log_warn (0, "clib_file_add fd %d private_data %u idx %u", \ 69 (b)->file_descriptor, (b)->private_data, *a); \ 72 #define memif_file_del(a) do { \ 73 memif_log_warn (0, "clib_file_del idx %u", a - file_main.file_pool); \ 74 clib_file_del (&file_main, a); \ 77 #define memif_file_del_by_index(a) do { \ 78 memif_log_warn (0, "clib_file_del idx %u", a); \ 79 clib_file_del_by_index (&file_main, a); \ 137 #define foreach_memif_if_flag \ 138 _(0, ADMIN_UP, "admin-up") \ 139 _(1, IS_SLAVE, "slave") \ 140 _(2, CONNECTING, "connecting") \ 141 _(3, CONNECTED, "connected") \ 142 _(4, DELETING, "deleting") \ 143 _(5, ZERO_COPY, "zero-copy") \ 148 #define _(a, b, c) MEMIF_IF_FLAG_##b = (1 << a), 217 #define MEMIF_RX_VECTOR_SZ VLIB_FRAME_SIZE
vlib_log_class_t log_class
u8 pad[3]
log2 (size of the packing page block)
vlib_node_registration_t memif_input_node
(constructor) VLIB_REGISTER_NODE (memif_input_node)
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
clib_socket_t ** pending_clients
u8 * format_memif_device_name(u8 *s, va_list *args)
memif_socket_file_t * socket_files
memif_log2_ring_size_t log2_ring_size
void memif_disconnect(memif_if_t *mif, clib_error_t *err)
uint16_t memif_region_index_t
clib_error_t * memif_msg_send_disconnect(memif_if_t *mif, clib_error_t *err)
memif_interface_mode_t mode
int memif_socket_filename_add_del(u8 is_add, u32 sock_id, u8 *sock_filename)
u16 first_buffer_vec_index
struct _vnet_device_class vnet_device_class_t
#define static_always_inline
clib_error_t * memif_master_conn_fd_read_ready(clib_file_t *uf)
memif_log2_ring_size_t log2_ring_size
vnet_device_class_t memif_device_class
u32 per_interface_next_index
memif_region_offset_t offset
u16 msg_id_base
API message ID base.
mhash_t dev_instance_by_id
clib_error_t * memif_master_conn_fd_error(clib_file_t *uf)
memif_region_index_t region
memif_copy_op_t * copy_ops
clib_error_t * memif_master_conn_fd_write_ready(clib_file_t *uf)
int memif_delete_if(vlib_main_t *vm, memif_if_t *mif)
uint32_t memif_region_offset_t
uint8_t memif_log2_ring_size_t
#define foreach_memif_if_flag
uword int_clib_file_index
memif_queue_t * tx_queues
int memif_create_if(vlib_main_t *vm, memif_create_if_args_t *args)
clib_error_t * memif_connect(memif_if_t *mif)
uint32_t memif_interface_id_t
static_always_inline void * memif_get_buffer(memif_if_t *mif, memif_ring_t *ring, u16 slot)
vlib_buffer_t buffer_template
struct _socket_t clib_socket_t
clib_error_t * memif_slave_conn_fd_write_ready(clib_file_t *uf)
clib_error_t * memif_slave_conn_fd_error(clib_file_t *uf)
clib_error_t * memif_slave_conn_fd_read_ready(clib_file_t *uf)
memif_region_offset_t offset
uword * dev_instance_by_fd
struct _vlib_node_registration vlib_node_registration_t
#define CLIB_ALIGN_MARK(name, alignment)
uint64_t memif_region_size_t
#define MEMIF_RX_VECTOR_SZ
VLIB buffer representation.
void memif_socket_close(clib_socket_t **sock)
clib_error_t * memif_init_regions_and_queues(memif_if_t *mif)
memif_log2_ring_size_t log2_ring_size
clib_error_t * memif_plugin_api_hookup(vlib_main_t *vm)
memif_per_thread_data_t * per_thread_data
memif_queue_t * rx_queues
clib_error_t * memif_conn_fd_accept_ready(clib_file_t *uf)
memif_desc_t desc_template
uword * socket_file_index_by_sock_id
memif_msg_fifo_elt_t * msg_queue
memif_region_index_t region
memif_interface_mode_t mode
memif_region_size_t region_size