From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5072AA0565; Thu, 4 Mar 2021 01:21:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE71340FDF; Thu, 4 Mar 2021 01:21:23 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 8404340147 for ; Thu, 4 Mar 2021 01:21:22 +0100 (CET) IronPort-SDR: 9CS0k2mKhCIyJtDpLUdvWMV5MIO0WN/PI+4Aj8E2lZrwBwV2pe1Tann0tl8xZmqxCWU6+XtnI8 2Wba14bwoJ+g== X-IronPort-AV: E=McAfee;i="6000,8403,9912"; a="184893956" X-IronPort-AV: E=Sophos;i="5.81,221,1610438400"; d="scan'208";a="184893956" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2021 16:21:20 -0800 IronPort-SDR: JrBhNWBBTGQ3w+K/6Xk0OoRukAgp1Om1lZQn9Sm/KmMBnp/HknuPezFuWN+X3/gSyer87de7ao OV/xa49kYeBQ== X-IronPort-AV: E=Sophos;i="5.81,221,1610438400"; d="scan'208";a="400089524" Received: from rmenon-desk.amr.corp.intel.com (HELO [10.166.30.253]) ([10.166.30.253]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2021 16:21:20 -0800 To: Khoa To , dev@dpdk.org Cc: dmitry.kozliuk@gmail.com, pallavi.kadam@intel.com References: <20210301062208.1904-1-khot@linux.microsoft.com> <20210301065241.237-1-khot@linux.microsoft.com> From: Ranjit Menon Message-ID: Date: Wed, 3 Mar 2021 16:21:19 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20210301065241.237-1-khot@linux.microsoft.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v4] bus/pci/windows: support for PCI scan allowed and blocked lists X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" On 2/28/2021 10:52 PM, Khoa To wrote: > EAL -a and -b options are used to specify which PCI devices are > explicitly allowed or blocked during PCI bus scan. This evaluation > is missing in the Windows implementation of rte_pci_scan. > > This patch provides this missing functionality, so that apps can specify > which NetUIO devices to ignore during PCI bus scan. > > Signed-off-by: Khoa To > --- > v4: > * Fix coding style warning with unaligned comments > v3: > * Move the check inside pci_scan_one > * Small change to pci_scan_one to malloc only after checks succeeded > v2: > * Truncate commit description lines to 75 charaters or less > > drivers/bus/pci/windows/pci.c | 23 ++++++++++++++++------- > 1 file changed, 16 insertions(+), 7 deletions(-) > > diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c > index f66258452..0d184f24d 100644 > --- a/drivers/bus/pci/windows/pci.c > +++ b/drivers/bus/pci/windows/pci.c > @@ -308,17 +308,24 @@ set_kernel_driver_type(PSP_DEVINFO_DATA device_info_data, > static int > pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data) > { > - struct rte_pci_device *dev; > + struct rte_pci_device *dev = NULL; > int ret = -1; > char pci_device_info[REGSTR_VAL_MAX_HCID_LEN]; > struct rte_pci_addr addr; > struct rte_pci_id pci_id; > > - dev = malloc(sizeof(*dev)); > - if (dev == NULL) > + ret = get_device_pci_address(dev_info, device_info_data, &addr); > + if (ret != 0) > goto end; > > - memset(dev, 0, sizeof(*dev)); > + if (rte_pci_ignore_device(&addr)) { > + /* > + * We won't add this device, but we want to continue > + * looking for supported devices > + */ > + ret = ERROR_CONTINUE; > + goto end; > + } > > ret = get_pci_hardware_id(dev_info, device_info_data, > pci_device_info, sizeof(pci_device_info)); > @@ -335,10 +342,12 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data) > goto end; > } > > - ret = get_device_pci_address(dev_info, device_info_data, &addr); > - if (ret != 0) > + dev = malloc(sizeof(*dev)); > + if (dev == NULL) > goto end; > > + memset(dev, 0, sizeof(*dev)); > + > dev->addr = addr; > dev->id = pci_id; > dev->max_vfs = 0; /* TODO: get max_vfs */ > @@ -417,7 +426,7 @@ rte_pci_scan(void) > device_index++; > /* we only want to enumerate net & netuio class devices */ > if (IsEqualGUID(&(device_info_data.ClassGuid), > - &GUID_DEVCLASS_NET) || > + &GUID_DEVCLASS_NET) || > IsEqualGUID(&(device_info_data.ClassGuid), > &GUID_DEVCLASS_NETUIO)) { > ret = pci_scan_one(dev_info, &device_info_data); This last change appears to be a formatting change. Was it required by checkpatch? Other than that... Acked-by: Ranjit Menon