From patchwork Sat May 25 14:07:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 798941 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp1156837wrw; Sat, 25 May 2024 07:08:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQaxel5lxkAJ9aX9cWjy+Cy22jmyZyZoVnYgpK0WD/zgCjWotxcT8+f+/nsFG4kkaD42XnOgV+vgtEy8SDI+Yx X-Google-Smtp-Source: AGHT+IF2HCKTuzLSDwiX91cgMRVIwsgSE46MhdJ3HHZUCNyujO5zIbeSnxXoqmU7kPJql3C3DWjo X-Received: by 2002:a05:651c:201d:b0:2e5:6958:b5de with SMTP id 38308e7fff4ca-2e95b09af62mr29394421fa.21.1716646092329; Sat, 25 May 2024 07:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716646092; cv=none; d=google.com; s=arc-20160816; b=aPANq269cR/xJ+wEWm3hr5U5g9hBRa1SMGfRWY6TjFTENEdXSGtwEgp8vcNUgOwt8S krIsnjX7oK8IrYIVP+BQyv3F+T/Vmux3YEIIkMuI+l5GeOQ9gT33kMz4DehmXinXhuOx cqUgdvb32ymAkv/PbwMfVHrGnLeEfwxzYF5rE+NrI1CsSK4LDRUsv7JMZ3QGQybznGst 9uzuepdHFygPwR8//NzaWXQi8iwTj0o4hkgBE2k485w4BJj4Z6NlKRB3g8Gl6hGarBsT EcMd+JrpUQDLI+RdGgK3hITjePWPPWjk8YT2HXO+kkP2RHFv+yWh46kg8rk8BL7e06Wi iUTg== 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=YlZHVDe/tWnEf116HCDrHBnadF124iyZQQJCDFljrlQ=; fh=N6ystvY2g7QTpz2QKkAMt/Nu9xETjtRlVAZxgmiIO6M=; b=YpFj2X5m37UDoPf89LsM2F2VtKN2MPEeqQJ5eHYVkJmMd0+BOXJLZ9IivBvaVZQcY2 TgD1DbbeoeC7D7N1/P4dPy6bGGJ7awXmbQ0Id3DF1cq/09sucTdlds7tYTadJYDWSR8/ X5K26BovIES7zyB/2H9fkmB5Bky5SMmyVb6ivGxK5LYUpXNAc3XrkBu2qaaVjHXI6WDL uxdc0+Q2fIPoabjPtNG4fygghN1C+4teYyQT+kwLhsEcLINSDzLfZs6fWSV901iat0wy qKU+KJjN9WTMGlx5VpRtLKs8L7UjTv5raL53Yrq/S//YILIkG2vzgj6dyaouef3Ttve3 FDZw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tzHPcPqg; 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 38308e7fff4ca-2e95bccaf53si11124941fa.32.2024.05.25.07.08.12; Sat, 25 May 2024 07:08:12 -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=tzHPcPqg; 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 73882402CC; Sat, 25 May 2024 16:08:08 +0200 (CEST) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mails.dpdk.org (Postfix) with ESMTP id 879B1402C7 for ; Sat, 25 May 2024 16:08:07 +0200 (CEST) Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2e73441edf7so66776321fa.1 for ; Sat, 25 May 2024 07:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716646087; x=1717250887; darn=dpdk.org; 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=YlZHVDe/tWnEf116HCDrHBnadF124iyZQQJCDFljrlQ=; b=tzHPcPqgXXyG/RYbASUNkTlEPF3u+CPwyRjdxO1taU5KUY1f6EZj91HODFVT77z4hV WXGu+LmmCH1Z+Zcd6avkENzAGbblFVPWN/6wg+uOtgKMu+TZQTXnXCR8462EDvObSHRw LdPnNujl2AGeelh3VSSRAa5llcMElPpQSOrebJWuFLqJ8tG2jXEYB/XwSRiMbAkKe0c3 4nSW3csHpQQM6PjII4WqRSD3HrhnWcxKA1exCG14hLXa/bmfc10Qk/hPrkAbuzeGysQm 4p/mT6y9h40OSi2T4ZNQYblZZZcPes8F7sHlAgxaqvCgWLTUUmUHMn4TYpMXCf8B4RiM mFIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716646087; x=1717250887; 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=YlZHVDe/tWnEf116HCDrHBnadF124iyZQQJCDFljrlQ=; b=NqwB4N3IWu07bxn2aPTxmSL/ehaMP25YHfvu0doaEWglplLCxR0izu1+SstcneqTgO 5nNvDs7Diqu7laGDxDiT5H2jhFBuwETaMlnUYA1ESciQPzrHcoyfWBdicfR44Rm3KA1G 2vkLNu5Smp/3OsV9SP4gH+EpISeaVOIcLA3mQur0eh2/XW8X3Y+Jdmha2Ff7DcVIT2iG PEI9xY2QDJFyI1SQGX2tVmXy8gMJkzOD081zk5y6/jsOdO3k1eXYMgAS/S6lt/02SV21 lbVGev5KaFYbyIIb7nmDpZ1TprIgORfsR2lTrLQGXYk7TPxOyCcrAmqh7IVinajW8ehu PA9A== X-Gm-Message-State: AOJu0YzLbW0X7HLLa9HjmkcHwKpyEcsUjq973hNon5LCm/p/xUB6RMDi Yzn+JaR5GfjDZM/xN/Qu1CHLnhX5rLdwt/LOiOY3ghJpWzeKu3qm+9BxMCyQqyTjIZTQOYSm0fQ 8WBLCODdU X-Received: by 2002:a2e:7d11:0:b0:2e4:14a0:4d15 with SMTP id 38308e7fff4ca-2e95b27ee38mr30249291fa.51.1716646087110; Sat, 25 May 2024 07:08:07 -0700 (PDT) Received: from localhost.localdomain (ec2-54-151-66-232.us-west-1.compute.amazonaws.com. [54.151.66.232]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42100f134cesm81969625e9.18.2024.05.25.07.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 07:08:06 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal , Fan Zhang , Ashish Gupta Cc: dev@dpdk.org, Zhangfei Gao Subject: [PATCH v2 1/3] compress/uadk: Introduce UADK compression driver Date: Sat, 25 May 2024 14:07:51 +0000 Message-Id: <20240525140753.122-2-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240525140753.122-1-zhangfei.gao@linaro.org> References: <20240525140753.122-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 Introduce a new compression & decompression PMD for hardware accelerators based on UADK [1]. UADK is a framework for user applications to access hardware accelerators. UADK relies on IOMMU SVA (Shared Virtual Address) feature, which shares the same page table between IOMMU and MMU. Thereby user application can directly use the virtual address for the device DMA, which enhances the performance as well as easy usability. This patch adds the basic framework. Test: sudo dpdk-test --vdev=compress_uadk RTE>>compressdev_autotest RTE>>quit [1] https://github.com/Linaro/uadk Signed-off-by: Zhangfei Gao --- drivers/compress/meson.build | 1 + drivers/compress/uadk/meson.build | 30 ++++++++ drivers/compress/uadk/uadk_compress_pmd.c | 75 +++++++++++++++++++ .../compress/uadk/uadk_compress_pmd_private.h | 20 +++++ 4 files changed, 126 insertions(+) create mode 100644 drivers/compress/uadk/meson.build create mode 100644 drivers/compress/uadk/uadk_compress_pmd.c create mode 100644 drivers/compress/uadk/uadk_compress_pmd_private.h diff --git a/drivers/compress/meson.build b/drivers/compress/meson.build index b91195b27d..91d7800a4a 100644 --- a/drivers/compress/meson.build +++ b/drivers/compress/meson.build @@ -10,6 +10,7 @@ drivers = [ 'mlx5', 'nitrox', 'octeontx', + 'uadk', 'zlib', ] diff --git a/drivers/compress/uadk/meson.build b/drivers/compress/uadk/meson.build new file mode 100644 index 0000000000..704833bbcf --- /dev/null +++ b/drivers/compress/uadk/meson.build @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2024-2025 Huawei Technologies Co.,Ltd. All rights reserved. +# Copyright 2024-2025 Linaro ltd. + +if not is_linux + build = false + reason = 'only supported on Linux' + subdir_done() +endif + +sources = files( + 'uadk_compress_pmd.c', +) + +deps += 'bus_vdev' +dep = dependency('libwd_comp', required: false, method: 'pkg-config') +if not dep.found() + build = false + reason = 'missing dependency, "libwd_comp"' +else + ext_deps += dep +endif + +dep = dependency('libwd', required: false, method: 'pkg-config') +if not dep.found() + build = false + reason = 'missing dependency, "libwd"' +else + ext_deps += dep +endif diff --git a/drivers/compress/uadk/uadk_compress_pmd.c b/drivers/compress/uadk/uadk_compress_pmd.c new file mode 100644 index 0000000000..6ffc22a0d2 --- /dev/null +++ b/drivers/compress/uadk/uadk_compress_pmd.c @@ -0,0 +1,75 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2024-2025 Huawei Technologies Co.,Ltd. All rights reserved. + * Copyright 2024-2025 Linaro ltd. + */ + +#include +#include +#include + +#include +#include + +#include "uadk_compress_pmd_private.h" + +static struct rte_compressdev_ops uadk_compress_pmd_ops; + +static int +uadk_compress_probe(struct rte_vdev_device *vdev) +{ + struct rte_compressdev_pmd_init_params init_params = { + "", + rte_socket_id(), + }; + struct rte_compressdev *compressdev; + struct uacce_dev *udev; + const char *name; + + udev = wd_get_accel_dev("deflate"); + if (!udev) + return -ENODEV; + + name = rte_vdev_device_name(vdev); + if (name == NULL) + return -EINVAL; + + compressdev = rte_compressdev_pmd_create(name, &vdev->device, + sizeof(struct uadk_compress_priv), &init_params); + if (compressdev == NULL) { + UADK_LOG(ERR, "driver %s: create failed", init_params.name); + return -ENODEV; + } + + compressdev->dev_ops = &uadk_compress_pmd_ops; + compressdev->dequeue_burst = NULL; + compressdev->enqueue_burst = NULL; + compressdev->feature_flags = RTE_COMPDEV_FF_HW_ACCELERATED; + + return 0; +} + +static int +uadk_compress_remove(struct rte_vdev_device *vdev) +{ + struct rte_compressdev *compressdev; + const char *name; + + name = rte_vdev_device_name(vdev); + if (name == NULL) + return -EINVAL; + + compressdev = rte_compressdev_pmd_get_named_dev(name); + if (compressdev == NULL) + return -ENODEV; + + return rte_compressdev_pmd_destroy(compressdev); +} + +static struct rte_vdev_driver uadk_compress_pmd = { + .probe = uadk_compress_probe, + .remove = uadk_compress_remove, +}; + +#define UADK_COMPRESS_DRIVER_NAME compress_uadk +RTE_PMD_REGISTER_VDEV(UADK_COMPRESS_DRIVER_NAME, uadk_compress_pmd); +RTE_LOG_REGISTER_DEFAULT(uadk_compress_logtype, INFO); diff --git a/drivers/compress/uadk/uadk_compress_pmd_private.h b/drivers/compress/uadk/uadk_compress_pmd_private.h new file mode 100644 index 0000000000..88e9075619 --- /dev/null +++ b/drivers/compress/uadk/uadk_compress_pmd_private.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2024-2025 Huawei Technologies Co.,Ltd. All rights reserved. + * Copyright 2024-2025 Linaro ltd. + */ + +#ifndef _UADK_COMPRESS_PMD_PRIVATE_H_ +#define _UADK_COMPRESS_PMD_PRIVATE_H_ + +struct uadk_compress_priv { + bool env_init; +}; + +extern int uadk_compress_logtype; + +#define UADK_LOG(level, fmt, ...) \ + rte_log(RTE_LOG_ ## level, uadk_compress_logtype, \ + "%s() line %u: " fmt "\n", __func__, __LINE__, \ + ## __VA_ARGS__) + +#endif /* _UADK_COMPRESS_PMD_PRIVATE_H_ */ From patchwork Sat May 25 14:07:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 798942 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp1156908wrw; Sat, 25 May 2024 07:08:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWn39uREZ3drZnFAWNVXZoQHmHiLzFrW6GV2r1foubxwPZipS/5OqzAHjGh9ceV/E01C8N4wZ8/zaeqb2TeQSM1 X-Google-Smtp-Source: AGHT+IGgKsslb3qetTgViK1wZANioehVG0HHHRc4hPdhOujWLrgbr2Bn+oQHgnS7yu/Kj8Bugca2 X-Received: by 2002:a2e:8910:0:b0:2e2:64d:6849 with SMTP id 38308e7fff4ca-2e95b27b09bmr37392261fa.50.1716646100729; Sat, 25 May 2024 07:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716646100; cv=none; d=google.com; s=arc-20160816; b=ofqOV47pWrrddai1LgHwt2b2ZURIdaMNX0d8h9SWhoLdYsBfxVeouk8Lso8/PQRuPE lY8kCU/5AwGln+Vw+NmLY3aPwrknZNQoZG3WytFfE4IPVAVbCE/xAyUTnN4xA/v4XpEp Cv33wichJpETTVo6gBraoJpTnFVxDY6f443N/PROz5Uo9cDnUMUd+Akz/8i7Axlo8prA Oxc2Vpju7nNVK9lWFKV793fgw+69wJS2mzO4oJWUIzyE4/RlfVDYsQQVlnWP4OEL6auj HKh+0SF1D6K2pHSpDbD0gdbPkqKRqzM5y0s3HCtFrkQb3hEBsfSspH7LQ5qyDcKNlrZB FUTw== 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=sm3l/A7A+MGqFfZLROrr+MRGIRiu0XmWtLbP+TZPeQc=; fh=N6ystvY2g7QTpz2QKkAMt/Nu9xETjtRlVAZxgmiIO6M=; b=CnvZ8oDHXoJ+d12saA2/7hbHPRwP0bl1nfi7S7ehcDun088MRhswfr3EkEmGgUO3mp PdKlb6mY7P/PDVpcDB7zDgoCK5mzaElxjJuV7+ZhBUXUQYxaYPjXdYXhyMlbMzgJrZc0 MDa0xEEoVlZPv5810iTbQXWE7HbB+Bm3j80gtu6XT79WeStNC9FrPGqSbj1ISolnSeiR LeRQmBqrJur69LT8ZZJLtrvHOdJxB/QiRWQgSJs2ogN6o9Qal65nTtVAfDlYknHppjYU EsZqEQRis3AB8lfCTK7EncXPYWc2vtp/ucifcggAe0YW7qApxtVXPWpkh0J8cCZIRpu+ R/QA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sEseeN1i; 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 38308e7fff4ca-2e95bf1b446si11213361fa.510.2024.05.25.07.08.20; Sat, 25 May 2024 07:08:20 -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=sEseeN1i; 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 A83ED402EE; Sat, 25 May 2024 16:08:12 +0200 (CEST) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mails.dpdk.org (Postfix) with ESMTP id 63CB7402ED for ; Sat, 25 May 2024 16:08:11 +0200 (CEST) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-420298ff5b1so95579215e9.1 for ; Sat, 25 May 2024 07:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716646091; x=1717250891; darn=dpdk.org; 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=sm3l/A7A+MGqFfZLROrr+MRGIRiu0XmWtLbP+TZPeQc=; b=sEseeN1iylpkz9Cc/dfzdwUjtX9idhue1uZJa4LnZHnQMyv3FqfiFl/3dL/ItTiru8 4T+kikk/arIvsCCOlC483xgU95ylxe5knsI/LP+/PX5fTADCRp+JFQjGJGLxjNY9CYy/ jPDd8TXKGwbWM0YLxNBkwSxR3Fepykm7JoKzH+DUz42wx3cC2GolQwy3ew+ZkLi9uFcf W+aC0KkeV5zOwWTbKkM/OI+0TQqaYo1pC5Rb15b3aPltx5ZjGSXY7Ep2tD8/yjGyjfoy r0iAbUoCNtylavnwE3IXaE3hO2048C2/Lsmq82jY7kmtVe4Ac0MShiRjTT+ur/VQJPDQ zaOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716646091; x=1717250891; 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=sm3l/A7A+MGqFfZLROrr+MRGIRiu0XmWtLbP+TZPeQc=; b=vvTn/p9Y59HDnZYzj5VF6f1DiIwGIk008OOmciHpNrpLB5WSYW1ojZUBG7V1aZgpMY T8CJU4tsQhxMsN+gpzx8SPrKR0jJ7RVBec+j2oeQ0eYonitC4uUPvcj7yolCJNgSbn6J QVQP5vWTFZywH4hJAMYmiTx0ef4Qk/RELuaMFBceht7imBFBK6LFDglU4Qk03kSWvAyd zFOUw/u7702TQF4JDBWXNF4VUaMALEZgP0WEDQhJRfh6Tz5Yhz8IsV/e0trKWqz+rXPr 8JFGygJgpdbO2ctDUn455C2PizKuOwUaO3XDZw3Iv48s9qZ/XLqg4FUZdzpjlniX+c9N CiKw== X-Gm-Message-State: AOJu0YwBct1fI/gBlFUyOsero0T+2Ll2fE7iMiXlT3OGRUZhSlET4Ocy LKQ8+9oRF3og0tXdiIM6TKTnOLLX+dxQy4+FAGvtvaFtnnlPqdgtjKKpwPyQCZQ= X-Received: by 2002:a05:600c:138e:b0:41b:fa34:9e48 with SMTP id 5b1f17b1804b1-42108a99ea9mr44453585e9.30.1716646090838; Sat, 25 May 2024 07:08:10 -0700 (PDT) Received: from localhost.localdomain (ec2-54-151-66-232.us-west-1.compute.amazonaws.com. [54.151.66.232]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42100f134cesm81969625e9.18.2024.05.25.07.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 07:08:10 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal , Fan Zhang , Ashish Gupta Cc: dev@dpdk.org, Zhangfei Gao Subject: [PATCH v2 2/3] compress/uadk: support basic operations Date: Sat, 25 May 2024 14:07:52 +0000 Message-Id: <20240525140753.122-3-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240525140753.122-1-zhangfei.gao@linaro.org> References: <20240525140753.122-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 Support the basic dev control operations: configure, close, start, stop, infos_get, and queue pairs operations, etc. Signed-off-by: Zhangfei Gao --- drivers/compress/uadk/uadk_compress_pmd.c | 279 +++++++++++++++++- .../compress/uadk/uadk_compress_pmd_private.h | 16 + 2 files changed, 294 insertions(+), 1 deletion(-) diff --git a/drivers/compress/uadk/uadk_compress_pmd.c b/drivers/compress/uadk/uadk_compress_pmd.c index 6ffc22a0d2..9e2dc3e308 100644 --- a/drivers/compress/uadk/uadk_compress_pmd.c +++ b/drivers/compress/uadk/uadk_compress_pmd.c @@ -12,7 +12,284 @@ #include "uadk_compress_pmd_private.h" -static struct rte_compressdev_ops uadk_compress_pmd_ops; +static const struct +rte_compressdev_capabilities uadk_compress_pmd_capabilities[] = { + { /* Deflate */ + .algo = RTE_COMP_ALGO_DEFLATE, + .comp_feature_flags = RTE_COMP_FF_SHAREABLE_PRIV_XFORM | + RTE_COMP_FF_HUFFMAN_FIXED | + RTE_COMP_FF_HUFFMAN_DYNAMIC, + }, + + RTE_COMP_END_OF_CAPABILITIES_LIST() +}; + +static int +uadk_compress_pmd_config(struct rte_compressdev *dev, + struct rte_compressdev_config *config __rte_unused) +{ + struct uadk_compress_priv *priv = dev->data->dev_private; + int ret; + + if (!priv->env_init) { + ret = wd_comp_env_init(NULL); + if (ret < 0) + return -EINVAL; + priv->env_init = true; + } + + return 0; +} + +static int +uadk_compress_pmd_start(struct rte_compressdev *dev __rte_unused) +{ + return 0; +} + +static void +uadk_compress_pmd_stop(struct rte_compressdev *dev __rte_unused) +{ +} + +static int +uadk_compress_pmd_close(struct rte_compressdev *dev) +{ + struct uadk_compress_priv *priv = dev->data->dev_private; + + if (priv->env_init) { + wd_comp_env_uninit(); + priv->env_init = false; + } + + return 0; +} + +static void +uadk_compress_pmd_stats_get(struct rte_compressdev *dev, + struct rte_compressdev_stats *stats) +{ + int qp_id; + + for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) { + struct uadk_compress_qp *qp = dev->data->queue_pairs[qp_id]; + + stats->enqueued_count += qp->qp_stats.enqueued_count; + stats->dequeued_count += qp->qp_stats.dequeued_count; + stats->enqueue_err_count += qp->qp_stats.enqueue_err_count; + stats->dequeue_err_count += qp->qp_stats.dequeue_err_count; + } +} + +static void +uadk_compress_pmd_stats_reset(struct rte_compressdev *dev) +{ + int qp_id; + + for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) { + struct uadk_compress_qp *qp = dev->data->queue_pairs[qp_id]; + + memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); + } +} + +static void +uadk_compress_pmd_info_get(struct rte_compressdev *dev, + struct rte_compressdev_info *dev_info) +{ + if (dev_info != NULL) { + dev_info->driver_name = dev->device->driver->name; + dev_info->feature_flags = dev->feature_flags; + dev_info->capabilities = uadk_compress_pmd_capabilities; + } +} + +static int +uadk_compress_pmd_qp_release(struct rte_compressdev *dev, uint16_t qp_id) +{ + struct uadk_compress_qp *qp = dev->data->queue_pairs[qp_id]; + + if (qp != NULL) { + rte_ring_free(qp->processed_pkts); + rte_free(qp); + dev->data->queue_pairs[qp_id] = NULL; + } + + return 0; +} + +static int +uadk_pmd_qp_set_unique_name(struct rte_compressdev *dev, + struct uadk_compress_qp *qp) +{ + unsigned int n = snprintf(qp->name, sizeof(qp->name), + "uadk_pmd_%u_qp_%u", + dev->data->dev_id, qp->id); + + if (n >= sizeof(qp->name)) + return -EINVAL; + + return 0; +} + +static struct rte_ring * +uadk_pmd_qp_create_processed_pkts_ring(struct uadk_compress_qp *qp, + unsigned int ring_size, int socket_id) +{ + struct rte_ring *r = qp->processed_pkts; + + if (r) { + if (rte_ring_get_size(r) >= ring_size) { + UADK_LOG(INFO, "Reusing existing ring %s for processed packets", + qp->name); + return r; + } + + UADK_LOG(ERR, "Unable to reuse existing ring %s for processed packets", + qp->name); + return NULL; + } + + return rte_ring_create(qp->name, ring_size, socket_id, + RING_F_EXACT_SZ); +} + +static int +uadk_compress_pmd_qp_setup(struct rte_compressdev *dev, uint16_t qp_id, + uint32_t max_inflight_ops, int socket_id) +{ + struct uadk_compress_qp *qp = NULL; + + /* Free memory prior to re-allocation if needed. */ + if (dev->data->queue_pairs[qp_id] != NULL) + uadk_compress_pmd_qp_release(dev, qp_id); + + /* Allocate the queue pair data structure. */ + qp = rte_zmalloc_socket("uadk PMD Queue Pair", sizeof(*qp), + RTE_CACHE_LINE_SIZE, socket_id); + if (qp == NULL) + return (-ENOMEM); + + qp->id = qp_id; + dev->data->queue_pairs[qp_id] = qp; + + if (uadk_pmd_qp_set_unique_name(dev, qp)) + goto qp_setup_cleanup; + + qp->processed_pkts = uadk_pmd_qp_create_processed_pkts_ring(qp, + max_inflight_ops, socket_id); + if (qp->processed_pkts == NULL) + goto qp_setup_cleanup; + + memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); + + return 0; + +qp_setup_cleanup: + if (qp) { + rte_free(qp); + qp = NULL; + } + return -EINVAL; +} + +static int +uadk_compress_pmd_xform_create(struct rte_compressdev *dev __rte_unused, + const struct rte_comp_xform *xform, + void **private_xform) +{ + struct wd_comp_sess_setup setup = {0}; + struct sched_params param = {0}; + struct uadk_compress_xform *xfrm; + handle_t handle; + + if (xform == NULL) { + UADK_LOG(ERR, "invalid xform struct"); + return -EINVAL; + } + + xfrm = rte_malloc(NULL, sizeof(struct uadk_compress_xform), 0); + if (xfrm == NULL) + return -ENOMEM; + + switch (xform->type) { + case RTE_COMP_COMPRESS: + switch (xform->compress.algo) { + case RTE_COMP_ALGO_NULL: + break; + case RTE_COMP_ALGO_DEFLATE: + setup.alg_type = WD_DEFLATE; + setup.win_sz = WD_COMP_WS_8K; + setup.comp_lv = WD_COMP_L8; + setup.op_type = WD_DIR_COMPRESS; + param.type = setup.op_type; + param.numa_id = -1; /* choose nearby numa node */ + setup.sched_param = ¶m; + break; + default: + goto err; + } + break; + case RTE_COMP_DECOMPRESS: + switch (xform->decompress.algo) { + case RTE_COMP_ALGO_NULL: + break; + case RTE_COMP_ALGO_DEFLATE: + setup.alg_type = WD_DEFLATE; + setup.comp_lv = WD_COMP_L8; + setup.op_type = WD_DIR_DECOMPRESS; + param.type = setup.op_type; + param.numa_id = -1; /* choose nearby numa node */ + setup.sched_param = ¶m; + break; + default: + goto err; + } + break; + default: + UADK_LOG(ERR, "Algorithm %u is not supported.", xform->type); + goto err; + } + + handle = wd_comp_alloc_sess(&setup); + if (!handle) + goto err; + + xfrm->handle = handle; + xfrm->type = xform->type; + *private_xform = xfrm; + return 0; + +err: + rte_free(xfrm); + return -EINVAL; +} + +static int +uadk_compress_pmd_xform_free(struct rte_compressdev *dev __rte_unused, void *xform) +{ + if (!xform) + return -EINVAL; + + wd_comp_free_sess(((struct uadk_compress_xform *)xform)->handle); + rte_free(xform); + + return 0; +} + +static struct rte_compressdev_ops uadk_compress_pmd_ops = { + .dev_configure = uadk_compress_pmd_config, + .dev_start = uadk_compress_pmd_start, + .dev_stop = uadk_compress_pmd_stop, + .dev_close = uadk_compress_pmd_close, + .stats_get = uadk_compress_pmd_stats_get, + .stats_reset = uadk_compress_pmd_stats_reset, + .dev_infos_get = uadk_compress_pmd_info_get, + .queue_pair_setup = uadk_compress_pmd_qp_setup, + .queue_pair_release = uadk_compress_pmd_qp_release, + .private_xform_create = uadk_compress_pmd_xform_create, + .private_xform_free = uadk_compress_pmd_xform_free, +}; static int uadk_compress_probe(struct rte_vdev_device *vdev) diff --git a/drivers/compress/uadk/uadk_compress_pmd_private.h b/drivers/compress/uadk/uadk_compress_pmd_private.h index 88e9075619..b09569fb94 100644 --- a/drivers/compress/uadk/uadk_compress_pmd_private.h +++ b/drivers/compress/uadk/uadk_compress_pmd_private.h @@ -10,6 +10,22 @@ struct uadk_compress_priv { bool env_init; }; +struct __rte_cache_aligned uadk_compress_qp { + /* Ring for placing process packets */ + struct rte_ring *processed_pkts; + /* Queue pair statistics */ + struct rte_compressdev_stats qp_stats; + /* Queue Pair Identifier */ + uint16_t id; + /* Unique Queue Pair Name */ + char name[RTE_COMPRESSDEV_NAME_MAX_LEN]; +}; + +struct uadk_compress_xform { + handle_t handle; + enum rte_comp_xform_type type; +}; + extern int uadk_compress_logtype; #define UADK_LOG(level, fmt, ...) \ From patchwork Sat May 25 14:07:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 798943 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp1156974wrw; Sat, 25 May 2024 07:08:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX86MKGI/47pbGi3o/BFo5qLeLO/0lGh+W5YatBLU/k0ljD1abNvgwKLi+7+5TudjQ4cZo1AzQNR9W8sN2iWrBk X-Google-Smtp-Source: AGHT+IHxQjmh/FrePhjW8uqg8JwN2OsPYMgoN2qyKV3bI2p0qsSf77wfgHZEWhTKkJZGnQfAnMBY X-Received: by 2002:a2e:b78a:0:b0:2da:bbf4:81bb with SMTP id 38308e7fff4ca-2e95b03f144mr32452671fa.2.1716646108318; Sat, 25 May 2024 07:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716646108; cv=none; d=google.com; s=arc-20160816; b=cwZDGJoXH2AxdEnVUlMcbRKDL4gCKty8ZcfVV/1j+rbpHKeQqcpkQlIgDs0EtSQkKz knb9fsmqGry/S3uqeYYVJrj0Mbp4WmNvzCOiR3EeZkc1doR/E/r/bY3uyvcVew+/dhlU NRYckXQ4NXPZ+4+HAf0+VhzuDF976e+5MrD7MwHLnZaeWoO9MRnDYJfrdbQXcSTvm/V+ q2mzRNgrGWZqY5cVdIyZVCMqGYEXiFrAmWZ/gP31x0eC8IuLivFovnBPH4efmedZ9Lah CluN3swFVbNCBTO9L432bKqHFgTzuGzpgrEtgfE3Ed5qVAFCmiG+DaiY3fvFY9XgwsPH w1DQ== 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=Y1W1pdOkI2cq4ZC1gjw6rGGvn90uMO/AlofvovYWD+M=; fh=N6ystvY2g7QTpz2QKkAMt/Nu9xETjtRlVAZxgmiIO6M=; b=dQE8LQ8yC+JkYpbQWd0rIK8JMIOn75JulTSXPbHG45WEQa8crAxSXJxccJVHlM2ktm Uh2oDaIRPh9mxsPkDn9Dxu/6QIJR5WQKvbBCdAjP5qDjKGSZ14GBfB0O4Q19V12lC8VE 9lLv+K9NPLXTWi74uYExIvH9gUevagAcSh9XvaxxG1YMVPNLYdEXmSwLZdec1fQfREQC D7IQRvjOctJGCHQ1ok0YdQB6p4hH52ir/eOZr+9+jOQn1UTL7xCENhJ/0OK8+Dez0Qyt kpxREuC82pyHlP5D2F5ljtLH1TyjbKJUa128caYEeTCMml/kG6zcBtjdgHx1tVG6rUMB UHVQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GvUWOetM; 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 38308e7fff4ca-2e95bdb1adcsi11162191fa.213.2024.05.25.07.08.28; Sat, 25 May 2024 07:08:28 -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=GvUWOetM; 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 7ADCC4067E; Sat, 25 May 2024 16:08:15 +0200 (CEST) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mails.dpdk.org (Postfix) with ESMTP id 95E4D4067C for ; Sat, 25 May 2024 16:08:14 +0200 (CEST) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4202959b060so70286645e9.2 for ; Sat, 25 May 2024 07:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716646094; x=1717250894; darn=dpdk.org; 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=Y1W1pdOkI2cq4ZC1gjw6rGGvn90uMO/AlofvovYWD+M=; b=GvUWOetMDq+RsfDJy/DjTZYjH9XU7MB/3sJQyj2AYzhbxWk0t/I9Go45Rt7ahCPsd0 lFGXFs4PGiLzJu/d1wU8BA3642FeiO7qHJoguV9ASX8rCGDkzs+EkxcULeM14ctHAy/i yVnoDAytbdHl6+jfiGEVXInGaVSM9HX4sDWt5KighGE4FV4b1FFKHfoJqepA6i5RnKS2 KoCE/jhSEw7zzHXHgH2BkWL8Nuzrb6iWTZR42L/ZDAfCwRB6IK1+h1Jo6IvqEopKQwQ3 1VoQE7DLhfeSWqrY13kzpw9hQhW0t2O52trFyHrt3VRDkGgYoam2ol316jc+dvHgfMfo CiWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716646094; x=1717250894; 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=Y1W1pdOkI2cq4ZC1gjw6rGGvn90uMO/AlofvovYWD+M=; b=XcWRqZ3ZJeMzTURlbP3qkDfFvxJM3580d63Y/Tmqv/0HwWZlmUezV5TYXgIuE+NnLj oq7yfZCliSFLdOwN1uBWAAg3BKK8oi/6PzBsisr5rtqGLuKNUfDabzslpSyngvGn1tLO pUtYGhkDV3FyqzXytzzjC/yNHXwDsNPKiSTGdpsc13qZAFuw+5aDiLUmE5wi0svBX7dY 9nRbcW7MlEA/MpcCllwAejh33N4zG2M5litnN+FM4G/dbqTdXwiHr3Btd4HR22jOVGTA HLVXRyzfiK2UonUmHm35momKgKXAkt+g7XcL7iqIntzvxtwq69k6jZ/+FSJ8NGuMeOL8 Rqiw== X-Gm-Message-State: AOJu0YzU/b1dgmma3tFZRvvnZjCYrz0JqFSK+YXl0J/an9oA37TF7yG6 JqYMZ/K+oZueK5b9pVfJ9EhIlD8IaQI6rGrZfzsszgJnN01q5ZnvLeDuMfElpIo= X-Received: by 2002:a05:600c:584c:b0:41c:f64:2f5 with SMTP id 5b1f17b1804b1-42108a0bb54mr39484975e9.36.1716646094184; Sat, 25 May 2024 07:08:14 -0700 (PDT) Received: from localhost.localdomain (ec2-54-151-66-232.us-west-1.compute.amazonaws.com. [54.151.66.232]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42100f134cesm81969625e9.18.2024.05.25.07.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 07:08:13 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal , Fan Zhang , Ashish Gupta Cc: dev@dpdk.org, Zhangfei Gao Subject: [PATCH v2 3/3] compress/uadk: support burst enqueue/dequeue Date: Sat, 25 May 2024 14:07:53 +0000 Message-Id: <20240525140753.122-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240525140753.122-1-zhangfei.gao@linaro.org> References: <20240525140753.122-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 This commit adds the burst enqueue and dequeue operations, and adds compressdev uadk info to doc Signed-off-by: Zhangfei Gao --- MAINTAINERS | 6 ++ doc/guides/compressdevs/index.rst | 1 + doc/guides/compressdevs/uadk.rst | 98 +++++++++++++++++++++++ doc/guides/rel_notes/release_24_07.rst | 5 ++ drivers/compress/uadk/uadk_compress_pmd.c | 88 +++++++++++++++++++- 5 files changed, 196 insertions(+), 2 deletions(-) create mode 100644 doc/guides/compressdevs/uadk.rst diff --git a/MAINTAINERS b/MAINTAINERS index c9adff9846..8e541d23e5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1213,6 +1213,12 @@ F: drivers/compress/octeontx/ F: doc/guides/compressdevs/octeontx.rst F: doc/guides/compressdevs/features/octeontx.ini +HiSilicon UADK compress +M: Zhangfei Gao +F: drivers/compress/uadk/ +F: doc/guides/compressdevs/uadk.rst +F: doc/guides/compressdevs/features/uadk.ini + Intel QuickAssist M: Kai Ji F: drivers/compress/qat/ diff --git a/doc/guides/compressdevs/index.rst b/doc/guides/compressdevs/index.rst index 849f211688..87ed4f72a4 100644 --- a/doc/guides/compressdevs/index.rst +++ b/doc/guides/compressdevs/index.rst @@ -15,4 +15,5 @@ Compression Device Drivers nitrox octeontx qat_comp + uadk zlib diff --git a/doc/guides/compressdevs/uadk.rst b/doc/guides/compressdevs/uadk.rst new file mode 100644 index 0000000000..7e7f9f2548 --- /dev/null +++ b/doc/guides/compressdevs/uadk.rst @@ -0,0 +1,98 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2024-2025 Huawei Technologies Co.,Ltd. All rights reserved. + Copyright 2024-2025 Linaro ltd. + +UADK Compression Poll Mode Driver +================================= + +UADK compression PMD provides poll mode compression & decompression driver +All compression operations are using UADK library compression API, which is +algorithm-level API, abstracting accelerators' low-level implementations. + +UADK compression PMD relies on `UADK library `_. + +UADK is a framework for user applications to access hardware accelerators. +UADK relies on IOMMU SVA (Shared Virtual Address) feature, +which shares the same page table between IOMMU and MMU. +As a result, the user application can directly use the virtual address for +device DMA, which enhances performance as well as easy usability. + + +Features +-------- + +UADK compression PMD has support for: + +Compression/Decompression algorithm: + + * DEFLATE - using Fixed and Dynamic Huffman encoding + +Window size support: + + * 32K + + +Test steps +---------- + +#. Build UADK + + .. code-block:: console + + git clone https://github.com/Linaro/uadk.git + cd uadk + mkdir build + ./autogen.sh + ./configure --prefix=$PWD/build + make + make install + + .. note:: + + Without ``--prefix``, UADK will be installed to ``/usr/local/lib`` by default. + + .. note:: + + If get error: "cannot find -lnuma", please install the libnuma-dev. + +#. Run pkg-config libwd to ensure env is setup correctly + + .. code-block:: console + + export PKG_CONFIG_PATH=$PWD/build/lib/pkgconfig + pkg-config libwd --cflags --libs -I/usr/local/include -L/usr/local/lib -lwd + + .. note:: + + export ``PKG_CONFIG_PATH`` is required on demand, + not needed if UADK is installed to ``/usr/local/lib``. + +#. Build DPDK + + .. code-block:: console + + cd dpdk + mkdir build + meson setup build (--reconfigure) + cd build + ninja + sudo ninja install + +#. Prepare hugepages for DPDK (see also :doc:`../tools/hugepages`) + + .. code-block:: console + + echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages + echo 1024 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages + echo 1024 > /sys/devices/system/node/node2/hugepages/hugepages-2048kB/nr_hugepages + echo 1024 > /sys/devices/system/node/node3/hugepages/hugepages-2048kB/nr_hugepages + mkdir -p /mnt/huge_2mb + mount -t hugetlbfs none /mnt/huge_2mb -o pagesize=2MB + +#. Run test app + + .. code-block:: console + + sudo dpdk-test --vdev=compress_uadk + RTE>>compressdev_autotest + RTE>>quit diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst index a69f24cf99..a7574045f0 100644 --- a/doc/guides/rel_notes/release_24_07.rst +++ b/doc/guides/rel_notes/release_24_07.rst @@ -24,6 +24,11 @@ DPDK Release 24.07 New Features ------------ +* **Added UADK compress driver.** + + Added a new compress driver for the UADK library. See the + :doc:`../compressdevs/uadk` guide for more details on this new driver. + .. This section should contain new features added in this release. Sample format: diff --git a/drivers/compress/uadk/uadk_compress_pmd.c b/drivers/compress/uadk/uadk_compress_pmd.c index 9e2dc3e308..1f4c4cfd00 100644 --- a/drivers/compress/uadk/uadk_compress_pmd.c +++ b/drivers/compress/uadk/uadk_compress_pmd.c @@ -291,6 +291,90 @@ static struct rte_compressdev_ops uadk_compress_pmd_ops = { .private_xform_free = uadk_compress_pmd_xform_free, }; +static uint16_t +uadk_compress_pmd_enqueue_burst_sync(void *queue_pair, + struct rte_comp_op **ops, uint16_t nb_ops) +{ + struct uadk_compress_qp *qp = queue_pair; + struct uadk_compress_xform *xform; + struct rte_comp_op *op; + uint16_t enqd = 0; + int i, ret = 0; + + for (i = 0; i < nb_ops; i++) { + op = ops[i]; + + if (op->op_type == RTE_COMP_OP_STATEFUL) { + op->status = RTE_COMP_OP_STATUS_INVALID_ARGS; + } else { + /* process stateless ops */ + xform = op->private_xform; + if (xform) { + struct wd_comp_req req = {0}; + uint16_t dst_len = rte_pktmbuf_data_len(op->m_dst); + + req.src = rte_pktmbuf_mtod(op->m_src, uint8_t *); + req.src_len = op->src.length; + req.dst = rte_pktmbuf_mtod(op->m_dst, uint8_t *); + req.dst_len = dst_len; + req.op_type = (enum wd_comp_op_type)xform->type; + req.cb = NULL; + req.data_fmt = WD_FLAT_BUF; + do { + ret = wd_do_comp_sync(xform->handle, &req); + } while (ret == -WD_EBUSY); + + op->consumed += req.src_len; + + if (req.dst_len <= dst_len) { + op->produced += req.dst_len; + op->status = RTE_COMP_OP_STATUS_SUCCESS; + } else { + op->status = RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED; + } + + if (ret) { + op->status = RTE_COMP_OP_STATUS_ERROR; + break; + } + } else { + op->status = RTE_COMP_OP_STATUS_INVALID_ARGS; + } + } + + /* Whatever is out of op, put it into completion queue with + * its status + */ + if (!ret) + ret = rte_ring_enqueue(qp->processed_pkts, (void *)op); + + if (unlikely(ret)) { + /* increment count if failed to enqueue op */ + qp->qp_stats.enqueue_err_count++; + } else { + qp->qp_stats.enqueued_count++; + enqd++; + } + } + + return enqd; +} + +static uint16_t +uadk_compress_pmd_dequeue_burst_sync(void *queue_pair, + struct rte_comp_op **ops, + uint16_t nb_ops) +{ + struct uadk_compress_qp *qp = queue_pair; + unsigned int nb_dequeued = 0; + + nb_dequeued = rte_ring_dequeue_burst(qp->processed_pkts, + (void **)ops, nb_ops, NULL); + qp->qp_stats.dequeued_count += nb_dequeued; + + return nb_dequeued; +} + static int uadk_compress_probe(struct rte_vdev_device *vdev) { @@ -318,8 +402,8 @@ uadk_compress_probe(struct rte_vdev_device *vdev) } compressdev->dev_ops = &uadk_compress_pmd_ops; - compressdev->dequeue_burst = NULL; - compressdev->enqueue_burst = NULL; + compressdev->dequeue_burst = uadk_compress_pmd_dequeue_burst_sync; + compressdev->enqueue_burst = uadk_compress_pmd_enqueue_burst_sync; compressdev->feature_flags = RTE_COMPDEV_FF_HW_ACCELERATED; return 0;