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, 55 s =
format (s,
"memif%u", i);
62 u32 dev_instance = va_arg (*args,
u32);
63 int verbose = va_arg (*args,
int);
66 s =
format (s,
"MEMIF interface");
78 s =
format (s,
"Unimplemented...");
123 *head = (*head + 1) & mask;
150 *head = (*head + 1) & mask;
172 qid = thread_index % tx_queues;
182 mask = ring_size - 1;
190 free_slots = tail - head;
192 free_slots = ring_size - head + tail;
194 while (n_left > 5 && free_slots > 1)
230 while (n_left && free_slots)
269 if (mif->flags & MEMIF_IF_FLAG_IS_SLAVE)
284 if (node_index == ~0)
326 mif->
flags |= MEMIF_IF_FLAG_ADMIN_UP;
328 mif->
flags &= ~MEMIF_IF_FLAG_ADMIN_UP;
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.
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)
#define CLIB_MEMORY_STORE_BARRIER()
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
static void memif_set_interface_next_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define MEMIF_RING_FLAG_MASK_INT
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
VNET_DEVICE_CLASS(af_packet_device_class)
#define MEMIF_DESC_FLAG_NEXT
vnet_hw_interface_rx_mode
#define VLIB_BUFFER_NEXT_PRESENT
#define static_always_inline
#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
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.
vlib_node_registration_t memif_input_node
(constructor) VLIB_REGISTER_NODE (memif_input_node)
static char * memif_tx_func_error_strings[]
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.
static u8 * format_memif_tx_trace(u8 *s, va_list *args)
#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_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)
static clib_error_t * memif_interface_rx_mode_change(vnet_main_t *vnm, u32 hw_if_index, u32 qid, vnet_hw_interface_rx_mode mode)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
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.
static vlib_main_t * vlib_get_main(void)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t ** vlib_mains
memif_log2_ring_size_t log2_ring_size
static u8 * format_memif_device(u8 *s, va_list *args)
memif_queue_t * rx_queues
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: 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.
#define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn)
u8 * format_memif_device_name(u8 *s, va_list *args)