[dpdk-dev,v2] app/pdump: check for ports

Message ID 1519626158-10519-1-git-send-email-vipin.varghese@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Varghese, Vipin Feb. 26, 2018, 6:22 a.m. UTC
  In case of application build with shared library mode unless
option '-d' is passed, poll mode driver for devices is not
initialized. Notifying the user just after rte_eal_init is
pro active way of intimating the user.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
---

Changes in V2:
 - updated the exit message - Reshma
---
 app/pdump/main.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Pattan, Reshma Feb. 28, 2018, 11:04 a.m. UTC | #1
> -----Original Message-----
> From: Varghese, Vipin
> Sent: Monday, February 26, 2018 6:23 AM
> To: dev@dpdk.org; Pattan, Reshma <reshma.pattan@intel.com>
> Cc: Mcnamara, John <john.mcnamara@intel.com>; Varghese, Vipin
> <vipin.varghese@intel.com>
> Subject: [PATCH v2] app/pdump: check for ports
> 
> In case of application build with shared library mode unless option '-d' is
> passed, poll mode driver for devices is not initialized. Notifying the user just
> after rte_eal_init is pro active way of intimating the user.
> 
> Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
> ---
> 
> Changes in V2:
>  - updated the exit message - Reshma
> ---
>  app/pdump/main.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/app/pdump/main.c b/app/pdump/main.c index f6865bd..203faa3
> 100644
> --- a/app/pdump/main.c
> +++ b/app/pdump/main.c
> @@ -863,6 +863,9 @@ struct parse_val {
>  	if (diag < 0)
>  		rte_panic("Cannot init EAL\n");
> 
> +	if (rte_eth_dev_count() == 0)
> +		rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
> +
>  	argc -= diag;
>  	argv += (diag - 3);
> 
> --
> 1.9.1

Acked-by: Reshma Pattan <reshma.pattan@intel.com>
  
Thomas Monjalon April 22, 2018, 11:13 p.m. UTC | #2
> > In case of application build with shared library mode unless option '-d' is
> > passed, poll mode driver for devices is not initialized. Notifying the user just
> > after rte_eal_init is pro active way of intimating the user.
> > 
> > Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
> > ---
> > +	if (rte_eth_dev_count() == 0)
> > +		rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");

Rebased to the new function rte_eth_dev_count_avail.

> Acked-by: Reshma Pattan <reshma.pattan@intel.com>

Applied, thanks
  

Patch

diff --git a/app/pdump/main.c b/app/pdump/main.c
index f6865bd..203faa3 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -863,6 +863,9 @@  struct parse_val {
 	if (diag < 0)
 		rte_panic("Cannot init EAL\n");
 
+	if (rte_eth_dev_count() == 0)
+		rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
+
 	argc -= diag;
 	argv += (diag - 3);