From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0D7E5429BA; Sun, 23 Apr 2023 06:23:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F6CC4021D; Sun, 23 Apr 2023 06:23:49 +0200 (CEST) Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by mails.dpdk.org (Postfix) with ESMTP id A0A2D40156 for ; Sun, 23 Apr 2023 06:23:48 +0200 (CEST) Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-74e0180b7d3so164827085a.2 for ; Sat, 22 Apr 2023 21:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682223828; x=1684815828; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fEOZJqJTynF39pCS/vILOu50tlEmxJOiKX5ieKMsTjY=; b=ANyIj0t5ls7FhrNKEXkFnB1vErzDj6NhqRxrQfuaT9WSDmbfaY3pZ4OKJPZwvmIcjo 5Hch0FBI6iQgQpRiNGeHt2rGwBCtsDLfKtLTpyTWYUETpjgSAn6qFyRuiw8Fc5eALQAg Yg6pbvDJ9oWb1k6/TNJbN20zBbQ42KOD32cMchSq56zdCM4CWs+ezpxRjkafPvuwwa1H BW4OsHbArIU8AvHS4XD8LoTvBzQu3bTw8YH/1hXM+Kd42KnmKLbMR7ubjsH1E2K/l37J GTwAoz6nHNk3skG48odcb5HICERU3mHxOCNy5vcnPevi5Wg6iWrKc92R9sXrlsQfc34n VYHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682223828; x=1684815828; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fEOZJqJTynF39pCS/vILOu50tlEmxJOiKX5ieKMsTjY=; b=fK2134lbPsQA+rplMpTAV5bWrsOHoQK+7Q2NuFLSOuPYnOibAh6775skH97Z3DpY7a OTRNBpEN3B4J2JRhuY+TnHWUDFbzrA9z7T6qSphp+omDoxaq2TYxXQ9j60bNLzqJBHoC y4PocmrqqvUc5OYxvbx/tOeIxHT3768cw2z+u3ynitZoLzwi3Sl/3vr353Cqf6k661+Y rJKuX7u6yUpamRAiyKK/qgpVKMlzJkoQbrNOKwUOB2u7Tieau9KvCreLykhpRxU2/WPe B3KpoiugJncH20g2KLW9LNttPgDP6ubG2ik+mAhbbQtSk8luXjzqK9HAjQpdGezo+xjU z67w== X-Gm-Message-State: AAQBX9dQxlF8KNp69wXYMtu9aLOnjlWX7StM4XeLCmMwaOL/n46hJHeR qqrb66TZJd4z9mb81DFxrY6W7IxCD9OLDsiG2FMIAg== X-Google-Smtp-Source: AKy350ZQuaPlMYdItoruxI6kZlbUBJlYL2QcHs+JEQqXj75PqESXAyfJDH/tJWgaNS2NADJNhn0Cu63sb47aaRcwwxY= X-Received: by 2002:a05:6214:4007:b0:5a2:f1e3:15d0 with SMTP id kd7-20020a056214400700b005a2f1e315d0mr15778360qvb.3.1682223827807; Sat, 22 Apr 2023 21:23:47 -0700 (PDT) MIME-Version: 1.0 References: <20230420065707.13318-1-zhangfei.gao@linaro.org> In-Reply-To: From: Zhangfei Gao Date: Sun, 23 Apr 2023 12:23:36 +0800 Message-ID: Subject: Re: [EXT] [PATCH] crypto/uadk: set queue pair in dev_configure To: Akhil Goyal Cc: "dev@dpdk.org" , "acc@lists.linaro.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi, Akhil On Thu, 20 Apr 2023 at 15:20, Akhil Goyal 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 > > --- > > 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