net/bonding: check code of promiscuous mode switch

rte_eth_promiscuous_enable()/rte_eth_promiscuous_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@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
This commit is contained in:
Ivan Ilchenko 2019-09-14 12:37:23 +01:00 committed by Ferruh Yigit
parent 6f6d5d2191
commit ae9f487f2e
2 changed files with 43 additions and 8 deletions

View File

@ -913,6 +913,8 @@ bond_mode_8023ad_periodic_cb(void *arg)
static int
bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
{
int ret;
rte_eth_allmulticast_enable(slave_id);
if (rte_eth_allmulticast_get(slave_id)) {
RTE_BOND_LOG(DEBUG, "forced allmulti for port %u",
@ -922,7 +924,12 @@ bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
return 0;
}
rte_eth_promiscuous_enable(slave_id);
ret = rte_eth_promiscuous_enable(slave_id);
if (ret != 0) {
RTE_BOND_LOG(ERR,
"failed to enable promiscuous mode for port %u: %s",
slave_id, rte_strerror(-ret));
}
if (rte_eth_promiscuous_get(slave_id)) {
RTE_BOND_LOG(DEBUG, "forced promiscuous for port %u",
slave_id);
@ -937,6 +944,8 @@ bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
static void
bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id)
{
int ret;
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);
@ -945,7 +954,11 @@ bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id)
case BOND_8023AD_FORCED_PROMISC:
RTE_BOND_LOG(DEBUG, "unset promisc for port %u", slave_id);
rte_eth_promiscuous_disable(slave_id);
ret = rte_eth_promiscuous_disable(slave_id);
if (ret != 0)
RTE_BOND_LOG(ERR,
"failed to disable promiscuous mode for port %u: %s",
slave_id, rte_strerror(-ret));
break;
default:

View File

@ -2487,6 +2487,8 @@ 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 */
@ -2495,9 +2497,13 @@ bond_ethdev_promiscuous_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_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));
}
break;
/* Promiscuous mode is propagated only to primary slave */
@ -2508,7 +2514,12 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
/* 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));
}
}
@ -2517,6 +2528,8 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
{
struct bond_dev_private *internals = dev->data->dev_private;
int i;
int ret;
uint16_t port_id;
switch (internals->mode) {
/* Promiscuous mode is propagated to all slaves */
@ -2525,13 +2538,17 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *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;
if (internals->mode == BONDING_MODE_8023AD &&
bond_mode_8023ad_ports[port_id].forced_rx_flags ==
BOND_8023AD_FORCED_PROMISC)
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));
}
break;
/* Promiscuous mode is propagated only to primary slave */
@ -2542,7 +2559,12 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
/* 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));
}
}