From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Jerin Jacob <jerinj@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>,
Zhirun Yan <yanzhirun_163@163.com>
Subject: [PATCH 05/10] examples/l3fwd: check return value from ethdev info
Date: Fri, 4 Oct 2024 09:21:52 -0700 [thread overview]
Message-ID: <20241004162418.52940-6-stephen@networkplumber.org> (raw)
In-Reply-To: <20241004162418.52940-1-stephen@networkplumber.org>
Need to check return value from rte_eth_dev_info_get.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/l3fwd-graph/main.c | 12 ++++++++++--
examples/l3fwd/l3fwd_fib.c | 16 ++++++++++++----
examples/l3fwd/l3fwd_lpm.c | 14 ++++++++++----
3 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/examples/l3fwd-graph/main.c b/examples/l3fwd-graph/main.c
index a13dc01138..26b33184e5 100644
--- a/examples/l3fwd-graph/main.c
+++ b/examples/l3fwd-graph/main.c
@@ -1088,7 +1088,10 @@ main(int argc, char **argv)
printf("Creating queues: nb_rxq=%d nb_txq=%u... ",
nb_rx_queue, n_tx_queue);
- rte_eth_dev_info_get(portid, &dev_info);
+ ret = rte_eth_dev_info_get(portid, &dev_info);
+ if (ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "Unable to get info for port %u\n", portid);
ret = config_port_max_pkt_len(&local_port_conf, &dev_info);
if (ret != 0)
@@ -1220,7 +1223,12 @@ main(int argc, char **argv)
printf("rxq=%d,%d,%d ", portid, queueid, socketid);
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,
+ "rte_eth_dev_info_get: err=%d, port=%u\n",
+ ret, portid);
+
rxq_conf = dev_info.default_rxconf;
rxq_conf.offloads = port_conf.rxmode.offloads;
if (!per_port_pool)
diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c
index f38b19af3f..2000fac168 100644
--- a/examples/l3fwd/l3fwd_fib.c
+++ b/examples/l3fwd/l3fwd_fib.c
@@ -675,8 +675,12 @@ setup_fib(const int socketid)
enabled_port_mask) == 0)
continue;
- rte_eth_dev_info_get(route_base_v4[i].if_out,
- &dev_info);
+ ret = rte_eth_dev_info_get(route_base_v4[i].if_out, &dev_info);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Unable to get device info for port %u\n",
+ route_base_v4[i].if_out);
+
ret = rte_fib_add(ipv4_l3fwd_fib_lookup_struct[socketid],
route_base_v4[i].ip,
route_base_v4[i].depth,
@@ -729,8 +733,12 @@ setup_fib(const int socketid)
enabled_port_mask) == 0)
continue;
- rte_eth_dev_info_get(route_base_v6[i].if_out,
- &dev_info);
+ ret = rte_eth_dev_info_get(route_base_v6[i].if_out, &dev_info);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Unable to get device info for port %u\n",
+ route_base_v6[i].if_out);
+
ret = rte_fib6_add(ipv6_l3fwd_fib_lookup_struct[socketid],
route_base_v6[i].ip_8,
route_base_v6[i].depth,
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index e8fd95aae9..39e5d7607b 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -588,8 +588,11 @@ setup_lpm(const int socketid)
enabled_port_mask) == 0)
continue;
- rte_eth_dev_info_get(route_base_v4[i].if_out,
- &dev_info);
+ ret = rte_eth_dev_info_get(route_base_v4[i].if_out, &dev_info);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE, "Unable to get device info for port %u\n",
+ route_base_v4[i].if_out);
+
ret = rte_lpm_add(ipv4_l3fwd_lpm_lookup_struct[socketid],
route_base_v4[i].ip,
route_base_v4[i].depth,
@@ -632,8 +635,11 @@ setup_lpm(const int socketid)
enabled_port_mask) == 0)
continue;
- rte_eth_dev_info_get(route_base_v6[i].if_out,
- &dev_info);
+ ret = rte_eth_dev_info_get(route_base_v6[i].if_out, &dev_info);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE, "Unable to get device info for port %u\n",
+ route_base_v6[i].if_out);
+
ret = rte_lpm6_add(ipv6_l3fwd_lpm_lookup_struct[socketid],
route_base_v6[i].ip_8,
route_base_v6[i].depth,
--
2.45.2
next prev parent reply other threads:[~2024-10-04 16:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 16:21 [PATCH 00/10] require checking ethdev get return value Stephen Hemminger
2024-10-04 16:21 ` [PATCH 01/10] app/test: remove redundant call Stephen Hemminger
2024-10-04 16:21 ` [PATCH 02/10] net/memif: check return value from rte_eth_dev_info_get Stephen Hemminger
2024-10-08 3:47 ` Ferruh Yigit
2024-10-04 16:21 ` [PATCH 03/10] graph: " Stephen Hemminger
2024-10-04 16:21 ` [PATCH 04/10] examples/ethtool: handle devices without registers Stephen Hemminger
2024-10-04 16:21 ` Stephen Hemminger [this message]
2024-10-04 16:21 ` [PATCH 06/10] examples/ntb: always check return value Stephen Hemminger
2024-10-04 16:21 ` [PATCH 07/10] examples/pipeline: check return value of ethdev functions Stephen Hemminger
2024-10-04 16:21 ` [PATCH 08/10] examples/qos_sched: check return value from rte_eth_link_get Stephen Hemminger
2024-10-04 16:21 ` [PATCH 09/10] ethdev: check return value from rte_eth_dev_info_get Stephen Hemminger
2024-10-08 3:47 ` Ferruh Yigit
2024-10-04 16:21 ` [PATCH 10/10] ethdev: require checking results of info_get functions Stephen Hemminger
2024-10-08 3:47 ` Ferruh Yigit
2024-10-08 9:33 ` [PATCH 00/10] require checking ethdev get return value Morten Brørup
2024-11-11 15:20 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241004162418.52940-6-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=yanzhirun_163@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).