Add two parameters:
rxq-setup: set the number of RX queues be setup before device started
txq-setup: set the number of TX queues be setup before device started.

Signed-off-by: Qi Zhang <qi.z.zh...@intel.com>
---
 app/test-pmd/parameters.c             | 29 +++++++++++++++++++++++++++++
 app/test-pmd/testpmd.c                |  8 ++++++--
 app/test-pmd/testpmd.h                |  2 ++
 doc/guides/testpmd_app_ug/run_app.rst | 12 ++++++++++++
 4 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 97d22b860..497259ee7 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -146,8 +146,12 @@ usage(char* progname)
        printf("  --rss-ip: set RSS functions to IPv4/IPv6 only .\n");
        printf("  --rss-udp: set RSS functions to IPv4/IPv6 + UDP.\n");
        printf("  --rxq=N: set the number of RX queues per port to N.\n");
+       printf("  --rxq-setup=N: set the number of RX queues be setup before"
+              "device start to N.\n");
        printf("  --rxd=N: set the number of descriptors in RX rings to N.\n");
        printf("  --txq=N: set the number of TX queues per port to N.\n");
+       printf("  --txq-setup=N: set the number of TX queues be setup before"
+              "device start to N.\n");
        printf("  --txd=N: set the number of descriptors in TX rings to N.\n");
        printf("  --burst=N: set the number of packets per burst to N.\n");
        printf("  --mbcache=N: set the cache of mbuf memory pool to N.\n");
@@ -596,7 +600,9 @@ launch_args_parse(int argc, char** argv)
                { "rss-ip",                     0, 0, 0 },
                { "rss-udp",                    0, 0, 0 },
                { "rxq",                        1, 0, 0 },
+               { "rxq-setup",                  1, 0, 0 },
                { "txq",                        1, 0, 0 },
+               { "txq-setup",                  1, 0, 0 },
                { "rxd",                        1, 0, 0 },
                { "txd",                        1, 0, 0 },
                { "burst",                      1, 0, 0 },
@@ -933,6 +939,15 @@ launch_args_parse(int argc, char** argv)
                                                  " >= 0 && <= %u\n", n,
                                                  get_allowed_max_nb_rxq(&pid));
                        }
+                       if (!strcmp(lgopts[opt_idx].name, "rxq-setup")) {
+                               n = atoi(optarg);
+                               if (n >= 0 && check_nb_rxq((queueid_t)n) == 0)
+                                       nb_rxq_setup = (queueid_t) n;
+                               else
+                                       rte_exit(EXIT_FAILURE, "rxq-setup %d 
invalid - must be"
+                                                 " >= 0 && <= %u\n", n,
+                                                 get_allowed_max_nb_rxq(&pid));
+                       }
                        if (!strcmp(lgopts[opt_idx].name, "txq")) {
                                n = atoi(optarg);
                                if (n >= 0 && check_nb_txq((queueid_t)n) == 0)
@@ -942,6 +957,15 @@ launch_args_parse(int argc, char** argv)
                                                  " >= 0 && <= %u\n", n,
                                                  get_allowed_max_nb_txq(&pid));
                        }
+                       if (!strcmp(lgopts[opt_idx].name, "txq-setup")) {
+                               n = atoi(optarg);
+                               if (n >= 0 && check_nb_txq((queueid_t)n) == 0)
+                                       nb_txq_setup = (queueid_t) n;
+                               else
+                                       rte_exit(EXIT_FAILURE, "txq-setup %d 
invalid - must be"
+                                                 " >= 0 && <= %u\n", n,
+                                                 get_allowed_max_nb_txq(&pid));
+                       }
                        if (!nb_rxq && !nb_txq) {
                                rte_exit(EXIT_FAILURE, "Either rx or tx queues 
should "
                                                "be non-zero\n");
@@ -1119,4 +1143,9 @@ launch_args_parse(int argc, char** argv)
        /* Set offload configuration from command line parameters. */
        rx_mode.offloads = rx_offloads;
        tx_mode.offloads = tx_offloads;
+
+       if (nb_rxq_setup > nb_rxq)
+               nb_rxq_setup = nb_rxq;
+       if (nb_txq_setup > nb_txq)
+               nb_txq_setup = nb_txq;
 }
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 46dc22c94..790e7359c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -207,6 +207,10 @@ uint8_t dcb_test = 0;
  */
 queueid_t nb_rxq = 1; /**< Number of RX queues per port. */
 queueid_t nb_txq = 1; /**< Number of TX queues per port. */
+queueid_t nb_rxq_setup = MAX_QUEUE_ID;
+/**< Number of RX queues per port start when dev_start. */
+queueid_t nb_txq_setup = MAX_QUEUE_ID;
+/**< Number of TX queues per port start when dev_start  */
 
 /*
  * Configurable number of RX/TX ring descriptors.
@@ -1594,7 +1598,7 @@ start_port(portid_t pid)
                        /* Apply Tx offloads configuration */
                        port->tx_conf.offloads = port->dev_conf.txmode.offloads;
                        /* setup tx queues */
-                       for (qi = 0; qi < nb_txq; qi++) {
+                       for (qi = 0; qi < nb_txq_setup; qi++) {
                                if ((numa_support) &&
                                        (txring_numa[pi] != NUMA_NO_CONFIG))
                                        diag = rte_eth_tx_queue_setup(pi, qi,
@@ -1622,7 +1626,7 @@ start_port(portid_t pid)
                        /* Apply Rx offloads configuration */
                        port->rx_conf.offloads = port->dev_conf.rxmode.offloads;
                        /* setup rx queues */
-                       for (qi = 0; qi < nb_rxq; qi++) {
+                       for (qi = 0; qi < nb_rxq_setup; qi++) {
                                if ((numa_support) &&
                                        (rxring_numa[pi] != NUMA_NO_CONFIG)) {
                                        struct rte_mempool * mp =
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 153abea05..1a423eb8c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -373,6 +373,8 @@ extern uint64_t rss_hf;
 
 extern queueid_t nb_rxq;
 extern queueid_t nb_txq;
+extern queueid_t nb_rxq_setup;
+extern queueid_t nb_txq_setup;
 
 extern uint16_t nb_rxd;
 extern uint16_t nb_txd;
diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index 1fd53958a..63dbec407 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -354,6 +354,12 @@ The commandline options are:
     Set the number of RX queues per port to N, where 1 <= N <= 65535.
     The default value is 1.
 
+*   ``--rxq-setup=N``
+
+    Set the number of RX queues will be setup before device started,
+    where 0 <= N <= 65535. The default value is rxq, if the number is
+    larger than rxq, it will be set to rxq automatically.
+
 *   ``--rxd=N``
 
     Set the number of descriptors in the RX rings to N, where N > 0.
@@ -364,6 +370,12 @@ The commandline options are:
     Set the number of TX queues per port to N, where 1 <= N <= 65535.
     The default value is 1.
 
+*   ``--txq-setup=N``
+
+    Set the number of TX queues will be setup before device started,
+    where 0 <= N <= 65535. The default value is rxq, if the number is
+    larger than txq, it will be set to txq automatically.
+
 *   ``--txd=N``
 
     Set the number of descriptors in the TX rings to N, where N > 0.
-- 
2.13.6

Reply via email to