From patchwork Tue Jun 11 07:07:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 803239 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:e87:b0:35b:5a80:51b4 with SMTP id dz7csp169107wrb; Tue, 11 Jun 2024 00:09:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXYzleF9aSeRhWu9eVAv3uPIQwNHcf3duBMDcUMLi4ieag02ghC/zPIXcNOLPkxqH9JCJWIyh14lsCK1KAdjh6Z X-Google-Smtp-Source: AGHT+IHHqiiszwWnJ22ZZpz2rAOaYq6iZPz4ZxjkjZhNx1wzM+u1bw8B362+NJNQP1SQTsYdIEO/ X-Received: by 2002:a05:6000:1565:b0:35f:2364:f1d2 with SMTP id ffacd0b85a97d-35f2364f20emr4653164f8f.63.1718089749712; Tue, 11 Jun 2024 00:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718089749; cv=none; d=google.com; s=arc-20160816; b=gX15R3I5DXjF7zRa864l5DJsiyIaSh+HWyHvEqsvJA8Aw0BHBKuecgq8laHjO9Rak0 AlS+pKcXmtHjEhz3mBrMUeGtu0rDPvAy6GtMGRlsVW2y9SSD7yyCBsdeyeaULbiuCp6W aV20rUkf7mNXmq9qQc8CvgryUeDXcmERqaWvuXp00QHuSDM86Z+sseBi6PuyCgqzeiRW tmeLflW9ld2SD4JXvh1isitZ5D4rYc6akmrioJOvXUL4ZFs3NJM2h/u2JN+SYdf4j6bx VQwDmB0AEIWEFRCxILsTL4jSAOkM20SKoFot1vUsvpOAu8LXzpQ38uLQAfZDA8uArnzS /0AQ== 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=9CSlKiGeqURhZXSy5I+ZP4S9a0szDWZjmkJfHa5inRI=; fh=N6ystvY2g7QTpz2QKkAMt/Nu9xETjtRlVAZxgmiIO6M=; b=MEjht0BSyAi4/EPozBLJ6rJP+Avh42DQhAs0zqQg/LAkB5VwwH4cynCAx7GiFuQ9QJ TEtQndH1g2qb6Q4Dp7haOFJKlYsYfSQVdbeYzJmSTOp9BsMKzIDxHWGkGcKGXnj240DE eDFOAALMsSe2Sdm1DUXYnpvew7Rx/NU1rlvFQ40PUXeRBqVaoYEy/Ts2stYY2jG4YTjZ VbYDR63x57gctz80NPSM7POi/KmM3ZhBNuBSXkRdrg4Kwlv+rsV7aKS4TxOXe5nDgFjh /FUMxJ7cmKPOXo2qvSNQ//P3QHsYJ+Z2UPAX1lvIT0P1HaN+Nc+GTmi9c8hjOxQkoVkZ 12uA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lr84NqRl; 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 ffacd0b85a97d-35f2c4c7b4asi635962f8f.100.2024.06.11.00.09.09; Tue, 11 Jun 2024 00:09:09 -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=Lr84NqRl; 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 4C11640A67; Tue, 11 Jun 2024 09:09:00 +0200 (CEST) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by mails.dpdk.org (Postfix) with ESMTP id 83128406FF for ; Tue, 11 Jun 2024 09:08:58 +0200 (CEST) Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-70413de08c7so640828b3a.0 for ; Tue, 11 Jun 2024 00:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718089738; x=1718694538; 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=9CSlKiGeqURhZXSy5I+ZP4S9a0szDWZjmkJfHa5inRI=; b=Lr84NqRlq3VAPaeiEztg4Kl+LpRDth/R1po8lbanzs3/8EdM5EkHK4pEa5jmzAt92D kKJ133hXZvRjCRh3tE+pjUebyKE+evYw3Bs6rlOUqD2EOzigU/9U0dGcrpj6tZCZG0KF qCMU+S5z5kIWo7RLlFPRZw+WdBXfxAJ+KDmh3q9whOmY29vowEnWtdep2tfBIuIhbO2x d3IGdCOJPO2faZ07+lBhSH9da1TnPZ667tApBOphvy19GJV43FKrqcIOEqu6urVzqOKx 9GcSquOgWffLJbU27w8o7Ck2VZ1QlpU7T01eDM/FvTzt/HdkfSIQHiGopMGE2IXNnn28 WfHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718089738; x=1718694538; 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=9CSlKiGeqURhZXSy5I+ZP4S9a0szDWZjmkJfHa5inRI=; b=p+rHCajsPD4WgwULuLrV968QIaqJwS3Pon/wHFYuqlcq4n6mYNNkTl7XayZ2zNhXQc Ik9MDccjd1gD7S+7FWdegXx5sIxTJwm/hgo9HPfl5PRcttLqnIOtXowd6w7p5xhUrioi QIDjmGLXWO89o1UE4Y7k+dpa2rR6Tt7rpgcJZPWA+L5t6F4NbjJlD6XGShTWtduoa4df kGvmL52te83Iejtc+pn5OxEkUdUwiek0nTqQtV3/xxvWle6hg+oryCgdjh5CWGir1Ri/ LaaNCvCAozbpdYJOmMpIWUwzq6SftfApIiXzOaWC/SlGoyNWBFb6D4UikpslcC3FDYSo iPSA== X-Gm-Message-State: AOJu0YzhSzPVvnIfTYUokmQ43xpZDtYk9T9+U+QiE+KVL6N/0TVbvLhN Q0qWau+2r6iGIQC5fe8O43ahfkuQ7Rr4bp8VZUR+sTGTZZnHGC5o3WqURuOaBoEsIJzfz68xble LF2PKTkaX X-Received: by 2002:a05:6a21:329c:b0:1af:4faf:e4a8 with SMTP id adf61e73a8af0-1b2f9a5f4d8mr11917093637.33.1718089737637; Tue, 11 Jun 2024 00:08:57 -0700 (PDT) Received: from localhost.localdomain (ec2-52-53-61-205.us-west-1.compute.amazonaws.com. [52.53.61.205]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ad947cdasm550945b3a.42.2024.06.11.00.08.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 00:08:57 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal , Fan Zhang , Ashish Gupta Cc: dev@dpdk.org, Zhangfei Gao Subject: [PATCH v3 3/3] compress/uadk: support burst enqueue/dequeue Date: Tue, 11 Jun 2024 07:07:26 +0000 Message-Id: <20240611070726.468-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240611070726.468-1-zhangfei.gao@linaro.org> References: <20240611070726.468-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, Test: sudo dpdk-test --vdev=compress_uadk RTE>>compressdev_autotest RTE>>quit Signed-off-by: Zhangfei Gao --- doc/guides/compressdevs/uadk.rst | 19 +++++ doc/guides/rel_notes/release_24_07.rst | 5 ++ drivers/compress/uadk/uadk_compress_pmd.c | 88 ++++++++++++++++++++++- 3 files changed, 110 insertions(+), 2 deletions(-) diff --git a/doc/guides/compressdevs/uadk.rst b/doc/guides/compressdevs/uadk.rst index 02fa3c7667..7e7f9f2548 100644 --- a/doc/guides/compressdevs/uadk.rst +++ b/doc/guides/compressdevs/uadk.rst @@ -77,3 +77,22 @@ Test steps 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;