From: Tomasz Kulasek <tomaszx.kulasek@intel.com>
To: dev@dpdk.org
Cc: daniel.verkamp@intel.com, james.r.harris@intel.com,
shuhei.matsumoto.xt@hitachi.com, dariuszx.stojaczyk@intel.com,
jblunck@infradead.org
Subject: [dpdk-dev] [PATCH] eal: fix whitelists for hot plug devices
Date: Fri, 31 Aug 2018 20:42:59 +0200 [thread overview]
Message-ID: <20180831184259.14804-1-tomaszx.kulasek@intel.com> (raw)
Currently white/blacklists doesn't work for hotplugged devices.
This patch checks if device is on the blacklist before attempting
to attach it.
Fixes: a3ee360f4440 ("eal: add hotplug add/remove device")
Cc: jblunck@infradead.org
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
---
lib/librte_eal/common/eal_common_dev.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 678dbca..5f4b600 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -147,6 +147,30 @@ int __rte_experimental rte_eal_hotplug_add(const char *busname, const char *devn
return -ENOTSUP;
}
+ /* Check if device is blacklisted */
+ if (bus->conf.scan_mode == RTE_BUS_SCAN_WHITELIST)
+ ret = -EINVAL;
+ else
+ ret = 0;
+
+ da = NULL;
+ do {
+ da = rte_devargs_next(busname, da);
+ if (da != NULL && strcmp(da->name, devname) == 0) {
+ if (da->policy == RTE_DEV_BLACKLISTED)
+ ret = -EINVAL;
+ else
+ ret = 0;
+ break;
+ }
+ } while (da != NULL);
+
+ if (ret) {
+ RTE_LOG(INFO, EAL, " Device is blacklisted (%s)\n",
+ devname);
+ return ret;
+ }
+
da = calloc(1, sizeof(*da));
if (da == NULL)
return -ENOMEM;
--
2.7.4
next reply other threads:[~2018-08-31 18:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-31 18:42 Tomasz Kulasek [this message]
2018-08-31 21:26 ` Gaëtan Rivet
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=20180831184259.14804-1-tomaszx.kulasek@intel.com \
--to=tomaszx.kulasek@intel.com \
--cc=daniel.verkamp@intel.com \
--cc=dariuszx.stojaczyk@intel.com \
--cc=dev@dpdk.org \
--cc=james.r.harris@intel.com \
--cc=jblunck@infradead.org \
--cc=shuhei.matsumoto.xt@hitachi.com \
/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).