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 7E37DA04A5; Wed, 17 Jun 2020 22:29:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6AF071252; Wed, 17 Jun 2020 22:29:04 +0200 (CEST) Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by dpdk.org (Postfix) with ESMTP id 336301023 for ; Wed, 17 Jun 2020 22:29:02 +0200 (CEST) Received: by mail-lf1-f66.google.com with SMTP id w15so2105564lfe.11 for ; Wed, 17 Jun 2020 13:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3v2goPcxpBHI65fNK027aNayHqzeq9lkqJWrIkB9Okg=; b=dhdc91MrFjZ+p6ONlhsM3cq7GZ5IZdSlD1AVqW4y0epJI8CRUaXcDCPWUc4BOoU1Q3 JyhLDldJV7TW7PxxW9WoklCOooXbsbzQY7xuOO4ZEG00Tsx5N6NHFN8FUqcblJQjjulI 9G2p2L1h8YF67HHSIdvZgWlV7QyjBEIKwIrON4fmk7K66Iu+ihxBgVRWfRWoqpW5fmHr BrfCqd+af2l3+MR2bvIRvCtJ0Q9RCE532gYXC1bXvbXCRBLiJGsXV1TF5SmEGeqI6mMr 2HWIccRQGo7YeYo07Cg3Ly1Yy6q27oMls8FPKPi90+2STbm8oio9670g3G3RYmCrR2jE yCUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3v2goPcxpBHI65fNK027aNayHqzeq9lkqJWrIkB9Okg=; b=CnmRimpRqV1RPih7NkKcxpLZYYr+fqrt0tnbazKQCxsjT7hbpGgqhe96Q4KCvv26vV MM/e4cllBlcpuvFD5U+T9PNtsK5y0zxezivNRvb3SFeXdjpd2gOgpvAfuFTg+sVSseSa ERSl8gBEkA7LAtCeFjd16C1nXXzwlQfoInqo1l6kZhu4vwHKWb2ODRF+JxFIZKPPTnXV yA9tCRUtGDPfO8tZKWXWoQygk92r6fgrp5OptP0bSPfSUYEW7Vk1hGs0RCMT6JaeqspY NZHAJSRrwlyHEt7L+U6UBANBprW21SzyjKawvL7LjfdytwADI9nhqwrgq3/hAFiI0BE4 n8+g== X-Gm-Message-State: AOAM530Ib9D39ZVkkHdMxs+kBGxvrN3aytMp5T9Z6+f7XpfpEpirOW4Q uz7bD/FzdoL5yrNZNwgBJck= X-Google-Smtp-Source: ABdhPJzMta5usz3Nup21CXN1azv0zaVZ3CSZIFe3O3YQ4tWh11AGs7VGbZM0LLtHoQKjOBLxozjy7Q== X-Received: by 2002:ac2:4db2:: with SMTP id h18mr352612lfe.167.1592425741602; Wed, 17 Jun 2020 13:29:01 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id i22sm161693ljb.50.2020.06.17.13.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 13:29:00 -0700 (PDT) Date: Wed, 17 Jun 2020 23:28:59 +0300 From: Dmitry Kozlyuk To: talshn@mellanox.com Cc: dev@dpdk.org, thomas@monjalon.net, pallavi.kadam@intel.com, david.marchand@redhat.com, grive@u256.net, ranjit.menon@intel.com, navasile@linux.microsoft.com, harini.ramakrishnan@microsoft.com, ocardona@microsoft.com, anatoly.burakov@intel.com Message-ID: <20200617232859.34bbfea5@sovereign> In-Reply-To: <20200609103139.22168-9-talshn@mellanox.com> References: <20200609103139.22168-1-talshn@mellanox.com> <20200609103139.22168-9-talshn@mellanox.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5 8/8] 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" [snip] > +#ifdef RTE_TOOLCHAIN_GCC > +#include This breaks cross-compilation because devpropdef.h is all-lowercase on Linux. > +DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40, 0x45bc, > + 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 3); > +#endif [snip] > +static int > +get_device_resource_info(HDEVINFO dev_info, > + PSP_DEVINFO_DATA dev_info_data, struct rte_pci_device *dev) > +{ > + DEVPROPTYPE property_type; > + DWORD numa_node; > + BOOL res; > + > + switch (dev->kdrv) { > + case RTE_KDRV_NONE: > + /* Get NUMA node using DEVPKEY_Device_Numa_Node */ > + res = SetupDiGetDevicePropertyW(dev_info, dev_info_data, > + &DEVPKEY_Device_Numa_Node, &property_type, > + (BYTE *)&numa_node, sizeof(numa_node), NULL, 0); > + if (!res) { > + RTE_LOG_WIN32_ERR( > + "SetupDiGetDevicePropertyW" > + "(DEVPKEY_Device_Numa_Node)"); > + return -1; > + } > + dev->device.numa_node = numa_node; > + /* mem_resource - Unneeded 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: > + return ERROR_NOT_SUPPORTED; > + } > + > + return 0; > +} Why return (-1) in one case and ERROR_NOT_SUPPORTED in another if these cases are not distinguished by the caller? Also, it returns 0 on success, but caller checks for ERROR_SUCCESS (which is 0, but this is inconsistent). [snip] > @@ -165,5 +360,40 @@ pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused) > int > rte_pci_scan(void) > { > + DWORD device_index = 0, found_device = 0; > + HDEVINFO dev_info; > + SP_DEVINFO_DATA device_info_data; > + int ret = -1; Sorry for nitpicking, but such alignment hurts readability, with 8 spaces per tab, at least. Please consider using spaces in the middle of line. > + > + dev_info = SetupDiGetClassDevs(&GUID_DEVCLASS_NET, TEXT("PCI"), NULL, > + DIGCF_PRESENT); > + if (dev_info == INVALID_HANDLE_VALUE) { > + RTE_LOG(ERR, EAL, "Unable to enumerate PCI devices.\n"); > + RTE_LOG_WIN32_ERR("SetupDiGetClassDevs(pci_scan)"); RTE_LOG() does output, which may rewrite GetLastError(), consider swapping these two lines. > + goto end; > + } > + [snip] -- Dmitry Kozlyuk