From patchwork Sun Apr 23 12:52:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 676340 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp1713047wrs; Sun, 23 Apr 2023 05:53:09 -0700 (PDT) X-Google-Smtp-Source: AKy350ZGq9dw7NuT0Cr/tfwt8mbYBC2qguGhYriBOYXoWhscFcrh3L5Tw3x8NKK6YoWhxX94QQDh X-Received: by 2002:a5d:4563:0:b0:2ef:b433:2942 with SMTP id a3-20020a5d4563000000b002efb4332942mr8009344wrc.21.1682254389813; Sun, 23 Apr 2023 05:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682254389; cv=none; d=google.com; s=arc-20160816; b=0qFdGz/uz1VM6RtueKHayvIA+rwgVqXiPNgoalP+t3IlypswXDLvugL2TwFubrKl79 RFNOWLJgh4eIKBbyRubK66VtSVcvqmhZ+x6+hbwd7z0oJQlKgcU3A2FbKLF+o4jRdac9 kPWO7JBh/0pmHGVmb7rjm/HbHglfycUWhpHR0eBySWXK0For7dv9l3b8DZJ3gAJvh98l Fm6Z/HctmzPkpeuSTa5/YFXBdr9MqKOUdj5kJdWsPRUXzyrAj1jC+uEFCi/PbUHYAV+S h98kys7RXyYr00r/XJUrFmUdjesQFRTB2xmwPAA2hdiRzxRIyGP8KoalhAK7RSE4jn7s nWqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=oRLSPUOI6IkzXiidTndpGgl9baDl1UJBhYdL5Tp5iu8=; b=hHzV1Qoex0tLh7U7Y4vUWmKYBwLwuKVOqWH6TDGufLwsYNzPGoyJzkgJQ4JCrQ5fvZ 0/ZIhEjHQdoBjsg1wDBkuHFksNiSoCYxnYy1Qiyx1IPN8C8ykmeQHnGKNeOnsabahm2+ 56ns4r0x0uMJr2I+fNJJWn6pVvH9IQKqtkVI4ru+OPaGZMAOUtWux9XeLqxeaMvIpwfs U30+w0gXTKRYHd0Bd5V//EXpy6k+Rut39vGKRFiXcGJaYAYt2AENXpwQ+kDs+oiAnYfy 2wwxZ12DnLB8DyJ4qil/XCK3tCYCutThNDCWvrYZBQBXcWOQuz7Y8eu3sfmiakitCYqz OGGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QKdLUvti; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id d18-20020adfe892000000b002f498eb4ca2si5751608wrm.961.2023.04.23.05.53.09; Sun, 23 Apr 2023 05:53:09 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QKdLUvti; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1D611410DE; Sun, 23 Apr 2023 14:53:09 +0200 (CEST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id 433BC40A80 for ; Sun, 23 Apr 2023 14:53:07 +0200 (CEST) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1a5197f00e9so29645315ad.1 for ; Sun, 23 Apr 2023 05:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682254386; x=1684846386; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oRLSPUOI6IkzXiidTndpGgl9baDl1UJBhYdL5Tp5iu8=; b=QKdLUvti32f/YdImPnQJrTzlGmOWi/Ut+F1LjNIwXr1mzG5fgUR5cMx4EYGf5B/61e HM4JFeIHSZg0Nx2tvQmnkarN/j2lNtC9+jzD5Jm+pmf7xG3gI2aLHDB2+cIHr2Z8A8bi Oi0o4iznnOT78/V7i+pVlpfIHd/WGZW6ouxoiGt+HJMvYcCCoK5KqCo7eUQq4P/ZYtvv 6WEuMMR6K/viHSKZP5YI8zi7hwhDa+efiSfhM0hDlE8lF2Szm830APbJxu/if13UHlVU J/zZGrpvSO7IuuLCn4NkMuZFvaAYLgyX/bIYqlcaM1zvb8C76t3q28k9CxDXdMwNIjEx WQVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682254386; x=1684846386; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oRLSPUOI6IkzXiidTndpGgl9baDl1UJBhYdL5Tp5iu8=; b=XVkkOCXCUIFkMdXVkAEjsFUiEmt4lEOsVJwZ1pDZfHJPrqAEZoxDuBwGEpmQ2FQcgM qyC10AktEGxMFOtTUShnhh5brt/pQ1BNxuPMSlEYZItAjq8Tq0bg2WBxWGsZS/WWHrfD qvvdIQDMoqe4MQINxtPiHKXIxh8qkN4VBLKKA73uKbjtV/BnFvy1MtTuiWewMpturYZE nQhjw2w8LJmZEyRA1sZgycJK5OFDWX9fzsQvre/NEid7Ugh5qAWFVffPcPN8PcFYv63c UFUDz/QWYRh6MHvD5CH8IAX8z0BgLjN6RDHal69yIUWzP/PS2LxYOD0AeUawiDdvSIL+ /Whw== X-Gm-Message-State: AAQBX9fMP9zx6ixH289zxGX56ZRERZ/hXNr3vODiXw2fTaJzYjPBOo3C EtWNrTvCFBTBdPpjQqHfSGRu0w== X-Received: by 2002:a17:903:25cd:b0:1a2:37fc:b591 with SMTP id jc13-20020a17090325cd00b001a237fcb591mr10186100plb.69.1682254386215; Sun, 23 Apr 2023 05:53:06 -0700 (PDT) Received: from localhost.localdomain ([199.101.192.162]) by smtp.gmail.com with ESMTPSA id t5-20020a170902a5c500b001a4fecf79e4sm5086055plq.49.2023.04.23.05.53.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 23 Apr 2023 05:53:05 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal Cc: dev@dpdk.org, acc@lists.linaro.org, Zhangfei Gao Subject: [PATCH v2] crypto/uadk: set queue pair in dev_configure Date: Sun, 23 Apr 2023 20:52:57 +0800 Message-Id: <20230423125257.694-1-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 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 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 --- 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="); 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;