From patchwork Thu Apr 20 06:57:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 675591 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp151102wrs; Wed, 19 Apr 2023 23:57:16 -0700 (PDT) X-Google-Smtp-Source: AKy350bTHFrdmjg7sFdp02ZxQisj7P7bTU0Siw2L0oOJ25DZinTHN9DXzWAIKpPfsgbBqICJuih8 X-Received: by 2002:a5d:56c4:0:b0:2f6:ca0d:ec1c with SMTP id m4-20020a5d56c4000000b002f6ca0dec1cmr355858wrw.10.1681973836616; Wed, 19 Apr 2023 23:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681973836; cv=none; d=google.com; s=arc-20160816; b=CsqCEZDjViK/Fe7rEAo+Z1uT3vvxbRtC5Y8bZ37rhL8XTSJVUQZxVvM7sJES3oNCQ5 Qpw2ypX/xq79UqPAGagaVzh9xocTs7ZS1sJIhwJQnYk9ORfYWevPMwRksX4vGLb/Pps9 g8dT4ovFnh8nx/a1saPadc8/eVL1BYfggiNXQu0RQ+OtPahs0lZcAF3yeoXbBc/K+nlr hOs4yftmUAdV4G5JSJ6ssJ877psQr959nUqmy2vYx8Lx26UJHUB3uqu4NZ9ixRJ6FDOj pjqDeELX3DJZAM1Tt0U4xUfWDaxpdUoov7mZTcWNcy04ahq0TFpX2EGq4wozigoZUW8V LWlA== 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=nKe6dJZJjvhrYEOPb45vhtVHSL/+yqvBfOR4tYNVdlg=; b=txYqmTqJkkRJ/6AU1bpyb65eUjfXd3a3QlhmDRy0j4W5wbH6B1fj1xfU6dllNaC8dH 7/WrWY/Y23KATcSgrI2xu4PsWFyWj0F6u5gTpUN40epr1PNoapt3JVff0kcW+Yfha8bF 19SCar9ki5PZWu8MOu4prC/o4/KY/P9/jtfdymeH1x3kdpYzTAG4yRb5asjQdqNQbh3p q/5jGSCgAl+0E11tF+2+Q/C1Xdx7EJRUxBqAaoKe1MIjDgG4woc1Op9oQO3yLvvMiU68 m7k6Pr/hEqz1FsNbBftLs+pN5yw9TXs72rnY7lFHLlyQ88K6zUs/nHBPvM+i97sFoZ/s 0qxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oAKqDcJO; 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 l16-20020a5d5610000000b002d11c12fb4csi865364wrv.484.2023.04.19.23.57.16; Wed, 19 Apr 2023 23:57:16 -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=oAKqDcJO; 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 E626140A4B; Thu, 20 Apr 2023 08:57:15 +0200 (CEST) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id 9F9B740687 for ; Thu, 20 Apr 2023 08:57:14 +0200 (CEST) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1a920d4842bso6589315ad.2 for ; Wed, 19 Apr 2023 23:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681973834; x=1684565834; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nKe6dJZJjvhrYEOPb45vhtVHSL/+yqvBfOR4tYNVdlg=; b=oAKqDcJOYBu0qwoDr9R4T7vXprXA+mtxXi+uNZSgGRjsINU3zjU6oGfneHfRSLpzsB 6riygqOQYlD2VouKeoFaIhd52PDn2o2yBLFsb86/DxOZpGLJmAv4zIFvIVyGzhoy1G7J RpTs8gA8eUI1tavXWoKCwjZmwf4+VtSK3eqk1h6bLCZIrRSRFCt4JHjRZm9l6p4CmUZS OAond/zya9NhF9/1vwyi2S22Hwtm0t/f1lq6g1j5zCAgF6tBSyuZEvfQQMjKVUNy7ImM M7bV+xYtzs6FEkGpdnHrdIQE+vzvSUXkqvUNRLZ6Bek7ymZEdb3shCUGsnNAbzo6vlKm 8ouw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681973834; x=1684565834; 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=nKe6dJZJjvhrYEOPb45vhtVHSL/+yqvBfOR4tYNVdlg=; b=DVrMlnp3ZtXtftuJlZa/+aFkyD/K5MSk/TprPw5ydypOwZMTE1vEEb3q7sXHekPCbJ ig2GPRfgjN/tRNRb9eRmxj1C4TsXiMoXwBaKir507Ivl2zwQl07gFYCdrv315A1QEm3K N7KEtfBJ+fzcYvxvRAxXGv9ENkpuIHdJOMJqizI3TC4P2lyF9BrZ12Rvb0dx96CytRCZ k2h0nH5fXwGmUkgXT3nz2jRMrDi9fds0JfhzFGblAI8g+5hGUc69BydQwakBAXiV8XYG cTfXyhhK/oe2IKUNxsZcACwbwhLW2Mn/X9XAWSVqSEHBpZfpdM9yER9f4AQgpQKKB0Bz 5UYw== X-Gm-Message-State: AAQBX9faZq0VbiJ22MqkYfaaLCv7cgTaLxjH4DUY5I/k32iI4+qyG5aV otsc9qbrGhdCCSsuwmB13InG5w== X-Received: by 2002:a17:902:9044:b0:1a2:85f0:e73f with SMTP id w4-20020a170902904400b001a285f0e73fmr473221plz.35.1681973833733; Wed, 19 Apr 2023 23:57:13 -0700 (PDT) Received: from localhost.localdomain ([199.101.192.137]) by smtp.gmail.com with ESMTPSA id c5-20020a170902848500b0019f892dc696sm493644plo.229.2023.04.19.23.57.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 19 Apr 2023 23:57:13 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal Cc: dev@dpdk.org, acc@lists.linaro.org, Zhangfei Gao Subject: [PATCH] crypto/uadk: set queue pair in dev_configure Date: Thu, 20 Apr 2023 14:57:07 +0800 Message-Id: <20230420065707.13318-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 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 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); + 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,7 @@ 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= " + "socket_id="); 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;