DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kai Ji <kai.ji@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, Kai Ji <kai.ji@intel.com>
Subject: [dpdk-dev v1] lib/cryptodev: multi-process IPC request handler
Date: Wed, 27 Jul 2022 07:08:04 +0800	[thread overview]
Message-ID: <20220726230804.90036-1-kai.ji@intel.com> (raw)

This patch add in multi-process IPC request handler function in rte
cryptodev. This function intend to support a queue-pair configuration
request to allow the secondary process to reconfigure the queue-pair
setup'ed by the primary process.

Signed-off-by: Kai Ji <kai.ji@intel.com>
---
 lib/cryptodev/rte_cryptodev.c | 45 +++++++++++++++++++++++++++++++++++
 lib/cryptodev/rte_cryptodev.h | 14 +++++++++++
 2 files changed, 59 insertions(+)

diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 42f3221052..18fdbf6db6 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -1202,6 +1202,51 @@ rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
 	return 0;
 }
 
+/* crypto queue pair config */
+#define CRYPTODEV_MP_REQ "cryptodev_mp_request"
+
+static int
+rte_cryptodev_mp_request(const struct rte_mp_msg *mp_msg, const void *peer)
+{
+	struct rte_mp_msg mp_res;
+	struct rte_cryptodev_mp_param *res =
+		(struct rte_cryptodev_mp_param *)mp_res.param;
+	const struct rte_cryptodev_mp_param *param =
+		(const struct rte_cryptodev_mp_param *)mp_msg->param;
+
+	int ret;
+	int dev_id = 0;
+	int port_id = 0, socket_id = 1;
+	struct rte_cryptodev_qp_conf queue_conf;
+	queue_conf.nb_descriptors = 2;
+
+	RTE_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
+	switch (param->type) {
+	case RTE_CRYPTODEV_MP_REQ_QP:
+		ret = rte_cryptodev_queue_pair_setup(dev_id, port_id,
+				&queue_conf, socket_id);
+		res->result = ret;
+
+		ret = rte_mp_reply(&mp_res, peer);
+		break;
+	default:
+		CDEV_LOG_ERR("invalid mp request type\n");
+		return -EINVAL;
+	}
+	return ret;
+
+}
+
+int rte_cryptodev_mp_request_register(void)
+{
+	int ret;
+
+	RTE_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
+	ret = rte_mp_action_register(CRYPTODEV_MP_REQ,
+				rte_cryptodev_mp_request);
+	return ret;
+}
+
 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/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 56f459c6a0..901465ca65 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -539,6 +539,18 @@ enum rte_cryptodev_event_type {
 	RTE_CRYPTODEV_EVENT_MAX		/**< max value of this enum */
 };
 
+/* Request types for IPC. */
+enum rte_cryptodev_mp_req_type {
+	RTE_CRYPTODEV_MP_REQ_NONE,
+	RTE_CRYPTODEV_MP_REQ_QP
+};
+
+/* Parameters for IPC. */
+struct rte_cryptodev_mp_param {
+	enum rte_cryptodev_mp_req_type type;
+	int result;
+};
+
 /** Crypto device queue pair configuration structure. */
 struct rte_cryptodev_qp_conf {
 	uint32_t nb_descriptors; /**< Number of descriptors per queue pair */
@@ -744,6 +756,8 @@ rte_cryptodev_stop(uint8_t dev_id);
 extern int
 rte_cryptodev_close(uint8_t dev_id);
 
+extern int rte_cryptodev_mp_request_register(void);
+
 /**
  * Allocate and set up a receive queue pair for a device.
  *
-- 
2.17.1


             reply	other threads:[~2022-07-26 23:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 23:08 Kai Ji [this message]
2022-07-27  4:25 ` [EXT] " Akhil Goyal
2022-08-05  8:51   ` Zhang, Roy Fan
2022-08-08  7:43     ` Akhil Goyal
2022-08-12  8:06       ` Zhang, Roy Fan
2022-08-12  8:25         ` Akhil Goyal
2022-09-21 18:37           ` Akhil Goyal
2022-10-02  1:43 ` [dpdk-dev v2] " Kai Ji
2022-10-02 18:57   ` [EXT] " Akhil Goyal
2022-10-02 22:44   ` [dpdk-dev v3 1/1] " Kai Ji
2022-10-03 16:39     ` Power, Ciara
2022-10-04 18:12     ` [EXT] " Akhil Goyal
2022-10-06  0:57       ` Ji, Kai
2022-10-06  8:16     ` [dpdk-dev v4] " Kai Ji
2022-10-06 16:19       ` Power, Ciara
2022-10-06 17:06       ` [dpdk-dev v5] " Kai Ji
2022-10-06 18:49         ` [EXT] " Akhil Goyal
2022-10-06 23:11           ` Ji, Kai
2022-10-07  9:37           ` Zhang, Fan
2022-10-06 22:41         ` Konstantin Ananyev

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=20220726230804.90036-1-kai.ji@intel.com \
    --to=kai.ji@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.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).