#include <vnet/ethernet/ethernet.h>
#include <vnet/devices/netmap/netmap.h>
+netmap_main_t netmap_main;
+
static u32
netmap_eth_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi,
u32 flags)
}
static clib_error_t *
-netmap_fd_read_ready (unix_file_t * uf)
+netmap_fd_read_ready (clib_file_t * uf)
{
vlib_main_t *vm = vlib_get_main ();
netmap_main_t *nm = &netmap_main;
static void
close_netmap_if (netmap_main_t * nm, netmap_if_t * nif)
{
- if (nif->unix_file_index != ~0)
+ if (nif->clib_file_index != ~0)
{
- unix_file_del (&unix_main, unix_main.file_pool + nif->unix_file_index);
- nif->unix_file_index = ~0;
+ clib_file_del (&file_main, file_main.file_pool + nif->clib_file_index);
+ nif->clib_file_index = ~0;
}
else if (nif->fd > -1)
close (nif->fd);
vec_free (nif->host_if_name);
vec_free (nif->req);
- memset (nif, 0, sizeof (*nif));
+ clib_memset (nif, 0, sizeof (*nif));
pool_put (nm->interfaces, nif);
}
pool_get (nm->interfaces, nif);
nif->if_index = nif - nm->interfaces;
nif->fd = fd;
- nif->unix_file_index = ~0;
+ nif->clib_file_index = ~0;
vec_validate (req, 0);
nif->req = req;
nif->per_interface_next_index = ~0;
if (tm->n_vlib_mains > 1)
- {
- nif->lockp = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES,
- CLIB_CACHE_LINE_BYTES);
- memset ((void *) nif->lockp, 0, CLIB_CACHE_LINE_BYTES);
- }
+ clib_spinlock_init (&nif->lockp);
{
- unix_file_t template = { 0 };
+ clib_file_t template = { 0 };
template.read_function = netmap_fd_read_ready;
template.file_descriptor = nif->fd;
template.private_data = nif->if_index;
- nif->unix_file_index = unix_file_add (&unix_main, &template);
+ nif->clib_file_index = clib_file_add (&file_main, &template);
}
/*use configured or generate random MAC address */
vlib_thread_registration_t *tr;
uword *p;
- memset (nm, 0, sizeof (netmap_main_t));
+ clib_memset (nm, 0, sizeof (netmap_main_t));
nm->input_cpu_first_index = 0;
nm->input_cpu_count = 1;