/* Only suspend for the admin_down_process */
vlib_process_t *proc = vlib_get_current_process (vm);
if (!(proc->flags & VLIB_PROCESS_IS_RUNNING) ||
- (proc->node_runtime.function != admin_up_down_process))
+ (proc->node_runtime.node_index !=
+ admin_up_down_process_node.index))
return 0;
f64 delay = 1e-6 * us;
static clib_error_t * dpdk_main_init (vlib_main_t * vm)
{
- dpdk_main_t * dm = &dpdk_main;
clib_error_t * error = 0;
- dm->vlib_main = vm;
- dm->vnet_main = vnet_get_main ();
-
- if ((error = vlib_call_init_function (vm, dpdk_init)))
- return error;
-
/* register custom delay function */
rte_delay_us_callback_register (rte_delay_us_override_cb);
return error;
}
-VLIB_INIT_FUNCTION (dpdk_main_init);
-
-
-clib_error_t *
-dpdk_early_init (vlib_main_t *vm)
+/* *INDENT-OFF* */
+VLIB_INIT_FUNCTION (dpdk_main_init) =
{
- int fd = -1;
- u64 *pt = 0;
- clib_error_t *err = 0;
-
- /* check if pagemap is accessible - if we get zero result
- dpdk will not be able to get physical memory address and game is over
- unless we have IOMMU */
- pt = clib_mem_vm_get_paddr (&pt, min_log2 (sysconf (_SC_PAGESIZE)), 1);
- if (pt && pt[0])
- goto done;
-
- if ((fd = open ("/dev/vfio/vfio", O_RDWR) == -1))
- goto error;
-
- if (ioctl (fd, VFIO_GET_API_VERSION) != VFIO_API_VERSION)
- goto error;
-
- /* if we have type 1 IOMMU page map is not needed */
- if (ioctl (fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) == 1)
- goto done;
-
-error:
- err = clib_error_return (0, "access to physical devices is not allowed");
-
-done:
- if (fd != -1)
- close (fd);
- vec_free (pt);
- return err;
-}
+ .runs_after = VLIB_INITS("dpdk_init"),
+};
-/* *INDENT-OFF* */
VLIB_PLUGIN_REGISTER () = {
.version = VPP_BUILD_VER,
.description = "Data Plane Development Kit (DPDK)",
- .early_init = "dpdk_early_init",
};
/* *INDENT-ON* */