From patchwork Thu Oct 12 08:21:09 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: 30194 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 16F781AF03; Thu, 12 Oct 2017 10:21:47 +0200 (CEST) Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 203EE4C57 for ; Thu, 12 Oct 2017 10:21:44 +0200 (CEST) Received: by mail-wm0-f43.google.com with SMTP id q124so10899337wmb.0 for ; Thu, 12 Oct 2017 01:21:44 -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=tHX+FvIWYyOnOjxgN2C158uicDOIxQBb1Ur8oo49Xbg=; b=FUZMKcKHdP48MkkZJB7yfOpcTgXWeA0jidJYVM6Foa8kY/33LetBKjQkg6SxfjXVPu 2r5YzrWkbgrXmgCU4FKxDkF1y4BJ8TLr1DwK9VY9Ri8THKyFEOkF3oxVxLzTxHSitzGA k4aIDSvQI6mcvtAICHcVXEWrngSVQH0xuBsFz/RL4CuYsk9AmfsNv8sJbqIGQcrHuKu3 hjoXVrDAbjsYzbGcDjuqPfsk9qUufSblhDVDePx91InKnREjHsQ+BJuXcPTxnb4tAdHc xdmAFHbNnOnD33RpsDGf4Qyx8Zb+PoXcg4rem29OUN/YU5S0kBOYEPp/TUfRqoVqKetI vnsg== 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=tHX+FvIWYyOnOjxgN2C158uicDOIxQBb1Ur8oo49Xbg=; b=cmt/pqH1yPHxD5lWeASC0L9s+8H1QcYvzLUoIVM9p2Nki/G+hcAMpqNabA8fMcQ6Aq cIhUTGTdZstvJeaEAzKktwpjo95B8NMnsv40I57khQxSKVbecV7BtDeGPcCFBS/WwBF0 8dVvMMdo8Vc9X6Xurx/SwPiascCkYcBmSvd0Cqvyjlv47i0kY5eAEaTXAIaQ9u10TOV7 J6Y2bN5ofwiG9fqHQ15DGFyQPHI1bvEappeUZ5yOplN6OLAkDXvahuP9e5ZVuvGz4N0J tZHYhS8KRH9uA2GaL0ue9RKjFioQF2pZUcpmHwUtFhrgw4mG4GLjYKLmhzOwwEqg2os/ 7zzA== X-Gm-Message-State: AMCzsaWZz1QKO776Hlrfko+U0yvH7j07CH4PoGiDtMyKiar/Rfb1aAYA +9UcKbiB1YZK3ZIs4wVtYH0fpsIN X-Google-Smtp-Source: AOwi7QBNT9WJ2jrbCSE1UQN7/k/+DNl4+wmf0iKgIqwCdy4cjnO8Gp8R/1sUUfkUlmP+D0OiPgJsLA== X-Received: by 10.28.4.135 with SMTP id 129mr1137037wme.34.1507796503278; Thu, 12 Oct 2017 01:21:43 -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.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Oct 2017 01:21:42 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 12 Oct 2017 10:21:09 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 02/18] eal: remove generic devtype 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" The devtype is now entirely defined by the device bus. As such, it is already characterized by the bus identifier within an rte_devargs. The rte_devtype enum can disappear, along with crutches added during this transition. rte_eal_devargs_type_count becomes useless and is removed. Signed-off-by: Gaetan Rivet --- drivers/bus/pci/pci_common.c | 16 ++------------ lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 - lib/librte_eal/common/eal_common_devargs.c | 20 +---------------- lib/librte_eal/common/eal_common_options.c | 19 +++++----------- lib/librte_eal/common/include/rte_dev.h | 8 ------- lib/librte_eal/common/include/rte_devargs.h | 29 +------------------------ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 - 7 files changed, 9 insertions(+), 85 deletions(-) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index bbe862b..5fbcf11 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -172,15 +172,6 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, loc->domain, loc->bus, loc->devid, loc->function, dev->device.numa_node); - /* no initialization when blacklisted, return without error */ - if (dev->device.devargs != NULL && - dev->device.devargs->policy == - RTE_DEV_BLACKLISTED) { - RTE_LOG(INFO, EAL, " Device is blacklisted, not" - " initializing\n"); - return 1; - } - if (dev->device.numa_node < 0) { RTE_LOG(WARNING, EAL, " Invalid NUMA socket, default to 0\n"); dev->device.numa_node = 0; @@ -380,11 +371,8 @@ rte_pci_probe(void) probed++; devargs = dev->device.devargs; - /* probe all or only whitelisted devices */ - if (probe_all) - ret = pci_probe_all_drivers(dev); - else if (devargs != NULL && - devargs->policy == RTE_DEV_WHITELISTED) + /* probe all or only declared devices */ + if (probe_all ^ (devargs != NULL)) ret = pci_probe_all_drivers(dev); if (ret < 0) { RTE_LOG(ERR, EAL, "Requested device " PCI_PRI_FMT diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 573869a..47416a5 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -22,7 +22,6 @@ DPDK_2.0 { rte_eal_alarm_set; rte_eal_devargs_add; rte_eal_devargs_dump; - rte_eal_devargs_type_count; rte_eal_get_configuration; rte_eal_get_lcore_state; rte_eal_get_physmem_layout; diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index e371456..2fddbfa 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -153,7 +153,7 @@ rte_eal_devargs_insert(struct rte_devargs *da) /* store a whitelist parameter for later parsing */ int -rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) +rte_eal_devargs_add(const char *devargs_str) { struct rte_devargs *devargs = NULL; const char *dev = devargs_str; @@ -165,9 +165,6 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) if (rte_eal_devargs_parse(dev, devargs)) goto fail; - devargs->type = devtype; - if (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) - devargs->policy = RTE_DEV_BLACKLISTED; TAILQ_INSERT_TAIL(&devargs_list, devargs, next); return 0; @@ -198,21 +195,6 @@ rte_eal_devargs_remove(const char *busname, const char *devname) return 1; } -/* count the number of devices of a specified type */ -unsigned int -rte_eal_devargs_type_count(enum rte_devtype devtype) -{ - struct rte_devargs *devargs; - unsigned int count = 0; - - TAILQ_FOREACH(devargs, &devargs_list, next) { - if (devargs->type != devtype) - continue; - count++; - } - return count; -} - /* dump the user devices on the console */ void rte_eal_devargs_dump(FILE *f) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index d57cb5d..603df27 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -131,7 +131,6 @@ TAILQ_HEAD(device_option_list, device_option); struct device_option { TAILQ_ENTRY(device_option) next; - enum rte_devtype type; char arg[]; }; @@ -143,8 +142,7 @@ static int mem_parsed; static int core_parsed; static int -eal_option_device_add(enum rte_devtype type, - const char *busname, const char *optarg) +eal_option_device_add(const char *busname, const char *optarg) { struct device_option *devopt; size_t optlen; @@ -159,7 +157,6 @@ eal_option_device_add(enum rte_devtype type, return -ENOMEM; } - devopt->type = type; if (busname != NULL) ret = snprintf(devopt->arg, optlen, "%s:%s", busname, optarg); @@ -183,7 +180,7 @@ eal_option_device_parse(void) TAILQ_FOREACH_SAFE(devopt, &devopt_list, next, tmp) { if (ret == 0) { - ret = rte_eal_devargs_add(devopt->type, devopt->arg); + ret = rte_eal_devargs_add(devopt->arg); if (ret) RTE_LOG(ERR, EAL, "Unable to parse device '%s'\n", devopt->arg); @@ -1009,19 +1006,15 @@ eal_parse_common_option(int opt, const char *optarg, case 'b': if (rte_bus_probe_mode_set("pci", RTE_BUS_PROBE_BLACKLIST) < 0) return -1; - if (eal_option_device_add(RTE_DEVTYPE_BLACKLISTED_PCI, - "pci", optarg) < 0) { + if (eal_option_device_add("pci", optarg) < 0) return -1; - } break; /* whitelist */ case 'w': if (rte_bus_probe_mode_set("pci", RTE_BUS_PROBE_WHITELIST) < 0) return -1; - if (eal_option_device_add(RTE_DEVTYPE_WHITELISTED_PCI, - "pci", optarg) < 0) { + if (eal_option_device_add("pci", optarg) < 0) return -1; - } break; /* coremask */ case 'c': @@ -1128,10 +1121,8 @@ eal_parse_common_option(int opt, const char *optarg, break; case OPT_VDEV_NUM: - if (eal_option_device_add(RTE_DEVTYPE_VIRTUAL, - "vdev", optarg) < 0) { + if (eal_option_device_add("vdev", optarg) < 0) return -1; - } break; case OPT_SYSLOG_NUM: diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index 4c4ac7e..5f090ed 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -127,14 +127,6 @@ enum rte_kernel_driver { }; /** - * Device policies. - */ -enum rte_dev_policy { - RTE_DEV_WHITELISTED, - RTE_DEV_BLACKLISTED, -}; - -/** * A generic memory resource representation. */ struct rte_mem_resource { diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h index 58d585d..e50c166 100644 --- a/lib/librte_eal/common/include/rte_devargs.h +++ b/lib/librte_eal/common/include/rte_devargs.h @@ -53,15 +53,6 @@ extern "C" { #include /** - * Type of generic device - */ -enum rte_devtype { - RTE_DEVTYPE_WHITELISTED_PCI, - RTE_DEVTYPE_BLACKLISTED_PCI, - RTE_DEVTYPE_VIRTUAL, -}; - -/** * Structure that stores a device given by the user with its arguments * * A user device is a physical or a virtual device given by the user to @@ -74,10 +65,6 @@ enum rte_devtype { struct rte_devargs { /** Next in list. */ TAILQ_ENTRY(rte_devargs) next; - /** Type of device. */ - enum rte_devtype type; - /** Device policy. */ - enum rte_dev_policy policy; /** Bus handle for the device. */ struct rte_bus *bus; /** Name of the device. */ @@ -166,8 +153,6 @@ rte_eal_devargs_insert(struct rte_devargs *da); * driver name is not checked by this function, it is done when probing * the drivers. * - * @param devtype - * The type of the device. * @param devargs_str * The arguments as given by the user. * @@ -175,7 +160,7 @@ rte_eal_devargs_insert(struct rte_devargs *da); * - 0 on success * - A negative value on error */ -int rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str); +int rte_eal_devargs_add(const char *devargs_str); /** * Remove a device from the user device list. @@ -196,18 +181,6 @@ int rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str); int rte_eal_devargs_remove(const char *busname, const char *devname); /** - * Count the number of user devices of a specified type - * - * @param devtype - * The type of the devices to counted. - * - * @return - * The number of devices. - */ -unsigned int -rte_eal_devargs_type_count(enum rte_devtype devtype); - -/** * This function dumps the list of user device and their arguments. * * @param f diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index a2709e3..e1e2a50 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -22,7 +22,6 @@ DPDK_2.0 { rte_eal_alarm_set; rte_eal_devargs_add; rte_eal_devargs_dump; - rte_eal_devargs_type_count; rte_eal_get_configuration; rte_eal_get_lcore_state; rte_eal_get_physmem_layout;