From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH v1 4/8] bus: add probe mode setter
Date: Thu, 12 Oct 2017 10:18:26 +0200 [thread overview]
Message-ID: <b197aae84700de4e2c7a1ab9e42066544c769aa7.1507796085.git.gaetan.rivet@6wind.com> (raw)
In-Reply-To: <cover.1507796085.git.gaetan.rivet@6wind.com>
In-Reply-To: <cover.1507796085.git.gaetan.rivet@6wind.com>
Introduce new rte_bus operation to configure the probe policy.
Implementation is required from buses interested in supporting
this configuration element.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
lib/librte_eal/common/eal_common_bus.c | 24 ++++++++++++++++++++++++
lib/librte_eal/common/eal_common_options.c | 17 ++++-------------
lib/librte_eal/common/include/rte_bus.h | 16 ++++++++++++++++
3 files changed, 44 insertions(+), 13 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
index 65d7229..5b155c6 100644
--- a/lib/librte_eal/common/eal_common_bus.c
+++ b/lib/librte_eal/common/eal_common_bus.c
@@ -120,6 +120,30 @@ rte_bus_probe(void)
return 0;
}
+/* Configure the probing policy of a bus */
+int
+rte_bus_probe_mode_set(const char *busname,
+ enum rte_bus_probe_mode mode)
+{
+ struct rte_bus *bus;
+ rte_bus_ctrl_t probe_mode_set;
+
+ bus = rte_bus_find_by_name(busname);
+ if (bus == NULL) {
+ RTE_LOG(ERR, EAL, "Bus %s not found.\n",
+ busname);
+ return -EFAULT;
+ }
+ probe_mode_set = bus->ctrl(RTE_BUS_CTRL_SET,
+ RTE_BUS_CTRL_PROBE_MODE);
+ if (probe_mode_set == NULL) {
+ RTE_LOG(ERR, EAL, "Bus %s: probe policy cannot be configured.\n",
+ busname);
+ return -ENOTSUP;
+ }
+ return probe_mode_set(&mode);
+}
+
/* Dump information of a single bus */
static int
bus_dump_one(FILE *f, struct rte_bus *bus)
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index e40c049..630c9d2 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -997,29 +997,24 @@ int
eal_parse_common_option(int opt, const char *optarg,
struct internal_config *conf)
{
- static int b_used;
- static int w_used;
-
switch (opt) {
/* blacklist */
case 'b':
- if (w_used)
- goto bw_used;
+ if (rte_bus_probe_mode_set("pci", RTE_BUS_PROBE_BLACKLIST) < 0)
+ return -1;
if (eal_option_device_add(RTE_DEVTYPE_BLACKLISTED_PCI,
optarg) < 0) {
return -1;
}
- b_used = 1;
break;
/* whitelist */
case 'w':
- if (b_used)
- goto bw_used;
+ if (rte_bus_probe_mode_set("pci", RTE_BUS_PROBE_WHITELIST) < 0)
+ return -1;
if (eal_option_device_add(RTE_DEVTYPE_WHITELISTED_PCI,
optarg) < 0) {
return -1;
}
- w_used = 1;
break;
/* coremask */
case 'c':
@@ -1165,10 +1160,6 @@ eal_parse_common_option(int opt, const char *optarg,
}
return 0;
-bw_used:
- RTE_LOG(ERR, EAL, "Options blacklist (-b) and whitelist (-w) "
- "cannot be used at the same time\n");
- return -1;
}
static void
diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
index a8fb6b1..93108ce 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -289,6 +289,22 @@ int rte_bus_scan(void);
int rte_bus_probe(void);
/**
+ * Configure bus probe policy.
+ *
+ * @param busname
+ * Name of the bus to configure.
+ *
+ * @param mode
+ * Configure the designated bus probe policy to this value.
+ *
+ * @return
+ * 0 on success
+ * !0 otherwise
+ */
+int rte_bus_probe_mode_set(const char *busname,
+ enum rte_bus_probe_mode mode);
+
+/**
* Dump information of all the buses registered with EAL.
*
* @param f
--
2.1.4
next prev parent reply other threads:[~2017-10-12 8:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 8:18 [dpdk-dev] [PATCH v1 0/8] Bus control framework Gaetan Rivet
2017-10-12 8:18 ` [dpdk-dev] [PATCH v1 1/8] bus: rename scan policy as probe policy Gaetan Rivet
2017-10-12 8:18 ` [dpdk-dev] [PATCH v1 2/8] bus: introduce opaque control framework Gaetan Rivet
2017-12-11 12:00 ` Shreyansh Jain
2017-12-11 12:43 ` Gaëtan Rivet
2017-12-11 13:36 ` Shreyansh Jain
2017-12-11 14:38 ` Gaëtan Rivet
2017-12-12 7:21 ` Shreyansh Jain
2017-10-12 8:18 ` [dpdk-dev] [PATCH v1 3/8] bus: remove probe mode configuration structure Gaetan Rivet
2017-10-12 8:18 ` Gaetan Rivet [this message]
2017-12-11 12:39 ` [dpdk-dev] [PATCH v1 4/8] bus: add probe mode setter Shreyansh Jain
2017-12-11 12:43 ` Shreyansh Jain
2017-10-12 8:18 ` [dpdk-dev] [PATCH v1 5/8] bus/pci: implement ctrl operator Gaetan Rivet
2017-10-12 8:18 ` [dpdk-dev] [PATCH v1 6/8] bus: add IOVA mode as a ctrl operation Gaetan Rivet
2017-10-12 8:18 ` [dpdk-dev] [PATCH v1 7/8] bus/pci: implement IOVA mode getter Gaetan Rivet
2017-10-12 8:18 ` [dpdk-dev] [PATCH v1 8/8] bus: remove redundant " Gaetan Rivet
2017-12-11 11:53 ` [dpdk-dev] [PATCH v1 0/8] Bus control framework Shreyansh Jain
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=b197aae84700de4e2c7a1ab9e42066544c769aa7.1507796085.git.gaetan.rivet@6wind.com \
--to=gaetan.rivet@6wind.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).