From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gaetan Rivet Subject: [PATCH v2 14/18] net/failsafe: keep legacy sub-device declaration Date: Thu, 12 Oct 2017 10:21:21 +0200 Message-ID: References: Cc: Gaetan Rivet To: dev@dpdk.org Return-path: Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id 397152A5D for ; Thu, 12 Oct 2017 10:21:58 +0200 (CEST) Received: by mail-wm0-f52.google.com with SMTP id k4so11007705wmc.1 for ; Thu, 12 Oct 2017 01:21:58 -0700 (PDT) In-Reply-To: In-Reply-To: References: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Allow users to use the same sub-device declaration format. The rte_devargs library now requires the bus name to be prepended to device declarations. While it is possible to use this new format, the transition to the new one can be made smoother. Signed-off-by: Gaetan Rivet --- drivers/net/failsafe/failsafe_args.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index 08ce4ad..0c98264 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -83,12 +84,20 @@ closing_paren(const char *text) static int fs_parse_device(struct sub_device *sdev, char *args) { + struct rte_bus *bus; struct rte_devargs *d; int ret; d = &sdev->devargs; DEBUG("%s", args); - ret = rte_eal_devargs_parse(d, "%s", args); + bus = rte_bus_find_by_device_name(args); + if (bus == NULL) + /* args may contain the bus name */ + ret = rte_eal_devargs_parse(d, "%s", args); + else + /* args is a device name */ + ret = rte_eal_devargs_parse(d, "%s:%s", + bus->name, args); if (ret) { DEBUG("devargs parsing failed with code %d", ret); return ret; -- 2.1.4