From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 23EF68EA0 for ; Fri, 22 Jan 2016 16:28:01 +0100 (CET) Received: by mail-wm0-f48.google.com with SMTP id n5so137670120wmn.0 for ; Fri, 22 Jan 2016 07:28:01 -0800 (PST) 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; bh=v1W0oQRPNsNstnD41avdY+aI91N/tK96B2Z51dpicRo=; b=rXUVi21fIgiS0dVf2/yytT6DIfmFGs1bOi1hjmZgon7qOP63rtGFVroOIPSXz+2qXR tTrLY0K/xx0y9yf1jn8QZWh+EFNXVhy4/zDLyiVo5g8CzYaTGNfs2EH39dg77BD5ReUH qd2s89/1/x68dnwPr8/zPLaVvvIeOGLLo9rLCLxAJEkwqTfdOoeVrVGXCc8E0U+0osgH OgyuT9gFImod6hU/Jif/xW59Orgx1cq9pMb38LFRvAFed+zmtEHNWJ+WSJsZG8AoKiOW qQnnPEmy+ehW3w9WaxhxVP8PCpAloL5kZENcooct2NiftJ5XxXLc1VSvIolQqT9A8fdJ 6bjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=v1W0oQRPNsNstnD41avdY+aI91N/tK96B2Z51dpicRo=; b=LZMX6LZkU/7rQHHgtmeo+RfBIEGkLp46SRtLLz7gtxS4LKVFI9VkwYPkge6xtii0bo 8zHVt99tTESavwVJY7ZjrfUcsIFBC6BeRd9ZDcPLyyBA46ScYmRYIU+489qI4195p3g0 8+HR3Lhv9ZbqrzKj7VX07bILpjb+Le4uCqCuP04B+C10jrK2UrsMCLdHBpOJpH9FCAIk oC/AupCr37MhikBT99kEcmTotH24tL39NQTeoB+EOHlj1fKyHkjSsz1JKiWMVb7hITp2 ctcZM+b2c92mcUatJ80A8SIvk9ar8qUVOt+RcYPzJfEerAOzc88aRyB5obeu1Uxath9g YoSg== X-Gm-Message-State: AG10YOSYs1GweKRTial1sROKLiXEx2bUmEsrPypkgxPAIMM90P7vSPmtoDgBk6pjStYIpUkE X-Received: by 10.28.225.132 with SMTP id y126mr4301276wmg.98.1453476481013; Fri, 22 Jan 2016 07:28:01 -0800 (PST) Received: from gloops.dev.6wind.com (144.77.126.78.rev.sfr.net. [78.126.77.144]) by smtp.gmail.com with ESMTPSA id w73sm3359464wmw.21.2016.01.22.07.28.00 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Jan 2016 07:28:00 -0800 (PST) From: David Marchand To: dev@dpdk.org Date: Fri, 22 Jan 2016 16:27:44 +0100 Message-Id: <1453476464-31767-10-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453476464-31767-1-git-send-email-david.marchand@6wind.com> References: <1453476464-31767-1-git-send-email-david.marchand@6wind.com> Cc: viktorin@rehivetech.com Subject: [dpdk-dev] [PATCH 9/9] pci: blacklist only in global probe function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2016 15:28:01 -0000 Move blacklist evaluation to rte_eal_pci_probe(). This way, rte_eal_pci_probe_one() (used by hotplug when attaching) now accepts to probe devices that were blacklisted initially. A new debug trace is added when skipping a device not part of a given whitelist. Signed-off-by: David Marchand --- lib/librte_eal/common/eal_common_pci.c | 56 ++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 71222a5..52d4594 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -209,21 +209,6 @@ static int pci_probe_device(struct rte_pci_driver *dr, struct rte_pci_device *dev) { int ret; - struct rte_pci_addr *loc = &dev->addr; - - RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n", - loc->domain, loc->bus, loc->devid, loc->function, - dev->numa_node); - - RTE_LOG(DEBUG, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id, - dev->id.device_id, dr->name); - - /* no initialization when blacklisted, return without error */ - if (dev->devargs != NULL && - dev->devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) { - RTE_LOG(DEBUG, EAL, " Device is blacklisted, not initializing\n"); - return 1; - } if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) { #ifdef RTE_PCI_CONFIG @@ -306,6 +291,14 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr) if (!dr) goto err_return; + RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n", + dev->addr.domain, dev->addr.bus, + dev->addr.devid, dev->addr.function, + dev->numa_node); + + RTE_LOG(DEBUG, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id, + dev->id.device_id, dr->name); + if (pci_probe_device(dr, dev) < 0) goto err_return; @@ -364,10 +357,8 @@ rte_eal_pci_probe(void) struct rte_pci_device *dev; struct rte_pci_driver *dr; struct rte_devargs *devargs; - int probe_all = 0; - - if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) == 0) - probe_all = 1; + int whitelist = rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI); + int blacklist = rte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED_PCI); TAILQ_FOREACH(dev, &pci_device_list, next) { @@ -381,11 +372,30 @@ rte_eal_pci_probe(void) if (devargs != NULL) dev->devargs = devargs; - /* skip if not probing all and device is not whitelisted */ - if (!probe_all && - (devargs == NULL || - devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) + RTE_LOG(DEBUG, EAL, + "PCI device "PCI_PRI_FMT" on NUMA socket %i\n", + dev->addr.domain, dev->addr.bus, + dev->addr.devid, dev->addr.function, + dev->numa_node); + + RTE_LOG(DEBUG, EAL, " probe driver: %x:%x %s\n", + dev->id.vendor_id, dev->id.device_id, dr->name); + + /* + * We want to probe this device when: + * - there is no whitelist/blacklist, + * - there is a whitelist, and device is part of it, + * - there is a blacklist, and device is not part of it. + */ + if (whitelist && !devargs) { + RTE_LOG(DEBUG, EAL, " Device is not whitelisted, not initializing\n"); + continue; + } + + if (blacklist && devargs) { + RTE_LOG(DEBUG, EAL, " Device is blacklisted, not initializing\n"); continue; + } if (pci_probe_device(dr, dev) < 0) rte_exit(EXIT_FAILURE, "Requested device " PCI_PRI_FMT -- 1.9.1