From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id C59687CC4 for ; Fri, 7 Jul 2017 02:05:03 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id k67so24118269wrc.2 for ; Thu, 06 Jul 2017 17:05:03 -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=UOGyxveC8khrsZDTrDxmLc386Vv40lmyrzxxOODa9pU=; b=Mtl3DZ6JaaHGI5+hAaTdStcGW/wuc9dU0NpxOk4Dht1CR/6v6QexrOnIhIGjCO5tnI i49asXxmAvYh130FFi1J/CE8h6DIT7yIed+QKhkRIY5Sc9e60jm7rjgYTqp9+IqbkE/h 7fsoJBpLfA9qt6R8jSymeIrkvk7DDWcyzlVhAK35POGlkjVTL48ZXzYipMRzO0HrKj4h JH3wTRpkDK7Ngq1YRBjbdXHbHhaUg3osFZBXjzoOvz+NNMperwxAZ3/9dNDCx09FFY5t c1ZFeUng9awviFsUNsXwqRyt+rcAyLKS28x/slU01LGQrA8AdkvilTbtwWK/62jq9qZk ayYg== 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=UOGyxveC8khrsZDTrDxmLc386Vv40lmyrzxxOODa9pU=; b=gliMbMAtL5nt4dVJKvGy7rqJYVBxkSctgoKg7TSzcqIEQhAsBg4Qk0Gb+bCbWhXEOf 3bGOofdp9C2zECtgMtZoVsxMIu9/BWZgWEhtKC0tV8xzweDXrQegUMhkYKBMv70a/xrq 0oPn0rTUSMMJQX0bNKk+xH9Xk9He0DWzk58YdyRReV1b67GyJm2WtKr24HEhY/xsd7Wp xF5Zc1f8Ss5/5xx4YnqYevaZGj3qTfyFj9Uv4eaFvW48ntkW8zD810VWOsNC/H4lJjv6 m5ltYYexSVUIFc5hYNYoQwK5uBF0P16bFzEVXtZGkIJuAKImRBwZ+lZ0lC1mf04MyvNr ARMQ== X-Gm-Message-State: AIVw113fzdn/UBw1elCVaG788LWIgAKYWCCjMZC0q5TI1Vc+XQwf7ten Hz/TDRsIuP1rRWq6ySI= X-Received: by 10.28.157.9 with SMTP id g9mr260414wme.76.1499385903142; Thu, 06 Jul 2017 17:05:03 -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 b197sm1111520wmb.4.2017.07.06.17.05.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Jul 2017 17:05:02 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Fri, 7 Jul 2017 02:04:32 +0200 Message-Id: <610e9376200b85e94b2bc787f17400342a98c304.1499384591.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 v7 15/17] devargs: generic device types 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: Fri, 07 Jul 2017 00:05:04 -0000 rte_devargs now represents any device from any bus. The related devtypes do not identify a bus anymore, only which scan policy the device subscribes to. The bus itself is identified by a bus handle previously introduced. Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_devargs.c | 4 ++-- lib/librte_eal/common/eal_common_options.c | 13 +++-------- lib/librte_eal/common/eal_common_pci.c | 6 ++--- lib/librte_eal/common/eal_common_vdev.c | 1 - lib/librte_eal/common/include/rte_devargs.h | 6 ++--- test/test/test_devargs.c | 36 +++++++++++++++-------------- 6 files changed, 30 insertions(+), 36 deletions(-) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 7b4dfca..8fe1b39 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -129,14 +129,14 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) ret = snprintf(devargs->name, sizeof(devargs->name), "%s", devname); if (ret < 0 || ret >= (int)sizeof(devargs->name)) goto fail; - if (devargs->type == RTE_DEVTYPE_WHITELISTED_PCI) { + if (devargs->type == RTE_DEVTYPE_WHITELISTED) { if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) { bus->conf.scan_mode = RTE_BUS_SCAN_WHITELIST; } else if (bus->conf.scan_mode == RTE_BUS_SCAN_BLACKLIST) { fprintf(stderr, "ERROR: incompatible device type and bus scan mode\n"); goto fail; } - } else if (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) { + } else if (devargs->type == RTE_DEVTYPE_BLACKLISTED) { if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) { bus->conf.scan_mode = RTE_BUS_SCAN_BLACKLIST; } else if (bus->conf.scan_mode == RTE_BUS_SCAN_WHITELIST) { diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index f470195..075b0ea 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -798,14 +798,14 @@ eal_parse_common_option(int opt, const char *optarg, switch (opt) { /* blacklist */ case 'b': - if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, + if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED, optarg) < 0) { return -1; } break; /* whitelist */ case 'w': - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, optarg) < 0) { return -1; } @@ -901,7 +901,7 @@ eal_parse_common_option(int opt, const char *optarg, break; case OPT_VDEV_NUM: - if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, + if (rte_eal_devargs_add(RTE_DEVTYPE_UNDEFINED, optarg) < 0) { return -1; } @@ -1025,13 +1025,6 @@ eal_check_common_options(struct internal_config *internal_cfg) return -1; } - if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) != 0 && - rte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED_PCI) != 0) { - RTE_LOG(ERR, EAL, "Options blacklist (-b) and whitelist (-w) " - "cannot be used at the same time\n"); - return -1; - } - return 0; } diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 5838cc6..e03a407 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -198,7 +198,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, /* no initialization when blacklisted, return without error */ if (dev->device.devargs != NULL && dev->device.devargs->type == - RTE_DEVTYPE_BLACKLISTED_PCI) { + RTE_DEVTYPE_BLACKLISTED) { RTE_LOG(INFO, EAL, " Device is blacklisted, not" " initializing\n"); return 1; @@ -390,7 +390,7 @@ rte_pci_probe(void) int probe_all = 0; int ret = 0; - if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) == 0) + if (rte_pci_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST) probe_all = 1; FOREACH_DEVICE_ON_PCIBUS(dev) { @@ -405,7 +405,7 @@ rte_pci_probe(void) if (probe_all) ret = pci_probe_all_drivers(dev); else if (devargs != NULL && - devargs->type == RTE_DEVTYPE_WHITELISTED_PCI) + devargs->type == RTE_DEVTYPE_WHITELISTED) ret = pci_probe_all_drivers(dev); if (ret < 0) { RTE_LOG(ERR, EAL, "Requested device " PCI_PRI_FMT diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 639ef73..517a9f3 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -176,7 +176,6 @@ alloc_devargs(const char *name, const char *args) if (!devargs) return NULL; - devargs->type = RTE_DEVTYPE_VIRTUAL; devargs->bus = rte_bus_find_by_name("vdev"); if (args) devargs->args = strdup(args); diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h index 35675fa..a5c4a4a 100644 --- a/lib/librte_eal/common/include/rte_devargs.h +++ b/lib/librte_eal/common/include/rte_devargs.h @@ -56,9 +56,9 @@ extern "C" { * Type of generic device */ enum rte_devtype { - RTE_DEVTYPE_WHITELISTED_PCI, - RTE_DEVTYPE_BLACKLISTED_PCI, - RTE_DEVTYPE_VIRTUAL, + RTE_DEVTYPE_UNDEFINED, + RTE_DEVTYPE_WHITELISTED, + RTE_DEVTYPE_BLACKLISTED, }; /** diff --git a/test/test/test_devargs.c b/test/test/test_devargs.c index 18f54ed..149c9c9 100644 --- a/test/test/test_devargs.c +++ b/test/test/test_devargs.c @@ -64,30 +64,32 @@ test_devargs(void) TAILQ_INIT(&devargs_list); /* test valid cases */ - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "08:00.1") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "08:00.1") < 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "0000:5:00.0") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "0000:5:00.0") < 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, "04:00.0,arg=val") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "04:00.0,arg=val") < 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, "0000:01:00.1") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "0000:01:00.1") < 0) goto fail; - if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) != 2) + if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED) != 4) goto fail; - if (rte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED_PCI) != 2) + if (rte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED) != 0) goto fail; - if (rte_eal_devargs_type_count(RTE_DEVTYPE_VIRTUAL) != 0) + if (rte_eal_devargs_type_count(RTE_DEVTYPE_UNDEFINED) != 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "net_ring0") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_UNDEFINED, "net_ring0") < 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "net_ring1,key=val,k2=val2") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_UNDEFINED, + "net_ring1,key=val,k2=val2") < 0) goto fail; - if (rte_eal_devargs_type_count(RTE_DEVTYPE_VIRTUAL) != 2) + if (rte_eal_devargs_type_count(RTE_DEVTYPE_UNDEFINED) != 2) goto fail; free_devargs_list(); /* check virtual device with argument parsing */ - if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "net_ring1,k1=val,k2=val2") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_UNDEFINED, + "net_ring1,k1=val,k2=val2") < 0) goto fail; devargs = TAILQ_FIRST(&devargs_list); if (strncmp(devargs->name, "net_ring1", @@ -98,7 +100,7 @@ test_devargs(void) free_devargs_list(); /* check PCI device with empty argument parsing */ - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "04:00.1") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "04:00.1") < 0) goto fail; devargs = TAILQ_FIRST(&devargs_list); if (strcmp(devargs->name, "04:00.1") != 0) @@ -108,15 +110,15 @@ test_devargs(void) free_devargs_list(); /* test error case: bad PCI address */ - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "08:1") == 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "08:1") == 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "00.1") == 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "00.1") == 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "foo") == 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "foo") == 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, ",") == 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, ",") == 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "000f:0:0") == 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "000f:0:0") == 0) goto fail; devargs_list = save_devargs_list; -- 2.1.4