[v2,4/6] app/testpmd: enhance queue count check

Message ID 20240314091708.1542769-5-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series testpmd options parsing cleanup |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand March 14, 2024, 9:17 a.m. UTC
  Checking the number of rxq/txq in the middle of option parsing is
confusing.
Besides, a check on nb_rxq / nb_txq check already exists after
option parsing.
Only keep this latter check and make testpmd quit in this case.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since v1:
- moved the check and termination out of argument parsing,

---
 app/test-pmd/parameters.c | 4 ----
 app/test-pmd/testpmd.c    | 3 +--
 2 files changed, 1 insertion(+), 6 deletions(-)
  

Comments

Ferruh Yigit March 14, 2024, 9:23 a.m. UTC | #1
On 3/14/2024 9:17 AM, David Marchand wrote:
> Checking the number of rxq/txq in the middle of option parsing is
> confusing.
> Besides, a check on nb_rxq / nb_txq check already exists after
> option parsing.
> Only keep this latter check and make testpmd quit in this case.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
>

Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
  

Patch

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index a4c09e2a2b..fc5cf3a195 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -1098,10 +1098,6 @@  launch_args_parse(int argc, char** argv)
 						  n + nb_rxq,
 						  get_allowed_max_nb_rxq(&pid));
 			}
-			if (!nb_rxq && !nb_txq) {
-				rte_exit(EXIT_FAILURE, "Either rx or tx queues should "
-						"be non-zero\n");
-			}
 			if (!strcmp(lgopts[opt_idx].name, "hairpin-mode")) {
 				char *end = NULL;
 				unsigned int n;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 9e4e99e53b..81d905d759 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4619,8 +4619,7 @@  main(int argc, char** argv)
 	}
 
 	if (!nb_rxq && !nb_txq)
-		fprintf(stderr,
-			"Warning: Either rx or tx queues should be non-zero\n");
+		rte_exit(EXIT_FAILURE, "Either rx or tx queues should be non-zero\n");
 
 	if (nb_rxq > 1 && nb_rxq > nb_txq)
 		fprintf(stderr,