app/testpmd: replace hardcoded min mbuf number with macro

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

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

Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
Acked-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
This commit is contained in:
Mingxia Liu 2022-03-31 02:33:33 +00:00 committed by Ferruh Yigit
parent 67ead3fa8c
commit 57d91f5b8d
2 changed files with 5 additions and 2 deletions

View File

@ -940,11 +940,12 @@ launch_args_parse(int argc, char** argv)
} }
if (!strcmp(lgopts[opt_idx].name, "total-num-mbufs")) { if (!strcmp(lgopts[opt_idx].name, "total-num-mbufs")) {
n = atoi(optarg); n = atoi(optarg);
if (n > 1024) if (n > MIN_TOTAL_NUM_MBUFS)
param_total_num_mbufs = (unsigned)n; param_total_num_mbufs = (unsigned)n;
else else
rte_exit(EXIT_FAILURE, 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")) { if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
n = atoi(optarg); n = atoi(optarg);

View File

@ -72,6 +72,8 @@
#define NUMA_NO_CONFIG 0xFF #define NUMA_NO_CONFIG 0xFF
#define UMA_NO_CONFIG 0xFF #define UMA_NO_CONFIG 0xFF
#define MIN_TOTAL_NUM_MBUFS 1024
typedef uint8_t lcoreid_t; typedef uint8_t lcoreid_t;
typedef uint16_t portid_t; typedef uint16_t portid_t;
typedef uint16_t queueid_t; typedef uint16_t queueid_t;