From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40054.outbound.protection.outlook.com [40.107.4.54]) by dpdk.org (Postfix) with ESMTP id 856C7FA7E for ; Thu, 19 Jan 2017 14:27:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=v4rvGkcadyAYAmi93NF07KFrCi+pdQW2CCVSbg4H14k=; b=dtj241kZDcKpRk0g13Tn4DdB9vZuXDnz6Y2zpKtx8MvV5H5UTm1xdjolmNfm/fA44CPhs8COSkYpYQLiU/38n6cI/JTiM5ueX0D0l6j6zIGoXhFRvAPNJbRbREuwpfG6uXsEkG30sdSWFQON8opYkMOHr8k63Q9I35HE/G2/MiM= Received: from DB5PR04MB1605.eurprd04.prod.outlook.com (10.164.38.147) by DB5PR04MB1605.eurprd04.prod.outlook.com (10.164.38.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Thu, 19 Jan 2017 13:27:48 +0000 Received: from DB5PR04MB1605.eurprd04.prod.outlook.com ([10.164.38.147]) by DB5PR04MB1605.eurprd04.prod.outlook.com ([10.164.38.147]) with mapi id 15.01.0860.012; Thu, 19 Jan 2017 13:27:48 +0000 From: Hemant Agrawal To: Hemant Agrawal , "dev@dpdk.org" CC: "thomas.monjalon@6wind.com" , "bruce.richardson@intel.com" , Shreyansh Jain , "john.mcnamara@intel.com" , "ferruh.yigit@intel.com" , "jerin.jacob@caviumnetworks.com" Thread-Topic: [PATCH] cryptodev: decouple from PCI device Thread-Index: AQHScldWZb1c3eWU8k6lO2tMCgieDKE/yvTg Date: Thu, 19 Jan 2017 13:27:48 +0000 Message-ID: References: <1484679174-4174-1-git-send-email-hemant.agrawal@nxp.com> <1484832240-2048-1-git-send-email-hemant.agrawal@nxp.com> <1484832240-2048-2-git-send-email-hemant.agrawal@nxp.com> In-Reply-To: <1484832240-2048-2-git-send-email-hemant.agrawal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; x-originating-ip: [192.88.169.1] x-microsoft-exchange-diagnostics: 1; DB5PR04MB1605; 7:OC3MIoF1N3De01tEqxVNld4g8BPpUEwopVg43iSdG65UwNnvGgyYpYFt62ZjPZh92aSnmjifpCX12ZyZnr4pYxIQ/QH7NLaGq4sLBqVm/ZZdv1ltfjLfAZdhZAVtMmhvGYY/JHLvR3Bc1153iJRXpIJhkvjeu+2POhaxFh3Cc0mNdJiTOxWnpCJKV0+1wi1YV09agNPqq5+Qj79YUVHe7QLNHhwMJ5eicVYLcF2WawTU8dUzpKwgMkWu8vPRF5745jYSmXvk86Z+mSYh0aJ6ihQcm1IO8Nudf8RokLw/WhUNIAzitGDowXjcAxe0hrqq51VBOebbV+YS7fb1LV6dqHTaJpRBJC9/jc8o9utpcENoma9HOf2FhlkdSRagJwgsw0GcwDWYSHUNy4uSUpZ9+G6LhDb0opkF2LzVq/gfaYFtCq2kQI2IPpYM5nCUGAfshMcWcFcKqGeGJXckteYHPQ== x-forefront-antispam-report: SFV:SKI; SCL:-1SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39860400002)(39450400003)(39410400002)(39850400002)(39840400002)(199003)(189002)(377454003)(13464003)(50986999)(5001770100001)(38730400001)(92566002)(97736004)(5890100001)(105586002)(2501003)(106116001)(106356001)(102836003)(2900100001)(54356999)(3660700001)(66066001)(8936002)(53936002)(101416001)(6116002)(3846002)(81166006)(2906002)(33656002)(4326007)(8676002)(7696004)(5660300001)(9686003)(3280700002)(25786008)(68736007)(122556002)(76176999)(229853002)(55016002)(305945005)(2950100002)(6436002)(7736002)(99286003)(189998001)(54906002)(86362001)(77096006)(74316002)(6506006)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR04MB1605; H:DB5PR04MB1605.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; x-ms-office365-filtering-correlation-id: 44ffc192-b22c-458a-8e67-08d4406ef622 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DB5PR04MB1605; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123562025)(20161123558021)(20161123560025)(20161123555025)(20161123564025)(6047074)(6072148); SRVR:DB5PR04MB1605; BCL:0; PCL:0; RULEID:; SRVR:DB5PR04MB1605; x-forefront-prvs: 0192E812EC received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jan 2017 13:27:48.4331 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR04MB1605 Subject: Re: [dpdk-dev] [PATCH] cryptodev: decouple from PCI device 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: , X-List-Received-Date: Thu, 19 Jan 2017 13:27:50 -0000 Please ignore. Apologies for repeated sent. This patch was posted earlier. - Hemant > -----Original Message----- > From: Hemant Agrawal [mailto:hemant.agrawal@nxp.com] > Sent: Thursday, January 19, 2017 6:53 PM > To: dev@dpdk.org > Cc: thomas.monjalon@6wind.com; bruce.richardson@intel.com; Shreyansh Jain > ; john.mcnamara@intel.com; > ferruh.yigit@intel.com; jerin.jacob@caviumnetworks.com; Hemant Agrawal > > Subject: [PATCH] cryptodev: decouple from PCI device >=20 > This makes struct rte_cryptodev independent of struct rte_pci_device by > replacing it with a pointer to the generic struct rte_device. >=20 > This is inline with the recent changes in ethdev >=20 > Signed-off-by: Hemant Agrawal > --- > drivers/crypto/qat/qat_qp.c | 12 +++++++++--- > drivers/crypto/qat/rte_qat_cryptodev.c | 6 +++--- > lib/librte_cryptodev/rte_cryptodev.c | 6 +++--- > lib/librte_cryptodev/rte_cryptodev.h | 4 ++-- > 4 files changed, 17 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c in= dex > 2e7188b..07e63fc 100644 > --- a/drivers/crypto/qat/qat_qp.c > +++ b/drivers/crypto/qat/qat_qp.c > @@ -135,6 +135,7 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev > *dev, uint16_t queue_pair_id, > int socket_id) > { > struct qat_qp *qp; > + struct rte_pci_device *pci_dev; > int ret; >=20 > PMD_INIT_FUNC_TRACE(); > @@ -153,7 +154,9 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev > *dev, uint16_t queue_pair_id, > return -EINVAL; > } >=20 > - if (dev->pci_dev->mem_resource[0].addr =3D=3D NULL) { > + pci_dev =3D RTE_DEV_TO_PCI(dev->device); > + > + if (pci_dev->mem_resource[0].addr =3D=3D NULL) { > PMD_DRV_LOG(ERR, "Could not find VF config space " > "(UIO driver attached?)."); > return -EINVAL; > @@ -174,7 +177,7 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev > *dev, uint16_t queue_pair_id, > PMD_DRV_LOG(ERR, "Failed to alloc mem for qp struct"); > return -ENOMEM; > } > - qp->mmap_bar_addr =3D dev->pci_dev->mem_resource[0].addr; > + qp->mmap_bar_addr =3D pci_dev->mem_resource[0].addr; > rte_atomic16_init(&qp->inflights16); >=20 > if (qat_tx_queue_create(dev, &(qp->tx_q), @@ -289,6 +292,7 @@ > static void qat_queue_delete(struct qat_queue *queue) > void *io_addr; > const struct rte_memzone *qp_mz; > uint32_t queue_size_bytes =3D nb_desc*desc_size; > + struct rte_pci_device *pci_dev; >=20 > PMD_INIT_FUNC_TRACE(); > if (desc_size > ADF_MSG_SIZE_TO_BYTES(ADF_MAX_MSG_SIZE)) { @@ - > 349,7 +353,9 @@ static void qat_queue_delete(struct qat_queue *queue) >=20 > queue_base =3D BUILD_RING_BASE_ADDR(queue->base_phys_addr, > queue->queue_size); > - io_addr =3D dev->pci_dev->mem_resource[0].addr; > + pci_dev =3D RTE_DEV_TO_PCI(dev->device); > + > + io_addr =3D pci_dev->mem_resource[0].addr; >=20 > WRITE_CSR_RING_BASE(io_addr, queue->hw_bundle_number, > queue->hw_queue_number, queue_base); diff --git > a/drivers/crypto/qat/rte_qat_cryptodev.c > b/drivers/crypto/qat/rte_qat_cryptodev.c > index 1e7ee61..840d828 100644 > --- a/drivers/crypto/qat/rte_qat_cryptodev.c > +++ b/drivers/crypto/qat/rte_qat_cryptodev.c > @@ -88,9 +88,9 @@ >=20 > PMD_INIT_FUNC_TRACE(); > PMD_DRV_LOG(DEBUG, "Found crypto device at %02x:%02x.%x", > - cryptodev->pci_dev->addr.bus, > - cryptodev->pci_dev->addr.devid, > - cryptodev->pci_dev->addr.function); > + RTE_DEV_TO_PCI(cryptodev->device)->addr.bus, > + RTE_DEV_TO_PCI(cryptodev->device)->addr.devid, > + RTE_DEV_TO_PCI(cryptodev->device)->addr.function); >=20 > cryptodev->dev_type =3D RTE_CRYPTODEV_QAT_SYM_PMD; > cryptodev->dev_ops =3D &crypto_qat_ops; > diff --git a/lib/librte_cryptodev/rte_cryptodev.c > b/lib/librte_cryptodev/rte_cryptodev.c > index 127e8d0..8402b6a 100644 > --- a/lib/librte_cryptodev/rte_cryptodev.c > +++ b/lib/librte_cryptodev/rte_cryptodev.c > @@ -446,7 +446,7 @@ struct rte_cryptodev * > "device data"); > } >=20 > - cryptodev->pci_dev =3D pci_dev; > + cryptodev->device =3D &pci_dev->device; > cryptodev->driver =3D cryptodrv; >=20 > /* init user callbacks */ > @@ -506,7 +506,7 @@ struct rte_cryptodev * > if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) > rte_free(cryptodev->data->dev_private); >=20 > - cryptodev->pci_dev =3D NULL; > + cryptodev->device =3D NULL; > cryptodev->driver =3D NULL; > cryptodev->data =3D NULL; >=20 > @@ -867,7 +867,7 @@ struct rte_cryptodev * > RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); > (*dev->dev_ops->dev_infos_get)(dev, dev_info); >=20 > - dev_info->pci_dev =3D dev->pci_dev; > + dev_info->pci_dev =3D RTE_DEV_TO_PCI(dev->device); > if (dev->driver) > dev_info->driver_name =3D dev->driver->pci_drv.driver.name; } > diff --git a/lib/librte_cryptodev/rte_cryptodev.h > b/lib/librte_cryptodev/rte_cryptodev.h > index 8f63e8f..ef072d2 100644 > --- a/lib/librte_cryptodev/rte_cryptodev.h > +++ b/lib/librte_cryptodev/rte_cryptodev.h > @@ -621,8 +621,8 @@ struct rte_cryptodev { > /**< Functions exported by PMD */ > uint64_t feature_flags; > /**< Supported features */ > - struct rte_pci_device *pci_dev; > - /**< PCI info. supplied by probing */ > + struct rte_device *device; > + /**< Backing device */ >=20 > enum rte_cryptodev_type dev_type; > /**< Crypto device type */ > -- > 1.9.1