DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ilya Maximets <i.maximets@samsung.com>
To: dev@dpdk.org, Declan Doherty <declan.doherty@intel.com>
Cc: Heetae Ahn <heetae82.ahn@samsung.com>,
	Eric Kinzie <ehkinzie@gmail.com>,
	Bernard Iremonger <bernard.iremonger@intel.com>,
	Jan Blunck <jblunck@infradead.org>,
	Ilya Maximets <i.maximets@samsung.com>
Subject: [dpdk-dev] [PATCH] net/bonding: remove all slaves on close
Date: Thu, 06 Apr 2017 14:59:51 +0300	[thread overview]
Message-ID: <1491479991-26802-1-git-send-email-i.maximets@samsung.com> (raw)
In-Reply-To: <CGME20170406120001eucas1p2a05d5006e760aee92254fe462c6c8bd2@eucas1p2.samsung.com>

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 <i.maximets@samsung.com>
---
 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

       reply	other threads:[~2017-04-06 12:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170406120001eucas1p2a05d5006e760aee92254fe462c6c8bd2@eucas1p2.samsung.com>
2017-04-06 11:59 ` Ilya Maximets [this message]
2017-04-14  9:06   ` Declan Doherty
2017-04-14  9:39     ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491479991-26802-1-git-send-email-i.maximets@samsung.com \
    --to=i.maximets@samsung.com \
    --cc=bernard.iremonger@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=ehkinzie@gmail.com \
    --cc=heetae82.ahn@samsung.com \
    --cc=jblunck@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).