[v3,27/54] examples/qos_sched: check status of getting ethdev info

Message ID 1567755066-31389-28-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: change rte_eth_dev_info_get() return value to int |

Checks

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

Commit Message

Andrew Rybchenko Sept. 6, 2019, 7:30 a.m. UTC
  From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>

rte_eth_dev_info_get() return value was changed from void to
int, so this patch modify rte_eth_dev_info_get() usage across
examples/qos_sched according to its new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 examples/qos_sched/init.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Comments

Jasvinder Singh Sept. 9, 2019, 7:04 a.m. UTC | #1
> -----Original Message-----
> From: Andrew Rybchenko [mailto:arybchenko@solarflare.com]
> Sent: Friday, September 6, 2019 8:31 AM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>
> Cc: dev@dpdk.org; Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
> Subject: [PATCH v3 27/54] examples/qos_sched: check status of getting ethdev
> info
> 
> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
> 
> rte_eth_dev_info_get() return value was changed from void to int, so this
> patch modify rte_eth_dev_info_get() usage across examples/qos_sched
> according to its new return type.
> 
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  examples/qos_sched/init.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index
> b05206d5ab..cf9e8f4ac7 100644
> --- a/examples/qos_sched/init.c
> +++ b/examples/qos_sched/init.c
> @@ -98,7 +98,13 @@ app_init_port(uint16_t portid, struct rte_mempool
> *mp)
>  	/* init port */
>  	RTE_LOG(INFO, APP, "Initializing port %"PRIu16"... ", portid);
>  	fflush(stdout);
> -	rte_eth_dev_info_get(portid, &dev_info);
> +
> +	ret = rte_eth_dev_info_get(portid, &dev_info);
> +	if (ret != 0)
> +		rte_exit(EXIT_FAILURE,
> +			"Error during getting device (port %u) info: %s\n",
> +			portid, strerror(-ret));
> +
>  	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
>  		local_port_conf.txmode.offloads |=
>  			DEV_TX_OFFLOAD_MBUF_FAST_FREE;
> --
> 2.17.1

Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
  

Patch

diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index b05206d5ab..cf9e8f4ac7 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -98,7 +98,13 @@  app_init_port(uint16_t portid, struct rte_mempool *mp)
 	/* init port */
 	RTE_LOG(INFO, APP, "Initializing port %"PRIu16"... ", portid);
 	fflush(stdout);
-	rte_eth_dev_info_get(portid, &dev_info);
+
+	ret = rte_eth_dev_info_get(portid, &dev_info);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Error during getting device (port %u) info: %s\n",
+			portid, strerror(-ret));
+
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
 		local_port_conf.txmode.offloads |=
 			DEV_TX_OFFLOAD_MBUF_FAST_FREE;