eal: remove size for setting runtime directory
[dpdk.git] / lib / eal / freebsd / eal.c
index 56a60f1..503e276 100644 (file)
@@ -123,7 +123,7 @@ eal_create_runtime_dir(void)
                return -1;
        }
 
-       if (eal_set_runtime_dir(run_dir, sizeof(run_dir)))
+       if (eal_set_runtime_dir(run_dir))
                return -1;
 
        return 0;
@@ -677,6 +677,8 @@ rte_eal_init(int argc, char **argv)
        const struct rte_config *config = rte_eal_get_configuration();
        struct internal_config *internal_conf =
                eal_get_internal_configuration();
+       bool has_phys_addr;
+       enum rte_iova_mode iova_mode;
 
        /* checks if the machine is adequate */
        if (!rte_cpu_is_supported()) {
@@ -777,19 +779,30 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
 
-       /* if no EAL option "--iova-mode=<pa|va>", use bus IOVA scheme */
-       if (internal_conf->iova_mode == RTE_IOVA_DC) {
-               /* autodetect the IOVA mapping mode (default is RTE_IOVA_PA) */
-               enum rte_iova_mode iova_mode = rte_bus_get_iommu_class();
-
-               if (iova_mode == RTE_IOVA_DC)
-                       iova_mode = RTE_IOVA_PA;
-               rte_eal_get_configuration()->iova_mode = iova_mode;
-       } else {
-               rte_eal_get_configuration()->iova_mode =
-                       internal_conf->iova_mode;
+       /*
+        * PA are only available for hugepages via contigmem.
+        * If contigmem is inaccessible, rte_eal_hugepage_init() will fail
+        * with a message describing the cause.
+        */
+       has_phys_addr = internal_conf->no_hugetlbfs == 0;
+       iova_mode = internal_conf->iova_mode;
+       if (iova_mode == RTE_IOVA_PA && !has_phys_addr) {
+               rte_eal_init_alert("Cannot use IOVA as 'PA' since physical addresses are not available");
+               rte_errno = EINVAL;
+               return -1;
        }
-
+       if (iova_mode == RTE_IOVA_DC) {
+               RTE_LOG(DEBUG, EAL, "Specific IOVA mode is not requested, autodetecting\n");
+               if (has_phys_addr) {
+                       RTE_LOG(DEBUG, EAL, "Selecting IOVA mode according to bus requests\n");
+                       iova_mode = rte_bus_get_iommu_class();
+                       if (iova_mode == RTE_IOVA_DC)
+                               iova_mode = RTE_IOVA_PA;
+               } else {
+                       iova_mode = RTE_IOVA_VA;
+               }
+       }
+       rte_eal_get_configuration()->iova_mode = iova_mode;
        RTE_LOG(INFO, EAL, "Selected IOVA mode '%s'\n",
                rte_eal_iova_mode() == RTE_IOVA_PA ? "PA" : "VA");
 
@@ -975,6 +988,7 @@ rte_eal_cleanup(void)
        rte_mp_channel_cleanup();
        /* after this point, any DPDK pointers will become dangling */
        rte_eal_memory_detach();
+       rte_eal_alarm_cleanup();
        rte_trace_save();
        eal_trace_fini();
        eal_cleanup_config(internal_conf);
@@ -1004,6 +1018,7 @@ int rte_vfio_setup_device(__rte_unused const char *sysfs_base,
                      __rte_unused int *vfio_dev_fd,
                      __rte_unused struct vfio_device_info *device_info)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }
 
@@ -1011,11 +1026,13 @@ int rte_vfio_release_device(__rte_unused const char *sysfs_base,
                        __rte_unused const char *dev_addr,
                        __rte_unused int fd)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }
 
 int rte_vfio_enable(__rte_unused const char *modname)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }
 
@@ -1031,7 +1048,8 @@ int rte_vfio_noiommu_is_enabled(void)
 
 int rte_vfio_clear_group(__rte_unused int vfio_group_fd)
 {
-       return 0;
+       rte_errno = ENOTSUP;
+       return -1;
 }
 
 int
@@ -1039,30 +1057,35 @@ rte_vfio_get_group_num(__rte_unused const char *sysfs_base,
                       __rte_unused const char *dev_addr,
                       __rte_unused int *iommu_group_num)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }
 
 int
 rte_vfio_get_container_fd(void)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }
 
 int
 rte_vfio_get_group_fd(__rte_unused int iommu_group_num)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }
 
 int
 rte_vfio_container_create(void)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }
 
 int
 rte_vfio_container_destroy(__rte_unused int container_fd)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }
 
@@ -1070,6 +1093,7 @@ int
 rte_vfio_container_group_bind(__rte_unused int container_fd,
                __rte_unused int iommu_group_num)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }
 
@@ -1077,6 +1101,7 @@ int
 rte_vfio_container_group_unbind(__rte_unused int container_fd,
                __rte_unused int iommu_group_num)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }
 
@@ -1086,6 +1111,7 @@ rte_vfio_container_dma_map(__rte_unused int container_fd,
                        __rte_unused uint64_t iova,
                        __rte_unused uint64_t len)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }
 
@@ -1095,5 +1121,6 @@ rte_vfio_container_dma_unmap(__rte_unused int container_fd,
                        __rte_unused uint64_t iova,
                        __rte_unused uint64_t len)
 {
+       rte_errno = ENOTSUP;
        return -1;
 }