From patchwork Thu Oct 12 08:21:19 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: 30204 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 1B5E51B223; Thu, 12 Oct 2017 10:22:04 +0200 (CEST) Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id E37852661 for ; Thu, 12 Oct 2017 10:21:55 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id q124so10900775wmb.0 for ; Thu, 12 Oct 2017 01:21:55 -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=rcPhhIpNSYH4XP78EffzmJY8Wo7XogIpEdIEFD0HO8s=; b=btYYNKvUuFGsRquFbSEnzL7KJ0lr+9/uV4iGCh5ZpX6TV7lhYxfz/r3Rrac4Iu5Inb vbjWQ3jUSdkdP1M+m1q3Uwl+Vnyt0qfcfmaA7H5kIZ8U4xnTk4Zjpe1Le+LZeaCOLkHh Jcrysx/hUJL2ZP1XDtOmM864b6/BERxhTLE8jsmYpyVFPYZDZaq7w61Q2Tn0DdDeE01k +u43ZEKbOlezN9IncvaMoE1FDDpO9kKpGKobGL1YKGBTAr9L2z91ugO2mdOj3hqemA/t WNpV1ZYhBnvC+fKU4DQjYtyyVnWPKv1g6pIJH5O0K2UTvSvjE6ROsZzlRN15mzBls2CD An2A== 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=rcPhhIpNSYH4XP78EffzmJY8Wo7XogIpEdIEFD0HO8s=; b=ZxoA69lMtXTAc+D85+JyLQAPczz73hjJ/boxHlj06DX1MMEQW0DoPIrRk5EApHlXoF J9BbVJGQKp2g1y8QHsGkml3hZrrgDfljHaOSSaYnTchlo/SKaZPrQv1RcKdiKXvrnCUI hfWO29OeLD7NIvrHRgbyIIAntSxQUb0A24KBRtXZOIrlmgGQ4BTEMkiRlYHobI5zcJXT 38F2wHZmDInBvpci7Nr5xMnlkVQVZMEhYxfh5mngek/4mUErghofDNAz+0V36htQqBfo BAmUSUW46AgEGJA7jESy+6xphVEAvg4Am7SdfsFYbg/VxzmJflxMblLRD+ZMZeILZC+O 1BOQ== X-Gm-Message-State: AMCzsaU/EAcBTTKJbIlu7YCI+HsEm7DT1AMYAzp9Q/IuUuSpZ2QQP2IS 24eSHxz5EpSbnGIZOLjv2SEO9vio X-Google-Smtp-Source: AOwi7QBUp/vsAz2zVxWXEZulUrmAjIenSBncZmkITBKgNBfE6JAD3Y9XfiWFwcybMySr/kHzWWWI3w== X-Received: by 10.223.156.139 with SMTP id d11mr1307996wre.214.1507796515215; Thu, 12 Oct 2017 01:21:55 -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.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Oct 2017 01:21:54 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 12 Oct 2017 10:21:19 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 12/18] eal: add generic device declaration parameter 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" Add a new generic device declaration parameter: --dev= That allows to declare device from any bus. The format is as follows: device_declaration := [,arg_list] bus := bus name c := arbitrary character separator device := device name (PCI location, virtual PMD name, ...) arg_list := key value list: key1=val1[,key2=val2[,...]] The bus name is mandatory. The character separator can be anything. The device name is mandatory. The argument list is optional. Examples: --dev=pci:0000:05:00.0,port=1 --dev=vdev_net_ring0 Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_options.c | 19 +++++++++++++++++++ lib/librte_eal/common/eal_options.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 603df27..b7591fd 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -95,6 +95,7 @@ eal_long_options[] = { {OPT_PROC_TYPE, 1, NULL, OPT_PROC_TYPE_NUM }, {OPT_SOCKET_MEM, 1, NULL, OPT_SOCKET_MEM_NUM }, {OPT_SYSLOG, 1, NULL, OPT_SYSLOG_NUM }, + {OPT_DEV, 1, NULL, OPT_DEV_NUM }, {OPT_VDEV, 1, NULL, OPT_VDEV_NUM }, {OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM }, {OPT_VMWARE_TSC_MAP, 0, NULL, OPT_VMWARE_TSC_MAP_NUM }, @@ -1120,6 +1121,21 @@ eal_parse_common_option(int opt, const char *optarg, } break; + case OPT_DEV_NUM: { + struct rte_devargs da; + int ret; + + if (rte_eal_devargs_parse(&da, optarg) < 0) + return -1; + ret = rte_bus_probe_mode_set(da.bus->name, + RTE_BUS_PROBE_WHITELIST); + if (ret < 0 && ret != -ENOTSUP) + return -1; + if (eal_option_device_add(NULL, optarg) < 0) + return -1; + } + break; + case OPT_VDEV_NUM: if (eal_option_device_add("vdev", optarg) < 0) return -1; @@ -1271,6 +1287,9 @@ eal_common_usage(void) " -n CHANNELS Number of memory channels\n" " -m MB Memory to allocate (see also --"OPT_SOCKET_MEM")\n" " -r RANKS Force number of memory ranks (don't detect)\n" + " --"OPT_DEV" Declare a device.\n" + " The argument format is [,key=val,...]\n" + " ex: pci:00:00.0,key=val\n" " -b, --"OPT_PCI_BLACKLIST" Add a PCI device in black list.\n" " Prevent EAL from using this PCI device. The argument\n" " format is .\n" diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h index 30e6bb4..d50eff7 100644 --- a/lib/librte_eal/common/eal_options.h +++ b/lib/librte_eal/common/eal_options.h @@ -77,6 +77,8 @@ enum { OPT_SOCKET_MEM_NUM, #define OPT_SYSLOG "syslog" OPT_SYSLOG_NUM, +#define OPT_DEV "dev" + OPT_DEV_NUM, #define OPT_VDEV "vdev" OPT_VDEV_NUM, #define OPT_VFIO_INTR "vfio-intr"