From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ilya Maximets Subject: [PATCH] net/bonding: remove all slaves on close Date: Thu, 06 Apr 2017 14:59:51 +0300 Message-ID: <1491479991-26802-1-git-send-email-i.maximets@samsung.com> References: Cc: Heetae Ahn , Eric Kinzie , Bernard Iremonger , Jan Blunck , Ilya Maximets To: dev@dpdk.org, Declan Doherty Return-path: Received: from mailout3.w1.samsung.com (mailout3.w1.samsung.com [210.118.77.13]) by dpdk.org (Postfix) with ESMTP id 6E8F829C7 for ; Thu, 6 Apr 2017 14:00:05 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ONZ00IWWLC3JM90@mailout3.w1.samsung.com> for dev@dpdk.org; Thu, 06 Apr 2017 13:00:03 +0100 (BST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- drivers/net/bonding/rte_eth_bond_pmd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 77d3bee..c398fdb 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1659,7 +1659,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); } -- 2.7.4