The mempool library no longer limits the cache size to
RTE_MEMPOOL_CACHE_MAX_SIZE, but the --mbcache option still rejected
values above it.

Limit the option to the range of the variable holding the value
instead. A cache size larger than the number of mbufs in the pool is
still rejected by the mempool library when the pool is created.

Update the user guide accordingly.

Fixes: b815acfdfc48 ("mempool: remove cache size limit")
Signed-off-by: Kishore Padmanabha <[email protected]>
---
 app/test-pmd/parameters.c             | 5 ++---
 doc/guides/testpmd_app_ug/run_app.rst | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 34a4f74e636b..9967e49881c5 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -1455,13 +1455,12 @@ launch_args_parse(int argc, char** argv)
                        break;
                case TESTPMD_OPT_MBCACHE_NUM:
                        n = atoi(optarg);
-                       if ((n >= 0) &&
-                                       (n <= RTE_MEMPOOL_CACHE_MAX_SIZE))
+                       if ((n >= 0) && (n <= UINT16_MAX))
                                mb_mempool_cache = (uint16_t) n;
                        else
                                rte_exit(EXIT_FAILURE,
                                        "mbcache must be >= 0 and <= %d\n",
-                                       RTE_MEMPOOL_CACHE_MAX_SIZE);
+                                       UINT16_MAX);
                        break;
                case TESTPMD_OPT_TXFREET_NUM:
                        n = atoi(optarg);
diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index e34e414ce246..e10fc5e16223 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -315,7 +315,7 @@ The command line options are:
 
 *   ``--mbcache=N``
 
-    Set the cache of mbuf memory pools to N, where 0 <= N <= 512.
+    Set the cache of mbuf memory pools to N, where 0 <= N <= UINT16_MAX.
     The default value is 16.
 
 *   ``--rxpt=N``
-- 
2.54.0

Reply via email to