From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f179.google.com (mail-wr0-f179.google.com [209.85.128.179]) by dpdk.org (Postfix) with ESMTP id 960887CDA for ; Wed, 12 Jul 2017 01:26:01 +0200 (CEST) Received: by mail-wr0-f179.google.com with SMTP id k67so9800347wrc.2 for ; Tue, 11 Jul 2017 16:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=FR3jSxEONUlTjZbU+RBJTEiz1ZWM7cSVL3i/pylStqY=; b=T4w2ShchtezaKbwTQNEHMZZGrkfeEWSPmGYIzlS0RaCW347jhPf/IDGgJd7qvX85rd MbCaX8CaL7K7BhpkriF5uB+eXqwOEqvijjZDg9FIDq/yQTzdySr25ZIDZoT71GNcygnQ RcLFUT1yklnG/99drYlfYTOGCr8tmw8TEXK5KLMEFWFtRmMOqE2jYl1gcOvCYwn41RGV Jwm0xQpQH4cdydxf8Q2Rc30/nNG1+a5MB4Oj9PuBd6cBdfJFLBPppoT/SHdTPK682C8e aaJAyjWZsNTRB2d2Vlz0PWS3fiaWIUS5HHtVKjEIAjxeqnOpjB0d/ROpljisMk1reiH2 oHTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=FR3jSxEONUlTjZbU+RBJTEiz1ZWM7cSVL3i/pylStqY=; b=J8BhVLe0LyCNtOhzj4fMgqxAenYa0Rg3IZV0gUX7Za8t1q4WUIHO629t+zmn6FxvXr a5GkkS2822L/AGBrxQGnT7Du7089q/YKq+BM1hkcSHBAAjm+jruqVxFRvM/qNro9xS9K 7IELIW30fI3SIFDGyD3uuC8FtOp9q/Hak5fhFmzjztVKmKVwzIr86v0kAkC7dRdEnvuk Hsos8Lx2HfKiqmv0GJ5eKgVUZIvloZOtyuXIPqU0r43XWCfJbInbFkvMb/ualQG7zhGU IhVjIFGGRZaRakgAvqYU+wfMVZtwC0adlSaBWHi24VWcfztFRvGnvW5dELxfFdkpnAgr iXYw== X-Gm-Message-State: AIVw113DYF/QmPC7EAq9cAosrZJCjppUQ+zm44b8o/8kU3UlEerpK4zO loq7ZtRShjPjXeNGE6A= X-Received: by 10.28.51.212 with SMTP id z203mr428240wmz.103.1499815560988; Tue, 11 Jul 2017 16:26:00 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 66sm407576wmj.29.2017.07.11.16.25.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Jul 2017 16:26:00 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 12 Jul 2017 01:25:37 +0200 Message-Id: <9885513c0b9107505bc8c61a40a1236533e9b7b4.1499814957.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 3/8] devargs: introduce insert function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 23:26:02 -0000 Some buses will operate either in whitelist or blacklist mode. This mode is currently passed down by the rte_eal_devargs_add function with the devtype argument. When inserting devices using the hotplug API, the implicit assumption is that this device is being whitelisted, meaning that it is explicitly requested by the application to be used. This can conflict with the initial bus configuration. While the rte_eal_devargs_add API is being deprecated soon, it cannot be modified at the moment to accomodate this situation. As such, this new experimental API offers a bare interface for inserting rte_devargs without directly manipulating the global rte_devargs list. This new function expects a fully-formed rte_devargs, previously parsed and allocated. It does not check whether the new rte_devargs is compatible with current bus configuration, but will replace any eventual existing one for the same device, allowing the hotplug operation to proceed. i.e. a previously blacklisted device can be redefined as being whitelisted. Signed-off-by: Gaetan Rivet --- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 + lib/librte_eal/common/eal_common_devargs.c | 12 ++++++++++++ lib/librte_eal/common/include/rte_devargs.h | 13 +++++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + 4 files changed, 27 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 40cd523..8b24309 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -206,6 +206,7 @@ DPDK_17.08 { EXPERIMENTAL { global: + rte_eal_devargs_insert; rte_eal_devargs_parse; rte_eal_devargs_remove; rte_eal_hotplug_add; diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index bcdee13..ff6c2a8 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -138,6 +138,18 @@ rte_eal_devargs_parse(const char *dev, struct rte_devargs *da) return 0; } +int +rte_eal_devargs_insert(struct rte_devargs *da) +{ + int ret; + + ret = rte_eal_devargs_remove(da->bus->name, da->name); + if (ret < 0) + return ret; + TAILQ_INSERT_TAIL(&devargs_list, da, next); + return 0; +} + /* store a whitelist parameter for later parsing */ int rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h index 36453b6..7b63fa3 100644 --- a/lib/librte_eal/common/include/rte_devargs.h +++ b/lib/librte_eal/common/include/rte_devargs.h @@ -139,6 +139,19 @@ rte_eal_devargs_parse(const char *dev, struct rte_devargs *da); /** + * Insert an rte_devargs in the global list. + * + * @param da + * The devargs structure to insert. + * + * @return + * - 0 on success + * - Negative on error. + */ +int +rte_eal_devargs_insert(struct rte_devargs *da); + +/** * Add a device to the user device list * * For PCI devices, the format of arguments string is "PCI_ADDR" or diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index a8ee349..81f6af3 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -211,6 +211,7 @@ DPDK_17.08 { EXPERIMENTAL { global: + rte_eal_devargs_insert; rte_eal_devargs_parse; rte_eal_devargs_remove; rte_eal_hotplug_add; -- 2.1.4