typedef struct
{
u8 *filename;
+ u32 socket_id;
clib_socket_t *sock;
clib_socket_t **pending_clients;
int ref_cnt;
void *shm;
memif_region_size_t region_size;
int fd;
+ u8 is_external;
} memif_region_t;
typedef struct
u16 last_head;
u16 last_tail;
+ u32 *buffers;
/* interrupts */
int int_fd;
uword int_clib_file_index;
u64 int_count;
+
+ /* queue type */
+ memif_ring_type_t type;
} memif_queue_t;
#define foreach_memif_if_flag \
_(1, IS_SLAVE, "slave") \
_(2, CONNECTING, "connecting") \
_(3, CONNECTED, "connected") \
- _(4, DELETING, "deleting")
+ _(4, DELETING, "deleting") \
+ _(5, ZERO_COPY, "zero-copy") \
+ _(6, ERROR, "error")
typedef enum
{
u8 *remote_disc_string;
} memif_if_t;
+typedef struct
+{
+ u32 packet_len;
+ u16 first_buffer_vec_index;
+} memif_packet_op_t;
+
+typedef struct
+{
+ void *data;
+ u32 data_len;
+ i16 buffer_offset;
+ u16 buffer_vec_index;
+} memif_copy_op_t;
+
+#define MEMIF_RX_VECTOR_SZ VLIB_FRAME_SIZE
+
+typedef struct
+{
+ CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
+
+ /* copy vector */
+ memif_packet_op_t packet_ops[MEMIF_RX_VECTOR_SZ];
+ memif_copy_op_t *copy_ops;
+ u32 *buffers;
+
+ /* buffer template */
+ vlib_buffer_t buffer_template;
+ memif_desc_t desc_template;
+} memif_per_thread_data_t;
+
typedef struct
{
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
/* pool of all unix socket files */
memif_socket_file_t *socket_files;
- mhash_t socket_file_index_by_filename;
+ uword *socket_file_index_by_sock_id; /* map user socket id to pool idx */
- /* rx buffer cache */
- u32 **rx_buffers;
+ /* per thread data */
+ memif_per_thread_data_t *per_thread_data;
} memif_main_t;
typedef struct
{
memif_interface_id_t id;
- u8 *socket_filename;
+ u32 socket_id;
u8 *secret;
u8 is_master;
+ u8 is_zero_copy;
memif_interface_mode_t mode:8;
memif_log2_ring_size_t log2_ring_size;
u16 buffer_size;
u32 sw_if_index;
} memif_create_if_args_t;
+int memif_socket_filename_add_del (u8 is_add, u32 sock_id,
+ u8 * sock_filename);
int memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args);
int memif_delete_if (vlib_main_t * vm, memif_if_t * mif);
clib_error_t *memif_plugin_api_hookup (vlib_main_t * vm);