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 5E6D3A0350; Wed, 24 Jun 2020 10:10:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E76231D9E1; Wed, 24 Jun 2020 10:02:49 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80042.outbound.protection.outlook.com [40.107.8.42]) by dpdk.org (Postfix) with ESMTP id 34B411D8E7 for ; Wed, 24 Jun 2020 10:02:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dYZZR/ghqTXHuOOeDk3Rua1Oyc5+qBeY6c4KJNPScmGUP+8fJiyZVwpDJOrdye+Eht4GO448C7K2X/UN4dVZWpbs/CcE9s5C3X2qmAxlSVcSfb2w+yL4PMHQlC4k+P5wjCoa17v3Luyih5wl/ffJX1iGU8qwhFZlmpkx0ANpQh+Z09RTBTdYdhNv9nciE+bNESusIOp2svHpnm0nUceySCdMcHv28zC35qFcZVhLONxqQNmpKuW5gf+QYI8hyy/AVNH60+hZMFRFKCSN4M/ANm9jlIwj8OPMWniGkbAiiMi3radSXLjVleN85di9kXfy9bIedy0Ie6W2V82RFbPbUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MAs2pFD7LYWCvm0MRdCgpp98x6WpTVxFmj557+mO6j8=; b=GyU2Lg+pxf2swmclKgKuHkGQ3wC0YNtXhFpRHSNSyridnQnqo3+LIMQCJ85Xboxgb2D9xp66LvD95tuby3kwVgxqi1T8WK1QhbA/jbxTiK/vgWEMbPTfG+enlOC99B4dC5JyJAZuPTAycYYzKdNOKRfjyNpriidjIW6qdB3SKYZxIVf8MB2360/1HaJPbxcn8LSkYAjSEzTMyG0hXJgYeNzKriPjm950M+Oy8mpPM1KeTgW3rQAEFY1rUXXoOwUNdtjJoZIxdVNVF2Ip98aCga0SC/9AWiZs9DiIQn+pum5pBoImqNE4P2DU60Zqc+DzLhiWE8jk9wdv540NzfG5jw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MAs2pFD7LYWCvm0MRdCgpp98x6WpTVxFmj557+mO6j8=; b=qNqtRebi8QmGUden71/nuwTHx6KBcQbO7Oqu5uX0e+P91cJWA/3KiV/ITVSVLi4sBQWsMs7EnFwv4hJFEa4ygS6owQn0uyJA4b1HVkJ9lX4nKevy+17+KpN91gKcw3WtwQcPZ4hgJW1Jvf/BM+783wPZpY8Fa8S7P8G6XBP2srk= Received: from AM0PR05MB5313.eurprd05.prod.outlook.com (2603:10a6:208:f2::28) by AM0PR05MB5729.eurprd05.prod.outlook.com (2603:10a6:208:11c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.21; Wed, 24 Jun 2020 08:02:46 +0000 Received: from AM0PR05MB5313.eurprd05.prod.outlook.com ([fe80::3069:d8f4:fadc:4d7]) by AM0PR05MB5313.eurprd05.prod.outlook.com ([fe80::3069:d8f4:fadc:4d7%5]) with mapi id 15.20.3109.027; Wed, 24 Jun 2020 08:02:45 +0000 From: Tal Shnaiderman To: Dmitry Kozlyuk CC: "dev@dpdk.org" , Thomas Monjalon , "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 Bader , "bruce.richardson@intel.com" Thread-Topic: [PATCH v8 8/9] bus/pci: support Windows with bifurcated drivers Thread-Index: AQHWSGqQEUX63lzWl0uybrE281SfGKjm2xOAgAB365A= Date: Wed, 24 Jun 2020 08:02:45 +0000 Message-ID: References: <20200621102612.22740-2-talshn@mellanox.com> <20200622075529.24180-1-talshn@mellanox.com> <20200622075529.24180-9-talshn@mellanox.com> <20200624022809.2141eccd@sovereign> In-Reply-To: <20200624022809.2141eccd@sovereign> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [37.142.1.17] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 55ad027f-701e-4a8c-60e5-08d81814fad4 x-ms-traffictypediagnostic: AM0PR05MB5729: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 0444EB1997 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: n38rCWbO0k6UEu/WxJ+Cf3bUxxJ6QgLmu76mrqJ78D5P+Gux3g8i2Hnrxfk2qcbpgNyEFF2daZ6eJeMfpnm6On2MK5h2ojREZ21RULyv2IH/717X023IQPH1AVnQzHNvLxWEvdqsuPTlxrU5EaxAZtIWgs+UoBi5TlxnJ5y9E5VamInF4vpaP5g1yxyWrz2uY3GI01dLCxpnaKkwsv24A5NEmE8FCRLv/4gbrWKZql4YuTQkl+fXlgU4FkJSbrhbb7BizPz0AWlim8P1BxeMTobshftT2lznVuva5a0fMRRVyxRHkj7kVqRQ6UkXzGPz7A62m6g5jhrZO8sHvji3Rg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB5313.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(136003)(376002)(396003)(39860400002)(366004)(6506007)(66946007)(7696005)(83380400001)(26005)(8676002)(7416002)(54906003)(55016002)(316002)(9686003)(52536014)(2906002)(186003)(478600001)(4326008)(5660300002)(76116006)(71200400001)(86362001)(33656002)(64756008)(66446008)(6916009)(66476007)(66556008)(8936002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: zKsOxQ0/TMH+clkNz52a3LmOPJb0T6wNJ7cwdFQ2Ebuy60wEADpyjzfoYlS6TE/oMleTgmPeXNN3fN41b8MdRTZXBvYyasrmzdZ42a2KzqTneY5xu+vx30N/xCVU9DpG5hj7Tnq0ydWaEhZjkhHfbmLiN5fw+ogyOLLaFkA7I59FvFyrZspFEgg4Pg3t2iwT0xSycaVpZ52GawI7pLINB/QstRbmSx+XG6c+IIKi094pijngOt/tJ6/ngb/rEghKdcn2xxUy3NAYvBHv/gKg++JZW1RD7q+3DScOtqfdekjALdF768rNfRRaKGG5ZrIkYNLEnqDc9Qz+ro0Jqpx1i5sh6te+YaqBTFsizvznxV5NH4Xft/PgAva0O6SYrl5071lpULCT28ElGujZWMZxYC9W8KedfP/M8rv+fommmqkINN2bCxcukD9nBg1pbhlpu4RHgu1ztCTuGrjAI+8vzdGePZKWDip7QYPXcqErNDs= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55ad027f-701e-4a8c-60e5-08d81814fad4 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jun 2020 08:02:45.8600 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: yi80JnkCbfRLu9mTeZvI5vOO/4EUxj1ANVRXPto1vN49lwPjVUD8Z0Kxrz8rgGUxdZK1zaM52JCToa76zIPbGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5729 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" > Subject: Re: [PATCH v8 8/9] bus/pci: support Windows with bifurcated > drivers >=20 > [snip] > > + /* kernel driver type is unsupported */ > > + RTE_LOG(DEBUG, EAL, > > + "kernel driver type for PCI device " PCI_PRI_FMT "," > > + " is unsupported", >=20 > Nit: log messages usually start with a capital. >=20 > > + 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 =3D -1; > > + > > + dev =3D malloc(sizeof(*dev)); > > + if (dev =3D=3D NULL) { > > + goto end; > > + } >=20 > Braces not needed here. Checkpatch should've complained. >=20 > > + > > + 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 =3D 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 =3D get_pci_hardware_info((const char *)&pci_device_info, > > +&pci_id); >=20 > What do you think of calling SetupDiGetDeviceRegistryPropertyA from > get_pci_hardware_info (like other functions in this file work) and renami= ng > 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. >=20 Agree, will modify to get_pci_hardware_id and parse_pci_hardware_id in v9 with the rest of your comments. > [snip] > > @@ -165,5 +366,44 @@ pci_uio_remap_resource(struct rte_pci_device > *dev > > __rte_unused) int > > rte_pci_scan(void) > > { > > + int ret =3D -1; > > + DWORD device_index =3D 0, found_device =3D 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 =3D SetupDiGetClassDevs(&GUID_DEVCLASS_NET, > TEXT("PCI"), NULL, > > + DIGCF_PRESENT); > > + if (dev_info =3D=3D 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 =3D sizeof(SP_DEVINFO_DATA); > > + device_index =3D 0; > > + > > + while (SetupDiEnumDeviceInfo(dev_info, device_index, > > + &device_info_data)) { > > + device_index++; > > + ret =3D pci_scan_one(dev_info, &device_info_data); > > + if (ret =3D=3D ERROR_SUCCESS) > > + found_device++; > > + else if (ret !=3D ERROR_CONTINUE) > > + goto end; > > + > > + memset(&device_info_data, 0, sizeof(SP_DEVINFO_DATA)); > > + device_info_data.cbSize =3D sizeof(SP_DEVINFO_DATA); > > + } > > + > > + RTE_LOG(DEBUG, EAL, "PCI scan found %lu devices\n", > found_device); > > return 0; >=20 > "dev_info" leaks here. >=20 > > +end: > > + if (dev_info !=3D INVALID_HANDLE_VALUE) > > + SetupDiDestroyDeviceInfoList(dev_info); > > + > > + return ret; > > } > [snip] >=20 > -- > Dmitry Kozlyuk