From patchwork Thu Oct 12 08:21:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABtan_Rivet?= X-Patchwork-Id: 30193 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EFC817CE1; Thu, 12 Oct 2017 10:21:45 +0200 (CEST) Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id CCC61107A for ; Thu, 12 Oct 2017 10:21:42 +0200 (CEST) Received: by mail-wm0-f54.google.com with SMTP id q132so10996163wmd.2 for ; Thu, 12 Oct 2017 01:21:42 -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=smergVKxR3b0vEnaxBFNmXCH/dlEpXOvcJfcfnpK43Q=; b=nEJNm2vGDLrhKfAzpcHJtMFy8TznihGZYZdoQefIWYzUz/WsD+M6KnjxQ57FNyAdVA O6ANU8JRvN8zxtYtiRzjYosjdyVCvKS0i29v53yoXf447a1v4cwV57sbijNo+GBVrbT2 XSrtJcETMf+Ee34b7jGYEkgltSuQNdlXWGUzuWU4pjgxWG4GJhmBJsxU/P0Mk/8YIbcE XWDqq1DaFpYEc77SsDosQlj3t3KLVyOSYjqchP01tNvmQpr1m32DYTSHFlJWB+RPUX7d pILEZryqLlsERNNPJkFlwCxgyYTqjoand9QwQJ0HPfHX7vdWNJiy4VHKbMnnN6WhoRbM ShLA== 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=smergVKxR3b0vEnaxBFNmXCH/dlEpXOvcJfcfnpK43Q=; b=t8dH+hg1VoprCeHVlMHTUPmtElkoO8R0HUFIK8YooS6SSaBIfsX1ulug4s3h/G0kuL m1KT/1dPY/L8VhdGOr5YJKezld1SNDKpChHsMC1FNJ0HHDjAH/0u0VaD8s4sQNjcrvpz 2tPHwQWWhBR2HVtOFwvJqZDmSOziJqCM4FAHGbbXTNkjtStAETl29zTIVxQd3FeG0R8i dUQRIcAvaRCNugoj6EcGVvMor2tZ1LNCurELamKaWWY+lNGeDZzGOW2C/VWk1SPC4mTg CO6wIcv1tJErQf8onu4QMnWQQEK57rUllC+rE7ON7gg//lbqJhcwbIV/MxrOqviszFe0 /fJA== X-Gm-Message-State: AMCzsaXJpiDVEfe8Lqqmd74UepLvurF1pY5bi4UuU2isvM1vMmW/BDhv ePXjE/hSaXKR8Np4fk+/0yiOoggm X-Google-Smtp-Source: AOwi7QCfW1rOUhtnlD3zY3cbGrLM0crmtvhE1X8IPs5MdlsYDeEX8cKJbKCUTFnrhGzim4h/UGZAPw== X-Received: by 10.28.0.66 with SMTP id 63mr1086844wma.7.1507796502174; Thu, 12 Oct 2017 01:21:42 -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 200sm19424728wmu.44.2017.10.12.01.21.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Oct 2017 01:21:41 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 12 Oct 2017 10:21:08 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 01/18] eal: prepend busname on legacy device declaration 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Legacy device options (-b, -w, --vdev) need to prepend their bus name to user parameters for backward compatibility. Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_options.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 630c9d2..d57cb5d 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -143,13 +143,16 @@ static int mem_parsed; static int core_parsed; static int -eal_option_device_add(enum rte_devtype type, const char *optarg) +eal_option_device_add(enum rte_devtype type, + const char *busname, const char *optarg) { struct device_option *devopt; size_t optlen; int ret; optlen = strlen(optarg) + 1; + if (busname != NULL) + optlen += strlen(optarg) + 1; devopt = calloc(1, sizeof(*devopt) + optlen); if (devopt == NULL) { RTE_LOG(ERR, EAL, "Unable to allocate device option\n"); @@ -157,7 +160,11 @@ eal_option_device_add(enum rte_devtype type, const char *optarg) } devopt->type = type; - ret = snprintf(devopt->arg, optlen, "%s", optarg); + if (busname != NULL) + ret = snprintf(devopt->arg, optlen, "%s:%s", + busname, optarg); + else + ret = snprintf(devopt->arg, optlen, "%s", optarg); if (ret < 0) { RTE_LOG(ERR, EAL, "Unable to copy device option\n"); free(devopt); @@ -1003,7 +1010,7 @@ eal_parse_common_option(int opt, const char *optarg, 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) { + "pci", optarg) < 0) { return -1; } break; @@ -1012,7 +1019,7 @@ eal_parse_common_option(int opt, const char *optarg, 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) { + "pci", optarg) < 0) { return -1; } break; @@ -1122,7 +1129,7 @@ eal_parse_common_option(int opt, const char *optarg, case OPT_VDEV_NUM: if (eal_option_device_add(RTE_DEVTYPE_VIRTUAL, - optarg) < 0) { + "vdev", optarg) < 0) { return -1; } break;