[dpdk-dev] [PATCH v2 3/7] net/bonding: check code of allmulticast mode switch

Andrew Rybchenko arybchenko at solarflare.com
Tue Sep 24 14:56:09 CEST 2019


m>
 <1569329773-10185-1-git-send-email-arybchenko at solarflare.com>

From: Ivan Ilchenko <Ivan.Ilchenko at oktetlabs.ru>

rte_eth_allmulticast_enable()/rte_eth_allmulticast_disable() return
value was changed from void to int, so this patch modify usage
of these functions across net/bonding
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko at oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 13 +++++++--
 drivers/net/bonding/rte_eth_bond_pmd.c    | 33 +++++++++++++++++++----
 2 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index fbde57984..e50d946eb 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -929,7 +929,12 @@ bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
 {
 	int ret;
 
-	rte_eth_allmulticast_enable(slave_id);
+	ret = rte_eth_allmulticast_enable(slave_id);
+	if (ret != 0) {
+		RTE_BOND_LOG(ERR,
+			"failed to enable allmulti mode for port %u: %s",
+			slave_id, rte_strerror(-ret));
+	}
 	if (rte_eth_allmulticast_get(slave_id)) {
 		RTE_BOND_LOG(DEBUG, "forced allmulti for port %u",
 			     slave_id);
@@ -963,7 +968,11 @@ bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id)
 	switch (bond_mode_8023ad_ports[slave_id].forced_rx_flags) {
 	case BOND_8023AD_FORCED_ALLMULTI:
 		RTE_BOND_LOG(DEBUG, "unset allmulti for port %u", slave_id);
-		rte_eth_allmulticast_disable(slave_id);
+		ret = rte_eth_allmulticast_disable(slave_id);
+		if (ret != 0)
+			RTE_BOND_LOG(ERR,
+				"failed to disable allmulti mode for port %u: %s",
+				slave_id, rte_strerror(-ret));
 		break;
 
 	case BOND_8023AD_FORCED_PROMISC:
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 060c1ddc3..e1034e7cc 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2647,6 +2647,8 @@ bond_ethdev_allmulticast_enable(struct rte_eth_dev *eth_dev)
 {
 	struct bond_dev_private *internals = eth_dev->data->dev_private;
 	int i;
+	int ret;
+	uint16_t port_id;
 
 	switch (internals->mode) {
 	/* allmulti mode is propagated to all slaves */
@@ -2655,9 +2657,13 @@ bond_ethdev_allmulticast_enable(struct rte_eth_dev *eth_dev)
 	case BONDING_MODE_BROADCAST:
 	case BONDING_MODE_8023AD:
 		for (i = 0; i < internals->slave_count; i++) {
-			uint16_t port_id = internals->slaves[i].port_id;
+			port_id = internals->slaves[i].port_id;
 
-			rte_eth_allmulticast_enable(port_id);
+			ret = rte_eth_allmulticast_enable(port_id);
+			if (ret != 0)
+				RTE_BOND_LOG(ERR,
+					"Failed to enable allmulti mode for port %u: %s",
+					port_id, rte_strerror(-ret));
 		}
 		break;
 	/* allmulti mode is propagated only to primary slave */
@@ -2668,7 +2674,12 @@ bond_ethdev_allmulticast_enable(struct rte_eth_dev *eth_dev)
 		/* Do not touch allmulti when there cannot be primary ports */
 		if (internals->slave_count == 0)
 			break;
-		rte_eth_allmulticast_enable(internals->current_primary_port);
+		port_id = internals->current_primary_port;
+		ret = rte_eth_allmulticast_enable(port_id);
+		if (ret != 0)
+			RTE_BOND_LOG(ERR,
+				"Failed to enable allmulti mode for port %u: %s",
+				port_id, rte_strerror(-ret));
 	}
 }
 
@@ -2677,6 +2688,8 @@ bond_ethdev_allmulticast_disable(struct rte_eth_dev *eth_dev)
 {
 	struct bond_dev_private *internals = eth_dev->data->dev_private;
 	int i;
+	int ret;
+	uint16_t port_id;
 
 	switch (internals->mode) {
 	/* allmulti mode is propagated to all slaves */
@@ -2691,7 +2704,12 @@ bond_ethdev_allmulticast_disable(struct rte_eth_dev *eth_dev)
 			    bond_mode_8023ad_ports[port_id].forced_rx_flags ==
 					BOND_8023AD_FORCED_ALLMULTI)
 				continue;
-			rte_eth_allmulticast_disable(port_id);
+
+			ret = rte_eth_allmulticast_disable(port_id);
+			if (ret != 0)
+				RTE_BOND_LOG(ERR,
+					"Failed to disable allmulti mode for port %u: %s",
+					port_id, rte_strerror(-ret));
 		}
 		break;
 	/* allmulti mode is propagated only to primary slave */
@@ -2702,7 +2720,12 @@ bond_ethdev_allmulticast_disable(struct rte_eth_dev *eth_dev)
 		/* Do not touch allmulti when there cannot be primary ports */
 		if (internals->slave_count == 0)
 			break;
-		rte_eth_allmulticast_disable(internals->current_primary_port);
+		port_id = internals->current_primary_port;
+		ret = rte_eth_allmulticast_disable(port_id);
+		if (ret != 0)
+			RTE_BOND_LOG(ERR,
+				"Failed to disable allmulti mode for port %u: %s",
+				port_id, rte_strerror(-ret));
 	}
 }
 
-- 
2.17.1



More information about the dev mailing list