DPDK patches and discussions
 help / color / mirror / Atom feed
From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: "Ji, Kai" <kai.ji@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "gakhil@marvell.com" <gakhil@marvell.com>,
	"Burakov, Anatoly" <anatoly.burakov@intel.com>
Subject: RE: [dpdk-dev v3] crypto/ipsec_mb: multi-process IPC request handler
Date: Wed, 26 Oct 2022 08:17:09 +0000	[thread overview]
Message-ID: <DM8PR11MB559190B7454A1569C5DE0D4484309@DM8PR11MB5591.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20221025214800.44779-1-kai.ji@intel.com>

Hi Kai,

A few comments below

Thanks,
Pablo

> -----Original Message-----
> From: Ji, Kai <kai.ji@intel.com>
> Sent: Tuesday, October 25, 2022 10:48 PM
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Ji, Kai <kai.ji@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Burakov, Anatoly
> <anatoly.burakov@intel.com>
> Subject: [dpdk-dev v3] crypto/ipsec_mb: multi-process IPC request handler
> 
> As the secondary process needs queue-pair to be configured by the primary
> process before use. 

This sentence looks incomplete: as the secondary process needs...., then what?

> This patch adds an IPC register function to allow
> secondary process to setup cryptodev queue-pair via IPC messages during
> the runtime. A new "qp_in_used_pid" param stores the PID to provide the
> ownership of the queue-pair so that only the PID matched queue-pair can be
> free'd in the request.
> 
> Signed-off-by: Kai Ji <kai.ji@intel.com>
> ---
> 
> v3:
> - remove shared memzone as qp_conf params can be passed directly from
> ipc message.
> 
> v2:
> - add in shared memzone for data exchange between multi-process
> ---
>  drivers/crypto/ipsec_mb/ipsec_mb_ops.c     | 130
> ++++++++++++++++++++-
>  drivers/crypto/ipsec_mb/ipsec_mb_private.c |  24 +++-
> drivers/crypto/ipsec_mb/ipsec_mb_private.h |  46 ++++++++
>  3 files changed, 196 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
> b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
> index cedcaa2742..c29656b746 100644
> --- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
> +++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
> @@ -3,6 +3,7 @@
>   */
> 
>  #include <string.h>
> +#include <unistd.h>
> 
>  #include <rte_common.h>
>  #include <rte_malloc.h>
> @@ -93,6 +94,46 @@ ipsec_mb_info_get(struct rte_cryptodev *dev,
>  	}
>  }
> 
> +static int
> +ipsec_mb_secondary_qp_op(int dev_id, int qp_id,
> +		const struct rte_cryptodev_qp_conf *qp_conf,
> +		int socket_id, uint16_t pid, enum ipsec_mb_mp_req_type
> op_type) {
> +	int ret;
> +	struct rte_mp_msg qp_req_msg;
> +	struct rte_mp_msg *qp_resp_msg;
> +	struct rte_mp_reply qp_resp;
> +	struct ipsec_mb_mp_param *req_param;
> +	struct ipsec_mb_mp_param *resp_param;
> +	struct timespec ts = {.tv_sec = 1, .tv_nsec = 0};
> +
> +	memset(&qp_req_msg, 0, sizeof(IPSEC_MB_MP_MSG));
> +	memcpy(qp_req_msg.name, IPSEC_MB_MP_MSG,
> sizeof(IPSEC_MB_MP_MSG));
> +	req_param = (struct ipsec_mb_mp_param *)&qp_req_msg.param;
> +
> +	qp_req_msg.len_param = sizeof(struct ipsec_mb_mp_param);
> +	req_param->type = op_type;
> +	req_param->dev_id = dev_id;
> +	req_param->qp_id = qp_id;
> +	req_param->socket_id = socket_id;
> +	req_param->process_id = pid;

I think you can use "get_pid()" here and not have "pid" argument in the function, as I believe it is always called within the same process.

> +	if (qp_conf) {
> +		req_param->nb_descriptors = qp_conf->nb_descriptors;
> +		req_param->mp_session = (void *)qp_conf->mp_session;
> +	}
> +
> +	qp_req_msg.num_fds = 0;
> +	ret = rte_mp_request_sync(&qp_req_msg, &qp_resp, &ts);
> +	if (ret) {
> +		RTE_LOG(ERR, USER1, "Create MR request to primary
> process failed.");
> +		return -1;
> +	}
> +	qp_resp_msg = &qp_resp.msgs[0];
> +	resp_param = (struct ipsec_mb_mp_param *)qp_resp_msg->param;
> +
> +	return resp_param->result;
> +}
> +

..

> diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
> b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
> index b56eaf061e..a2b52f808e 100644
> --- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
> +++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h

...

> +
>  /** All supported device types */
>  enum ipsec_mb_pmd_types {
>  	IPSEC_MB_PMD_TYPE_AESNI_MB = 0,
> @@ -149,11 +155,51 @@ struct ipsec_mb_qp {
>  	IMB_MGR *mb_mgr;
>  	/* Multi buffer manager */
>  	const struct rte_memzone *mb_mgr_mz;
> +	/** The process id used for queue pairs **/
> +	uint16_t qp_in_used_by_pid;

I would rename this to "qp_in_use_by_pid" or "qp_used_by_pid".

>  	/* Shared memzone for storing mb_mgr */

Check these comments. This last one "Shared memzone..." applies to the field "mb_mgr_mz".
Also, they should use "/**< ".

>  	__extension__ uint8_t additional_data[];
>  	/**< Storing PMD specific additional data */  };
> 


  reply	other threads:[~2022-10-26  8:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 23:51 [dpdk-dev v1] " Kai Ji
2022-10-24 23:38 ` [dpdk-dev v2] " Kai Ji
2022-10-25 21:48   ` [dpdk-dev v3] " Kai Ji
2022-10-26  8:17     ` De Lara Guarch, Pablo [this message]
2022-10-26 10:01     ` [dpdk-dev v4] " Kai Ji
2022-10-26 10:22       ` Kai Ji
2022-10-26 10:27         ` Kai Ji
2022-10-26 11:07           ` Kusztal, ArkadiuszX
2022-10-26 12:32           ` De Lara Guarch, Pablo
2022-10-26 12:48           ` Kai Ji
2022-10-26 13:04             ` De Lara Guarch, Pablo
2022-10-26 13:19             ` [dpdk-dev v5] " Kai Ji
2022-10-27  9:54               ` [EXT] " Akhil Goyal
2022-10-27 17:57               ` 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=DM8PR11MB559190B7454A1569C5DE0D4484309@DM8PR11MB5591.namprd11.prod.outlook.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=kai.ji@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).