[v2] app/pdump: exit if no device specified

Message ID 20230701021611.8269-1-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] app/pdump: exit if no device specified |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Stephen Hemminger July 1, 2023, 2:16 a.m. UTC
  Simpler version of earlier patch which had a good idea, was just
implemented with more code than necessary.
If no device is specified don't start the capture loop.

Reported-by: usman.tanveer <usman.tanveer@emumba.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/pdump/main.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

fengchengwen July 3, 2023, 6:29 a.m. UTC | #1
Acked-by: Chengwen Feng <fengchengwen@huawei.com>

On 2023/7/1 10:16, Stephen Hemminger wrote:
> Simpler version of earlier patch which had a good idea, was just
> implemented with more code than necessary.
> If no device is specified don't start the capture loop.
> 
> Reported-by: usman.tanveer <usman.tanveer@emumba.com>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  app/pdump/main.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/app/pdump/main.c b/app/pdump/main.c
> index c94606275b28..7a1c7bdf6011 100644
> --- a/app/pdump/main.c
> +++ b/app/pdump/main.c
> @@ -915,6 +915,9 @@ dump_packets(void)
>  	int i;
>  	unsigned int lcore_id = 0;
>  
> +	if (num_tuples == 0)
> +		rte_exit(EXIT_FAILURE, "No device specified for capture\n");
> +
>  	if (!multiple_core_capture) {
>  		printf(" core (%u), capture for (%d) tuples\n",
>  				rte_lcore_id(), num_tuples);
>
  
Thomas Monjalon July 6, 2023, 10:45 a.m. UTC | #2
03/07/2023 08:29, fengchengwen:
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> 
> On 2023/7/1 10:16, Stephen Hemminger wrote:
> > Simpler version of earlier patch which had a good idea, was just
> > implemented with more code than necessary.
> > If no device is specified don't start the capture loop.
> > 
> > Reported-by: usman.tanveer <usman.tanveer@emumba.com>
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Applied, thanks.
  

Patch

diff --git a/app/pdump/main.c b/app/pdump/main.c
index c94606275b28..7a1c7bdf6011 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -915,6 +915,9 @@  dump_packets(void)
 	int i;
 	unsigned int lcore_id = 0;
 
+	if (num_tuples == 0)
+		rte_exit(EXIT_FAILURE, "No device specified for capture\n");
+
 	if (!multiple_core_capture) {
 		printf(" core (%u), capture for (%d) tuples\n",
 				rte_lcore_id(), num_tuples);