From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 26E7EA045E for ; Thu, 30 May 2019 19:49:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 357431B95A; Thu, 30 May 2019 19:48:42 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 849714F91 for ; Thu, 30 May 2019 19:48:29 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 May 2019 10:48:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,532,1549958400"; d="scan'208";a="180020093" Received: from bwalker-desk.ch.intel.com ([143.182.136.145]) by fmsmga002.fm.intel.com with ESMTP; 30 May 2019 10:48:27 -0700 From: Ben Walker To: dev@dpdk.org Cc: Ben Walker Date: Thu, 30 May 2019 10:48:12 -0700 Message-Id: <20190530174819.1160221-6-benjamin.walker@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190530174819.1160221-1-benjamin.walker@intel.com> References: <20190530174819.1160221-1-benjamin.walker@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 05/12] eal/pci: Add function pci_ignore_device 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" This performs a check for whether the device should be ignored due to whitelist or blacklist. This check eventually needs to apply to all of the other checks in rte_pci_get_iommu_class. Signed-off-by: Ben Walker Change-Id: I8e63e4c2e4199f34561ea1d911e13d6d74a47322 --- drivers/bus/pci/linux/pci.c | 44 +++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index b7a66d717..f269b6a64 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -560,6 +560,29 @@ pci_one_device_iommu_support_va(__rte_unused struct rte_pci_device *dev) } #endif +static bool +pci_ignore_device(struct rte_pci_device *dev) +{ + struct rte_devargs *devargs; + + devargs = dev->device.devargs; + + switch (rte_pci_bus.bus.conf.scan_mode) { + case RTE_BUS_SCAN_WHITELIST: + if (devargs && devargs->policy == RTE_DEV_WHITELISTED) + return false; + break; + case RTE_BUS_SCAN_UNDEFINED: + case RTE_BUS_SCAN_BLACKLIST: + if (devargs == NULL || + devargs->policy != RTE_DEV_BLACKLISTED) + return false; + break; + } + + return true; +} + /* * Get iommu class of PCI devices on the bus. */ @@ -571,10 +594,9 @@ rte_pci_get_iommu_class(void) bool has_iova_va = false; bool is_bound_uio = false; bool iommu_no_va = false; - bool need_check; struct rte_pci_device *dev = NULL; struct rte_pci_driver *drv = NULL; - struct rte_devargs *devargs; + FOREACH_DEVICE_ON_PCIBUS(dev) { if (dev->kdrv == RTE_KDRV_UNKNOWN || @@ -612,23 +634,7 @@ rte_pci_get_iommu_class(void) } FOREACH_DEVICE_ON_PCIBUS(dev) { - devargs = dev->device.devargs; - - need_check = false; - switch (rte_pci_bus.bus.conf.scan_mode) { - case RTE_BUS_SCAN_WHITELIST: - if (devargs && devargs->policy == RTE_DEV_WHITELISTED) - need_check = true; - break; - case RTE_BUS_SCAN_UNDEFINED: - case RTE_BUS_SCAN_BLACKLIST: - if (devargs == NULL || - devargs->policy != RTE_DEV_BLACKLISTED) - need_check = true; - break; - } - - if (!need_check) + if (pci_ignore_device(dev)) continue; if (dev->kdrv == RTE_KDRV_IGB_UIO || -- 2.20.1