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 C42C5440C5; Sat, 25 May 2024 16:08:11 +0200 (CEST) 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-Google-Smtp-Source: AGHT+IHHVk8aMgZ1UeYUFmgN0cBj+VtUXSjNil8/FRHEkHcMrzXppo86BFlwWo5TpTHJFTABSyf80w== 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 Content-Transfer-Encoding: 8bit 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_ */ -- 2.25.1