From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2AC00A00BE; Tue, 28 Apr 2020 00:58:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 956DB1D505; Tue, 28 Apr 2020 00:58:53 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id CCFF41D445 for ; Tue, 28 Apr 2020 00:58:52 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 0A7B820B4737; Mon, 27 Apr 2020 15:58:52 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0A7B820B4737 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1588028332; bh=r5kZRb3OQgDrWz41hNNbIwHDPsinq5tA7JKQvCGDBgI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bEjL3s1TH+qXAPebsrtQ2lrcltUPE0NWa2HYVvntOFlSbxeCMXVKi3eydmDu9cUuj nS1eBMAenQK623lIF9Qvl7JPK7h+Cwko26djdsULgjv5v4FCniGFFqf22VyQJhiyU2 uk54LiJeTKCMme1tC+tXJzTq2/ETap5gEwssgwVs= Date: Mon, 27 Apr 2020 15:58:52 -0700 From: Narcisa Ana Maria Vasile To: talshn@mellanox.com Cc: dev@dpdk.org, thomas@monjalon.net, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com, david.marchand@redhat.com, grive@u256.net Message-ID: <20200427225852.GA62222@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20200422072747.15960-1-talshn@mellanox.com> <20200422072747.15960-8-talshn@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200422072747.15960-8-talshn@mellanox.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [dpdk-dev] [PATCH 7/7] bus/pci: support Windows with bifurcated drivers 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" On Wed, Apr 22, 2020 at 10:27:47AM +0300, talshn@mellanox.com wrote: > From: Tal Shnaiderman > > Uses SetupAPI.h functions to scan PCI tree. > Uses DEVPKEY_Device_Numa_Node to get the PCI Numa node. > scanning currently supports types RTE_KDRV_NONE. > > Signed-off-by: Tal Shnaiderman > --- > drivers/bus/pci/windows/pci.c | 342 ++++++++++++++++++++++++++- > lib/librte_eal/rte_eal_exports.def | 1 + > lib/librte_eal/windows/include/rte_windows.h | 1 + > 3 files changed, 342 insertions(+), 2 deletions(-) > > diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c > index 7eff39173..d5ee938fa 100644 > --- a/drivers/bus/pci/windows/pci.c > +++ b/drivers/bus/pci/windows/pci.c > @@ -1,14 +1,24 @@ > /* SPDX-License-Identifier: BSD-3-Clause > * Copyright 2020 Mellanox Technologies, Ltd > */ > + > +static > +int get_device_resource_info(HDEVINFO hDevInfo, > + PSP_DEVINFO_DATA pDeviceInfoData , struct rte_pci_device *dev) > +{ > + int ret = -1; > + DEVPROPTYPE uPropertyType; > + DWORD uNumaNode; > + BOOL bResult; > + > + switch (dev->kdrv) { > + case RTE_KDRV_NONE: > + /* Get NUMA node using DEVPKEY_Device_Numa_Node */ > + bResult = SetupDiGetDevicePropertyW(hDevInfo, pDeviceInfoData, > + &DEVPKEY_Device_Numa_Node, &uPropertyType, > + (BYTE *)&uNumaNode, sizeof(uNumaNode), NULL, 0); > + if (!bResult) { > + ret = GetLastError(); > + break; Here 'ret' is correctly set to an error code, but after breaking out of the switch, it is overwritten to ERROR_SUCCESS. Maybe 'goto end' instead of 'break'. > + } > + dev->device.numa_node = uNumaNode; > + /* mem_resource - Uneeded for RTE_KDRV_NONE */ > + dev->mem_resource[0].phys_addr = 0; > + dev->mem_resource[0].len = 0; > + dev->mem_resource[0].addr = NULL; > + break; > + default: > + ret = -1; Same thing here, ret is overwritten after breaking from the switch. > + break; > + } > + > + ret = ERROR_SUCCESS; > +end: > + return ret; > +} > + > + > +/*