DPDK patches and discussions
 help / color / mirror / Atom feed
From: Zhangfei Gao <zhangfei.gao@linaro.org>
To: Akhil Goyal <gakhil@marvell.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"acc@lists.linaro.org" <acc@lists.linaro.org>
Subject: Re: [EXT] [PATCH] crypto/uadk: set queue pair in dev_configure
Date: Sun, 23 Apr 2023 12:23:36 +0800	[thread overview]
Message-ID: <CABQgh9GSg6ko6xTRp-Db3XsKAguMDMk=TpHT09OWnn_N2iDXtw@mail.gmail.com> (raw)
In-Reply-To: <CO6PR18MB4484EB413DEDF21B39FC55B3D8639@CO6PR18MB4484.namprd18.prod.outlook.com>

Hi, Akhil

On Thu, 20 Apr 2023 at 15:20, Akhil Goyal <gakhil@marvell.com> wrote:
>
> > 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
> >
> Please add documentation for the newly added devarg in uadk.rst.

Will add

+
+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

>
> > 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
> >
> >     lcore id    Buf Size  Burst Size          Gbps  Cycles/Buf
> >
> >            3        8192          32        7.5226      871.19
> >            7        8192          32        7.5225      871.20
> >            1        8192          32        7.5225      871.20
> >            4        8192          32        7.5224      871.21
> >            5        8192          32        7.5224      871.21
> >           10        8192          32        7.5223      871.22
> >            9        8192          32        7.5223      871.23
> >            2        8192          32        7.5222      871.23
> >            8        8192          32        7.5222      871.23
> >            6        8192          32        7.5218      871.28
> >
>
> No need to mention the above test result in patch description.
ok, thanks

>
> > Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> > ---
> >  drivers/crypto/uadk/uadk_crypto_pmd.c         | 19 +++++++++++++++++--
> >  drivers/crypto/uadk/uadk_crypto_pmd_private.h |  1 +
> >  2 files changed, 18 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/crypto/uadk/uadk_crypto_pmd.c
> > b/drivers/crypto/uadk/uadk_crypto_pmd.c
> > index 4f729e0f07..34aae99342 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);
> > +
>
> Who is the intended user of this environment variable?
wd_cipher_env_init and wd_digest_env_init in set_session_xxx_parameters
will fetch the env and allocate queue pairs accordingly.


>
> >       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;
>
> Is the user free to give any number as max? Do you want to add a check here?
> You should also mention in the documentation about the max and min values.

The max number can be obtained from the device property: available_instances.
It is not a constant value and may differ from the devices and platforms,
so it may not be suitable to add a check here.
Plan to leave this check to wd_cipher_env_init, which will fail if
allocating more queues
than available_instances.

Thanks

      reply	other threads:[~2023-04-23  4:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20  6:57 Zhangfei Gao
2023-04-20  7:20 ` [EXT] " Akhil Goyal
2023-04-23  4:23   ` Zhangfei Gao [this message]

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='CABQgh9GSg6ko6xTRp-Db3XsKAguMDMk=TpHT09OWnn_N2iDXtw@mail.gmail.com' \
    --to=zhangfei.gao@linaro.org \
    --cc=acc@lists.linaro.org \
    --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).