From 4491fd2e4fb1c1d101e4c2d45998b484ce946443 Mon Sep 17 00:00:00 2001 From: Wenkai Lin Date: Wed, 19 Jan 2022 11:25:34 +0800 Subject: [PATCH 51/53] uadk: fix for wd_env_config numa_num numa number should be updated synchronously with config_per_numa, so set it to zero when free numa. Signed-off-by: Wenkai Lin --- include/wd_util.h | 2 +- wd_util.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/wd_util.h b/include/wd_util.h index c07ecce..2d3c1e4 100644 --- a/include/wd_util.h +++ b/include/wd_util.h @@ -16,7 +16,7 @@ extern "C" { #define FOREACH_NUMA(i, config, config_numa) \ for (i = 0, config_numa = config->config_per_numa; \ - config_numa && i < config->numa_num; config_numa++, i++) + i < config->numa_num; config_numa++, i++) struct wd_async_msg_pool { struct msg_pool *pools; diff --git a/wd_util.c b/wd_util.c index 7fa688d..44c8909 100644 --- a/wd_util.c +++ b/wd_util.c @@ -356,6 +356,7 @@ static void wd_free_numa(struct wd_env_config *config) free(config->config_per_numa); config->config_per_numa = NULL; + config->numa_num = 0; } /** @@ -484,6 +485,7 @@ static int wd_alloc_numa(struct wd_env_config *config, return 0; free_list: + config->numa_num = 0; wd_free_list_accels(head); free_numa_dev_num: free(numa_dev_num); -- 2.25.1