[v1] app/test-pmd: change a magic number to macro

Message ID 20220329075047.1526063-1-mingxia.liu@intel.com (mailing list archive)
State Superseded, archived
Headers
Series [v1] app/test-pmd: change a magic number to macro |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Liu, Mingxia March 29, 2022, 7:50 a.m. UTC
  From: mingxial <mingxia.liu@intel.com>

Add macro MIN_TOTAL_NUM_MBUFS (1024) to indicate
what the value of total-num-mbufs should bigger than.

Fixes: c87988187fdb ("app/testpmd: add --total-num-mbufs option")
Cc: stable@dpdk.org

Signed-off-by: mingxial <mingxia.liu@intel.com>
---
 app/test-pmd/parameters.c | 5 +++--
 app/test-pmd/testpmd.h    | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)
  

Patch

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index daf6a31b2b..641c9c767e 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -940,11 +940,12 @@  launch_args_parse(int argc, char** argv)
 			}
 			if (!strcmp(lgopts[opt_idx].name, "total-num-mbufs")) {
 				n = atoi(optarg);
-				if (n > 1024)
+				if (n > MIN_TOTAL_NUM_MBUFS)
 					param_total_num_mbufs = (unsigned)n;
 				else
 					rte_exit(EXIT_FAILURE,
-						 "total-num-mbufs should be > 1024\n");
+						 "total-num-mbufs should be > %d\n",
+						 MIN_TOTAL_NUM_MBUFS);
 			}
 			if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
 				n = atoi(optarg);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 31f766c965..a633f81b50 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -72,6 +72,8 @@ 
 #define NUMA_NO_CONFIG 0xFF
 #define UMA_NO_CONFIG  0xFF
 
+#define MIN_TOTAL_NUM_MBUFS 1024
+
 typedef uint8_t  lcoreid_t;
 typedef uint16_t portid_t;
 typedef uint16_t queueid_t;