}
}
-static void
+static int
bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev);
static int
rte_eth_stats_reset(internals->slaves[i].port_id);
}
-static void
+static int
bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
{
struct bond_dev_private *internals = eth_dev->data->dev_private;
int i;
+ int ret = 0;
+ uint16_t port_id;
switch (internals->mode) {
/* Promiscuous mode is propagated to all slaves */
case BONDING_MODE_ROUND_ROBIN:
case BONDING_MODE_BALANCE:
case BONDING_MODE_BROADCAST:
- case BONDING_MODE_8023AD:
+ case BONDING_MODE_8023AD: {
+ unsigned int slave_ok = 0;
+
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_promiscuous_enable(port_id);
+ ret = rte_eth_promiscuous_enable(port_id);
+ if (ret != 0)
+ RTE_BOND_LOG(ERR,
+ "Failed to enable promiscuous mode for port %u: %s",
+ port_id, rte_strerror(-ret));
+ else
+ slave_ok++;
}
+ /*
+ * Report success if operation is successful on at least
+ * on one slave. Otherwise return last error code.
+ */
+ if (slave_ok > 0)
+ ret = 0;
break;
+ }
/* Promiscuous mode is propagated only to primary slave */
case BONDING_MODE_ACTIVE_BACKUP:
case BONDING_MODE_TLB:
/* Do not touch promisc when there cannot be primary ports */
if (internals->slave_count == 0)
break;
- rte_eth_promiscuous_enable(internals->current_primary_port);
+ port_id = internals->current_primary_port;
+ ret = rte_eth_promiscuous_enable(port_id);
+ if (ret != 0)
+ RTE_BOND_LOG(ERR,
+ "Failed to enable promiscuous mode for port %u: %s",
+ port_id, rte_strerror(-ret));
}
+
+ return ret;
}
-static void
+static int
bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
{
struct bond_dev_private *internals = dev->data->dev_private;
int i;
+ int ret = 0;
+ uint16_t port_id;
switch (internals->mode) {
/* Promiscuous mode is propagated to all slaves */
case BONDING_MODE_ROUND_ROBIN:
case BONDING_MODE_BALANCE:
case BONDING_MODE_BROADCAST:
- case BONDING_MODE_8023AD:
+ case BONDING_MODE_8023AD: {
+ unsigned int slave_ok = 0;
+
for (i = 0; i < internals->slave_count; i++) {
- uint16_t port_id = internals->slaves[i].port_id;
+ port_id = internals->slaves[i].port_id;
if (internals->mode == BONDING_MODE_8023AD &&
bond_mode_8023ad_ports[port_id].forced_rx_flags ==
- BOND_8023AD_FORCED_PROMISC)
+ BOND_8023AD_FORCED_PROMISC) {
+ slave_ok++;
continue;
- rte_eth_promiscuous_disable(port_id);
+ }
+ ret = rte_eth_promiscuous_disable(port_id);
+ if (ret != 0)
+ RTE_BOND_LOG(ERR,
+ "Failed to disable promiscuous mode for port %u: %s",
+ port_id, rte_strerror(-ret));
+ else
+ slave_ok++;
}
+ /*
+ * Report success if operation is successful on at least
+ * on one slave. Otherwise return last error code.
+ */
+ if (slave_ok > 0)
+ ret = 0;
break;
+ }
/* Promiscuous mode is propagated only to primary slave */
case BONDING_MODE_ACTIVE_BACKUP:
case BONDING_MODE_TLB:
/* Do not touch promisc when there cannot be primary ports */
if (internals->slave_count == 0)
break;
- rte_eth_promiscuous_disable(internals->current_primary_port);
+ port_id = internals->current_primary_port;
+ ret = rte_eth_promiscuous_disable(port_id);
+ if (ret != 0)
+ RTE_BOND_LOG(ERR,
+ "Failed to disable promiscuous mode for port %u: %s",
+ port_id, rte_strerror(-ret));
}
+
+ return ret;
}
static void