All of lore.kernel.org
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] cryptodev: add function to check if qp was setup
@ 2020-06-10 18:53 Arek Kusztal
  2020-06-10 18:53 ` [dpdk-dev] [PATCH 2/2] cryptodev: add cryptodev trace in multi process function Arek Kusztal
  2020-06-11 13:42 ` [dpdk-dev] [PATCH 1/2] cryptodev: add function to check if qp was setup Trahe, Fiona
  0 siblings, 2 replies; 5+ messages in thread
From: Arek Kusztal @ 2020-06-10 18:53 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, fiona.trahe, arkaduszx.kusztal

From: Fiona Trahe <fiona.trahe@intel.com>

This patch adds function that can check if queue pair
was already setup. This may be useful when dealing with
multi process approach in cryptodev.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
---
 lib/librte_cryptodev/rte_cryptodev.c | 28 ++++++++++++++++++++++++++++
 lib/librte_cryptodev/rte_cryptodev.h | 14 ++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index e37b83a..705387b 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1080,6 +1080,34 @@ rte_cryptodev_close(uint8_t dev_id)
 }
 
 int
+rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
+{
+	struct rte_cryptodev *dev;
+
+	if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+		CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
+		return -(ENODEV);
+	}
+
+	dev = &rte_crypto_devices[dev_id];
+	if (queue_pair_id >= dev->data->nb_queue_pairs) {
+		CDEV_LOG_ERR("Invalid queue_pair_id=%d", queue_pair_id);
+		return -(ENODEV);
+	}
+	void **qps = dev->data->queue_pairs;
+
+	if (qps[queue_pair_id])	{
+		CDEV_LOG_INFO("qp %d on dev %d is initialised",
+			queue_pair_id, dev_id);
+		return 1;
+	}
+
+	CDEV_LOG_INFO("qp %d on dev %d is not initialised",
+		queue_pair_id, dev_id);
+	return 0;
+}
+
+int
 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
 
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 4aaee73..d01a658 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -727,6 +727,20 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
 
 /**
+ * Get the status of queue pairs setup on a specific crypto device
+ *
+ * @param	dev_id			Crypto device identifier.
+ * @param	queue_pair_id	The index of the queue pair to check.
+ *
+ * @return
+ *   - 0: qp was not configured
+ *   - 1: qp was configured
+ *   - -ENODEV: device was not configured
+ */
+int
+rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id);
+
+/**
  * Get the number of queue pairs on a specific crypto device
  *
  * @param	dev_id		Crypto device identifier.
-- 
2.1.0


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

* [dpdk-dev] [PATCH 2/2] cryptodev: add cryptodev trace in multi process function
  2020-06-10 18:53 [dpdk-dev] [PATCH 1/2] cryptodev: add function to check if qp was setup Arek Kusztal
@ 2020-06-10 18:53 ` Arek Kusztal
  2020-06-11 13:45   ` Trahe, Fiona
  2020-06-11 13:42 ` [dpdk-dev] [PATCH 1/2] cryptodev: add function to check if qp was setup Trahe, Fiona
  1 sibling, 1 reply; 5+ messages in thread
From: Arek Kusztal @ 2020-06-10 18:53 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, fiona.trahe, arkaduszx.kusztal

From: Fiona Trahe <fiona.trahe@intel.com>

This patch adds traces to some Cryptodev functions that are used
in primary/secondary context.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
---
 lib/librte_cryptodev/rte_cryptodev.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 705387b..230c5cf 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -717,8 +717,13 @@ rte_cryptodev_data_alloc(uint8_t dev_id, struct rte_cryptodev_data **data,
 		mz = rte_memzone_reserve(mz_name,
 				sizeof(struct rte_cryptodev_data),
 				socket_id, 0);
-	} else
+		CDEV_LOG_DEBUG("PRIMARY:reserved memzone for %s (%p)",
+				mz_name, mz);
+	} else {
 		mz = rte_memzone_lookup(mz_name);
+		CDEV_LOG_DEBUG("SECONDARY:looked up memzone for %s (%p)",
+				mz_name, mz);
+	}
 
 	if (mz == NULL)
 		return -ENOMEM;
@@ -749,8 +754,14 @@ rte_cryptodev_data_free(uint8_t dev_id, struct rte_cryptodev_data **data)
 	RTE_ASSERT(*data == mz->addr);
 	*data = NULL;
 
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+		CDEV_LOG_DEBUG("PRIMARY:free memzone of %s (%p)",
+				mz_name, mz);
 		return rte_memzone_free(mz);
+	} else {
+		CDEV_LOG_DEBUG("SECONDARY:don't free memzone of %s (%p)",
+				mz_name, mz);
+	}
 
 	return 0;
 }
@@ -807,8 +818,15 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
 			cryptodev->data->dev_id = dev_id;
 			cryptodev->data->socket_id = socket_id;
 			cryptodev->data->dev_started = 0;
+			CDEV_LOG_DEBUG("PRIMARY:init data");
 		}
 
+		CDEV_LOG_DEBUG("Data for %s: dev_id %d, socket %d, started %d",
+				cryptodev->data->name,
+				cryptodev->data->dev_id,
+				cryptodev->data->socket_id,
+				cryptodev->data->dev_started);
+
 		/* init user callbacks */
 		TAILQ_INIT(&(cryptodev->link_intr_cbs));
 
-- 
2.1.0


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

* Re: [dpdk-dev] [PATCH 1/2] cryptodev: add function to check if qp was setup
  2020-06-10 18:53 [dpdk-dev] [PATCH 1/2] cryptodev: add function to check if qp was setup Arek Kusztal
  2020-06-10 18:53 ` [dpdk-dev] [PATCH 2/2] cryptodev: add cryptodev trace in multi process function Arek Kusztal
@ 2020-06-11 13:42 ` Trahe, Fiona
  1 sibling, 0 replies; 5+ messages in thread
From: Trahe, Fiona @ 2020-06-11 13:42 UTC (permalink / raw)
  To: Kusztal, ArkadiuszX, dev; +Cc: akhil.goyal, Trahe, Fiona

Hi Arek,

> -----Original Message-----
> From: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Sent: Wednesday, June 10, 2020 7:53 PM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Trahe, Fiona <fiona.trahe@intel.com>; arkaduszx.kusztal@intel.com
> Subject: [PATCH 1/2] cryptodev: add function to check if qp was setup
> 
> From: Fiona Trahe <fiona.trahe@intel.com>
> 
> This patch adds function that can check if queue pair
> was already setup. This may be useful when dealing with
> multi process approach in cryptodev.
> 
> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
> ---
>  lib/librte_cryptodev/rte_cryptodev.c | 28 ++++++++++++++++++++++++++++
>  lib/librte_cryptodev/rte_cryptodev.h | 14 ++++++++++++++
>  2 files changed, 42 insertions(+)
> 
> diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
> index e37b83a..705387b 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.c
> +++ b/lib/librte_cryptodev/rte_cryptodev.c
> @@ -1080,6 +1080,34 @@ rte_cryptodev_close(uint8_t dev_id)
>  }
> 
>  int
> +rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
[Fiona] This should be marked as experimental & added to map file

> +{
> +	struct rte_cryptodev *dev;
> +
> +	if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
> +		CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
> +		return -(ENODEV);
> +	}
> +
> +	dev = &rte_crypto_devices[dev_id];
> +	if (queue_pair_id >= dev->data->nb_queue_pairs) {
> +		CDEV_LOG_ERR("Invalid queue_pair_id=%d", queue_pair_id);
> +		return -(ENODEV);
[Fiona]  -EINVAL would be more appropriate here

> +	}
> +	void **qps = dev->data->queue_pairs;
> +
> +	if (qps[queue_pair_id])	{
> +		CDEV_LOG_INFO("qp %d on dev %d is initialised",
[Fiona] This and below should use CDEV_LOG_DEBUG
> +			queue_pair_id, dev_id);
> +		return 1;
> +	}
> +
> +	CDEV_LOG_INFO("qp %d on dev %d is not initialised",
> +		queue_pair_id, dev_id);
> +	return 0;
> +}
> +
> +int
>  rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
>  		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
> 
> diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
> index 4aaee73..d01a658 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.h
> +++ b/lib/librte_cryptodev/rte_cryptodev.h
> @@ -727,6 +727,20 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
>  		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
> 
>  /**
> + * Get the status of queue pairs setup on a specific crypto device
> + *
> + * @param	dev_id			Crypto device identifier.
> + * @param	queue_pair_id	The index of the queue pair to check.
> + *
> + * @return
> + *   - 0: qp was not configured
> + *   - 1: qp was configured
> + *   - -ENODEV: device was not configured
> + */
> +int
> +rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id);
> +
> +/**
>   * Get the number of queue pairs on a specific crypto device
>   *
>   * @param	dev_id		Crypto device identifier.
> --
> 2.1.0


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

* Re: [dpdk-dev] [PATCH 2/2] cryptodev: add cryptodev trace in multi process function
  2020-06-10 18:53 ` [dpdk-dev] [PATCH 2/2] cryptodev: add cryptodev trace in multi process function Arek Kusztal
@ 2020-06-11 13:45   ` Trahe, Fiona
  2020-07-04 20:08     ` Akhil Goyal
  0 siblings, 1 reply; 5+ messages in thread
From: Trahe, Fiona @ 2020-06-11 13:45 UTC (permalink / raw)
  To: Kusztal, ArkadiuszX, dev; +Cc: akhil.goyal, arkaduszx.kusztal



> -----Original Message-----
> From: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Sent: Wednesday, June 10, 2020 7:53 PM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Trahe, Fiona <fiona.trahe@intel.com>; arkaduszx.kusztal@intel.com
> Subject: [PATCH 2/2] cryptodev: add cryptodev trace in multi process function
> 
> From: Fiona Trahe <fiona.trahe@intel.com>
> 
> This patch adds traces to some Cryptodev functions that are used
> in primary/secondary context.
> 
> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>

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

* Re: [dpdk-dev] [PATCH 2/2] cryptodev: add cryptodev trace in multi process function
  2020-06-11 13:45   ` Trahe, Fiona
@ 2020-07-04 20:08     ` Akhil Goyal
  0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2020-07-04 20:08 UTC (permalink / raw)
  To: Trahe, Fiona, Kusztal, ArkadiuszX, dev; +Cc: arkaduszx.kusztal

> > From: Fiona Trahe <fiona.trahe@intel.com>
> >
> > This patch adds traces to some Cryptodev functions that are used
> > in primary/secondary context.
> >
> > Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
> Acked-by: Fiona Trahe <fiona.trahe@intel.com>

Self Ack is not required and should not be done.

Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Applied to dpdk-next-crypto

Thanks.

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

end of thread, other threads:[~2020-07-04 20:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 18:53 [dpdk-dev] [PATCH 1/2] cryptodev: add function to check if qp was setup Arek Kusztal
2020-06-10 18:53 ` [dpdk-dev] [PATCH 2/2] cryptodev: add cryptodev trace in multi process function Arek Kusztal
2020-06-11 13:45   ` Trahe, Fiona
2020-07-04 20:08     ` Akhil Goyal
2020-06-11 13:42 ` [dpdk-dev] [PATCH 1/2] cryptodev: add function to check if qp was setup Trahe, Fiona

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.