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 320F4A0519; Fri, 3 Jul 2020 14:53:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CDC8B1DB6D; Fri, 3 Jul 2020 14:53:25 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20065.outbound.protection.outlook.com [40.107.2.65]) by dpdk.org (Postfix) with ESMTP id D6F3C1DB53 for ; Fri, 3 Jul 2020 14:53:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EV5fBXZL15IKp2LuxvzmaGLx3o3o4y5OMR/euTnzJEps2iXOskxv0E+Ir5Y7SKNkhRoMIOQVX6m1luzTAoJvVXcmS2gPjTNnxyz/qnK+ApgblXhbxw4vymSyrs7Gtwf7AHAnCKl6IJN9sZRA0CRfANPM5PBP6LMYArRSnsbagrhM2DX4WHfJbKccLLxdPOPxyTM+YqAq/lvX0ybJqhYC4ZABH3vEIK4qpmnJjeFfV9nuBHe7pqQbBqd+FcIn84c18NlYsDvjU8MrIRsAQyt/8LTBA5CoNP6KmuAw6rfWu+/Bto5UgjTXfNtZ8IjjPkuRYbUuXmtskf7qowk3jotn2A== 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=STTpyjd5bk0w00ceUI3Ok/xeK1fpXAYTL0zFiD65nPM=; b=dCiOvN6Us2TgX2v34hevzVux9jDlulCD7q6u18Kq6eeptszDaNAen4QHBn0uXGvGKKWxb0p4LkpfqKns/kwTFWhA6ePDuoimwtwE8H4HR3S2546wsvr2KevlYUhU1qRjOaCGs95zfu2JZ/DU3duNAGyxq5l+AVwF5cMilNao/hlECLnobxg0UZL8qNG945oLZ+HmPxfgRQWBZ49Vha+1ISDjESas0mtSCocx15uf9tCfKP4HgQXZaVDT17AHEnYdtBiEfW0DEQNyvkgp70zJBatQtOo6CkN6KTu+MrZGHBSPjxfddxU/LfLh4aacO8ZIIku/bXToKyUSDMdpILY3sg== 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=STTpyjd5bk0w00ceUI3Ok/xeK1fpXAYTL0zFiD65nPM=; b=iJnvJaolsE4ridtNi9IKTs24wVZqVc2EpB1+hRxmGKWmfLmcrvDNARupuuLGRzYFMLgYZUs1PRtB/gvrKzBB8tpE6U740FdcH2TYoSMJ6VXi+7CixPZJmy7x9Z6nC6TO1WrF84jAzXgeGIvFIHvxoruVjM5+sny6AeS5xKoqCqs= Received: from AM0PR05MB4866.eurprd05.prod.outlook.com (2603:10a6:208:c0::32) by AM0PR05MB5747.eurprd05.prod.outlook.com (2603:10a6:208:113::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.20; Fri, 3 Jul 2020 12:53:23 +0000 Received: from AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::d44d:a804:c730:d2b7]) by AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::d44d:a804:c730:d2b7%2]) with mapi id 15.20.3153.024; Fri, 3 Jul 2020 12:53:22 +0000 From: Parav Pandit To: "dev@dpdk.org" , "grive@u256.net" , "ferruh.yigit@intel.com" CC: Thomas Monjalon , Ori Kam , Matan Azrad Thread-Topic: [PATCH v3 07/10] bus/mlx5_pci: register a PCI driver Thread-Index: AQHWURo4eyL3gwJND0OMIGKtR9iXrqj1zvVQ Date: Fri, 3 Jul 2020 12:53:22 +0000 Message-ID: References: <20200610171728.89-2-parav@mellanox.com> <20200703091259.2108996-1-parav@mellanox.com> <20200703091259.2108996-8-parav@mellanox.com> In-Reply-To: <20200703091259.2108996-8-parav@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [106.51.28.254] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 04ebecfb-1f1e-4afa-71d9-08d81f501169 x-ms-traffictypediagnostic: AM0PR05MB5747: 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:7691; x-forefront-prvs: 045315E1EE x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: df9JukHGCCBQEmbLXTVS8Ci+SncHEt5/Bg+2FVYScA8zHn1W2iyzAqkFtqJpVV1UJTp6fMHBBlzSqtS8dHN3nH7YG1GRpOv7AVUzsKB1dc+BXmgEkFqWALti5xCyZCDss5gWzDh/olxnAMi7sGOkFrSOylfHLSPVSeSSSMXXLPN0wsvmbdjvbkzuDhiUgr2h/E1usoFTLb+fcYj/pslbnPCm/s8O65YD+n386FI1gqi/qkH19jOe6iStO64SDLPg8qQaTME7ajnVCVA12O4hK0j3qNVUkNhxUpegPaEeJreqVFxd9Uj941dVvBhhfOB8 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB4866.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(39860400002)(346002)(376002)(136003)(366004)(52536014)(33656002)(8936002)(7696005)(8676002)(71200400001)(6506007)(86362001)(4326008)(54906003)(2906002)(110136005)(186003)(316002)(66556008)(5660300002)(107886003)(55236004)(66476007)(55016002)(26005)(76116006)(66446008)(9686003)(478600001)(64756008)(66946007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: ARAstLwvOBISPO688Yz7Q67lWVek56hiNs24iKjLPs2xZcncGbGoA7o0C558LSaCW1euCMd4YXgnEuuWuH9lNLMR72R7U+EBmYp1hHfu4hoBqXedAgkJzJ0o7tvv66BsfdSkviqE7qaar5DGvOJEuv65qEh12DxvA83f8gQqDvIRe3pmMP4vg+omwsOG4vv4LRnFwEjPdGIKYH3X/UfI/Ha0duyfHYNdF+2HtcoJNNyz1EBKimVc7BL7SPEh+O5r7qPfUr264DQeM/KRJtX6NlDR5UooMyAn9TkAuUNng+ootihjba8geKZIDiE533ZYmLt7P2oRkmLYzIkBdsaL2H/Gq9TRYuuxQ4PON1IF4grRY7bpQJzY637AoOvwDXyTw2izdDsVIlIvXzM8QWSNyn+vFnyDcEwRPlqT4TBsN0BXlPO0I8TuRLc9PT7AaeWGBxsg2tRa+YgZDMXWOG02yq7UnNdcgfagRfRV2PWD2xvFwS3DVJmJzDigml/ktpx7 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR05MB4866.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04ebecfb-1f1e-4afa-71d9-08d81f501169 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jul 2020 12:53:22.2263 (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: lO9BUphrae5P97VY0o828Y5403xrmQlPHRhUS6KAln3XT1nr/qQw3AgXKotwBjKju65PSJNoeV9h6cj5LPLgrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5747 Subject: Re: [dpdk-dev] [PATCH v3 07/10] bus/mlx5_pci: register a PCI driver 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" > From: Parav Pandit > Sent: Friday, July 3, 2020 2:43 PM >=20 > Create a mlx5 bus driver framework for invoking drivers of multiple class= es > who have registered with the mlx5_pci bus driver. [..] > diff --git a/drivers/bus/mlx5_pci/mlx5_pci_bus.c > b/drivers/bus/mlx5_pci/mlx5_pci_bus.c > index 66db3c7b0..7344c2083 100644 > --- a/drivers/bus/mlx5_pci/mlx5_pci_bus.c > +++ b/drivers/bus/mlx5_pci/mlx5_pci_bus.c > @@ -2,13 +2,521 @@ > * Copyright 2020 Mellanox Technologies, Ltd > */ > +static int > +mlx5_bus_pci_dma_map(struct rte_pci_device *pci_dev, void *addr, > + uint64_t iova, size_t len) > +{ > + struct rte_mlx5_pci_driver *class; > + struct rte_mlx5_pci_driver *temp; > + struct mlx5_pci_device *dev; > + int ret =3D -EINVAL; > + > + dev =3D pci_to_mlx5_device(pci_dev); > + if (!dev) > + return -ENODEV; > + TAILQ_FOREACH_REVERSE(class, &drv_list, mlx5_pci_bus_drv_head, > next) { > + if (device_class_enabled(dev, class->dev_class) && > + class->pci_driver.dma_map) { > + ret =3D class->pci_driver.dma_map(pci_dev, addr, > + iova, len); > + if (ret) > + goto map_err; > + } > + } > + return ret; > +map_err: > + TAILQ_FOREACH(temp, &drv_list, next) { I made a mistake in reusing the logic of the dma_unmap() callback here. This loop needs to follow same sequence as that what dma_map() does. I will send the fix. Will wait for some time to gather if there are comment= s. > + if (temp =3D=3D class) > + break; > + if (device_class_enabled(dev, temp->dev_class) && > + temp->pci_driver.dma_map && temp- > >pci_driver.dma_unmap) > + temp->pci_driver.dma_unmap(pci_dev, addr, iova, > len); > + } > + return ret; > +}