When there is not enough space to memsegs, we should prompt
which configuration should be modified instead of printing
some numbers.

Signed-off-by: Fengnan Chang <changfeng...@bytedance.com>
---
 lib/eal/common/eal_common_dynmem.c |  6 ++----
 lib/eal/freebsd/eal_memory.c       |  8 +++-----
 lib/eal/linux/eal_memory.c         | 11 ++++-------
 3 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/lib/eal/common/eal_common_dynmem.c 
b/lib/eal/common/eal_common_dynmem.c
index 52e52e5986..bdbbe233a0 100644
--- a/lib/eal/common/eal_common_dynmem.c
+++ b/lib/eal/common/eal_common_dynmem.c
@@ -120,8 +120,7 @@ eal_dynmem_memseg_lists_init(void)
        max_seglists_per_type = RTE_MAX_MEMSEG_LISTS / n_memtypes;
 
        if (max_seglists_per_type == 0) {
-               RTE_LOG(ERR, EAL, "Cannot accommodate all memory types, please 
increase %s\n",
-                       RTE_STR(RTE_MAX_MEMSEG_LISTS));
+               RTE_LOG(ERR, EAL, "Cannot accommodate all memory types, please 
increase RTE_MAX_MEMSEG_LISTS\n");
                goto out;
        }
 
@@ -180,8 +179,7 @@ eal_dynmem_memseg_lists_init(void)
                for (cur_seglist = 0; cur_seglist < n_seglists; cur_seglist++) {
                        if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
                                RTE_LOG(ERR, EAL,
-                                       "No more space in memseg lists, please 
increase %s\n",
-                                       RTE_STR(RTE_MAX_MEMSEG_LISTS));
+                                       "No more space in memseg lists, please 
increase RTE_MAX_MEMSEG_LISTS\n");
                                goto out;
                        }
                        msl = &mcfg->memsegs[msl_idx++];
diff --git a/lib/eal/freebsd/eal_memory.c b/lib/eal/freebsd/eal_memory.c
index 17ab10e0ca..5c6165c580 100644
--- a/lib/eal/freebsd/eal_memory.c
+++ b/lib/eal/freebsd/eal_memory.c
@@ -172,9 +172,8 @@ rte_eal_hugepage_init(void)
                                break;
                        }
                        if (msl_idx == RTE_MAX_MEMSEG_LISTS) {
-                               RTE_LOG(ERR, EAL, "Could not find space for 
memseg. Please increase %s and/or %s in configuration.\n",
-                                       RTE_STR(RTE_MAX_MEMSEG_PER_TYPE),
-                                       RTE_STR(RTE_MAX_MEM_MB_PER_TYPE));
+                               RTE_LOG(ERR, EAL, "Could not find space for 
memseg. Please increase RTE_MAX_MEMSEG_PER_LIST "
+                                       "RTE_MAX_MEMSEG_PER_TYPE and/or 
RTE_MAX_MEM_MB_PER_TYPE in configuration.\n");
                                return -1;
                        }
                        arr = &msl->memseg_arr;
@@ -404,8 +403,7 @@ memseg_primary_init(void)
 
                        if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
                                RTE_LOG(ERR, EAL,
-                                       "No more space in memseg lists, please 
increase %s\n",
-                                       RTE_STR(RTE_MAX_MEMSEG_LISTS));
+                                       "No more space in memseg lists, please 
increase RTE_MAX_MEMSEG_LISTS\n");
                                return -1;
                        }
 
diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
index 0876974631..9b6f08fba8 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -716,9 +716,8 @@ remap_segment(struct hugepage_file *hugepages, int 
seg_start, int seg_end)
                break;
        }
        if (msl_idx == RTE_MAX_MEMSEG_LISTS) {
-               RTE_LOG(ERR, EAL, "Could not find space for memseg. Please 
increase %s and/or %s in configuration.\n",
-                               RTE_STR(RTE_MAX_MEMSEG_PER_TYPE),
-                               RTE_STR(RTE_MAX_MEM_MB_PER_TYPE));
+               RTE_LOG(ERR, EAL, "Could not find space for memseg. Please 
increase RTE_MAX_MEMSEG_PER_LIST "
+                       "RTE_MAX_MEMSEG_PER_TYPE and/or RTE_MAX_MEM_MB_PER_TYPE 
in configuration.\n");
                return -1;
        }
 
@@ -966,8 +965,7 @@ prealloc_segments(struct hugepage_file *hugepages, int 
n_pages)
                                break;
                        }
                        if (msl_idx == RTE_MAX_MEMSEG_LISTS) {
-                               RTE_LOG(ERR, EAL, "Not enough space in memseg 
lists, please increase %s\n",
-                                       RTE_STR(RTE_MAX_MEMSEG_LISTS));
+                               RTE_LOG(ERR, EAL, "Not enough space in memseg 
lists, please increase RTE_MAX_MEMSEG_LISTS\n");
                                return -1;
                        }
 
@@ -1833,8 +1831,7 @@ memseg_primary_init_32(void)
 
                                if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
                                        RTE_LOG(ERR, EAL,
-                                               "No more space in memseg lists, 
please increase %s\n",
-                                               RTE_STR(RTE_MAX_MEMSEG_LISTS));
+                                               "No more space in memseg lists, 
please increase RTE_MAX_MEMSEG_LISTS\n");
                                        return -1;
                                }
 
-- 
2.37.1 (Apple Git-137.1)

Reply via email to