21 #include <sys/ioctl.h> 30 #define foreach_memif_tx_func_error \ 31 _(NO_FREE_SLOTS, "no free tx slots") \ 32 _(PENDING_MSGS, "pending msgs in tx ring") 36 #define _(f,s) MEMIF_TX_ERROR_##f, 54 s =
format (s,
"memif%u", i);
61 u32 dev_instance = va_arg (*args,
u32);
62 int verbose = va_arg (*args,
int);
65 s =
format (s,
"MEMIF interface");
77 s =
format (s,
"Unimplemented...");
86 while (__sync_lock_test_and_set (mif->
lockp, 1))
116 u16 mask = ring_size - 1;
128 free_slots = tail - head;
130 free_slots = ring_size - head + tail;
132 while (n_left > 5 && free_slots > 1)
164 head = (head + 1) & mask;
169 head = (head + 1) & mask;
190 while (n_left && free_slots)
203 head = (head + 1) & mask;
255 if (node_index == ~0)
291 if (send (mif->
connection.
fd, &msg, sizeof (msg), 0) < 0)
void memif_disconnect(vlib_main_t *vm, memif_if_t *mif)
static_always_inline void memif_interface_unlock(memif_if_t *mif)
sll srl srl sll sra u16x4 i
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
u8 runtime_data[0]
Function dependent node-runtime data.
static uword memif_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static_always_inline void * memif_get_buffer(memif_if_t *mif, memif_ring_t *ring, u16 slot)
#define CLIB_MEMORY_STORE_BARRIER()
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
vlib_node_registration_t memif_input_node
(constructor) VLIB_REGISTER_NODE (memif_input_node)
static void memif_set_interface_next_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
#define MEMIF_MSG_TYPE_DISCONNECT
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define MEMIF_IF_FLAG_IS_SLAVE
VNET_DEVICE_CLASS(af_packet_device_class)
#define static_always_inline
static_always_inline void memif_interface_lock(memif_if_t *mif)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
memif_file_t interrupt_line
u32 per_interface_next_index
static clib_error_t * memif_subif_add_del_function(vnet_main_t *vnm, u32 hw_if_index, struct vnet_sw_interface_t *st, int is_add)
static void memif_clear_hw_interface_counters(u32 instance)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static char * memif_tx_func_error_strings[]
u16 current_length
Nbytes between current data and the end of this buffer.
#define clib_error_return_unix(e, args...)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u32 node_index
Node index.
static u8 * format_memif_tx_trace(u8 *s, va_list *args)
#define foreach_memif_tx_func_error
static_always_inline uword memif_interface_tx_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, memif_if_t *mif, memif_ring_type_t type)
#define CLIB_PREFETCH(addr, size, type)
#define MEMIF_IF_FLAG_ADMIN_UP
static_always_inline void memif_prefetch_buffer_and_data(vlib_main_t *vm, u32 bi)
#define clib_memcpy(a, b, c)
static clib_error_t * memif_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
static u8 * format_memif_device_name(u8 *s, va_list *args)
static void * vlib_frame_args(vlib_frame_t *f)
Get pointer to frame scalar data.
static vlib_main_t * vlib_get_main(void)
vnet_device_class_t memif_device_class
#define MEMIF_IF_FLAG_DELETING
#define clib_unix_warning(format, args...)
static_always_inline memif_ring_t * memif_get_ring(memif_if_t *mif, memif_ring_type_t type, u16 ring_num)
static u8 * format_memif_device(u8 *s, va_list *args)
#define CLIB_CACHE_LINE_BYTES
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn)