* [PATCH v2 resend] crypto/uadk: set queue pair in dev_configure
[not found] <20230420021313.66733-1-zhangfei.gao@linaro.org>
@ 2023-06-02 3:04 ` Zhangfei Gao
2023-06-09 6:57 ` Zhangfei Gao
2023-06-14 19:10 ` [EXT] " Akhil Goyal
0 siblings, 2 replies; 5+ messages in thread
From: Zhangfei Gao @ 2023-06-02 3:04 UTC (permalink / raw)
To: Akhil Goyal; +Cc: dev, Zhangfei Gao
By default, uadk only alloc two queues for each algorithm, which
will impact performance.
Set queue pair number as required in dev_configure.
The default max queue pair number is 8, which can be modified
via para: max_nb_queue_pairs
Example:
sudo dpdk-test-crypto-perf -l 0-10 --vdev crypto_uadk,max_nb_queue_pairs=10
-- --devtype crypto_uadk --optype cipher-only --buffer-sz 8192
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
---
doc/guides/cryptodevs/uadk.rst | 27 +++++++++++++++++++
drivers/crypto/uadk/uadk_crypto_pmd.c | 18 +++++++++++--
drivers/crypto/uadk/uadk_crypto_pmd_private.h | 1 +
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/doc/guides/cryptodevs/uadk.rst b/doc/guides/cryptodevs/uadk.rst
index 9af6b88a5a..053622f7bf 100644
--- a/doc/guides/cryptodevs/uadk.rst
+++ b/doc/guides/cryptodevs/uadk.rst
@@ -110,3 +110,30 @@ Test steps
sudo dpdk-test --vdev=crypto_uadk --log-level=6
RTE>>cryptodev_uadk_autotest
RTE>>quit
+
+
+Initialization
+--------------
+
+To use the PMD in an application, user must:
+
+* Call rte_vdev_init("crypto_uadk") within the application.
+
+* Use --vdev="crypto_uadk" in the EAL options, which will call rte_vdev_init() internally.
+
+The following parameters (all optional) can be provided in the previous two calls:
+
+* max_nb_queue_pairs: Specify the maximum number of queue pairs in the device (8 by default).
+ The max value of max_nb_queue_pairs can be queried from the device property available_instances.
+ Property available_instances value may differ from the devices and platforms.
+ Allocating queue pairs bigger than available_instances will fail.
+
+Example:
+
+.. code-block:: console
+
+ cat /sys/class/uacce/hisi_sec2-2/available_instances
+ 256
+
+ sudo dpdk-test-crypto-perf -l 0-10 --vdev crypto_uadk,max_nb_queue_pairs=10 \
+ -- --devtype crypto_uadk --optype cipher-only --buffer-sz 8192
diff --git a/drivers/crypto/uadk/uadk_crypto_pmd.c b/drivers/crypto/uadk/uadk_crypto_pmd.c
index 4f729e0f07..824383512e 100644
--- a/drivers/crypto/uadk/uadk_crypto_pmd.c
+++ b/drivers/crypto/uadk/uadk_crypto_pmd.c
@@ -357,8 +357,15 @@ static const struct rte_cryptodev_capabilities uadk_crypto_v2_capabilities[] = {
/* Configure device */
static int
uadk_crypto_pmd_config(struct rte_cryptodev *dev __rte_unused,
- struct rte_cryptodev_config *config __rte_unused)
+ struct rte_cryptodev_config *config)
{
+ char env[128];
+
+ /* set queue pairs num via env */
+ sprintf(env, "sync:%d@0", config->nb_queue_pairs);
+ setenv("WD_CIPHER_CTX_NUM", env, 1);
+ setenv("WD_DIGEST_CTX_NUM", env, 1);
+
return 0;
}
@@ -434,7 +441,7 @@ uadk_crypto_pmd_info_get(struct rte_cryptodev *dev,
if (dev_info != NULL) {
dev_info->driver_id = dev->driver_id;
dev_info->driver_name = dev->device->driver->name;
- dev_info->max_nb_queue_pairs = 128;
+ dev_info->max_nb_queue_pairs = priv->max_nb_qpairs;
/* No limit of number of sessions */
dev_info->sym.max_nb_sessions = 0;
dev_info->feature_flags = dev->feature_flags;
@@ -1015,6 +1022,7 @@ uadk_cryptodev_probe(struct rte_vdev_device *vdev)
struct uadk_crypto_priv *priv;
struct rte_cryptodev *dev;
struct uacce_dev *udev;
+ const char *input_args;
const char *name;
udev = wd_get_accel_dev("cipher");
@@ -1030,6 +1038,9 @@ uadk_cryptodev_probe(struct rte_vdev_device *vdev)
if (name == NULL)
return -EINVAL;
+ input_args = rte_vdev_device_args(vdev);
+ rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
+
dev = rte_cryptodev_pmd_create(name, &vdev->device, &init_params);
if (dev == NULL) {
UADK_LOG(ERR, "driver %s: create failed", init_params.name);
@@ -1044,6 +1055,7 @@ uadk_cryptodev_probe(struct rte_vdev_device *vdev)
RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO;
priv = dev->data->dev_private;
priv->version = version;
+ priv->max_nb_qpairs = init_params.max_nb_queue_pairs;
rte_cryptodev_pmd_probing_finish(dev);
@@ -1078,4 +1090,6 @@ static struct cryptodev_driver uadk_crypto_drv;
RTE_PMD_REGISTER_VDEV(UADK_CRYPTO_DRIVER_NAME, uadk_crypto_pmd);
RTE_PMD_REGISTER_CRYPTO_DRIVER(uadk_crypto_drv, uadk_crypto_pmd.driver,
uadk_cryptodev_driver_id);
+RTE_PMD_REGISTER_PARAM_STRING(UADK_CRYPTO_DRIVER_NAME,
+ "max_nb_queue_pairs=<int>");
RTE_LOG_REGISTER_DEFAULT(uadk_crypto_logtype, INFO);
diff --git a/drivers/crypto/uadk/uadk_crypto_pmd_private.h b/drivers/crypto/uadk/uadk_crypto_pmd_private.h
index 9075f0f058..5a7dbff117 100644
--- a/drivers/crypto/uadk/uadk_crypto_pmd_private.h
+++ b/drivers/crypto/uadk/uadk_crypto_pmd_private.h
@@ -67,6 +67,7 @@ struct uadk_crypto_priv {
bool env_cipher_init;
bool env_auth_init;
enum uadk_crypto_version version;
+ unsigned int max_nb_qpairs;
} __rte_cache_aligned;
extern int uadk_crypto_logtype;
--
2.39.2 (Apple Git-143)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 resend] crypto/uadk: set queue pair in dev_configure
2023-06-02 3:04 ` [PATCH v2 resend] crypto/uadk: set queue pair in dev_configure Zhangfei Gao
@ 2023-06-09 6:57 ` Zhangfei Gao
2023-06-09 8:31 ` [EXT] " Akhil Goyal
2023-06-14 19:10 ` [EXT] " Akhil Goyal
1 sibling, 1 reply; 5+ messages in thread
From: Zhangfei Gao @ 2023-06-09 6:57 UTC (permalink / raw)
To: Akhil Goyal; +Cc: dev
Hi, Akhil
在 2023/6/2 11:04, Zhangfei Gao 写道:
> By default, uadk only alloc two queues for each algorithm, which
> will impact performance.
> Set queue pair number as required in dev_configure.
> The default max queue pair number is 8, which can be modified
> via para: max_nb_queue_pairs
>
> Example:
> sudo dpdk-test-crypto-perf -l 0-10 --vdev crypto_uadk,max_nb_queue_pairs=10
> -- --devtype crypto_uadk --optype cipher-only --buffer-sz 8192
>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Would you mind taking a look at this patch?
The ci test supposes no problem.
https://lab.dpdk.org/results/dashboard/patchsets/26502/
Thanks
> ---
> doc/guides/cryptodevs/uadk.rst | 27 +++++++++++++++++++
> drivers/crypto/uadk/uadk_crypto_pmd.c | 18 +++++++++++--
> drivers/crypto/uadk/uadk_crypto_pmd_private.h | 1 +
> 3 files changed, 44 insertions(+), 2 deletions(-)
>
> diff --git a/doc/guides/cryptodevs/uadk.rst b/doc/guides/cryptodevs/uadk.rst
> index 9af6b88a5a..053622f7bf 100644
> --- a/doc/guides/cryptodevs/uadk.rst
> +++ b/doc/guides/cryptodevs/uadk.rst
> @@ -110,3 +110,30 @@ Test steps
> sudo dpdk-test --vdev=crypto_uadk --log-level=6
> RTE>>cryptodev_uadk_autotest
> RTE>>quit
> +
> +
> +Initialization
> +--------------
> +
> +To use the PMD in an application, user must:
> +
> +* Call rte_vdev_init("crypto_uadk") within the application.
> +
> +* Use --vdev="crypto_uadk" in the EAL options, which will call rte_vdev_init() internally.
> +
> +The following parameters (all optional) can be provided in the previous two calls:
> +
> +* max_nb_queue_pairs: Specify the maximum number of queue pairs in the device (8 by default).
> + The max value of max_nb_queue_pairs can be queried from the device property available_instances.
> + Property available_instances value may differ from the devices and platforms.
> + Allocating queue pairs bigger than available_instances will fail.
> +
> +Example:
> +
> +.. code-block:: console
> +
> + cat /sys/class/uacce/hisi_sec2-2/available_instances
> + 256
> +
> + sudo dpdk-test-crypto-perf -l 0-10 --vdev crypto_uadk,max_nb_queue_pairs=10 \
> + -- --devtype crypto_uadk --optype cipher-only --buffer-sz 8192
> diff --git a/drivers/crypto/uadk/uadk_crypto_pmd.c b/drivers/crypto/uadk/uadk_crypto_pmd.c
> index 4f729e0f07..824383512e 100644
> --- a/drivers/crypto/uadk/uadk_crypto_pmd.c
> +++ b/drivers/crypto/uadk/uadk_crypto_pmd.c
> @@ -357,8 +357,15 @@ static const struct rte_cryptodev_capabilities uadk_crypto_v2_capabilities[] = {
> /* Configure device */
> static int
> uadk_crypto_pmd_config(struct rte_cryptodev *dev __rte_unused,
> - struct rte_cryptodev_config *config __rte_unused)
> + struct rte_cryptodev_config *config)
> {
> + char env[128];
> +
> + /* set queue pairs num via env */
> + sprintf(env, "sync:%d@0", config->nb_queue_pairs);
> + setenv("WD_CIPHER_CTX_NUM", env, 1);
> + setenv("WD_DIGEST_CTX_NUM", env, 1);
> +
> return 0;
> }
>
> @@ -434,7 +441,7 @@ uadk_crypto_pmd_info_get(struct rte_cryptodev *dev,
> if (dev_info != NULL) {
> dev_info->driver_id = dev->driver_id;
> dev_info->driver_name = dev->device->driver->name;
> - dev_info->max_nb_queue_pairs = 128;
> + dev_info->max_nb_queue_pairs = priv->max_nb_qpairs;
> /* No limit of number of sessions */
> dev_info->sym.max_nb_sessions = 0;
> dev_info->feature_flags = dev->feature_flags;
> @@ -1015,6 +1022,7 @@ uadk_cryptodev_probe(struct rte_vdev_device *vdev)
> struct uadk_crypto_priv *priv;
> struct rte_cryptodev *dev;
> struct uacce_dev *udev;
> + const char *input_args;
> const char *name;
>
> udev = wd_get_accel_dev("cipher");
> @@ -1030,6 +1038,9 @@ uadk_cryptodev_probe(struct rte_vdev_device *vdev)
> if (name == NULL)
> return -EINVAL;
>
> + input_args = rte_vdev_device_args(vdev);
> + rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
> +
> dev = rte_cryptodev_pmd_create(name, &vdev->device, &init_params);
> if (dev == NULL) {
> UADK_LOG(ERR, "driver %s: create failed", init_params.name);
> @@ -1044,6 +1055,7 @@ uadk_cryptodev_probe(struct rte_vdev_device *vdev)
> RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO;
> priv = dev->data->dev_private;
> priv->version = version;
> + priv->max_nb_qpairs = init_params.max_nb_queue_pairs;
>
> rte_cryptodev_pmd_probing_finish(dev);
>
> @@ -1078,4 +1090,6 @@ static struct cryptodev_driver uadk_crypto_drv;
> RTE_PMD_REGISTER_VDEV(UADK_CRYPTO_DRIVER_NAME, uadk_crypto_pmd);
> RTE_PMD_REGISTER_CRYPTO_DRIVER(uadk_crypto_drv, uadk_crypto_pmd.driver,
> uadk_cryptodev_driver_id);
> +RTE_PMD_REGISTER_PARAM_STRING(UADK_CRYPTO_DRIVER_NAME,
> + "max_nb_queue_pairs=<int>");
> RTE_LOG_REGISTER_DEFAULT(uadk_crypto_logtype, INFO);
> diff --git a/drivers/crypto/uadk/uadk_crypto_pmd_private.h b/drivers/crypto/uadk/uadk_crypto_pmd_private.h
> index 9075f0f058..5a7dbff117 100644
> --- a/drivers/crypto/uadk/uadk_crypto_pmd_private.h
> +++ b/drivers/crypto/uadk/uadk_crypto_pmd_private.h
> @@ -67,6 +67,7 @@ struct uadk_crypto_priv {
> bool env_cipher_init;
> bool env_auth_init;
> enum uadk_crypto_version version;
> + unsigned int max_nb_qpairs;
> } __rte_cache_aligned;
>
> extern int uadk_crypto_logtype;
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [EXT] Re: [PATCH v2 resend] crypto/uadk: set queue pair in dev_configure
2023-06-09 6:57 ` Zhangfei Gao
@ 2023-06-09 8:31 ` Akhil Goyal
2023-06-09 10:19 ` Zhangfei Gao
0 siblings, 1 reply; 5+ messages in thread
From: Akhil Goyal @ 2023-06-09 8:31 UTC (permalink / raw)
To: Zhangfei Gao; +Cc: dev
> Hi, Akhil
>
>
> 在 2023/6/2 11:04, Zhangfei Gao 写道:
> > By default, uadk only alloc two queues for each algorithm, which
> > will impact performance.
> > Set queue pair number as required in dev_configure.
> > The default max queue pair number is 8, which can be modified
> > via para: max_nb_queue_pairs
> >
> > Example:
> > sudo dpdk-test-crypto-perf -l 0-10 --vdev
> crypto_uadk,max_nb_queue_pairs=10
> > -- --devtype crypto_uadk --optype cipher-only --buffer-sz 8192
> >
> > Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>
>
> Would you mind taking a look at this patch?
>
I plan to take this patch in RC2.
RC1 is mainly for large features and library changes.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [EXT] Re: [PATCH v2 resend] crypto/uadk: set queue pair in dev_configure
2023-06-09 8:31 ` [EXT] " Akhil Goyal
@ 2023-06-09 10:19 ` Zhangfei Gao
0 siblings, 0 replies; 5+ messages in thread
From: Zhangfei Gao @ 2023-06-09 10:19 UTC (permalink / raw)
To: Akhil Goyal; +Cc: dev
在 2023/6/9 16:31, Akhil Goyal 写道:
>> Hi, Akhil
>>
>>
>> 在 2023/6/2 11:04, Zhangfei Gao 写道:
>>> By default, uadk only alloc two queues for each algorithm, which
>>> will impact performance.
>>> Set queue pair number as required in dev_configure.
>>> The default max queue pair number is 8, which can be modified
>>> via para: max_nb_queue_pairs
>>>
>>> Example:
>>> sudo dpdk-test-crypto-perf -l 0-10 --vdev
>> crypto_uadk,max_nb_queue_pairs=10
>>> -- --devtype crypto_uadk --optype cipher-only --buffer-sz 8192
>>>
>>> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>>
>> Would you mind taking a look at this patch?
>>
> I plan to take this patch in RC2.
> RC1 is mainly for large features and library changes.
Thanks Akhil
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [EXT] [PATCH v2 resend] crypto/uadk: set queue pair in dev_configure
2023-06-02 3:04 ` [PATCH v2 resend] crypto/uadk: set queue pair in dev_configure Zhangfei Gao
2023-06-09 6:57 ` Zhangfei Gao
@ 2023-06-14 19:10 ` Akhil Goyal
1 sibling, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2023-06-14 19:10 UTC (permalink / raw)
To: Zhangfei Gao; +Cc: dev
> By default, uadk only alloc two queues for each algorithm, which
> will impact performance.
> Set queue pair number as required in dev_configure.
> The default max queue pair number is 8, which can be modified
> via para: max_nb_queue_pairs
>
> Example:
> sudo dpdk-test-crypto-perf -l 0-10 --vdev crypto_uadk,max_nb_queue_pairs=10
> -- --devtype crypto_uadk --optype cipher-only --buffer-sz 8192
>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Applied to dpdk-next-crypto
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-14 19:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20230420021313.66733-1-zhangfei.gao@linaro.org>
2023-06-02 3:04 ` [PATCH v2 resend] crypto/uadk: set queue pair in dev_configure Zhangfei Gao
2023-06-09 6:57 ` Zhangfei Gao
2023-06-09 8:31 ` [EXT] " Akhil Goyal
2023-06-09 10:19 ` Zhangfei Gao
2023-06-14 19:10 ` [EXT] " Akhil Goyal
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).