DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bernard Iremonger <bernard.iremonger@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/2] bonding: fix detach of bonded device
Date: Wed, 10 Feb 2016 10:13:44 +0000	[thread overview]
Message-ID: <1455099225-7731-2-git-send-email-bernard.iremonger@intel.com> (raw)
In-Reply-To: <1455099225-7731-1-git-send-email-bernard.iremonger@intel.com>

Check that the bonded device has no slaves before detaching it.

Fixes: 8d30fe7fa737 ("bonding: support port hotplug")
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/bonding/rte_eth_bond_api.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 8a000c8..484a6f3 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -277,6 +277,7 @@ int
 rte_eth_bond_free(const char *name)
 {
 	struct rte_eth_dev *eth_dev = NULL;
+	struct bond_dev_private *internals;
 
 	/* now free all data allocation - for eth_dev structure,
 	 * dummy pci driver and internal (private) data
@@ -287,6 +288,10 @@ rte_eth_bond_free(const char *name)
 	if (eth_dev == NULL)
 		return -ENODEV;
 
+	internals = eth_dev->data->dev_private;
+	if (internals->slave_count != 0)
+		return -EBUSY;
+
 	if (eth_dev->data->dev_started == 1) {
 		bond_ethdev_stop(eth_dev);
 		bond_ethdev_close(eth_dev);
-- 
2.6.3

  reply	other threads:[~2016-02-10 10:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-10 10:13 [dpdk-dev] [PATCH 0/2] bonding fixes Bernard Iremonger
2016-02-10 10:13 ` Bernard Iremonger [this message]
2016-02-10 10:13 ` [dpdk-dev] [PATCH 2/2] bonding: fix detach of bonded slave devices Bernard Iremonger
2016-02-22 13:20 ` [dpdk-dev] [PATCH 0/2] bonding fixes Doherty, Declan
2016-02-26 17:48   ` Bruce Richardson

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=1455099225-7731-2-git-send-email-bernard.iremonger@intel.com \
    --to=bernard.iremonger@intel.com \
    --cc=dev@dpdk.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).