[PATCH] net/bonding: fix device configure reentrancy
Ivan Malov
ivan.malov at oktetlabs.ru
Tue Nov 1 17:18:53 CET 2022
As per report [1], the previous patch for device
configure code apparently overlooks the corner
case of manually adding back-end devices to
the bond using testpmd CLI. The problem is
in removing back-end ports on re-configure
instead of just stopping them. Fix that.
Fixes: 339f1ba51353 ("net/bonding: make configure method re-entrant")
Cc: stable at dpdk.org
[1] https://bugs.dpdk.org/show_bug.cgi?id=1119
Signed-off-by: Ivan Malov <ivan.malov at oktetlabs.ru>
---
drivers/net/bonding/eth_bond_private.h | 2 ++
drivers/net/bonding/rte_eth_bond_pmd.c | 17 ++++++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h
index d067ea8c9a..7171516d0d 100644
--- a/drivers/net/bonding/eth_bond_private.h
+++ b/drivers/net/bonding/eth_bond_private.h
@@ -184,6 +184,8 @@ struct bond_dev_private {
void *vlan_filter_bmpmem; /* enabled vlan filter bitmap */
struct rte_bitmap *vlan_filter_bmp;
+
+ bool kvargs_processing_is_done;
};
extern const struct eth_dev_ops default_dev_ops;
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index dc74852137..bd25040851 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2170,7 +2170,7 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev)
}
static void
-bond_ethdev_cfg_cleanup(struct rte_eth_dev *dev)
+bond_ethdev_cfg_cleanup(struct rte_eth_dev *dev, bool remove)
{
struct bond_dev_private *internals = dev->data->dev_private;
uint16_t bond_port_id = internals->port_id;
@@ -2182,10 +2182,15 @@ bond_ethdev_cfg_cleanup(struct rte_eth_dev *dev)
while (internals->slave_count != skipped) {
uint16_t port_id = internals->slaves[skipped].port_id;
+ int ret;
- if (rte_eth_dev_stop(port_id) != 0) {
+ ret = rte_eth_dev_stop(port_id);
+ if (ret != 0) {
RTE_BOND_LOG(ERR, "Failed to stop device on port %u",
port_id);
+ }
+
+ if (ret != 0 || !remove) {
skipped++;
continue;
}
@@ -2209,7 +2214,7 @@ bond_ethdev_close(struct rte_eth_dev *dev)
RTE_BOND_LOG(INFO, "Closing bonded device %s", dev->device->name);
- bond_ethdev_cfg_cleanup(dev);
+ bond_ethdev_cfg_cleanup(dev, true);
bond_ethdev_free_queues(dev);
rte_bitmap_reset(internals->vlan_filter_bmp);
@@ -3644,7 +3649,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
unsigned i, j;
- bond_ethdev_cfg_cleanup(dev);
+ bond_ethdev_cfg_cleanup(dev, false);
/*
* If RSS is enabled, fill table with default values and
@@ -3733,9 +3738,11 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
* if no kvlist, it means that this bonded device has been created
* through the bonding api.
*/
- if (!kvlist)
+ if (!kvlist || internals->kvargs_processing_is_done)
return 0;
+ internals->kvargs_processing_is_done = true;
+
/* Parse MAC address for bonded device */
arg_count = rte_kvargs_count(kvlist, PMD_BOND_MAC_ADDR_KVARG);
if (arg_count == 1) {
--
2.30.2
More information about the stable
mailing list