[v3,13/54] net/bonding: check status of getting ethdev info

Message ID 1567755066-31389-14-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
net/bonding according to its new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/bonding/rte_eth_bond_api.c | 10 ++++++-
 drivers/net/bonding/rte_eth_bond_pmd.c | 36 +++++++++++++++++++++++---
 2 files changed, 41 insertions(+), 5 deletions(-)
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 0fc4c5eda5..e2e27e9f24 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -452,6 +452,7 @@  __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
 	struct bond_dev_private *internals;
 	struct rte_eth_link link_props;
 	struct rte_eth_dev_info dev_info;
+	int ret;
 
 	bonded_eth_dev = &rte_eth_devices[bonded_port_id];
 	internals = bonded_eth_dev->data->dev_private;
@@ -465,7 +466,14 @@  __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
 		return -1;
 	}
 
-	rte_eth_dev_info_get(slave_port_id, &dev_info);
+	ret = rte_eth_dev_info_get(slave_port_id, &dev_info);
+	if (ret != 0) {
+		RTE_BOND_LOG(ERR,
+			"%s: Error during getting device (port %u) info: %s\n",
+			__func__, slave_port_id, strerror(-ret));
+
+		return ret;
+	}
 	if (dev_info.max_rx_pktlen < internals->max_rx_pktlen) {
 		RTE_BOND_LOG(ERR, "Slave (port %u) max_rx_pktlen too small",
 			     slave_port_id);
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 97ab3f29f3..a1b50141f9 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -186,7 +186,15 @@  bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
 		return -1;
 	}
 
-	rte_eth_dev_info_get(slave_port, &slave_info);
+	ret = rte_eth_dev_info_get(slave_port, &slave_info);
+	if (ret != 0) {
+		RTE_BOND_LOG(ERR,
+			"%s: Error during getting device (port %u) info: %s\n",
+			__func__, slave_port, strerror(-ret));
+
+		return ret;
+	}
+
 	if (slave_info.max_rx_queues < bond_dev->data->nb_rx_queues ||
 			slave_info.max_tx_queues < bond_dev->data->nb_tx_queues) {
 		RTE_BOND_LOG(ERR,
@@ -204,10 +212,19 @@  bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) {
 	struct bond_dev_private *internals = bond_dev->data->dev_private;
 	struct rte_eth_dev_info bond_info;
 	uint16_t idx;
+	int ret;
 
 	/* Verify if all slaves in bonding supports flow director and */
 	if (internals->slave_count > 0) {
-		rte_eth_dev_info_get(bond_dev->data->port_id, &bond_info);
+		ret = rte_eth_dev_info_get(bond_dev->data->port_id, &bond_info);
+		if (ret != 0) {
+			RTE_BOND_LOG(ERR,
+				"%s: Error during getting device (port %u) info: %s\n",
+				__func__, bond_dev->data->port_id,
+				strerror(-ret));
+
+			return ret;
+		}
 
 		internals->mode4.dedicated_queues.rx_qid = bond_info.nb_rx_queues;
 		internals->mode4.dedicated_queues.tx_qid = bond_info.nb_tx_queues;
@@ -2102,6 +2119,8 @@  static void
 bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct bond_dev_private *internals = dev->data->dev_private;
+	struct bond_slave_details slave;
+	int ret;
 
 	uint16_t max_nb_rx_queues = UINT16_MAX;
 	uint16_t max_nb_tx_queues = UINT16_MAX;
@@ -2123,8 +2142,17 @@  bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		uint16_t idx;
 
 		for (idx = 0; idx < internals->slave_count; idx++) {
-			rte_eth_dev_info_get(internals->slaves[idx].port_id,
-					&slave_info);
+			slave = internals->slaves[idx];
+			ret = rte_eth_dev_info_get(slave.port_id, &slave_info);
+			if (ret != 0) {
+				RTE_BOND_LOG(ERR,
+					"%s: Error during getting device (port %u) info: %s\n",
+					__func__,
+					slave.port_id,
+					strerror(-ret));
+
+				return;
+			}
 
 			if (slave_info.max_rx_queues < max_nb_rx_queues)
 				max_nb_rx_queues = slave_info.max_rx_queues;