From: Ilya Maximets Date: Thu, 6 Apr 2017 11:59:51 +0000 (+0300) Subject: net/bonding: remove all slaves on close X-Git-Tag: spdx-start~3529 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=01c0eae742fe524d517ab9b0fe255b5847faa992;p=dpdk.git net/bonding: remove all slaves on close Some applications like OVS knows nothing about the device type and wants to use same API to work with all of them. But bond_pmd, unlike other pmds, requires additional step (removing of all the slaves) before closing the device. In fact that bond_pmd automatically adds all the devices from kvargs to bonding on configuration it also should remove all of them on close. This change is intended to have the same API for physical and virtual devices. It allows us to handle virtual devices in OVS in a common way. Signed-off-by: Ilya Maximets Acked-by: Declan Doherty --- diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 2ddcd0791a..5fd733c1f4 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1661,7 +1661,22 @@ void bond_ethdev_close(struct rte_eth_dev *dev) { struct bond_dev_private *internals = dev->data->dev_private; + uint8_t bond_port_id = internals->port_id; + int skipped = 0; + RTE_LOG(INFO, EAL, "Closing bonded device %s\n", dev->data->name); + while (internals->slave_count != skipped) { + uint8_t port_id = internals->slaves[skipped].port_id; + + rte_eth_dev_stop(port_id); + + if (rte_eth_bond_slave_remove(bond_port_id, port_id) != 0) { + RTE_LOG(ERR, EAL, + "Failed to remove port %d from bonded device " + "%s\n", port_id, dev->data->name); + skipped++; + } + } bond_ethdev_free_queues(dev); rte_bitmap_reset(internals->vlan_filter_bmp); }