From patchwork Wed Jan 22 09:33:08 2025
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Hanxiao Li
X-Patchwork-Id: 150377
X-Patchwork-Delegate: gakhil@marvell.com
Return-Path:
X-Original-To: patchwork@inbox.dpdk.org
Delivered-To: patchwork@inbox.dpdk.org
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
by inbox.dpdk.org (Postfix) with ESMTP id BB438460E2;
Wed, 22 Jan 2025 10:45:12 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
by mails.dpdk.org (Postfix) with ESMTP id 8EAA64065C;
Wed, 22 Jan 2025 10:44:49 +0100 (CET)
Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209])
by mails.dpdk.org (Postfix) with ESMTP id 0388B4064C
for ; Wed, 22 Jan 2025 10:44:41 +0100 (CET)
Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mxct.zte.com.cn (FangMail) with ESMTPS id 4YdK114sYkz501bj
for ; Wed, 22 Jan 2025 17:44:37 +0800 (CST)
Received: from szxlzmapp03.zte.com.cn ([10.5.231.207])
by mse-fl2.zte.com.cn with SMTP id 50M9iOvv035186
for ; Wed, 22 Jan 2025 17:44:24 +0800 (+08)
(envelope-from li.hanxiao@zte.com.cn)
Received: from localhost.localdomain (unknown [192.168.6.15])
by smtp (Zmail) with SMTP; Fri, 22 Jan 2025 17:44:27 +0800
X-Zmail-TransId: 3e816790bdfb003-3d554
From: Hanxiao Li
To: dev@dpdk.org
Cc: Hanxiao Li
Subject: [PATCH v25 09/13] compress/zsda: add zsda compressdev xform ops
Date: Wed, 22 Jan 2025 17:33:08 +0800
Message-ID: <20250122093325.3099070-10-li.hanxiao@zte.com.cn>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250122093325.3099070-1-li.hanxiao@zte.com.cn>
References: <20250113022943.2603401-2-li.hanxiao@zte.com.cn>
<20250122093325.3099070-1-li.hanxiao@zte.com.cn>
MIME-Version: 1.0
X-MAIL: mse-fl2.zte.com.cn 50M9iOvv035186
X-Fangmail-Anti-Spam-Filtered: true
X-Fangmail-MID-QID: 6790BE05.001/4YdK114sYkz501bj
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
Add zsda compressdev xform interface implementation.
Signed-off-by: Hanxiao Li
---
drivers/compress/zsda/zsda_comp_pmd.c | 54 ++++++++++++++++++++++++++-
1 file changed, 52 insertions(+), 2 deletions(-)
--
2.27.0
diff --git a/drivers/compress/zsda/zsda_comp_pmd.c b/drivers/compress/zsda/zsda_comp_pmd.c
index ee3d6602ec..a8d2da0477 100644
--- a/drivers/compress/zsda/zsda_comp_pmd.c
+++ b/drivers/compress/zsda/zsda_comp_pmd.c
@@ -149,6 +149,56 @@ zsda_comp_stats_reset(struct rte_compressdev *dev)
zsda_stats_reset(dev->data->queue_pairs, dev->data->nb_queue_pairs);
}
+static int
+zsda_comp_private_xform_create(struct rte_compressdev *dev,
+ const struct rte_comp_xform *xform,
+ void **private_xform)
+{
+ struct zsda_comp_dev_private *zsda = dev->data->dev_private;
+
+ if (unlikely(private_xform == NULL)) {
+ ZSDA_LOG(ERR, "Failed! private_xform is NULL");
+ return -EINVAL;
+ }
+ if (unlikely(zsda->xformpool == NULL)) {
+ ZSDA_LOG(ERR, "Failed! zsda->xformpool is NULL");
+ return -ENOMEM;
+ }
+ if (rte_mempool_get(zsda->xformpool, private_xform)) {
+ ZSDA_LOG(ERR, "Failed! zsda->xformpool is NULL");
+ return -ENOMEM;
+ }
+
+ struct zsda_comp_xform *zsda_xform = *private_xform;
+ zsda_xform->type = xform->type;
+
+ if (zsda_xform->type == RTE_COMP_COMPRESS)
+ zsda_xform->checksum_type = xform->compress.chksum;
+ else
+ zsda_xform->checksum_type = xform->decompress.chksum;
+
+ if (zsda_xform->checksum_type == RTE_COMP_CHECKSUM_CRC32_ADLER32)
+ return -EINVAL;
+
+ return ZSDA_SUCCESS;
+}
+
+static int
+zsda_comp_private_xform_free(struct rte_compressdev *dev __rte_unused,
+ void *private_xform)
+{
+ struct zsda_comp_xform *zsda_xform = private_xform;
+
+ if (zsda_xform) {
+ memset(zsda_xform, 0, zsda_comp_xform_size());
+ struct rte_mempool *mp = rte_mempool_from_obj(zsda_xform);
+
+ rte_mempool_put(mp, zsda_xform);
+ return ZSDA_SUCCESS;
+ }
+ return -EINVAL;
+}
+
static struct rte_compressdev_ops compress_zsda_ops = {
.dev_configure = zsda_comp_dev_config,
@@ -162,8 +212,8 @@ static struct rte_compressdev_ops compress_zsda_ops = {
.queue_pair_setup = NULL,
.queue_pair_release = NULL,
- .private_xform_create = NULL,
- .private_xform_free = NULL
+ .private_xform_create = zsda_comp_private_xform_create,
+ .private_xform_free = zsda_comp_private_xform_free,
};
/* An rte_driver is needed in the registration of the device with compressdev.