21 #include <sys/ioctl.h> 31 #define foreach_memif_tx_func_error \ 32 _(NO_FREE_SLOTS, "no free tx slots") \ 33 _(TRUNC_PACKET, "packet > buffer size -- truncated in tx ring") \ 34 _(PENDING_MSGS, "pending msgs in tx ring") 38 #define _(f,s) MEMIF_TX_ERROR_##f, 50 #ifndef CLIB_MULTIARCH_VARIANT 54 u32 dev_instance = va_arg (*args,
u32);
63 static __clib_unused
u8 *
66 u32 dev_instance = va_arg (*args,
u32);
67 int verbose = va_arg (*args,
int);
70 s =
format (s,
"MEMIF interface");
79 static __clib_unused
u8 *
82 s =
format (s,
"Unimplemented...");
113 u16 slot = (*head) & mask;
129 slot = (*head) & mask;
179 qid = thread_index % tx_queues;
188 mask = ring_size - 1;
196 free_slots = ring_size - head + tail;
198 while (n_left > 5 && free_slots > 1)
221 while (n_left && free_slots)
233 if (n_left && n_retries--)
265 if (mif->flags & MEMIF_IF_FLAG_IS_SLAVE)
271 static __clib_unused
void 280 if (node_index == ~0)
290 static __clib_unused
void 322 mif->
flags |= MEMIF_IF_FLAG_ADMIN_UP;
324 mif->
flags &= ~MEMIF_IF_FLAG_ADMIN_UP;
338 #ifndef CLIB_MULTIARCH_VARIANT 358 static void __clib_constructor
uword( vlib_node_function_t)(struct vlib_main_t *vm, struct vlib_node_runtime_t *node, struct vlib_frame_t *frame)
static_always_inline void memif_copy_buffer_to_tx_ring(vlib_main_t *vm, vlib_node_runtime_t *node, memif_if_t *mif, u32 bi, memif_ring_t *ring, u16 *head, u16 mask)
Copy buffer to tx ring.
static __clib_unused u8 * format_memif_device(u8 *s, va_list *args)
static __clib_unused void memif_set_interface_next_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
#define CLIB_MEMORY_STORE_BARRIER()
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
static __clib_unused clib_error_t * memif_interface_rx_mode_change(vnet_main_t *vnm, u32 hw_if_index, u32 qid, vnet_hw_interface_rx_mode mode)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vlib_node_function_t __clib_weak memif_interface_tx_avx512
vlib_main_t ** vlib_mains
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
static __clib_unused u8 * format_memif_tx_trace(u8 *s, va_list *args)
VNET_DEVICE_CLASS(af_packet_device_class)
uword CLIB_MULTIARCH_FN() memif_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void __clib_constructor dpdk_interface_tx_multiarch_select(void)
vnet_hw_interface_rx_mode
#define VLIB_BUFFER_NEXT_PRESENT
#define static_always_inline
static __clib_unused void memif_clear_hw_interface_counters(u32 instance)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vnet_device_class_t memif_device_class
u32 per_interface_next_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_node_registration_t memif_input_node
(constructor) VLIB_REGISTER_NODE (memif_input_node)
u16 current_length
Nbytes between current data and the end of this buffer.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u32 node_index
Node index.
#define foreach_memif_tx_func_error
memif_queue_t * tx_queues
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)
static_always_inline uword vlib_get_thread_index(void)
#define CLIB_PREFETCH(addr, size, type)
static __clib_unused 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_always_inline void memif_prefetch_buffer_and_data(vlib_main_t *vm, u32 bi)
#define clib_memcpy(a, b, c)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define MEMIF_DESC_FLAG_NEXT
static_always_inline void * memif_get_buffer(memif_if_t *mif, memif_ring_t *ring, u16 slot)
u32 next_buffer
Next buffer for this linked-list of buffers.
static void * vlib_frame_args(vlib_frame_t *f)
Get pointer to frame scalar data.
#define MEMIF_RING_FLAG_MASK_INT
static __clib_unused clib_error_t * memif_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
static vlib_main_t * vlib_get_main(void)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
memif_log2_ring_size_t log2_ring_size
static __clib_unused char * memif_tx_func_error_strings[]
vlib_node_function_t __clib_weak memif_interface_tx_avx2
memif_queue_t * rx_queues
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
u8 * format_memif_device_name(u8 *s, va_list *args)
#define CLIB_MULTIARCH_FN(fn)