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 E2409A0350; Wed, 24 Jun 2020 01:28:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A78981D6F0; Wed, 24 Jun 2020 01:28:13 +0200 (CEST) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id 496A71D6ED for ; Wed, 24 Jun 2020 01:28:12 +0200 (CEST) Received: by mail-lj1-f196.google.com with SMTP id x18so483245lji.1 for ; Tue, 23 Jun 2020 16:28:12 -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=T2zmRxFXYMSEA2Y2SMOziKS7aX3M3u/TKKFJjNztXDQ=; b=clIHPJ/KimcHzotQXzFmJtqHxBOq906CF3nwF+JbIfP5tI3+YnOLlBP91cGKO5Iyxw CBKlQQwT0vjEtwfTfJLJ1B2THD416DPIT7KUMrj7ApXVfrAtS34H0meh+VZduyFV63a8 v6gT9GxSTy4W2++Ph4CMGARbEHxteUUXTb2A/5uWR6z2WzprsEs3mpErgcFf0p+rFFyZ 0vs9qTovkFzJpmG0MAuLUkqclpXiRgVROoMW4n9Hdu6E1DgZw1FHetrG1VzOQBD3hjks MIGdQHpBKWMk68RP7vzu8dVXFQ+QSsk0YqGq3a5tIem2GGH8BR0I7HobOewe6oplPQD8 IQdg== 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=T2zmRxFXYMSEA2Y2SMOziKS7aX3M3u/TKKFJjNztXDQ=; b=IWBqbx20p7eVD22bwpgo7Gaf5xGaeRDFTeZkhWS8QvXUl9/K3cOfA62ZggYTFnhb5a KbOchywXpCF1qPBmqWBIZTWDBz4GYwFg8tLWM2KOkUIV6O5S9J9Ca4so8fO8z+ZGQapT 4zRT+tWuJnJ/ZUhfTUYVVLNeDAvvlhRLUCWDLHC7+euO7obSHFyTISyvxDdm9gzWtSz5 djARjXkrxVcCjvOkxGlCDTLv3R0jpcrEMZBBaKL6cc+LqezTOoBjHlq0FzNyit6WcRwv AseFHkkNbgLSjPq150gUBt5q105xUNi80cGkZm0lfDJFufWs6tSpuA5lr3vCg26LlmRS e7SQ== X-Gm-Message-State: AOAM530tFN9Kl1flRO49MHOGrDWvsTqHbwEYn5DO1BuxxhK/f5OWJdqT iNsscCPhe96JyaE4PXkUduA= X-Google-Smtp-Source: ABdhPJwkS+XP3GnGKQFwjDMyOp4xTqRPe1mNV3k9xWxO5sp8hczgRQZU7H6wfDJba29J15dKDMVzvA== X-Received: by 2002:a05:651c:106c:: with SMTP id y12mr11685405ljm.427.1592954891643; Tue, 23 Jun 2020 16:28:11 -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 m13sm3588415ljj.20.2020.06.23.16.28.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 16:28:10 -0700 (PDT) Date: Wed, 24 Jun 2020 02:28:09 +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, fady@mellanox.com, bruce.richardson@intel.com Message-ID: <20200624022809.2141eccd@sovereign> In-Reply-To: <20200622075529.24180-9-talshn@mellanox.com> References: <20200621102612.22740-2-talshn@mellanox.com> <20200622075529.24180-1-talshn@mellanox.com> <20200622075529.24180-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 v8 8/9] 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] > + /* kernel driver type is unsupported */ > + RTE_LOG(DEBUG, EAL, > + "kernel driver type for PCI device " PCI_PRI_FMT "," > + " is unsupported", Nit: log messages usually start with a capital. > + dev->addr.domain, dev->addr.bus, > + dev->addr.devid, dev->addr.function); > + return -1; > + } > + > + return ERROR_SUCCESS; > +} [snip] > +static int > +pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data) > +{ > + struct rte_pci_device *dev; > + int ret = -1; > + > + dev = malloc(sizeof(*dev)); > + if (dev == NULL) { > + goto end; > + } Braces not needed here. Checkpatch should've complained. > + > + memset(dev, 0, sizeof(*dev)); > + > + char pci_device_info[PATH_MAX]; > + BOOL res; > + struct rte_pci_addr addr; > + struct rte_pci_id pci_id; > + > + /* Retrieve PCI device IDs */ > + res = SetupDiGetDeviceRegistryPropertyA(dev_info, device_info_data, > + SPDRP_HARDWAREID, NULL, (BYTE *)&pci_device_info, > + sizeof(pci_device_info), NULL); > + if (!res) { > + RTE_LOG_WIN32_ERR( > + "SetupDiGetDeviceRegistryPropertyA(SPDRP_HARDWAREID)"); > + goto end; > + } > + > + ret = get_pci_hardware_info((const char *)&pci_device_info, &pci_id); What do you think of calling SetupDiGetDeviceRegistryPropertyA from get_pci_hardware_info (like other functions in this file work) and renaming the latter to something like get_device_pci_id (for what it exactly does)? Current get_pci_hardware_info may become parse_pci_id static helper. [snip] > @@ -165,5 +366,44 @@ pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused) > int > rte_pci_scan(void) > { > + int ret = -1; > + DWORD device_index = 0, found_device = 0; > + HDEVINFO dev_info; > + SP_DEVINFO_DATA device_info_data; > + > + /* for debug purposes, PCI can be disabled */ > + if (!rte_eal_has_pci()) > + return 0; > + > + dev_info = SetupDiGetClassDevs(&GUID_DEVCLASS_NET, TEXT("PCI"), NULL, > + DIGCF_PRESENT); > + if (dev_info == INVALID_HANDLE_VALUE) { > + RTE_LOG_WIN32_ERR("SetupDiGetClassDevs(pci_scan)"); > + RTE_LOG(ERR, EAL, "Unable to enumerate PCI devices.\n"); > + goto end; > + } > + > + device_info_data.cbSize = sizeof(SP_DEVINFO_DATA); > + device_index = 0; > + > + while (SetupDiEnumDeviceInfo(dev_info, device_index, > + &device_info_data)) { > + device_index++; > + ret = pci_scan_one(dev_info, &device_info_data); > + if (ret == ERROR_SUCCESS) > + found_device++; > + else if (ret != ERROR_CONTINUE) > + goto end; > + > + memset(&device_info_data, 0, sizeof(SP_DEVINFO_DATA)); > + device_info_data.cbSize = sizeof(SP_DEVINFO_DATA); > + } > + > + RTE_LOG(DEBUG, EAL, "PCI scan found %lu devices\n", found_device); > return 0; "dev_info" leaks here. > +end: > + if (dev_info != INVALID_HANDLE_VALUE) > + SetupDiDestroyDeviceInfoList(dev_info); > + > + return ret; > } [snip] -- Dmitry Kozlyuk