From patchwork Fri Jun 2 03:04:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 688202 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp664634wru; Thu, 1 Jun 2023 20:04:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BvE+MFagbm0fKhcEIm6ohLSXDfL+Xa1LcdAghVMB+P6WSfGLParpyC92e02UDzHOJyaw4 X-Received: by 2002:a1c:f311:0:b0:3f6:e13:b268 with SMTP id q17-20020a1cf311000000b003f60e13b268mr824137wmq.22.1685675090226; Thu, 01 Jun 2023 20:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685675090; cv=none; d=google.com; s=arc-20160816; b=gj2N5UXzdkGCpFBmBMQ5kPoV3iXYU+jVUzua6jrlo7hGyo5qxR6da+pc5ybRT6RRBo i/vnVZ1PEC1ruxNCzr+jzq9qBG4bR4JigYz4FgMKsNnDeVY/02XRK7+dtLnkboyd6Is8 euEn/o+Y1cmLCIJwcHyzv1k4jD9jqpN1GaLpqE8fhZ825sfl9RJuIlLzyqM8sMUhZVUN tHcnRGPfRjPBScUujMj5b7+e4Dn9NtBT7xEzGFBhYpq0LIobdphCBiwq/jqzGm4J26sd 7RO58j0Vhenekm8fITpsjoU3HELLSRNXSdg97gG2U4mi6XDPSNAiQ96KBHwrNaTZorT4 YXHw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oRLSPUOI6IkzXiidTndpGgl9baDl1UJBhYdL5Tp5iu8=; b=DEBxDlpg51szQoFa01HxbdD195KYzutMl4xvH5GRLIbFdPZAB30lttFKxxNSRdkZls lE796M+CKZ1SjMCCCEeadd9e0SUdF8UB/6d2jfRHqZG604Y9rY3fbPsAWzNS1jcSSKVW ahxCiWrfhYp+eMNDXTN222tCQsf3a2Pu2IzCOL0iRjELGuKWYJqAhyGShghkJsJT0CFu Qzv10gL5Y60pDdJabcuz/ttFQKUVYsZZkqsZd5WUQbj0mxYtwjtAbbavYlFz8Wv/VTZI O6fcRWyVYtTHXOBbqSjxSQyy06R+S7vaFFABPNDarbBdZQaS7WrRHY+6aCWu6wwrxhBb TKCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c6eKHpCH; 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 m1-20020a056000008100b0030c2c3efbb6si124676wrx.910.2023.06.01.20.04.50; Thu, 01 Jun 2023 20:04:50 -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=c6eKHpCH; 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 854A3406B8; Fri, 2 Jun 2023 05:04:49 +0200 (CEST) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mails.dpdk.org (Postfix) with ESMTP id 710E140693 for ; Fri, 2 Jun 2023 05:04:48 +0200 (CEST) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-3f70fc4682aso14914935e9.1 for ; Thu, 01 Jun 2023 20:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685675088; x=1688267088; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oRLSPUOI6IkzXiidTndpGgl9baDl1UJBhYdL5Tp5iu8=; b=c6eKHpCHWZPjZjEPEBcXhZj6RFsRYUeQSa48OZY1gHOCXNL+58WHQqxSuhB9o3lrXB ZNbJ4osP/sg3swpOLSgu3FiN0FWbQZkcCAcekEXscN7shN3KWeCei7NwQJKkpVQmKbjB XXVmCd2J9ZaoFmmtbm8dk5Y0/5CVAk5fTV/ptdcj6KOY6u2x4KsNvEJ7rDhYqzpvofRp H7rXh5H3eIHUAucOFNg0gd9nZoKrrQDyMfCrma1OiIHbd3ayoljlGe3UePKykTL+Nbj8 4QTJ7Jc44+hP65UfkrHhouP4IkdD+n38kU+tYwHy/sAe3zWpjegZFPg5MYk3YuRWqHSZ XvkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685675088; x=1688267088; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oRLSPUOI6IkzXiidTndpGgl9baDl1UJBhYdL5Tp5iu8=; b=L+CfQWoeRWXXIkwoFofUoukaP0J0LkuQqAFCrDam5t4ZAxVOjPWvBnYkNm0tLiRy5i 0R0pbW1skwswAvieU+WgZktlR3XD1ST9pMeKcdg+T9WGjPbUb8kme4GrZRld5t99w+gp T++WN7PX+GwuTgkz2mRSacPCZ+DmUW2+lk9NVYmE1r+t7oj39OyjXp3NNzS4Qsxdj52X Uwc1ClYPkdiw2tr2HrpZzQhwban8y8i7dDnzIdbjp4CO/Rqb3ySdeHocarTedYxDd23g YtDA6tXiFxWxH4nKZF68IUJ6dO+zg0W5QFAPgkKm1mYq2n4bjOc6knORiTeTH2lpz5If 0kRA== X-Gm-Message-State: AC+VfDwis5N/6qFfWHR5+5iGSyNj+bS5wC2dHpSfHUN3pkqyrDk+CIjY wK5i0GKbnewI/DLkeOyUbcmXpA== X-Received: by 2002:a1c:7c0a:0:b0:3f6:289:b53b with SMTP id x10-20020a1c7c0a000000b003f60289b53bmr749994wmc.5.1685675087976; Thu, 01 Jun 2023 20:04:47 -0700 (PDT) Received: from localhost.localdomain ([185.217.119.27]) by smtp.gmail.com with ESMTPSA id 4-20020a05600c248400b003f604793989sm4010516wms.18.2023.06.01.20.04.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 01 Jun 2023 20:04:47 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal Cc: dev@dpdk.org, Zhangfei Gao Subject: [PATCH v2 resend] crypto/uadk: set queue pair in dev_configure Date: Fri, 2 Jun 2023 11:04:35 +0800 Message-Id: <20230602030436.7829-1-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20230420021313.66733-1-zhangfei.gao@linaro.org> References: <20230420021313.66733-1-zhangfei.gao@linaro.org> 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;