DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Updated skeleton example code to better emit error
@ 2026-05-12 19:28 Arin Kharkar
  2026-05-13 16:30 ` Marat Khalili
  2026-07-17 13:29 ` Thomas Monjalon
  0 siblings, 2 replies; 3+ messages in thread
From: Arin Kharkar @ 2026-05-12 19:28 UTC (permalink / raw)
  To: dev; +Cc: Arin Kharkar

Previously, the program would check if the number of ports is even and if not, would exit with an error stating "the number of ports must be even". To provide more information, the program now states how many ports were found. This is especially helpful if 0 ports were found, as it explicitly states DPDK wasn't able to find any ports, rather than making the user troubleshoot this.
---
 examples/skeleton/basicfwd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c
index 133293cf15..381e4d4273 100644
--- a/examples/skeleton/basicfwd.c
+++ b/examples/skeleton/basicfwd.c
@@ -188,11 +188,9 @@ main(int argc, char *argv[])
 	/* Check that there is an even number of ports to send/receive on. */
 	nb_ports = rte_eth_dev_count_avail();
 	if (nb_ports < 2 || (nb_ports & 1))
-		rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");
+		rte_exit(EXIT_FAILURE, "Error: number of ports must be even, found %u ports\n", nb_ports);
 
-	/* Creates a new mempool in memory to hold the mbufs. */
-
-	/* Allocates mempool to hold the mbufs. 8< */
+	/* Creates and allocates a mempool to hold the mbufs. 8< */
 	mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports,
 		MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
 	/* >8 End of allocating mempool to hold mbuf. */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] Updated skeleton example code to better emit error
  2026-05-12 19:28 [PATCH] Updated skeleton example code to better emit error Arin Kharkar
@ 2026-05-13 16:30 ` Marat Khalili
  2026-07-17 13:29 ` Thomas Monjalon
  1 sibling, 0 replies; 3+ messages in thread
From: Marat Khalili @ 2026-05-13 16:30 UTC (permalink / raw)
  To: Arin Kharkar, dev@dpdk.org

> --- a/examples/skeleton/basicfwd.c
> +++ b/examples/skeleton/basicfwd.c
> @@ -188,11 +188,9 @@ main(int argc, char *argv[])
>  	/* Check that there is an even number of ports to send/receive on. */
>  	nb_ports = rte_eth_dev_count_avail();
>  	if (nb_ports < 2 || (nb_ports & 1))
> -		rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");
> +		rte_exit(EXIT_FAILURE, "Error: number of ports must be even, found %u ports\n", nb_ports);

Maybe "positive even"?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Updated skeleton example code to better emit error
  2026-05-12 19:28 [PATCH] Updated skeleton example code to better emit error Arin Kharkar
  2026-05-13 16:30 ` Marat Khalili
@ 2026-07-17 13:29 ` Thomas Monjalon
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2026-07-17 13:29 UTC (permalink / raw)
  To: Arin Kharkar; +Cc: dev

12/05/2026 21:28, Arin Kharkar:
> Previously, the program would check if the number of ports is even and if not, would exit with an error stating "the number of ports must be even". To provide more information, the program now states how many ports were found. This is especially helpful if 0 ports were found, as it explicitly states DPDK wasn't able to find any ports, rather than making the user troubleshoot this.
> ---
>  examples/skeleton/basicfwd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c
> index 133293cf15..381e4d4273 100644
> --- a/examples/skeleton/basicfwd.c
> +++ b/examples/skeleton/basicfwd.c
> @@ -188,11 +188,9 @@ main(int argc, char *argv[])
>  	/* Check that there is an even number of ports to send/receive on. */
>  	nb_ports = rte_eth_dev_count_avail();
>  	if (nb_ports < 2 || (nb_ports & 1))
> -		rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");
> +		rte_exit(EXIT_FAILURE, "Error: number of ports must be even, found %u ports\n", nb_ports);
>  
> -	/* Creates a new mempool in memory to hold the mbufs. */
> -
> -	/* Allocates mempool to hold the mbufs. 8< */
> +	/* Creates and allocates a mempool to hold the mbufs. 8< */

Changing this comment requires changing the doc referencing it.

I've made this change, added your signoff and other details,
and applied, thanks.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-17 13:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 19:28 [PATCH] Updated skeleton example code to better emit error Arin Kharkar
2026-05-13 16:30 ` Marat Khalili
2026-07-17 13:29 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox