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 EB21CA0A0D; Sun, 31 Jan 2021 16:56:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7142F40693; Sun, 31 Jan 2021 16:56:53 +0100 (CET) Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by mails.dpdk.org (Postfix) with ESMTP id E255140692 for ; Sun, 31 Jan 2021 16:56:51 +0100 (CET) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Sun, 31 Jan 2021 07:56:50 -0800 Received: from HQMAIL107.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Sun, 31 Jan 2021 07:56:50 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Sun, 31 Jan 2021 07:56:50 -0800 Received: from HKMAIL102.nvidia.com (10.18.16.11) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 31 Jan 2021 15:56:50 +0000 Received: from HKMAIL103.nvidia.com (10.18.16.12) by HKMAIL102.nvidia.com (10.18.16.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 31 Jan 2021 15:56:42 +0000 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.104) by HKMAIL103.nvidia.com (10.18.16.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Sun, 31 Jan 2021 15:56:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D/o4eAjp3FO4KvyLXmkFA7jn2JPE24QqTpbCgIoabEFu48kwT8QYWgY0yOIn79rIPb0Qg2eX/qsVOFMjrPzudmOi4AgsjIYFhHt8VBxqBjDOLOQ1U3uzVyQdN3E75Z/I7efkjJUCXMXeNDpDbOfSba/3Sgp0NuapzEby5jHjyuEnZJw+0Tj93w1HMohxZrksFpvyZ/TwEtoENghudQPfLmLDZLIC4wXIgMgc9bNd82ozXHVFb9ngWTWlmCZqJCBjpAFfcPzSXDXV4AFKN36OIx3uY1uqdFlS8Odtmsft5D9OTk30Fk2hTzSLGBF/He22cMFMRDb4HOlLS6gz9QwoDA== 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=EtqvUPiPaqY7FslQEH/nzlFVV98t46Hjvyjn2xDWZwg=; b=RJ9sanYjSePGEJ8psK5d+I3utw/33AE95KhoZUf0nVNBuQ3dAjb8JC38vPmy6oq/xheHxt6sRG0dIOFuHFDSbMHeFEqgQAFvtdZBvpbBsQ27+MXnaajZVMK8KjkofeNhwH2hVJ2kPRDDzYjiFYzspPZwKYG4c8+a8ap8x03jMie+8pIfF90s2lrhqSQoZrNFS9sfOQhx33cFU2gQMOfjqbh4CS+ai7SGfG6Ixdcx8cgIi46URFKnpal920xPFoPWv0Q4KSz+J5Z80CJLe3yz3g5uTYQTZRc0iZE3CW8lyMRy+CwOq+XTscELvWyfC5qVbMXSobibwHMabwd6+UzyVA== 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 DM6PR12MB3852.namprd12.prod.outlook.com (2603:10b6:5:14a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17; Sun, 31 Jan 2021 15:56:39 +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.3805.024; Sun, 31 Jan 2021 15:56:39 +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 v3] bus/pci: nvme on Windows requires class id and bus Thread-Index: AQHW9Ze9dtZ0xeUkfUS56ChXpOx6/qpB4wLA Date: Sun, 31 Jan 2021 15:56:38 +0000 Message-ID: References: <20210125170821.11306-1-nick.connolly@mayadata.io> <20210128170435.4304-1-nick.connolly@mayadata.io> In-Reply-To: <20210128170435.4304-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: 5c2ffbe0-6c52-4c2f-ca20-08d8c600cba7 x-ms-traffictypediagnostic: DM6PR12MB3852: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-header: ProcessedBy-CMR-outbound x-ms-oob-tlc-oobclassifiers: OLM:2331; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: IXhp06cAG87695jDOLv8vx4DQGptVJjY7VjTmXPyRl/61OYa8rD8FpgcJojaZgqNTw9LFay7YEH3oRNEdxT64Q20KBwf6GgAf0v5S4dJwW5XsrCKF6LcWq3vOTRSOTIV1Y2zPXxm0TmmAYf68Q31JZgVGeP9L9l+pSRwxi7nEU6RtW1MKfGGz42n3CqO/A3YtKLE3vOMaUcx1FH+gwvvBJW98cXI8lttba1v0j/uSzNSC+Iww/hsMiqESP/g08aebMquKxPO+eO2GZc2yxZNmvDNm+dh2OdLoNxWbHcLD9Zu23c/vxlU4QyfWIFDVS/nhA09PDHxRQrg7RepzVAEiYF7f5oEQeHHOUEaE9J48MPO7wVOuk3xOwG53rWcFy5pqq74CTvifXv96TQNtfRYHx5ody+I+bjLgaGKR0dQH4zmifu7e6bvii2D67HhU4P0vHrRTJoxOdOpNPnAYvMOma3FQaDq8TJeNtfDgHNfpY35yVrla79K80oHx30C0uxm0qaaC8HSI7FvhaEnnt0AKg== 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)(396003)(366004)(136003)(376002)(346002)(39850400004)(110136005)(52536014)(86362001)(186003)(33656002)(8936002)(478600001)(7696005)(5660300002)(26005)(316002)(6506007)(4326008)(55016002)(83380400001)(9686003)(8676002)(76116006)(66446008)(64756008)(66556008)(66476007)(71200400001)(2906002)(66946007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?+0tWerX/8zkZr3EAz9dxtTCJ9354PvzPr3EWmHKcTAsUh0F6R/vAnfC29jVu?= =?us-ascii?Q?W5uTASNwhK2eA8dTJZlm+OZEWEYY4KiQ98W2btC53RAKyCVvfm2Bit7W+lmJ?= =?us-ascii?Q?/K2WxfHD8dkutmO4jveZ3U78RMS04zcJBP/B1BCXSiZE7Q87AIRsL5/nVNJm?= =?us-ascii?Q?gOYZKn7xKTAsRW/ejOwDAVND3IpYMvWmWKv3hxILOfPDS7WqJVeeE9AyBGCZ?= =?us-ascii?Q?67+JwmaVDPexP6aYLRtmtfOawPV3LLG7ogkcuMHxTRS0/cgc6t5EgRvRy38N?= =?us-ascii?Q?1YZLKn+UpjhrQK+5IK5ArOs1dtFldxC4XQ1R3J0Ze5MZrupxyEhl/qMSPj+Q?= =?us-ascii?Q?EdB48CknxP1GcCwUw/j/Ldqnnn3XVeBXP6ocHXnOefzPMUP4RfWO7J0+mU9q?= =?us-ascii?Q?QkI+ydh9M1cPIs7wqxaUp8XB3UyVRbxDUPwWK3XDPuK5++bTJBxkN9LB2Aoe?= =?us-ascii?Q?oWTYDe6ibWsNqtyDJI3lvqJKqgpjVG18T+cEM8aHM+7XsCW5zmU7NN68x58a?= =?us-ascii?Q?sr9QXTtiR70paHE+k99KiOJdG5diY6PXYqB4df5Ljp/xSxAd4To92lSKPK+b?= =?us-ascii?Q?z/pfQIkEI/Z0hSHIqpetP/xy4TGvP9RzT7Y6wsTjtMzEuxoNfIpTEz9GYjZw?= =?us-ascii?Q?wcCud8h0lZFKjo4QlWFiBnOzr5U2HART0Y//Ye4J/OjN1IYjrhViJ0lq5d9D?= =?us-ascii?Q?WIMmS40MrDahmVMaEQvxzvR5gqJP4LwU2zXwwkT82HPVQM3QfNE06I3ha/1C?= =?us-ascii?Q?T1FJiO/yJD3dXlot5ZgQfX+1DppFS8GAUhr1vg6vm/KgMVUJ1tgCQ2ey52BT?= =?us-ascii?Q?/2cW8wcXBbqrN4NsojPBpBqQxNGDB5y1kW+rIH9azmt9awVd0NqGptx9gxSb?= =?us-ascii?Q?1CgmcpSxKzhvmPXA+HHqXoAVtP3RWVyBJntoodWFBw/78kW0fOw46fY2uaQ2?= =?us-ascii?Q?kLlmHZII7k35ZDtyBdONi4bR3H23I9/NajQRFFODd7gdHBZ5ykBUBzN0Esgb?= =?us-ascii?Q?7x4OfMOWMGP8Zzriyq3NKE8VXokG0BMnVSSEi/mHO5B30UrHClLZAFuMJGLi?= =?us-ascii?Q?xuIqTtpQ?= 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: 5c2ffbe0-6c52-4c2f-ca20-08d8c600cba7 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jan 2021 15:56:39.0926 (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: WtZpGkSyEYysRllJBGMHLKZix6TUGlPCEiw7DrCNapnWsCHZJL+fKFnM3ligs+jyjHqeWWNm2gzu70fBdWkrKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3852 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1612108611; bh=EtqvUPiPaqY7FslQEH/nzlFVV98t46Hjvyjn2xDWZwg=; 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-header: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=qG9DiRivNo7Q07ezgl1p3RV4+bZFQhZ6V6XZpJVnnQFn6aP2ptqoDhKLqcO46IpfP LTrQ0k56NHI1BbSMIxhHamaIIeS+lpf08KrxVWt9JSAZrBezP37OdLN0D8Pt4d43BQ leCxRTI9ATWTFKLsloE8GdPEJ/T6YZHwaUvPd2A5h9eSd/z5FvqkWvS8GlCAWF9wS9 zxBLitDl9GeAku6kNgI8ggCFbAFPwiMYEP8Ls4Eho6uQY/0IHJWtvGKsMinrEloB/O 46rXow+Y9qgjeAcAWR3eO50fwk1KxGZAnZ7URPijNXFWjiB7KfWcYA5YpycYNQH8UO JRJMgBPAi0brg== Subject: Re: [dpdk-dev] [PATCH v3] 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 v3] 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 > --- > v3: > * Put version history at top - v2 mistakenly had it after the diffs >=20 > v2: > * If only a 4-digit class ID is available, convert it to 6-digit format >=20 > drivers/bus/pci/windows/pci.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.= c > index f66258452..d380fc1ae 100644 > --- a/drivers/bus/pci/windows/pci.c > +++ b/drivers/bus/pci/windows/pci.c > @@ -280,17 +280,29 @@ 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++) > + if (*cp =3D=3D '&' && sscanf_s(cp, > + "&CC_%" PRIx32, &class_id) =3D=3D 1) { > + /* Convert 4-digit class IDs to 6-digit format */ > + if (strspn(cp + 4, "0123456789abcdefABCDEF") =3D= =3D 4) Maybe we can move this format string to a define in the header, something l= ike RTE_PCI_DRV_CLASSID_FMT? > + class_id <<=3D 8; > + 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 +351,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