All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Duszynski <tdu@semihalf.com>
To: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Cc: declan.doherty@intel.com, akhil.goyal@nxp.com,
	shally.verma@caviumnetworks.com, ravi1.kumar@amd.com,
	jerin.jacob@caviumnetworks.com, roy.fan.zhang@intel.com,
	fiona.trahe@intel.com, tdu@semihalf.com, jianjay.zhou@huawei.com,
	dev@dpdk.org
Subject: Re: [PATCH v6 07/16] crypto/mvsam: parse max number of sessions
Date: Tue, 10 Jul 2018 12:42:12 +0200	[thread overview]
Message-ID: <20180710104211.GA3496@sh> (raw)
In-Reply-To: <20180710003623.1463-8-pablo.de.lara.guarch@intel.com>

Looks good.

Acked-by: Tomasz Duszynski <tdu@semihalf.com>
On Tue, Jul 10, 2018 at 01:36:14AM +0100, Pablo de Lara wrote:
> The maximum number of sessions device argument will be removed,
> as most PMDs do not have a limitation on this number.
> Therefore, the MVSAM PMD needs to parse this value internally.
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>  drivers/crypto/mvsam/rte_mrvl_pmd.c | 132 ++++++++++++++++++++++++++++++++----
>  1 file changed, 120 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
> index 1b6029a56..a7f5389ee 100644
> --- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
> +++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
> @@ -16,8 +16,23 @@
>
>  #define MRVL_MUSDK_DMA_MEMSIZE 41943040
>
> +#define MRVL_PMD_MAX_NB_SESS_ARG		("max_nb_sessions")
> +#define MRVL_PMD_DEFAULT_MAX_NB_SESSIONS	2048
> +
>  static uint8_t cryptodev_driver_id;
>
> +struct mrvl_pmd_init_params {
> +	struct rte_cryptodev_pmd_init_params common;
> +	uint32_t max_nb_sessions;
> +};
> +
> +const char *mrvl_pmd_valid_params[] = {
> +	RTE_CRYPTODEV_PMD_NAME_ARG,
> +	RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
> +	RTE_CRYPTODEV_PMD_SOCKET_ID_ARG,
> +	MRVL_PMD_MAX_NB_SESS_ARG
> +};
> +
>  /**
>   * Flag if particular crypto algorithm is supported by PMD/MUSDK.
>   *
> @@ -691,14 +706,15 @@ mrvl_crypto_pmd_dequeue_burst(void *queue_pair,
>  static int
>  cryptodev_mrvl_crypto_create(const char *name,
>  		struct rte_vdev_device *vdev,
> -		struct rte_cryptodev_pmd_init_params *init_params)
> +		struct mrvl_pmd_init_params *init_params)
>  {
>  	struct rte_cryptodev *dev;
>  	struct mrvl_crypto_private *internals;
>  	struct sam_init_params	sam_params;
>  	int ret;
>
> -	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
> +	dev = rte_cryptodev_pmd_create(name, &vdev->device,
> +			&init_params->common);
>  	if (dev == NULL) {
>  		MRVL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
>  		goto init_error;
> @@ -718,7 +734,7 @@ cryptodev_mrvl_crypto_create(const char *name,
>  	/* Set vector instructions mode supported */
>  	internals = dev->data->dev_private;
>
> -	internals->max_nb_qpairs = init_params->max_nb_queue_pairs;
> +	internals->max_nb_qpairs = init_params->common.max_nb_queue_pairs;
>  	internals->max_nb_sessions = init_params->max_nb_sessions;
>
>  	/*
> @@ -740,12 +756,99 @@ cryptodev_mrvl_crypto_create(const char *name,
>
>  init_error:
>  	MRVL_CRYPTO_LOG_ERR(
> -		"driver %s: %s failed", init_params->name, __func__);
> +		"driver %s: %s failed", init_params->common.name, __func__);
>
>  	cryptodev_mrvl_crypto_uninit(vdev);
>  	return -EFAULT;
>  }
>
> +/** Parse integer from integer argument */
> +static int
> +parse_integer_arg(const char *key __rte_unused,
> +		const char *value, void *extra_args)
> +{
> +	int *i = (int *) extra_args;
> +
> +	*i = atoi(value);
> +	if (*i < 0) {
> +		MRVL_CRYPTO_LOG_ERR("Argument has to be positive.\n");
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
> +/** Parse name */
> +static int
> +parse_name_arg(const char *key __rte_unused,
> +		const char *value, void *extra_args)
> +{
> +	struct rte_cryptodev_pmd_init_params *params = extra_args;
> +
> +	if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
> +		MRVL_CRYPTO_LOG_ERR("Invalid name %s, should be less than "
> +				"%u bytes.\n", value,
> +				RTE_CRYPTODEV_NAME_MAX_LEN - 1);
> +		return -EINVAL;
> +	}
> +
> +	strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
> +
> +	return 0;
> +}
> +
> +static int
> +mrvl_pmd_parse_input_args(struct mrvl_pmd_init_params *params,
> +			 const char *input_args)
> +{
> +	struct rte_kvargs *kvlist = NULL;
> +	int ret = 0;
> +
> +	if (params == NULL)
> +		return -EINVAL;
> +
> +	if (input_args) {
> +		kvlist = rte_kvargs_parse(input_args,
> +					  mrvl_pmd_valid_params);
> +		if (kvlist == NULL)
> +			return -1;
> +
> +		/* Common VDEV parameters */
> +		ret = rte_kvargs_process(kvlist,
> +					 RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
> +					 &parse_integer_arg,
> +					 &params->common.max_nb_queue_pairs);
> +		if (ret < 0)
> +			goto free_kvlist;
> +
> +		ret = rte_kvargs_process(kvlist,
> +					 RTE_CRYPTODEV_PMD_SOCKET_ID_ARG,
> +					 &parse_integer_arg,
> +					 &params->common.socket_id);
> +		if (ret < 0)
> +			goto free_kvlist;
> +
> +		ret = rte_kvargs_process(kvlist,
> +					 RTE_CRYPTODEV_PMD_NAME_ARG,
> +					 &parse_name_arg,
> +					 &params->common);
> +		if (ret < 0)
> +			goto free_kvlist;
> +
> +		ret = rte_kvargs_process(kvlist,
> +					 MRVL_PMD_MAX_NB_SESS_ARG,
> +					 &parse_integer_arg,
> +					 params);
> +		if (ret < 0)
> +			goto free_kvlist;
> +
> +	}
> +
> +free_kvlist:
> +	rte_kvargs_free(kvlist);
> +	return ret;
> +}
> +
>  /**
>   * Initialize the crypto device.
>   *
> @@ -755,7 +858,18 @@ cryptodev_mrvl_crypto_create(const char *name,
>  static int
>  cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
>  {
> -	struct rte_cryptodev_pmd_init_params init_params = { };
> +	struct mrvl_pmd_init_params init_params = {
> +		.common = {
> +			.name = "",
> +			.private_data_size =
> +				sizeof(struct mrvl_crypto_private),
> +			.max_nb_queue_pairs =
> +				sam_get_num_inst() * SAM_HW_RING_NUM,
> +			.socket_id = rte_socket_id()
> +		},
> +		.max_nb_sessions = MRVL_PMD_DEFAULT_MAX_NB_SESSIONS
> +	};
> +
>  	const char *name, *args;
>  	int ret;
>
> @@ -764,13 +878,7 @@ cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
>  		return -EINVAL;
>  	args = rte_vdev_device_args(vdev);
>
> -	init_params.private_data_size = sizeof(struct mrvl_crypto_private);
> -	init_params.max_nb_queue_pairs = sam_get_num_inst() * SAM_HW_RING_NUM;
> -	init_params.max_nb_sessions =
> -		RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS;
> -	init_params.socket_id = rte_socket_id();
> -
> -	ret = rte_cryptodev_pmd_parse_input_args(&init_params, args);
> +	ret = mrvl_pmd_parse_input_args(&init_params, args);
>  	if (ret) {
>  		RTE_LOG(ERR, PMD,
>  			"Failed to parse initialisation arguments[%s]\n",
> --
> 2.14.4
>

--
- Tomasz Duszyński

  reply	other threads:[~2018-07-10 10:42 UTC|newest]

Thread overview: 135+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-08 22:02 [PATCH 0/6] Cryptodev API changes Pablo de Lara
2018-06-08 22:02 ` [PATCH 1/6] cryptodev: replace bus specific struct with generic dev Pablo de Lara
2018-06-21 12:43   ` Akhil Goyal
2018-06-08 22:02 ` [PATCH 2/6] cryptodev: remove max number of sessions per queue Pablo de Lara
2018-06-21 13:03   ` Akhil Goyal
2018-06-08 22:02 ` [PATCH 3/6] cryptodev: remove max number of sessions Pablo de Lara
2018-06-12 11:37   ` Tomasz Duszynski
2018-06-12 13:53     ` De Lara Guarch, Pablo
2018-06-13  6:11       ` Tomasz Duszynski
2018-06-13  8:23         ` De Lara Guarch, Pablo
2018-06-13 10:11           ` Tomasz Duszynski
2018-06-19 13:20             ` Trahe, Fiona
2018-06-25 16:42               ` De Lara Guarch, Pablo
2018-06-08 22:02 ` [PATCH 4/6] cryptodev: remove queue start/stop functions Pablo de Lara
2018-06-21 12:50   ` Akhil Goyal
2018-06-08 22:02 ` [PATCH 5/6] cryptodev: remove old get session size functions Pablo de Lara
2018-06-21 12:59   ` Akhil Goyal
2018-06-22 17:02     ` Verma, Shally
2018-06-25 16:40       ` De Lara Guarch, Pablo
2018-06-26  5:28         ` Verma, Shally
2018-06-26  8:17           ` De Lara Guarch, Pablo
2018-06-08 22:02 ` [PATCH 6/6] cryptodev: replace mbuf scatter gather flag Pablo de Lara
2018-06-18  6:29   ` Akhil Goyal
2018-06-25 16:43     ` De Lara Guarch, Pablo
2018-06-25  8:48 ` [PATCH v2 00/15] Cryptodev API changes for 18.08 Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 01/15] cryptodev: replace bus specific struct with generic dev Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 02/15] cryptodev: remove max number of sessions per queue Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 03/15] app/crypto-perf: limit number of sessions Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 04/15] test/crypto: " Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 05/15] examples/l2fwd-crypto: " Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 06/15] examples/ipsec-secgw: check for max supported sessions Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 07/15] crypto/mvsam: parse max number of sessions Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 08/15] cryptodev: define value for unlimited sessions Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 09/15] cryptodev: remove max number of sessions parameter Pablo de Lara
2018-06-29  8:02     ` Tomasz Duszynski
2018-06-25  8:48   ` [PATCH v2 10/15] doc: remove unneeded deprecation notice Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 11/15] cryptodev: remove queue start/stop functions Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 12/15] cryptodev: remove old get session size functions Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 13/15] cryptodev: replace mbuf scatter gather flag Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 14/15] cryptodev: remove attach/detach session API Pablo de Lara
2018-06-25  8:48   ` [PATCH v2 15/15] cryptodev: rename PMD symmetric " Pablo de Lara
2018-06-28  0:52 ` [PATCH v3 00/16] Cryptodev API changes for 18.08 Pablo de Lara
2018-06-28  0:52   ` [PATCH v3 01/16] cryptodev: replace bus specific struct with generic dev Pablo de Lara
2018-06-28  0:52   ` [PATCH v3 02/16] cryptodev: remove max number of sessions per queue Pablo de Lara
2018-06-28  0:52   ` [PATCH v3 03/16] app/crypto-perf: limit number of sessions Pablo de Lara
2018-07-04 12:13     ` Akhil Goyal
2018-07-04 12:15     ` Akhil Goyal
2018-06-28  0:52   ` [PATCH v3 04/16] test/crypto: " Pablo de Lara
2018-07-04 12:21     ` Akhil Goyal
2018-06-28  0:52   ` [PATCH v3 05/16] examples/l2fwd-crypto: " Pablo de Lara
2018-07-04 12:04     ` Akhil Goyal
2018-06-28  0:52   ` [PATCH v3 06/16] examples/ipsec-secgw: check for max supported sessions Pablo de Lara
2018-07-04 12:30     ` Akhil Goyal
2018-06-28  0:52   ` [PATCH v3 07/16] crypto/mvsam: parse max number of sessions Pablo de Lara
2018-06-28  0:52   ` [PATCH v3 08/16] cryptodev: define value for unlimited sessions Pablo de Lara
2018-07-04 12:40     ` Akhil Goyal
2018-06-28  0:52   ` [PATCH v3 09/16] cryptodev: remove max number of sessions parameter Pablo de Lara
2018-06-29  8:04     ` Tomasz Duszynski
2018-07-02 10:58       ` De Lara Guarch, Pablo
2018-07-04 12:42     ` Akhil Goyal
2018-06-28  0:52   ` [PATCH v3 10/16] doc: remove unneeded deprecation notice Pablo de Lara
2018-07-04 11:29     ` Akhil Goyal
2018-06-28  0:52   ` [PATCH v3 11/16] cryptodev: remove queue start/stop functions Pablo de Lara
2018-06-28  0:53   ` [PATCH v3 12/16] cryptodev: remove old get session size functions Pablo de Lara
2018-07-04 11:31     ` Akhil Goyal
2018-06-28  0:53   ` [PATCH v3 13/16] cryptodev: replace mbuf scatter gather flag Pablo de Lara
2018-07-04 12:57     ` Akhil Goyal
2018-07-04 15:53       ` De Lara Guarch, Pablo
2018-06-28  0:53   ` [PATCH v3 14/16] cryptodev: remove attach/detach session API Pablo de Lara
2018-07-04 11:33     ` Akhil Goyal
2018-06-28  0:53   ` [PATCH v3 15/16] cryptodev: rename PMD symmetric " Pablo de Lara
2018-07-04 11:36     ` Akhil Goyal
2018-06-28  0:53   ` [PATCH v3 16/16] cryptodev: check if symmetric sessions are supported Pablo de Lara
2018-06-28 13:40     ` Verma, Shally
2018-06-28 14:15       ` De Lara Guarch, Pablo
2018-07-04 12:27     ` Akhil Goyal
2018-07-04  8:51 ` [PATCH v4 00/16] Cryptodev API changes Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 01/16] cryptodev: replace bus specific struct with generic dev Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 02/16] cryptodev: remove max number of sessions per queue Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 03/16] app/crypto-perf: limit number of sessions Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 04/16] test/crypto: " Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 05/16] examples/l2fwd-crypto: " Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 06/16] examples/ipsec-secgw: check for max supported sessions Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 07/16] crypto/mvsam: parse max number of sessions Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 08/16] cryptodev: define value for unlimited sessions Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 09/16] cryptodev: remove max number of sessions parameter Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 10/16] doc: remove unneeded deprecation notice Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 11/16] cryptodev: remove queue start/stop functions Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 12/16] cryptodev: remove old get session size functions Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 13/16] cryptodev: replace mbuf scatter gather flag Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 14/16] cryptodev: remove attach/detach session API Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 15/16] cryptodev: rename PMD symmetric " Pablo de Lara
2018-07-04  8:51   ` [PATCH v4 16/16] cryptodev: check if symmetric sessions are supported Pablo de Lara
2018-07-05  2:07 ` [PATCH v5 00/16] Cryptodev API changes Pablo de Lara
2018-07-05  2:07   ` [PATCH v5 01/16] cryptodev: replace bus specific struct with generic dev Pablo de Lara
2018-07-05  2:07   ` [PATCH v5 02/16] cryptodev: remove max number of sessions per queue Pablo de Lara
2018-07-05  2:07   ` [PATCH v5 03/16] app/crypto-perf: limit number of sessions Pablo de Lara
2018-07-05  2:07   ` [PATCH v5 04/16] test/crypto: " Pablo de Lara
2018-07-05 11:27     ` Verma, Shally
2018-07-05 11:30       ` Akhil Goyal
2018-07-05  2:07   ` [PATCH v5 05/16] examples/l2fwd-crypto: " Pablo de Lara
2018-07-05  2:07   ` [PATCH v5 06/16] examples/ipsec-secgw: check for max supported sessions Pablo de Lara
2018-07-05  2:07   ` [PATCH v5 07/16] crypto/mvsam: parse max number of sessions Pablo de Lara
2018-07-05  2:07   ` [PATCH v5 08/16] cryptodev: define value for unlimited sessions Pablo de Lara
2018-07-05  2:07   ` [PATCH v5 09/16] cryptodev: remove max number of sessions parameter Pablo de Lara
2018-07-09 10:53     ` De Lara Guarch, Pablo
2018-07-05  2:07   ` [PATCH v5 10/16] doc: remove unneeded deprecation notice Pablo de Lara
2018-07-05  2:08   ` [PATCH v5 11/16] cryptodev: remove queue start/stop functions Pablo de Lara
2018-07-05  2:08   ` [PATCH v5 12/16] cryptodev: remove old get session size functions Pablo de Lara
2018-07-05  2:08   ` [PATCH v5 13/16] cryptodev: replace mbuf scatter gather flag Pablo de Lara
2018-07-05 11:35     ` Akhil Goyal
2018-07-05  2:08   ` [PATCH v5 14/16] cryptodev: remove attach/detach session API Pablo de Lara
2018-07-05  2:08   ` [PATCH v5 15/16] cryptodev: rename PMD symmetric " Pablo de Lara
2018-07-05  2:08   ` [PATCH v5 16/16] cryptodev: check if symmetric sessions are supported Pablo de Lara
2018-07-10  0:36 ` [PATCH v6 00/16] Cryptodev API changes Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 01/16] cryptodev: replace bus specific struct with generic dev Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 02/16] cryptodev: remove max number of sessions per queue Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 03/16] app/crypto-perf: limit number of sessions Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 04/16] test/crypto: " Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 05/16] examples/l2fwd-crypto: " Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 06/16] examples/ipsec-secgw: check for max supported sessions Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 07/16] crypto/mvsam: parse max number of sessions Pablo de Lara
2018-07-10 10:42     ` Tomasz Duszynski [this message]
2018-07-10 10:45       ` De Lara Guarch, Pablo
2018-07-10  0:36   ` [PATCH v6 08/16] cryptodev: define value for unlimited sessions Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 09/16] cryptodev: remove max number of sessions parameter Pablo de Lara
2018-07-10  8:46     ` Akhil Goyal
2018-07-10  0:36   ` [PATCH v6 10/16] doc: remove unneeded deprecation notice Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 11/16] cryptodev: remove queue start/stop functions Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 12/16] cryptodev: remove old get session size functions Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 13/16] cryptodev: replace mbuf scatter gather flag Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 14/16] cryptodev: remove attach/detach session API Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 15/16] cryptodev: rename PMD symmetric " Pablo de Lara
2018-07-10  0:36   ` [PATCH v6 16/16] cryptodev: check if symmetric sessions are supported Pablo de Lara
2018-07-10 11:00   ` [PATCH v6 00/16] Cryptodev API changes De Lara Guarch, Pablo

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=20180710104211.GA3496@sh \
    --to=tdu@semihalf.com \
    --cc=akhil.goyal@nxp.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=ravi1.kumar@amd.com \
    --cc=roy.fan.zhang@intel.com \
    --cc=shally.verma@caviumnetworks.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 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.