common/octeontx2: fix memory mapping API usage
[dpdk.git] / lib / librte_eal / windows / eal_hugepages.c
index 61d0dcd..44dae98 100644 (file)
@@ -4,6 +4,7 @@
 #include <rte_memzone.h>
 #include <rte_os.h>
 
+#include "eal_private.h"
 #include "eal_filesystem.h"
 #include "eal_hugepages.h"
 #include "eal_internal_cfg.h"
@@ -40,6 +41,10 @@ hugepage_claim_privilege(void)
                goto exit;
        }
 
+       /* AdjustTokenPrivileges() may succeed with ERROR_NOT_ALL_ASSIGNED. */
+       if (GetLastError() != ERROR_SUCCESS)
+               goto exit;
+
        ret = 0;
 
 exit:
@@ -54,10 +59,12 @@ hugepage_info_init(void)
        struct hugepage_info *hpi;
        unsigned int socket_id;
        int ret = 0;
+       struct internal_config *internal_conf =
+               eal_get_internal_configuration();
 
        /* Only one hugepage size available on Windows. */
-       internal_config.num_hugepage_sizes = 1;
-       hpi = &internal_config.hugepage_info[0];
+       internal_conf->num_hugepage_sizes = 1;
+       hpi = &internal_conf->hugepage_info[0];
 
        hpi->hugepage_sz = GetLargePageMinimum();
        if (hpi->hugepage_sz == 0)
@@ -95,12 +102,13 @@ int
 eal_hugepage_info_init(void)
 {
        if (hugepage_claim_privilege() < 0) {
-               RTE_LOG(ERR, EAL, "Cannot claim hugepage privilege\n");
+               RTE_LOG(ERR, EAL, "Cannot claim hugepage privilege\n"
+               "Verify that large-page support privilege is assigned to the current user\n");
                return -1;
        }
 
        if (hugepage_info_init() < 0) {
-               RTE_LOG(ERR, EAL, "Cannot get hugepage information\n");
+               RTE_LOG(ERR, EAL, "Cannot discover available hugepages\n");
                return -1;
        }