From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id 2F2307CB1 for ; Fri, 14 Jul 2017 23:12:42 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id j85so12764758wmj.0 for ; Fri, 14 Jul 2017 14:12:42 -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=9Gn0zMTWtLUSN13oe7EniS+UKNu8UGFdE8nnM9H7wdk=; b=l3PFk959wrQ51ECqalpdheHViuOsP6secVTOH0yfoT6Aw5X4nwDFxt7C1fi40BC5gj lvkOTpvEX2w0sdF0kQc4cKqdqHtpR2wSW9v4pg2jPIKt9lxDmj+USBRJZi2T+ahXpmt2 BEBsSIh3lF6xKlTyDuFlf8IrPWCU8Q7BcHeO+smrQ+XvupF+SsVAzulmk4AXuxQgBqEn S4Kw2XDSGL8WG3i8KwdXaKdsznV3iJxIHi2HDGOATAvMfoQEVAWn0U+ZpL2VS8eefaav KojqLxwBycnymLF+La9+uNvYKy6F9xrgWyd/zFT7srRrutKRzyHhxfK3X4P3igZIwLfF WkUQ== 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=9Gn0zMTWtLUSN13oe7EniS+UKNu8UGFdE8nnM9H7wdk=; b=Xyz/O6/F0r+ZPqOSVwEuB+gIAPjirVZrt6y1XWV7q9n5M+p4LjZlFKJX8IPjoh1rCz 4V84U2fgvKeD0xQccqjtywqaB+lVjc4bNCAsTTkoHoptAU8fVoSvHcuyKP5PuEXWVh0A L0YWttfKob5/OOxQrYvAHRmlBWTfpGX4ysMmbxLsGe8YVyXCJL4rdjxIwc2JYftiXPoc AdG/cTXb1Ar7qtHLKFFQ+Y5BOdjaOcSymnXoq3/cqklIjnGPOPJXsQ8cuoETp/rLdmql sj8WiBFz0NpzcjqwPP2KVvURfg9SKL59U5xb8/lGAqc7aewh0MnYMWUfP64cA6VQg3qX RRjA== X-Gm-Message-State: AIVw110nWpBlFrO/k9/t5hsBcNm016dqgqSM6wUi8Y8ywK5Mflcd6UOO 2Hk+xbNczePB8gol X-Received: by 10.80.170.218 with SMTP id r26mr8191714edc.113.1500066761774; Fri, 14 Jul 2017 14:12:41 -0700 (PDT) Received: from localhost.localdomain ([37.228.147.16]) by smtp.gmail.com with ESMTPSA id c11sm4892223eda.0.2017.07.14.14.12.40 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Jul 2017 14:12:40 -0700 (PDT) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Date: Fri, 14 Jul 2017 17:12:08 -0400 Message-Id: <20170714211213.34436-11-jblunck@infradead.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170714211213.34436-1-jblunck@infradead.org> References: <20170711232512.54641-1-jblunck@infradead.org> <20170714211213.34436-1-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v2 10/15] devargs: use busname 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, 14 Jul 2017 21:12:42 -0000 This makes the devargs code itself require the rte_devargs type field for properly functioning. Signed-off-by: Jan Blunck --- lib/librte_eal/common/eal_common_devargs.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 588df1410..38ba64567 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -199,13 +199,28 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) unsigned int rte_eal_devargs_type_count(enum rte_devtype devtype) { + struct rte_bus *pci_bus = rte_bus_find_by_name("pci"); + const char *busname = ""; struct rte_devargs *devargs; unsigned int count = 0; + switch (devtype) { + case RTE_DEVTYPE_WHITELISTED_PCI: + if (pci_bus->conf.scan_mode == RTE_BUS_SCAN_WHITELIST) + busname = "pci"; + break; + case RTE_DEVTYPE_BLACKLISTED_PCI: + if (pci_bus->conf.scan_mode == RTE_BUS_SCAN_BLACKLIST) + busname = "pci"; + break; + case RTE_DEVTYPE_VIRTUAL: + busname = "vdev"; + break; + } + TAILQ_FOREACH(devargs, &devargs_list, next) { - if (devargs->type != devtype) - continue; - count++; + if (strcmp(busname, devargs->busname) == 0) + count++; } return count; } @@ -218,8 +233,7 @@ rte_eal_devargs_dump(FILE *f) fprintf(f, "User device list:\n"); TAILQ_FOREACH(devargs, &devargs_list, next) { - fprintf(f, " [%s]: %s %s\n", - (devargs->bus ? devargs->bus->name : "??"), - devargs->name, devargs->args); + fprintf(f, " [%s]: %s %s\n", devargs->busname, devargs->name, + devargs->args); } } -- 2.13.2