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 78DCB2E83 for ; Wed, 12 Jul 2017 01:25:34 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id 77so9920731wrb.1 for ; Tue, 11 Jul 2017 16:25:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=+fD+GlSJLoBu8BJ/+t71BFJ0BQ02X6NUDQSPCWmfZbM=; b=rF40MZ+/P2mYqSeB1NAGCBA7fBlsNpeb7N1U+BeSvNPogVm1MiSoPTwrlOqUeOxKLz IL9YSjBUU2ryChEm5oWSzqXcvE76A+OV/q5guepN3zehRDaUK8ItPGvZW8XhZNT5xCoR 2WWZ41zW8+Qgh4i5bg70G+STKMsxrxBW1TY2ouwk3QF7Hr0oJriFOol33pvtXWgJ8VlH N/BtbvrElSuVka96r6wWp0scaTht/lwkRe+aalsYtOi9Pux4pSl4oUNRBIg5wbsmBQUA SPhWPgffu71LO4zSM/E6rgIWrl/h1TkfRoaMc4XSuONBaVrhczIaVDpWF7CGyrapsVEf PFWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=+fD+GlSJLoBu8BJ/+t71BFJ0BQ02X6NUDQSPCWmfZbM=; b=hM/6IUzFA7bpqiXexOyn/ZfQMD4RK3d8VH+aPxZxV0ENNJE6AJMQUUjh8/dD7NcpqD K1gMjMhHvzZryZHxaAGA+RQh9uugp33k/D3KtqRdkumqh0KlcbYrNGIS25vV7Ar49M1A 6W2nZOkn19G3cmJP+N6ZYusht73Azm2LiDj8ZVKLtkYIKL/Ob6QKt2jNyWSwOICxQX25 zYWhNJEi9FkVhsQbGNtWrELalYyoYXJS2UkFuRuoRqbLnlXNI/5SdDo9Ju1qJaShB9eU nscBStdg7bAPHpj8UnbqLNI3SV5jtBD+RCN2p1yp6SCzwv1n58y/K9p2++fJuXjPWR52 n7+Q== X-Gm-Message-State: AIVw110li0uMSAPdPam/KIkbMK8b08yThsv+lKntpVdPcgVsPR5rHz5R pyMeWIC6uIAB/fn1 X-Received: by 10.80.146.79 with SMTP id j15mr4204957eda.17.1499815534041; Tue, 11 Jul 2017 16:25:34 -0700 (PDT) Received: from localhost.localdomain ([37.228.147.16]) by smtp.gmail.com with ESMTPSA id k45sm311516ede.16.2017.07.11.16.25.33 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 11 Jul 2017 16:25:33 -0700 (PDT) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Date: Tue, 11 Jul 2017 19:25:00 -0400 Message-Id: <20170711232512.54641-2-jblunck@infradead.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170711232512.54641-1-jblunck@infradead.org> References: <20170711232512.54641-1-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH 01/13] Revert "devargs: make device types generic" 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: Tue, 11 Jul 2017 23:25:34 -0000 This (partially) reverts commit bd279a79366f50a4893fb84db91bbf64b56f9fb1. --- lib/librte_eal/common/eal_common_devargs.c | 4 ++-- lib/librte_eal/common/eal_common_options.c | 6 ++--- lib/librte_eal/common/eal_common_pci.c | 4 ++-- 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, 28 insertions(+), 29 deletions(-) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 49d43a328..92c77c30e 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -154,14 +154,14 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) goto fail; devargs->type = devtype; bus = devargs->bus; - if (devargs->type == RTE_DEVTYPE_WHITELISTED) { + if (devargs->type == RTE_DEVTYPE_WHITELISTED_PCI) { 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) { + } else if (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) { 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 075b0ea9e..84a21fefe 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, + if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, optarg) < 0) { return -1; } break; /* whitelist */ case 'w': - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, 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_UNDEFINED, + if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, optarg) < 0) { return -1; } diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 76bbcc853..72fcc35c2 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) { + RTE_DEVTYPE_BLACKLISTED_PCI) { RTE_LOG(INFO, EAL, " Device is blacklisted, not" " initializing\n"); return 1; @@ -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) + devargs->type == RTE_DEVTYPE_WHITELISTED_PCI) 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 e00dda9aa..ff6a3b571 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -141,6 +141,7 @@ alloc_devargs(const char *name, const char *args) if (!devargs) return NULL; + devargs->type = RTE_DEVTYPE_VIRTUAL; devargs->bus = &rte_vdev_bus; 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 a0427cd8a..62dd67bff 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_UNDEFINED, - RTE_DEVTYPE_WHITELISTED, - RTE_DEVTYPE_BLACKLISTED, + RTE_DEVTYPE_WHITELISTED_PCI, + RTE_DEVTYPE_BLACKLISTED_PCI, + RTE_DEVTYPE_VIRTUAL, }; /** diff --git a/test/test/test_devargs.c b/test/test/test_devargs.c index 149c9c926..18f54edc1 100644 --- a/test/test/test_devargs.c +++ b/test/test/test_devargs.c @@ -64,32 +64,30 @@ test_devargs(void) TAILQ_INIT(&devargs_list); /* test valid cases */ - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "08:00.1") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "08:00.1") < 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "0000:5:00.0") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "0000:5:00.0") < 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "04:00.0,arg=val") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, "04:00.0,arg=val") < 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "0000:01:00.1") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, "0000:01:00.1") < 0) goto fail; - if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED) != 4) + if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) != 2) goto fail; - if (rte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED) != 0) + if (rte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED_PCI) != 2) goto fail; - if (rte_eal_devargs_type_count(RTE_DEVTYPE_UNDEFINED) != 0) + if (rte_eal_devargs_type_count(RTE_DEVTYPE_VIRTUAL) != 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_UNDEFINED, "net_ring0") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "net_ring0") < 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_UNDEFINED, - "net_ring1,key=val,k2=val2") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "net_ring1,key=val,k2=val2") < 0) goto fail; - if (rte_eal_devargs_type_count(RTE_DEVTYPE_UNDEFINED) != 2) + if (rte_eal_devargs_type_count(RTE_DEVTYPE_VIRTUAL) != 2) goto fail; free_devargs_list(); /* check virtual device with argument parsing */ - if (rte_eal_devargs_add(RTE_DEVTYPE_UNDEFINED, - "net_ring1,k1=val,k2=val2") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "net_ring1,k1=val,k2=val2") < 0) goto fail; devargs = TAILQ_FIRST(&devargs_list); if (strncmp(devargs->name, "net_ring1", @@ -100,7 +98,7 @@ test_devargs(void) free_devargs_list(); /* check PCI device with empty argument parsing */ - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "04:00.1") < 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "04:00.1") < 0) goto fail; devargs = TAILQ_FIRST(&devargs_list); if (strcmp(devargs->name, "04:00.1") != 0) @@ -110,15 +108,15 @@ test_devargs(void) free_devargs_list(); /* test error case: bad PCI address */ - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "08:1") == 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "08:1") == 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "00.1") == 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "00.1") == 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "foo") == 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "foo") == 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, ",") == 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, ",") == 0) goto fail; - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "000f:0:0") == 0) + if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "000f:0:0") == 0) goto fail; devargs_list = save_devargs_list; -- 2.13.2