[dpdk-dev] [PATCH v2 47/54] examples/ipsec-secgw: check status of getting ethdev info
Andrew Rybchenko
arybchenko at solarflare.com
Tue Sep 3 15:57:21 CEST 2019
From: Ivan Ilchenko <Ivan.Ilchenko at 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/ipsec-secgw according to its new return type.
Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko at oktetlabs.com>
Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
examples/ipsec-secgw/ipsec-secgw.c | 6 +++++-
examples/ipsec-secgw/ipsec.c | 9 ++++++++-
examples/ipsec-secgw/sa.c | 10 +++++++++-
3 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 0d1fd6a..534830a 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1911,7 +1911,11 @@ struct lcore_conf {
struct rte_ether_addr ethaddr;
struct rte_eth_conf local_port_conf = port_conf;
- 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));
/* limit allowed HW offloafs, as user requested */
dev_info.rx_offload_capa &= dev_rx_offload;
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index dc85adf..7720080 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -243,7 +243,14 @@
unsigned int i;
unsigned int j;
- rte_eth_dev_info_get(sa->portid, &dev_info);
+ ret = rte_eth_dev_info_get(sa->portid, &dev_info);
+ if (ret != 0) {
+ RTE_LOG(ERR, IPSEC,
+ "Error during getting device (port %u) info: %s\n",
+ sa->portid, strerror(-ret));
+ return ret;
+ }
+
sa->action[2].type = RTE_FLOW_ACTION_TYPE_END;
/* Try RSS. */
sa->action[1].type = RTE_FLOW_ACTION_TYPE_RSS;
diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index c3cf3bd..14ee947 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -756,8 +756,16 @@ struct sa_ctx {
check_eth_dev_caps(uint16_t portid, uint32_t inbound)
{
struct rte_eth_dev_info dev_info;
+ int retval;
- rte_eth_dev_info_get(portid, &dev_info);
+ retval = rte_eth_dev_info_get(portid, &dev_info);
+ if (retval != 0) {
+ RTE_LOG(ERR, IPSEC,
+ "Error during getting device (port %u) info: %s\n",
+ portid, strerror(-retval));
+
+ return retval;
+ }
if (inbound) {
if ((dev_info.rx_offload_capa &
--
1.8.3.1
More information about the dev
mailing list