DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] cryptodev: decouple from PCI device
@ 2017-01-18  9:16 Hemant Agrawal
  2017-01-24 18:10 ` Griffin, John
  2017-01-25  4:48 ` Shreyansh Jain
  0 siblings, 2 replies; 8+ messages in thread
From: Hemant Agrawal @ 2017-01-18  9:16 UTC (permalink / raw)
  To: dev
  Cc: thomas.monjalon, declan.doherty, shreyansh.jain,
	pablo.de.lara.guarch, jblunck

This makes struct rte_cryptodev independent of struct rte_pci_device by
replacing it with a pointer to the generic struct rte_device.

This is inline with the recent changes in ethdev

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 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(-)

diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c
index 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;
 
 	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;
 	}
 
-	if (dev->pci_dev->mem_resource[0].addr == NULL) {
+	pci_dev = RTE_DEV_TO_PCI(dev->device);
+
+	if (pci_dev->mem_resource[0].addr == 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 = dev->pci_dev->mem_resource[0].addr;
+	qp->mmap_bar_addr = pci_dev->mem_resource[0].addr;
 	rte_atomic16_init(&qp->inflights16);
 
 	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 = nb_desc*desc_size;
+	struct rte_pci_device *pci_dev;
 
 	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)
 
 	queue_base = BUILD_RING_BASE_ADDR(queue->base_phys_addr,
 					queue->queue_size);
-	io_addr = dev->pci_dev->mem_resource[0].addr;
+	pci_dev = RTE_DEV_TO_PCI(dev->device);
+
+	io_addr = pci_dev->mem_resource[0].addr;
 
 	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 @@
 
 	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);
 
 	cryptodev->dev_type = RTE_CRYPTODEV_QAT_SYM_PMD;
 	cryptodev->dev_ops = &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");
 	}
 
-	cryptodev->pci_dev = pci_dev;
+	cryptodev->device = &pci_dev->device;
 	cryptodev->driver = cryptodrv;
 
 	/* init user callbacks */
@@ -506,7 +506,7 @@ struct rte_cryptodev *
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		rte_free(cryptodev->data->dev_private);
 
-	cryptodev->pci_dev = NULL;
+	cryptodev->device = NULL;
 	cryptodev->driver = NULL;
 	cryptodev->data = NULL;
 
@@ -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);
 
-	dev_info->pci_dev = dev->pci_dev;
+	dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device);
 	if (dev->driver)
 		dev_info->driver_name = 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 */
 
 	enum rte_cryptodev_type dev_type;
 	/**< Crypto device type */
-- 
1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] cryptodev: decouple from PCI device
  2017-01-18  9:16 [dpdk-dev] [PATCH] cryptodev: decouple from PCI device Hemant Agrawal
@ 2017-01-24 18:10 ` Griffin, John
  2017-01-25  4:48 ` Shreyansh Jain
  1 sibling, 0 replies; 8+ messages in thread
From: Griffin, John @ 2017-01-24 18:10 UTC (permalink / raw)
  To: Hemant Agrawal, dev
  Cc: thomas.monjalon, Doherty, Declan, shreyansh.jain, De Lara Guarch,
	Pablo, jblunck


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal
> Sent: Wednesday, January 18, 2017 9:16 AM
> To: dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; Doherty, Declan
> <declan.doherty@intel.com>; shreyansh.jain@nxp.com; De Lara Guarch,
> Pablo <pablo.de.lara.guarch@intel.com>; jblunck@infradead.org
> Subject: [dpdk-dev] [PATCH] cryptodev: decouple from PCI device
> 
> This makes struct rte_cryptodev independent of struct rte_pci_device by
> replacing it with a pointer to the generic struct rte_device.
> 
> This is inline with the recent changes in ethdev
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: John Griffin <john.griffin@intel.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] cryptodev: decouple from PCI device
  2017-01-18  9:16 [dpdk-dev] [PATCH] cryptodev: decouple from PCI device Hemant Agrawal
  2017-01-24 18:10 ` Griffin, John
@ 2017-01-25  4:48 ` Shreyansh Jain
  2017-01-25  4:54   ` Stephen Hemminger
  2017-01-25  9:07   ` De Lara Guarch, Pablo
  1 sibling, 2 replies; 8+ messages in thread
From: Shreyansh Jain @ 2017-01-25  4:48 UTC (permalink / raw)
  To: dev
  Cc: Hemant Agrawal, thomas.monjalon, declan.doherty,
	pablo.de.lara.guarch, jblunck

On Wednesday 18 January 2017 02:46 PM, Hemant Agrawal wrote:
> This makes struct rte_cryptodev independent of struct rte_pci_device by
> replacing it with a pointer to the generic struct rte_device.
>
> This is inline with the recent changes in ethdev
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  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(-)
>

Next step would be to remove rte_pci_driver from eth_driver
and rte_cryptodev_driver and make it generic.

Reviewed-by: Shreyansh Jain <shreyansh.jain@nxp.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] cryptodev: decouple from PCI device
  2017-01-25  4:48 ` Shreyansh Jain
@ 2017-01-25  4:54   ` Stephen Hemminger
  2017-01-25  9:07   ` De Lara Guarch, Pablo
  1 sibling, 0 replies; 8+ messages in thread
From: Stephen Hemminger @ 2017-01-25  4:54 UTC (permalink / raw)
  To: Shreyansh Jain
  Cc: dev, Hemant Agrawal, thomas.monjalon, declan.doherty,
	pablo.de.lara.guarch, jblunck

On Wed, 25 Jan 2017 10:18:01 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:

> On Wednesday 18 January 2017 02:46 PM, Hemant Agrawal wrote:
> > This makes struct rte_cryptodev independent of struct rte_pci_device by
> > replacing it with a pointer to the generic struct rte_device.
> >
> > This is inline with the recent changes in ethdev
> >
> > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> > ---
> >  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(-)
> >  
> 
> Next step would be to remove rte_pci_driver from eth_driver
> and rte_cryptodev_driver and make it generic.
> 
> Reviewed-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> 

Agreed. 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] cryptodev: decouple from PCI device
  2017-01-25  4:48 ` Shreyansh Jain
  2017-01-25  4:54   ` Stephen Hemminger
@ 2017-01-25  9:07   ` De Lara Guarch, Pablo
  1 sibling, 0 replies; 8+ messages in thread
From: De Lara Guarch, Pablo @ 2017-01-25  9:07 UTC (permalink / raw)
  To: Shreyansh Jain, dev
  Cc: Hemant Agrawal, thomas.monjalon, Doherty, Declan, jblunck



> -----Original Message-----
> From: Shreyansh Jain [mailto:shreyansh.jain@nxp.com]
> Sent: Wednesday, January 25, 2017 4:48 AM
> To: dev@dpdk.org
> Cc: Hemant Agrawal; thomas.monjalon@6wind.com; Doherty, Declan; De
> Lara Guarch, Pablo; jblunck@infradead.org
> Subject: Re: [PATCH] cryptodev: decouple from PCI device
> 
> On Wednesday 18 January 2017 02:46 PM, Hemant Agrawal wrote:
> > This makes struct rte_cryptodev independent of struct rte_pci_device by
> > replacing it with a pointer to the generic struct rte_device.
> >
> > This is inline with the recent changes in ethdev
> >
> > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> > ---
> >  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(-)
> >
> 
> Next step would be to remove rte_pci_driver from eth_driver
> and rte_cryptodev_driver and make it generic.
> 
> Reviewed-by: Shreyansh Jain <shreyansh.jain@nxp.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] cryptodev: decouple from PCI device
  2017-01-19 13:27     ` Hemant Agrawal
@ 2017-01-20 12:28       ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 8+ messages in thread
From: De Lara Guarch, Pablo @ 2017-01-20 12:28 UTC (permalink / raw)
  To: Hemant Agrawal, dev
  Cc: thomas.monjalon, Richardson, Bruce, Shreyansh Jain, Mcnamara,
	John, Yigit, Ferruh, jerin.jacob

Hi Hemant,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal
> Sent: Thursday, January 19, 2017 1:28 PM
> To: Hemant Agrawal; dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; Richardson, Bruce; Shreyansh Jain;
> Mcnamara, John; Yigit, Ferruh; jerin.jacob@caviumnetworks.com
> Subject: Re: [dpdk-dev] [PATCH] cryptodev: decouple from PCI device
> 
> Please ignore.
> 
> Apologies for repeated sent. This patch was  posted earlier.

No worries. Next time, change the state of the patch to "Not Applicable" in Patchwork.

Thanks,
Pablo

> 
> - Hemant
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] cryptodev: decouple from PCI device
  2017-01-19 13:23   ` [dpdk-dev] [PATCH] cryptodev: decouple from PCI device Hemant Agrawal
@ 2017-01-19 13:27     ` Hemant Agrawal
  2017-01-20 12:28       ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 8+ messages in thread
From: Hemant Agrawal @ 2017-01-19 13:27 UTC (permalink / raw)
  To: Hemant Agrawal, dev
  Cc: thomas.monjalon, bruce.richardson, Shreyansh Jain, john.mcnamara,
	ferruh.yigit, jerin.jacob

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
> <shreyansh.jain@nxp.com>; john.mcnamara@intel.com;
> ferruh.yigit@intel.com; jerin.jacob@caviumnetworks.com; Hemant Agrawal
> <hemant.agrawal@nxp.com>
> Subject: [PATCH] cryptodev: decouple from PCI device
> 
> This makes struct rte_cryptodev independent of struct rte_pci_device by
> replacing it with a pointer to the generic struct rte_device.
> 
> This is inline with the recent changes in ethdev
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  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(-)
> 
> diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c index
> 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;
> 
>  	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;
>  	}
> 
> -	if (dev->pci_dev->mem_resource[0].addr == NULL) {
> +	pci_dev = RTE_DEV_TO_PCI(dev->device);
> +
> +	if (pci_dev->mem_resource[0].addr == 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 = dev->pci_dev->mem_resource[0].addr;
> +	qp->mmap_bar_addr = pci_dev->mem_resource[0].addr;
>  	rte_atomic16_init(&qp->inflights16);
> 
>  	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 = nb_desc*desc_size;
> +	struct rte_pci_device *pci_dev;
> 
>  	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)
> 
>  	queue_base = BUILD_RING_BASE_ADDR(queue->base_phys_addr,
>  					queue->queue_size);
> -	io_addr = dev->pci_dev->mem_resource[0].addr;
> +	pci_dev = RTE_DEV_TO_PCI(dev->device);
> +
> +	io_addr = pci_dev->mem_resource[0].addr;
> 
>  	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 @@
> 
>  	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);
> 
>  	cryptodev->dev_type = RTE_CRYPTODEV_QAT_SYM_PMD;
>  	cryptodev->dev_ops = &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");
>  	}
> 
> -	cryptodev->pci_dev = pci_dev;
> +	cryptodev->device = &pci_dev->device;
>  	cryptodev->driver = cryptodrv;
> 
>  	/* init user callbacks */
> @@ -506,7 +506,7 @@ struct rte_cryptodev *
>  	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
>  		rte_free(cryptodev->data->dev_private);
> 
> -	cryptodev->pci_dev = NULL;
> +	cryptodev->device = NULL;
>  	cryptodev->driver = NULL;
>  	cryptodev->data = NULL;
> 
> @@ -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);
> 
> -	dev_info->pci_dev = dev->pci_dev;
> +	dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device);
>  	if (dev->driver)
>  		dev_info->driver_name = 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 */
> 
>  	enum rte_cryptodev_type dev_type;
>  	/**< Crypto device type */
> --
> 1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH] cryptodev: decouple from PCI device
  2017-01-19 13:23 ` [dpdk-dev] [PATCHv5 " Hemant Agrawal
@ 2017-01-19 13:23   ` Hemant Agrawal
  2017-01-19 13:27     ` Hemant Agrawal
  0 siblings, 1 reply; 8+ messages in thread
From: Hemant Agrawal @ 2017-01-19 13:23 UTC (permalink / raw)
  To: dev
  Cc: thomas.monjalon, bruce.richardson, shreyansh.jain, john.mcnamara,
	ferruh.yigit, jerin.jacob, Hemant Agrawal

This makes struct rte_cryptodev independent of struct rte_pci_device by
replacing it with a pointer to the generic struct rte_device.

This is inline with the recent changes in ethdev

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 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(-)

diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c
index 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;
 
 	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;
 	}
 
-	if (dev->pci_dev->mem_resource[0].addr == NULL) {
+	pci_dev = RTE_DEV_TO_PCI(dev->device);
+
+	if (pci_dev->mem_resource[0].addr == 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 = dev->pci_dev->mem_resource[0].addr;
+	qp->mmap_bar_addr = pci_dev->mem_resource[0].addr;
 	rte_atomic16_init(&qp->inflights16);
 
 	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 = nb_desc*desc_size;
+	struct rte_pci_device *pci_dev;
 
 	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)
 
 	queue_base = BUILD_RING_BASE_ADDR(queue->base_phys_addr,
 					queue->queue_size);
-	io_addr = dev->pci_dev->mem_resource[0].addr;
+	pci_dev = RTE_DEV_TO_PCI(dev->device);
+
+	io_addr = pci_dev->mem_resource[0].addr;
 
 	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 @@
 
 	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);
 
 	cryptodev->dev_type = RTE_CRYPTODEV_QAT_SYM_PMD;
 	cryptodev->dev_ops = &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");
 	}
 
-	cryptodev->pci_dev = pci_dev;
+	cryptodev->device = &pci_dev->device;
 	cryptodev->driver = cryptodrv;
 
 	/* init user callbacks */
@@ -506,7 +506,7 @@ struct rte_cryptodev *
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		rte_free(cryptodev->data->dev_private);
 
-	cryptodev->pci_dev = NULL;
+	cryptodev->device = NULL;
 	cryptodev->driver = NULL;
 	cryptodev->data = NULL;
 
@@ -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);
 
-	dev_info->pci_dev = dev->pci_dev;
+	dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device);
 	if (dev->driver)
 		dev_info->driver_name = 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 */
 
 	enum rte_cryptodev_type dev_type;
 	/**< Crypto device type */
-- 
1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-01-25  9:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-18  9:16 [dpdk-dev] [PATCH] cryptodev: decouple from PCI device Hemant Agrawal
2017-01-24 18:10 ` Griffin, John
2017-01-25  4:48 ` Shreyansh Jain
2017-01-25  4:54   ` Stephen Hemminger
2017-01-25  9:07   ` De Lara Guarch, Pablo
  -- strict thread matches above, loose matches on Subject: below --
2017-01-17 18:52 [dpdk-dev] [PATCHv4 00/33] NXP DPAA2 PMD Hemant Agrawal
2017-01-19 13:23 ` [dpdk-dev] [PATCHv5 " Hemant Agrawal
2017-01-19 13:23   ` [dpdk-dev] [PATCH] cryptodev: decouple from PCI device Hemant Agrawal
2017-01-19 13:27     ` Hemant Agrawal
2017-01-20 12:28       ` De Lara Guarch, Pablo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).