X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fdpdk%2Fmain.c;h=d22b671e008ebea1c0d28120af93b85ed2623782;hb=040950a59d53e8802ad31430d67df105939cce4c;hp=5437e2fafdcf496707b9a1c5b34d828209c65889;hpb=72d2c4f3718ba5293e9e0fa8726406ee7d9f3940;p=vpp.git diff --git a/src/plugins/dpdk/main.c b/src/plugins/dpdk/main.c index 5437e2fafdc..d22b671e008 100644 --- a/src/plugins/dpdk/main.c +++ b/src/plugins/dpdk/main.c @@ -58,7 +58,8 @@ rte_delay_us_override (unsigned us) /* 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; @@ -102,23 +103,39 @@ dpdk_early_init (vlib_main_t *vm) int fd = -1; u64 *pt = 0; clib_error_t *err = 0; + clib_mem_vm_alloc_t alloc = { 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; + goto check_hugetlb; - if ((fd = open ("/dev/vfio/vfio", O_RDWR) == -1)) + 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; + if (ioctl (fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) != 1) + goto error; + +check_hugetlb: + alloc.flags = CLIB_MEM_VM_F_SHARED | CLIB_MEM_VM_F_HUGETLB | CLIB_MEM_VM_F_HUGETLB_PREALLOC; + alloc.size = 1; + alloc.name = "dpdk_early_init"; + + if ((err = clib_mem_vm_ext_alloc (&alloc))) + { + clib_error_free (err); + goto error; + } + else + clib_mem_vm_ext_free (&alloc); + + goto done; error: err = clib_error_return (0, "access to physical devices is not allowed");