add missing code to affinitize main_lcore from lcore configuration.

Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com>
---

v2: RTE_LOG of eal_thread_dump_current_affinity as linux does

 lib/eal/windows/eal.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index ca3c41aaa7..98d8b155c7 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -279,6 +279,7 @@ rte_eal_init(int argc, char **argv)
        bool has_phys_addr;
        enum rte_iova_mode iova_mode;
        int ret;
+       char cpuset[RTE_CPU_AFFINITY_STR_LEN];
 
        eal_log_init(NULL, 0);
 
@@ -401,9 +402,20 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
 
+       if (pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t),
+                       &lcore_config[config->main_lcore].cpuset) != 0) {
+               rte_eal_init_alert("Cannot set affinity");
+               rte_errno = EINVAL;
+               return -1;
+       }
        __rte_thread_init(config->main_lcore,
                &lcore_config[config->main_lcore].cpuset);
 
+       ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset));
+       RTE_LOG(DEBUG, EAL, "Main lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
+               config->main_lcore, (uintptr_t)pthread_self(), cpuset,
+               ret == 0 ? "" : "...");
+
        RTE_LCORE_FOREACH_WORKER(i) {
 
                /*
-- 
2.33.0.vfs.0.0

Reply via email to