|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
20 #include <sys/ioctl.h>
21 #include <sys/types.h>
23 #include <vnet/devices/netmap/net_netmap.h>
28 #include <vnet/devices/netmap/netmap.h>
47 nm->pending_input_bitmap =
64 else if (nif->
fd > -1)
95 VLIB_NODE_STATE_POLLING);
108 VLIB_NODE_STATE_INTERRUPT);
126 struct nmreq *req = 0;
131 p =
mhash_get (&
nm->if_index_by_host_if_name, if_name);
133 return VNET_API_ERROR_SUBIF_ALREADY_EXISTS;
135 fd = open (
"/dev/netmap", O_RDWR);
137 return VNET_API_ERROR_SUBIF_ALREADY_EXISTS;
155 snprintf (req->
nr_name, IFNAMSIZ,
"%s", if_name);
156 req->
nr_name[IFNAMSIZ - 1] = 0;
160 ret = VNET_API_ERROR_NOT_CONNECTED;
169 reg->
mem = mmap (NULL, req->
nr_memsize, PROT_READ | PROT_WRITE,
172 if (reg->
mem == MAP_FAILED)
174 ret = VNET_API_ERROR_NOT_CONNECTED;
195 template.file_descriptor = nif->
fd;
196 template.private_data = nif->
if_index;
197 template.description =
format (0,
"netmap socket");
203 memcpy (hw_addr, hw_addr_set, 6);
211 memcpy (hw_addr + 2, &rnd,
sizeof (rnd));
224 ret = VNET_API_ERROR_SYSCALL_ERROR_1;
255 p =
mhash_get (&
nm->if_index_by_host_if_name, host_if_name);
258 clib_warning (
"Host interface %s does not exist", host_if_name);
259 return VNET_API_ERROR_SYSCALL_ERROR_1;
286 nm->input_cpu_first_index = 0;
287 nm->input_cpu_count = 1;
293 if (tr && tr->
count > 0)
296 nm->input_cpu_count = tr->
count;
static void clib_spinlock_init(clib_spinlock_t *p)
static clib_error_t * netmap_init(vlib_main_t *vm)
clib_file_main_t file_main
netmap_main_t netmap_main
int netmap_worker_thread_disable()
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
nat44_ei_interface_t * interfaces
clib_file_function_t * read_function
static void close_netmap_if(netmap_main_t *nm, netmap_if_t *nif)
#define pool_put(P, E)
Free an object E in pool P.
static uword * mhash_get(mhash_t *h, const void *key)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
#define clib_error_report(e)
int netmap_worker_thread_enable()
static clib_error_t * netmap_fd_read_ready(clib_file_t *uf)
static u32 random_u32(u32 *seed)
32-bit random number generator
#define foreach_vlib_main()
int netmap_create_if(vlib_main_t *vm, u8 *if_name, u8 *hw_addr_set, u8 is_pipe, u8 is_master, u32 *sw_if_index)
vnet_main_t * vnet_get_main(void)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static void mhash_init_vec_string(mhash_t *h, uword n_value_bytes)
static u32 netmap_eth_flag_change(vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 flags)
uword * thread_registrations_by_name
#define NR_ACCEPT_VNET_HDR
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
#define CLIB_CACHE_LINE_BYTES
int netmap_delete_if(vlib_main_t *vm, u8 *host_if_name)
#define vec_free(V)
Free vector's memory (no header).
#define hash_get_mem(h, key)
description fragment has unexpected format
static void clib_file_del(clib_file_main_t *um, clib_file_t *f)
u32 per_interface_next_index
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define VLIB_INIT_FUNCTION(x)
void ethernet_delete_interface(vnet_main_t *vnm, u32 hw_if_index)
static void vlib_node_set_interrupt_pending(vlib_main_t *vm, u32 node_index)
static uword pool_elts(void *v)
Number of active elements in a pool.
static uword clib_file_add(clib_file_main_t *um, clib_file_t *template)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vnet_device_class_t netmap_device_class
static vlib_main_t * vlib_get_main(void)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define clib_warning(format, args...)
static f64 vlib_time_now(vlib_main_t *vm)
static vlib_thread_main_t * vlib_get_thread_main()
vl_api_interface_index_t sw_if_index
vlib_node_registration_t netmap_input_node
(constructor) VLIB_REGISTER_NODE (netmap_input_node)
__clib_export uword mhash_set_mem(mhash_t *h, void *key, uword *new_value, uword *old_value)
__clib_export uword mhash_unset(mhash_t *h, void *key, uword *old_value)
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, const u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
vl_api_wireguard_peer_flags_t flags