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 17A4DA052A; Tue, 26 Jan 2021 18:45:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 95C79140EEA; Tue, 26 Jan 2021 18:45:45 +0100 (CET) Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by mails.dpdk.org (Postfix) with ESMTP id 5574D140EE9 for ; Tue, 26 Jan 2021 18:45:42 +0100 (CET) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 26 Jan 2021 09:45:41 -0800 Received: from HQMAIL107.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 26 Jan 2021 09:45:41 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 26 Jan 2021 09:45:41 -0800 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 26 Jan 2021 17:45:41 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 26 Jan 2021 17:45:39 +0000 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.175) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 26 Jan 2021 17:45:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G2si9N/UPm/VRq1tZMFaM1hD4zRTx4hH20iVYwwiLrLpqtQMO7NRg9ZMGMlgDkoU5i0ZmQIXeXC8Q6Tx9Tf/n6gffOz7rWEVXI3b7bRi6Z2rw0wcFaR/WY7wSwf1yGfQPiEf6GVZoTaEKQNcZ8+Q8Caq4ZegCYzFW2Llo4VUidTrQbvikQuFlDj5mWb/OZwIzlqRyb80HhAoC/OTi/sd+lrJ8NotvTnuMqt24wwdRG7VwWN5p9yV2l7nv06RQzGxhfu9rE+CBdcPu9XTumsOfYXF47yN6XaGumAtcuPDeNH1lnD5yg7ea25yIlZVOF8mCUqfVMh34Fzf7Th+qf4ddg== 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=TWNwHFtzJtekI2SRDQ6EYHxpOZW1hmcfAyKFYGRun2Y=; b=TwZP7OIBSqYtMGsX6t75k7ZnI9GGXYiG6bL2Sbh1coqCwlAFekaeNn0lmi2lnuSCqHKy2IkwTuIsXjrwjXdX/Q18DyJHqFNXa71IjE8Fhf5MJRMslYxi3ascIF88+iP7roLfLLjxhvMZn3UK/S31yjAsYInitVOdQuJrp3i+53YauNa+jVo/a2U6FnuN3qN1f4zajomG+03M4N1iUoejnvmFfteMZU+NeVT2gmBIvaFL6ON5g8FOHHpG1nihEepO0QqxjhPO4ierSciiAAcNqX9pirPY4mtMksaqiPmE6XubbztzyWQe601yWA+czhyOuMgrn8SSmpJbmVSNeoN7wA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none Received: from DM6PR12MB3945.namprd12.prod.outlook.com (2603:10b6:5:1c2::27) by DM6PR12MB4762.namprd12.prod.outlook.com (2603:10b6:5:7b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Tue, 26 Jan 2021 17:45:37 +0000 Received: from DM6PR12MB3945.namprd12.prod.outlook.com ([fe80::d1dc:9fb2:4724:53df]) by DM6PR12MB3945.namprd12.prod.outlook.com ([fe80::d1dc:9fb2:4724:53df%7]) with mapi id 15.20.3784.019; Tue, 26 Jan 2021 17:45:37 +0000 From: Tal Shnaiderman To: Nick Connolly , "dmitry.kozliuk@gmail.com" , "pallavi.kadam@intel.com" , NBU-Contact-Thomas Monjalon CC: "dev@dpdk.org" Thread-Topic: [PATCH] bus/pci: nvme on Windows requires class id and bus Thread-Index: AQHW8zy4Nk9xSuad8Emfy0i1vu8I1qo6Li8g Date: Tue, 26 Jan 2021 17:45:37 +0000 Message-ID: References: <20210125170821.11306-1-nick.connolly@mayadata.io> In-Reply-To: <20210125170821.11306-1-nick.connolly@mayadata.io> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: mayadata.io; dkim=none (message not signed) header.d=none;mayadata.io; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [77.137.141.17] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1616c492-5df6-4e07-e720-08d8c22230c9 x-ms-traffictypediagnostic: DM6PR12MB4762: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2449; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: IxyhBWWqjuIc9dtmSnG8VyzEIYSg4pndhDkt73kZVIBmGD+CajTe6BomEkLilDLhW5bDHAsZzA2XKFPYjNzQ5U2IS0ZMD9VJhdCV3K+gu4f42w0QEVChJ4LpPeB5KES7fJJTIK7bXeyufOvB4dZUhCDpXUTaETDikc7q/wRph1TjQPBH2wKF16HLtbos3u8koP2z/JUbI79dX4SxI/Th9ROcRqwd+pWm8232oPQRLXkoTJBmzwvNBT2Nl30sELnS1om+2dGQnTpfdWAtQOocJp99O8Btd1Hnz7UNCWvuGJnE9/vylDnXc6QDVsqkUqFAOyJ+CdpjIH4MZ+7i0Iyl8qhk64ZjdLVPqH9GvEOPxZBA+BHT0FXcdZltr/fGtLgcTvO57TY8u2HWivU746Gs/kZMOucSksQ/S4hxB8NMzgYTSCljKgLI+2JNolFZ1hBoFPQFubXTsoLiMwO67u1EmmRO6N3kSELCzv7E1Nr1phezqdMHSPOuHN3FUwAYffkaWHhgp5S9TqRtzGXr0wvIHg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3945.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(396003)(376002)(39860400002)(366004)(5660300002)(186003)(6506007)(86362001)(52536014)(8676002)(26005)(33656002)(478600001)(83380400001)(7696005)(9686003)(71200400001)(55016002)(316002)(64756008)(66946007)(8936002)(76116006)(66446008)(110136005)(66556008)(66476007)(4326008)(2906002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?0l4P0nFd0jM1FLcQsT9mKlHjmg5KN/yTH5QKG6zUn177nuJbDkEh3PZuZRkK?= =?us-ascii?Q?I3auJVV0TPjPEsMHwErzrVNOE3u8Xy4bpzPLOp4vNudmnEikLnE08lCATB/T?= =?us-ascii?Q?F+Q4GWxNOh1Fi/eEA/8JsUKrqbTYKnGN9gGTvWfcOS3LIVJKv68+oOsi6yZ4?= =?us-ascii?Q?yZ2MkCAjwnjEzTQ0T4zobnQKT6OWYaA4VGruac9sH1VZWfvkQuekcaMThkWy?= =?us-ascii?Q?hn0oDVdImxvQY98yT4QP9R/LWjHoZ3gHWibSKqJmRcYQQGHVYhX8hsOKgQdp?= =?us-ascii?Q?ttySNQsPC08Hl5z9w9mw2x0J1qIzRv3zSewNs2Rr99xHHdNDcqnkJNalVj+v?= =?us-ascii?Q?en5qTM8v1LcA2qkSelvTBO1f5rOtj1HHvUtNrBGSDCmeJIJvCfHYSkUudeKo?= =?us-ascii?Q?1xPjbLBxKd/Fb3Y+f/B1U9iTBu8DfZd+oiRQrF+BIghKY9QGGSFPIxB/eQHs?= =?us-ascii?Q?nzouA3bGUABaHGM0J3gGUYqsoC6996btQkgtN9WNwXBblRIXbl875CpELb1r?= =?us-ascii?Q?lBZqrKTlkqW3nRIayokywdL+hD0Hx/wFKkMQsvUmwwZk1fAcHuybrTkW2dmF?= =?us-ascii?Q?AWM6zIzAfShlBrC+/1Xg2WGFHEjYqrlnHr/eSHTdu5/kAUBH3VRZ1NYKIWi5?= =?us-ascii?Q?Dm4nnnqmtSZ24AUxsiTNpLH/hwtC6nwMZIgd7rynHF/Yazzm/SX5Mq/ZCFJw?= =?us-ascii?Q?hevqTdZ8c5eER4zmP8kQZZxa9Pu1PJBD+HIpu5pRmXjr6CpZ61tGUYHZ813z?= =?us-ascii?Q?6d4nHVHqlSXvsFsikJHzUhQsM/NWsDXqUO8JGOCW354G2u8j6oItLRSFZEqu?= =?us-ascii?Q?AEas4eLdenn553pOL4L148C8kIVP7IGWZqIrOuCDeg402JAwRM30T4ygzIdi?= =?us-ascii?Q?jwOrnZ+QIV8E56NZSlTfAkcVBni+XYr2iZ9d9O4HtOiPKI+PKPsmTki9SodY?= =?us-ascii?Q?Mvy3p4KtU9c6HnKZxmuuOCihTv5pZasGVOL6MWf6W88g8oIB9Q+tXilZPVnu?= =?us-ascii?Q?5dHqFD6SUB+0XZyfKZ/fXcEyJ0NkUfCzNb658a7dD6kQoIq0OSbE0TgpPxxc?= =?us-ascii?Q?PpylcfRm?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3945.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1616c492-5df6-4e07-e720-08d8c22230c9 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2021 17:45:37.5160 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: z0zHw7NSZvGx7s3v/7aRen7wFwB6DFOmcJKexeBleQERurmCQ0vYP+cvQdmyvytN7QosCgx66G3gc4PvvOIk3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4762 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1611683141; bh=TWNwHFtzJtekI2SRDQ6EYHxpOZW1hmcfAyKFYGRun2Y=; h=X-PGP-Universal:ARC-Seal:ARC-Message-Signature: ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic: Thread-Index:Date:Message-ID:References:In-Reply-To: Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:authentication-results:x-originating-ip: x-ms-publictraffictype:x-ms-office365-filtering-correlation-id: x-ms-traffictypediagnostic:x-ld-processed: x-microsoft-antispam-prvs:x-ms-oob-tlc-oobclassifiers: x-ms-exchange-senderadcheck:x-microsoft-antispam: x-microsoft-antispam-message-info:x-forefront-antispam-report: x-ms-exchange-antispam-messagedata:x-ms-exchange-transport-forked: Content-Type:Content-Transfer-Encoding:MIME-Version: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; b=q3kARURdZcvtqHS74XB8EcUz93gFYvE83BW85UtMQngclI8MCZz0uhob5vj9GFvzx k4uHU1zYN6XwnKA7r2e3v6NFsl5m9ya19S5Zh7Xp5heZ+SsrMF2AZnlkok00l+SneR oZnelvn0YeVMtyTrDDqnzmrKAfj2EokxEypD6I2EKNOqAXVvVydHVgLmO/McNHHwzf V2OQPxccP08ZBu9ZhQbXj7RX0nm4BtoUjgRufw8p2mPwgD1P5JTmKd8t8f8f3/g/pZ QNndHofCTOoV9NjLwoyv76ed1EGlThmEIUH7qLM44lui/ogPdpf7c55zfoJVtU0/Qp eUstHEVCWlWoA== Subject: Re: [dpdk-dev] [PATCH] bus/pci: nvme on Windows requires class id and bus 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" > Subject: [PATCH] bus/pci: nvme on Windows requires class id and bus >=20 > External email: Use caution opening links or attachments >=20 >=20 > Attaching to an NVMe disk on Windows using SPDK requires the PCI class ID > and device.bus fields. Decode the class ID from the PCI device info strin= gs if it > is present and set device.bus. >=20 > Signed-off-by: Nick Connolly > --- > drivers/bus/pci/windows/pci.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.= c > index f66258452..3d11444c2 100644 > --- a/drivers/bus/pci/windows/pci.c > +++ b/drivers/bus/pci/windows/pci.c > @@ -280,17 +280,24 @@ parse_pci_hardware_id(const char *buf, struct > rte_pci_id *pci_id) { > int ids =3D 0; > uint16_t vendor_id, device_id; > - uint32_t subvendor_id =3D 0; > + uint32_t subvendor_id =3D 0, class_id =3D 0; > + const char *cp; >=20 > ids =3D sscanf_s(buf, "PCI\\VEN_%" PRIx16 "&DEV_%" PRIx16 > "&SUBSYS_%" > PRIx32, &vendor_id, &device_id, &subvendor_id); > if (ids !=3D 3) > return -1; >=20 > + /* Try and find PCI class ID */ > + for (cp =3D buf; !(cp[0] =3D=3D 0 && cp[1] =3D=3D 0); cp++) How about=20 for (cp =3D buf; cp[0] || cp[1]; cp++) > + if (*cp =3D=3D '&' && sscanf_s(cp, "&CC_%" PRIx32, &class= _id) =3D=3D 1) Could there be a case where PCI\\VEN_v(4)&DEV_d(4)&CC_c(2)s(2) exist but PC= I\\VEN_v(4)&DEV_d(4)&CC_c(2)s(2)p(2) doesn't? In that case the parsing woul= d be incorrect. > + break; > + > pci_id->vendor_id =3D vendor_id; > pci_id->device_id =3D device_id; > pci_id->subsystem_device_id =3D subvendor_id >> 16; > pci_id->subsystem_vendor_id =3D subvendor_id & 0xffff; > + pci_id->class_id =3D class_id; > return 0; > } >=20 > @@ -339,6 +346,7 @@ pci_scan_one(HDEVINFO dev_info, > PSP_DEVINFO_DATA device_info_data) > if (ret !=3D 0) > goto end; >=20 > + dev->device.bus =3D &rte_pci_bus.bus; > dev->addr =3D addr; > dev->id =3D pci_id; > dev->max_vfs =3D 0; /* TODO: get max_vfs */ > -- > 2.25.1