DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH v2] devargs: fix policy check in rte_eal_devargs_add
Date: Wed,  2 Aug 2017 19:12:07 +0200	[thread overview]
Message-ID: <1da8b8d0c80d7af97ca32c35a0215f99ad2f6666.1501693240.git.gaetan.rivet@6wind.com> (raw)
In-Reply-To: <dfbb11930ec2f85254fe439ec7dfd594a0a6330b.1501664109.git.gaetan.rivet@6wind.com>

Do not fail upon detecting a set bus configuration when adding an
rte_devargs. i.e. adding a blacklisted PCI device while the bus is
configured in whitelist mode.

This failure condition has been introduced when the bus policies
were implemented. This implementation however was meant to strictly
follow the existing API. This check was not and should not be performed
until the current API has been properly deprecated.

Fixes: 02823c1db0bc ("devargs: parse bus policies")

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---

v2:

  - reword commitlog to better explain my intent.

 lib/librte_eal/common/eal_common_devargs.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c
index 33e9f0a..6ac88d6 100644
--- a/lib/librte_eal/common/eal_common_devargs.c
+++ b/lib/librte_eal/common/eal_common_devargs.c
@@ -170,22 +170,12 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)
 	bus = devargs->bus;
 	if (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI)
 		devargs->policy = RTE_DEV_BLACKLISTED;
-	if (devargs->policy == RTE_DEV_WHITELISTED) {
-		if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
+	if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
+		if (devargs->policy == RTE_DEV_WHITELISTED)
 			bus->conf.scan_mode = RTE_BUS_SCAN_WHITELIST;
-		} else if (bus->conf.scan_mode == RTE_BUS_SCAN_BLACKLIST) {
-			fprintf(stderr, "ERROR: incompatible device policy and bus scan mode\n");
-			goto fail;
-		}
-	} else if (devargs->policy == RTE_DEV_BLACKLISTED) {
-		if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
+		else if (devargs->policy == RTE_DEV_BLACKLISTED)
 			bus->conf.scan_mode = RTE_BUS_SCAN_BLACKLIST;
-		} else if (bus->conf.scan_mode == RTE_BUS_SCAN_WHITELIST) {
-			fprintf(stderr, "ERROR: incompatible device policy and bus scan mode\n");
-			goto fail;
-		}
 	}
-
 	TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
 	return 0;
 
-- 
2.1.4

  parent reply	other threads:[~2017-08-02 17:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02  8:55 [dpdk-dev] [PATCH] devargs: fix scan mode configuration in add Gaetan Rivet
2017-08-02 14:32 ` Thomas Monjalon
2017-08-02 15:13   ` Gaëtan Rivet
2017-08-02 17:12 ` Gaetan Rivet [this message]
2017-08-03 19:36   ` [dpdk-dev] [PATCH v2] devargs: fix policy check in rte_eal_devargs_add Thomas Monjalon

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=1da8b8d0c80d7af97ca32c35a0215f99ad2f6666.1501693240.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).