DPDK patches and discussions
 help / color / mirror / Atom feed
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Cc: Kamalakannan R <kamalakannan.r@intel.com>
Subject: [PATCH 05/11] examples/pipeline: support crypto devices
Date: Wed, 11 Jan 2023 20:56:02 +0000	[thread overview]
Message-ID: <20230111205608.87953-6-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20230111205608.87953-1-cristian.dumitrescu@intel.com>

Add support for crypto devices in the application.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
---
 examples/pipeline/obj.c | 61 +++++++++++++++++++++++++++++++++++++++++
 examples/pipeline/obj.h | 11 ++++++++
 2 files changed, 72 insertions(+)

diff --git a/examples/pipeline/obj.c b/examples/pipeline/obj.c
index a5c09e7219..078395c6aa 100644
--- a/examples/pipeline/obj.c
+++ b/examples/pipeline/obj.c
@@ -7,6 +7,7 @@
 
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
+#include <rte_cryptodev.h>
 
 #include "obj.h"
 
@@ -191,3 +192,63 @@ ethdev_config(const char *name, struct ethdev_params *params)
 
 	return 0;
 }
+
+/*
+ * cryptodev
+ */
+int
+cryptodev_config(const char *name, struct cryptodev_params *params)
+{
+	struct rte_cryptodev_info dev_info;
+	struct rte_cryptodev_config dev_conf;
+	struct rte_cryptodev_qp_conf queue_conf;
+	uint8_t dev_id;
+	uint32_t socket_id, i;
+	int status;
+
+	/* Check input parameters. */
+	if (!name ||
+	    !params->n_queue_pairs ||
+	    !params->queue_size)
+		return -EINVAL;
+
+	/* Find the crypto device. */
+	status = rte_cryptodev_get_dev_id(name);
+	if (status < 0)
+		return -EINVAL;
+
+	dev_id = (uint8_t)status;
+
+	rte_cryptodev_info_get(dev_id, &dev_info);
+	if (params->n_queue_pairs > dev_info.max_nb_queue_pairs)
+		return -EINVAL;
+
+	socket_id = rte_cryptodev_socket_id(dev_id);
+
+	/* Configure the crypto device. */
+	dev_conf.socket_id = socket_id;
+	dev_conf.nb_queue_pairs = params->n_queue_pairs;
+	dev_conf.ff_disable = 0;
+
+	status = rte_cryptodev_configure(dev_id, &dev_conf);
+	if (status)
+		return status;
+
+	/* Configure the crypto device queue pairs. */
+	queue_conf.nb_descriptors = params->queue_size;
+	queue_conf.mp_session = NULL;
+	queue_conf.mp_session_private = NULL;
+
+	for (i = 0; i < params->n_queue_pairs; i++) {
+		status = rte_cryptodev_queue_pair_setup(dev_id, i, &queue_conf, socket_id);
+		if (status)
+			return status;
+	}
+
+	/* Start the crypto device. */
+	status = rte_cryptodev_start(dev_id);
+	if (status)
+		return status;
+
+	return 0;
+}
diff --git a/examples/pipeline/obj.h b/examples/pipeline/obj.h
index fb091f4ba7..0f103be6a7 100644
--- a/examples/pipeline/obj.h
+++ b/examples/pipeline/obj.h
@@ -38,4 +38,15 @@ struct ethdev_params {
 int
 ethdev_config(const char *name, struct ethdev_params *params);
 
+/*
+ * cryptodev
+ */
+struct cryptodev_params {
+	uint32_t n_queue_pairs;
+	uint32_t queue_size;
+};
+
+int
+cryptodev_config(const char *name, struct cryptodev_params *params);
+
 #endif /* _INCLUDE_OBJ_H_ */
-- 
2.34.1


  parent reply	other threads:[~2023-01-11 20:56 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 20:55 [PATCH 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-11 20:55 ` [PATCH 01/11] " Cristian Dumitrescu
2023-01-11 20:55 ` [PATCH 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-11 20:56 ` Cristian Dumitrescu [this message]
2023-01-11 20:56 ` [PATCH 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-11 23:43 ` [PATCH V2 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 01/11] " Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-12 15:45 ` [PATCH V3 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 01/11] " Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-12 15:49 ` [PATCH V3 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 01/11] " Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-12 18:53 ` [PATCH V4 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 01/11] " Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-26  9:17   ` [PATCH V4 00/11] pipeline: add IPsec support Thomas Monjalon
2023-01-26 13:11     ` Dumitrescu, Cristian
2023-01-26 13:34 ` [PATCH V5 " Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 01/11] " Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-26 14:12 ` [PATCH V6 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 01/11] " Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-02-05 16:13   ` [PATCH V6 00/11] pipeline: add IPsec support Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230111205608.87953-6-cristian.dumitrescu@intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=kamalakannan.r@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).