20 #include <sys/ioctl.h> 29 #define foreach_netmap_tx_func_error \ 30 _(NO_FREE_SLOTS, "no free tx slots") \ 31 _(PENDING_MSGS, "pending msgs in tx ring") 35 #define _(f,s) NETMAP_TX_ERROR_##f, 62 u32 dev_instance = va_arg (*args,
u32);
63 int verbose = va_arg (*args,
int);
68 s =
format (s,
"NETMAP interface");
71 s =
format (s,
"\n%U version %d flags 0x%x" 72 "\n%U region %u memsize 0x%x offset 0x%x" 73 "\n%U tx_slots %u rx_slots %u tx_rings %u rx_rings %u",
92 s =
format (s,
"Unimplemented...");
103 f64 const time_constant = 1e3;
110 cur_ring = nif->first_tx_ring;
112 while (n_left && cur_ring <= nif->last_tx_ring)
114 struct netmap_ring *ring = NETMAP_TXRING (nif->nifp, cur_ring);
115 int n_free_slots = nm_ring_space (ring);
118 if (nm_tx_pending (ring))
124 if (nm_tx_pending (ring) && !n_free_slots)
131 while (n_left && n_free_slots)
161 if (n_left < frame->n_vectors)
169 frame->
n_vectors ? NETMAP_TX_ERROR_PENDING_MSGS :
170 NETMAP_TX_ERROR_NO_FREE_SLOTS), n_left);
185 if (node_index == ~0)
struct netmap_slot slot[0]
sll srl srl sll sra u16x4 i
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
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 void clib_cpu_time_wait(u64 dt)
static u8 * format_netmap_device_name(u8 *s, va_list *args)
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 vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static u8 * format_netmap_tx_trace(u8 *s, va_list *args)
#define VNET_HW_INTERFACE_FLAG_LINK_UP
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
VNET_DEVICE_CLASS(af_packet_device_class)
static void netmap_set_interface_next_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
static clib_error_t * netmap_subif_add_del_function(vnet_main_t *vnm, u32 hw_if_index, struct vnet_sw_interface_t *st, int is_add)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u32 per_interface_next_index
static uword netmap_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u16 current_length
Nbytes between current data and the end of this buffer.
static u8 * format_netmap_device(u8 *s, va_list *args)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u32 node_index
Node index.
#define foreach_netmap_tx_func_error
#define clib_memcpy(a, b, c)
static char * netmap_tx_func_error_strings[]
static clib_error_t * netmap_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
netmap_main_t netmap_main
vlib_node_registration_t netmap_input_node
(constructor) VLIB_REGISTER_NODE (netmap_input_node)
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)
template key/value backing page structure
vnet_device_class_t netmap_device_class
#define clib_unix_warning(format, args...)
struct clib_bihash_value offset
template key/value backing page structure
static void netmap_clear_hw_interface_counters(u32 instance)
#define CLIB_MEMORY_BARRIER()
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)