From ae9f487f2ea463eac4424d7ca19bcb18a9287906 Mon Sep 17 00:00:00 2001 From: Ivan Ilchenko Date: Sat, 14 Sep 2019 12:37:23 +0100 Subject: [PATCH] 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 Signed-off-by: Andrew Rybchenko --- drivers/net/bonding/rte_eth_bond_8023ad.c | 17 ++++++++++-- drivers/net/bonding/rte_eth_bond_pmd.c | 34 +++++++++++++++++++---- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index fbc69051a9..7189a84585 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -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: diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index a994c9abd2..edf660db34 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -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)); } } -- 2.20.1