[v24,11/13] compress/zsda: add zsda compressdev enqueue datapath
Checks
Commit Message
Add zsda compressdev enqueue datapath.
Signed-off-by: Hanxiao Li <li.hanxiao@zte.com.cn>
---
drivers/common/zsda/meson.build | 2 +-
drivers/common/zsda/zsda_qp.c | 106 ++++++++++++
drivers/common/zsda/zsda_qp.h | 13 +-
drivers/common/zsda/zsda_qp_common.c | 72 ++++++++
drivers/common/zsda/zsda_qp_common.h | 30 ++++
drivers/compress/zsda/zsda_comp.c | 233 ++++++++++++++++++++++++++
drivers/compress/zsda/zsda_comp.h | 36 ++++
drivers/compress/zsda/zsda_comp_pmd.c | 15 +-
8 files changed, 504 insertions(+), 3 deletions(-)
create mode 100644 drivers/compress/zsda/zsda_comp.c
create mode 100644 drivers/compress/zsda/zsda_comp.h
--
2.27.0
Comments
> Add zsda compressdev enqueue datapath.
>
> Signed-off-by: Hanxiao Li <li.hanxiao@zte.com.cn>
> ---
> drivers/common/zsda/meson.build | 2 +-
> drivers/common/zsda/zsda_qp.c | 106 ++++++++++++
> drivers/common/zsda/zsda_qp.h | 13 +-
> drivers/common/zsda/zsda_qp_common.c | 72 ++++++++
> drivers/common/zsda/zsda_qp_common.h | 30 ++++
> drivers/compress/zsda/zsda_comp.c | 233 ++++++++++++++++++++++++++
> drivers/compress/zsda/zsda_comp.h | 36 ++++
> drivers/compress/zsda/zsda_comp_pmd.c | 15 +-
> 8 files changed, 504 insertions(+), 3 deletions(-)
> create mode 100644 drivers/compress/zsda/zsda_comp.c
> create mode 100644 drivers/compress/zsda/zsda_comp.h
>
> diff --git a/drivers/common/zsda/meson.build
> b/drivers/common/zsda/meson.build
> index 6e6d5ab006..152150e5ef 100644
> --- a/drivers/common/zsda/meson.build
> +++ b/drivers/common/zsda/meson.build
> @@ -20,7 +20,7 @@ zsda_compress_path = 'compress/zsda'
> zsda_compress_relpath = '../../' + zsda_compress_path
> includes += include_directories(zsda_compress_relpath)
> if zsda_compress
> - foreach f: ['zsda_comp_pmd.c']
> + foreach f: ['zsda_comp_pmd.c', 'zsda_comp.c']
> sources += files(join_paths(zsda_compress_relpath, f))
> endforeach
> endif
> diff --git a/drivers/common/zsda/zsda_qp.c b/drivers/common/zsda/zsda_qp.c
> index 66b212b39e..53169afea4 100644
> --- a/drivers/common/zsda/zsda_qp.c
> +++ b/drivers/common/zsda/zsda_qp.c
> @@ -783,3 +783,109 @@ zsda_task_queue_setup(struct zsda_pci_device
> *zsda_pci_dev,
>
> return ret;
> }
> +
> +static int
> +zsda_free_cookie_find(const struct zsda_queue *queue, void **op_cookie,
> + uint16_t *idx)
> +{
> + uint16_t old_tail = queue->tail;
> + uint16_t tail = queue->tail;
> + struct zsda_op_cookie *cookie;
> +
> + do {
> + cookie = op_cookie[tail];
> + if (!cookie->used) {
> + *idx = tail & (queue->queue_size - 1);
> + return ZSDA_SUCCESS;
> + }
> + tail = zsda_modulo_16(tail++, queue->modulo_mask);
> + } while (old_tail != tail);
> +
> + return -EINVAL;
> +}
> +
> +static int
> +zsda_enqueue(void *op, struct zsda_qp *qp)
> +{
> + uint16_t new_tail;
> + enum zsda_service_type type;
> + void **op_cookie;
> + int ret = ZSDA_SUCCESS;
> + struct zsda_queue *queue;
> +
> + for (type = 0; type < ZSDA_SERVICE_INVALID; type++) {
> + if (qp->srv[type].used) {
> + if (!qp->srv[type].match(op))
> + continue;
> + queue = &qp->srv[type].tx_q;
> + op_cookie = qp->srv[type].op_cookies;
> +
> + if (zsda_free_cookie_find(queue, op_cookie,
> + &new_tail)) {
> + ret = -EBUSY;
> + break;
> + }
> + ret = qp->srv[type].tx_cb(op, queue, op_cookie,
> + new_tail);
> + if (ret) {
> + qp->srv[type].stats.enqueue_err_count++;
> + ZSDA_LOG(ERR, "Failed! config wqe");
> + break;
> + }
> + qp->srv[type].stats.enqueued_count++;
> +
> + queue->tail = zsda_modulo_16(new_tail + 1,
> + queue->queue_size - 1);
> +
> + if (new_tail > queue->tail)
> + queue->valid =
> + zsda_modulo_8(queue->valid + 1,
> + (uint8_t)(queue->cycle_size - 1));
> +
> + queue->pushed_wqe++;
> + break;
> + }
> + }
> +
> + return ret;
> +}
> +
> +static void
> +zsda_tx_tail_write(struct zsda_queue *queue)
> +{
> + if (queue->pushed_wqe)
> + WRITE_CSR_WQ_TAIL(queue->io_addr, queue->hw_queue_number,
> + queue->tail);
> +
> + queue->pushed_wqe = 0;
> +}
> +
> +uint16_t
> +zsda_enqueue_burst(struct zsda_qp *qp, void **ops, const uint16_t nb_ops)
> +{
> + int ret = ZSDA_SUCCESS;
> + enum zsda_service_type type;
> + uint16_t i;
> + uint16_t nb_send = 0;
> + void *op;
> +
> + if (nb_ops > ZSDA_MAX_DESC) {
> + ZSDA_LOG(ERR, "Enqueue number bigger than %d", ZSDA_MAX_DESC);
> + return 0;
> + }
> +
> + for (i = 0; i < nb_ops; i++) {
> + op = ops[i];
> + ret = zsda_enqueue(op, qp);
> + if (ret < 0)
> + break;
> + nb_send++;
> + }
> +
> + for (type = 0; type < ZSDA_SERVICE_INVALID; type++)
> + if (qp->srv[type].used)
> + zsda_tx_tail_write(&qp->srv[type].tx_q);
> +
> + return nb_send;
> +}
> +
Fix this extra line at end of file.
git am will complain while applying the patch.
> diff --git a/drivers/common/zsda/zsda_qp.h b/drivers/common/zsda/zsda_qp.h
> index c79bfb5d36..96fc38ea09 100644
> --- a/drivers/common/zsda/zsda_qp.h
> +++ b/drivers/common/zsda/zsda_qp.h
> @@ -48,7 +48,6 @@
> #define SET_CYCLE 0xff
> #define SET_HEAD_INTI 0x0
>
> -
> #define ZSDA_TIME_SLEEP_US 100
> #define ZSDA_TIME_NUM 500
>
> @@ -95,6 +94,15 @@
> u_base); \
> } while (0)
>
> +#define READ_CSR_WQ_HEAD(csr_base_addr, ring) \
> + ZSDA_CSR_RD(csr_base_addr, WQ_TAIL + (ring << 3))
> +#define WRITE_CSR_WQ_TAIL(csr_base_addr, ring, value) \
> + ZSDA_CSR_WC_WR(csr_base_addr, WQ_TAIL + (ring << 3), value)
> +#define READ_CSR_CQ_HEAD(csr_base_addr, ring) \
> + ZSDA_CSR_RD(csr_base_addr, WQ_TAIL + (ring << 3))
> +#define WRITE_CSR_CQ_HEAD(csr_base_addr, ring, value) \
> + ZSDA_CSR_WC_WR(csr_base_addr, CQ_HEAD + (ring << 3), value)
> +
> extern struct zsda_num_qps zsda_nb_qps;
>
> enum zsda_admin_msg_id {
> @@ -179,4 +187,7 @@ zsda_qps_hw_per_service(struct zsda_pci_device
> *zsda_pci_dev,
>
> int zsda_task_queue_setup(struct zsda_pci_device *zsda_pci_dev,
> struct zsda_qp *qp, struct task_queue_info *task_q_info);
> +
> +uint16_t zsda_enqueue_burst(struct zsda_qp *qp, void **ops, const uint16_t
> nb_ops);
> +
> #endif /* _ZSDA_QP_H_ */
> diff --git a/drivers/common/zsda/zsda_qp_common.c
> b/drivers/common/zsda/zsda_qp_common.c
> index 577392871f..399fba87e3 100644
> --- a/drivers/common/zsda/zsda_qp_common.c
> +++ b/drivers/common/zsda/zsda_qp_common.c
> @@ -118,3 +118,75 @@ zsda_stats_reset(void **queue_pairs, const uint32_t
> nb_queue_pairs)
> }
> }
> }
> +
> +int
> +zsda_sgl_fill(const struct rte_mbuf *buf, uint32_t offset, struct zsda_sgl *sgl,
> + const phys_addr_t sgl_phy_addr, uint32_t remain_len,
> + struct comp_head_info *comp_head_info)
> +{
> + uint32_t nr;
> + uint16_t put_in_len;
> + bool head_set = false;
> +
> + for (nr = 0; (buf && (nr < (ZSDA_SGL_MAX_NUMBER - 1)));) {
> + if (offset >= rte_pktmbuf_data_len(buf)) {
> + offset -= rte_pktmbuf_data_len(buf);
> + buf = buf->next;
> + continue;
> + }
> + memset(&(sgl->buffers[nr]), 0, sizeof(struct zsda_buf));
> + if ((nr > 0) && (((nr + 1) % ZSDA_SGL_FRAGMENT_SIZE) == 0) &&
> + (buf->next != NULL)) {
> + sgl->buffers[nr].len = SGL_TYPE_PHYS_ADDR;
> + sgl->buffers[nr].addr =
> + sgl_phy_addr +
> + ((nr + 1) * sizeof(struct zsda_buf));
> + sgl->buffers[nr].type = SGL_TYPE_NEXT_LIST;
> + ++nr;
> + continue;
> + }
> + if (comp_head_info && !head_set) {
> + sgl->buffers[nr].len = comp_head_info->head_len;
> + sgl->buffers[nr].addr = comp_head_info->head_phys_addr;
> + sgl->buffers[nr].type = SGL_TYPE_PHYS_ADDR;
> + ++nr;
> + head_set = true;
> + remain_len -= comp_head_info->head_len;
> + continue;
> + } else {
> + put_in_len = rte_pktmbuf_data_len(buf) - (offset & 0xffff);
> + if (remain_len <= put_in_len)
> + put_in_len = remain_len;
> + remain_len -= put_in_len;
> +
> + sgl->buffers[nr].len = put_in_len;
> + sgl->buffers[nr].addr = rte_pktmbuf_iova_offset(buf, offset);
> + sgl->buffers[nr].type = SGL_TYPE_PHYS_ADDR;
> + }
> + offset = 0;
> + ++nr;
> + buf = buf->next;
> +
> + if (remain_len == 0)
> + break;
> + }
> +
> + if (nr == 0) {
> + ZSDA_LOG(ERR, "In fill_sgl, nr == 0");
> + return ZSDA_FAILED;
> + }
> +
> + sgl->buffers[nr - 1].type = SGL_TYPE_LAST_PHYS_ADDR;
> +
> + if (buf) {
> + if (unlikely(buf->next)) {
> + if (nr == (ZSDA_SGL_MAX_NUMBER - 1)) {
> + ZSDA_LOG(ERR, "ERR! segs size (%u)",
> + (ZSDA_SGL_MAX_NUMBER));
> + return -EINVAL;
> + }
> + }
> + }
> +
> + return ZSDA_SUCCESS;
> +}
> diff --git a/drivers/common/zsda/zsda_qp_common.h
> b/drivers/common/zsda/zsda_qp_common.h
> index ba77b0f027..2b1a549a69 100644
> --- a/drivers/common/zsda/zsda_qp_common.h
> +++ b/drivers/common/zsda/zsda_qp_common.h
> @@ -43,6 +43,27 @@ enum zsda_service_type {
> #define ZSDA_MAX_CYCLE 256
> #define ZSDA_MAX_DEV RTE_PMD_ZSDA_MAX_PCI_DEVICES
> #define MAX_NUM_OPS 0x1FF
> +#define ZSDA_SGL_FRAGMENT_SIZE 32
> +
> +#define ZSDA_OPC_COMP_GZIP 0x10 /* Encomp deflate-Gzip */
> +#define ZSDA_OPC_COMP_ZLIB 0x11 /* Encomp deflate-Zlib */
> +#define ZSDA_OPC_DECOMP_GZIP 0x18 /* Decomp inflate-Gzip */
> +#define ZSDA_OPC_DECOMP_ZLIB 0x19 /* Decomp inflate-Zlib */
> +#define ZSDA_OPC_INVALID 0xff
> +
> +enum wqe_element_type {
> + WQE_ELM_TYPE_PHYS_ADDR = 1,
> + WQE_ELM_TYPE_LIST,
> + WQE_ELM_TYPE_LIST_ADDR,
> + WQE_ELM_TYPE_LIST_SGL32,
> +};
> +
> +enum sgl_element_type {
> + SGL_TYPE_PHYS_ADDR = 0,
> + SGL_TYPE_LAST_PHYS_ADDR,
> + SGL_TYPE_NEXT_LIST,
> + SGL_TYPE_EC_LEVEL1_SGL32,
> +};
>
> struct zsda_admin_req {
> uint16_t msg_type;
> @@ -159,10 +180,19 @@ struct __rte_cache_aligned zsda_sgl {
> struct zsda_buf buffers[ZSDA_SGL_MAX_NUMBER];
> };
>
> +struct comp_head_info {
> + uint32_t head_len;
> + phys_addr_t head_phys_addr;
> +};
> +
> void zsda_queue_delete(const struct zsda_queue *queue);
> int zsda_queue_pair_release(struct zsda_qp **qp_addr);
> void zsda_stats_get(void **queue_pairs, const uint32_t nb_queue_pairs,
> struct zsda_qp_stat *stats);
> void zsda_stats_reset(void **queue_pairs, const uint32_t nb_queue_pairs);
>
> +int zsda_sgl_fill(const struct rte_mbuf *buf, uint32_t offset,
> + struct zsda_sgl *sgl, const phys_addr_t sgl_phy_addr,
> + uint32_t remain_len, struct comp_head_info *comp_head_info);
> +
> #endif /* _ZSDA_QP_COMMON_H_ */
> diff --git a/drivers/compress/zsda/zsda_comp.c
> b/drivers/compress/zsda/zsda_comp.c
> new file mode 100644
> index 0000000000..608c50c49a
> --- /dev/null
> +++ b/drivers/compress/zsda/zsda_comp.c
> @@ -0,0 +1,233 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2024 ZTE Corporation
> + */
> +
> +#include "zsda_comp.h"
> +
> +#define ZLIB_HEADER_SIZE 2
> +#define ZLIB_TRAILER_SIZE 4
> +#define GZIP_HEADER_SIZE 10
> +#define GZIP_TRAILER_SIZE 8
> +#define CHECKSUM_SIZE 4
> +
> +int
> +zsda_comp_match(const void *op_in)
> +{
> + const struct rte_comp_op *op = op_in;
> + const struct zsda_comp_xform *xform = op->private_xform;
> +
> + if (op->op_type != RTE_COMP_OP_STATELESS)
> + return 0;
> +
> + if (xform->type != RTE_COMP_COMPRESS)
> + return 0;
> +
> + return 1;
> +}
> +
> +int
> +zsda_decomp_match(const void *op_in)
> +{
> + const struct rte_comp_op *op = op_in;
> + const struct zsda_comp_xform *xform = op->private_xform;
> +
> + if (op->op_type != RTE_COMP_OP_STATELESS)
> + return 0;
> +
> + if (xform->type != RTE_COMP_DECOMPRESS)
> + return 0;
> + return 1;
> +}
> +
> +static uint8_t
> +zsda_opcode_get(const struct zsda_comp_xform *xform)
> +{
> + if (xform->type == RTE_COMP_COMPRESS) {
> + if (xform->checksum_type == RTE_COMP_CHECKSUM_NONE ||
> + xform->checksum_type == RTE_COMP_CHECKSUM_CRC32)
> + return ZSDA_OPC_COMP_GZIP;
> + else if (xform->checksum_type == RTE_COMP_CHECKSUM_ADLER32)
> + return ZSDA_OPC_COMP_ZLIB;
> + }
> + if (xform->type == RTE_COMP_DECOMPRESS) {
> + if (xform->checksum_type == RTE_COMP_CHECKSUM_CRC32 ||
> + xform->checksum_type == RTE_COMP_CHECKSUM_NONE)
> + return ZSDA_OPC_DECOMP_GZIP;
> + else if (xform->checksum_type == RTE_COMP_CHECKSUM_ADLER32)
> + return ZSDA_OPC_DECOMP_ZLIB;
> + }
> +
> + return ZSDA_OPC_INVALID;
> +}
> +
> +int
> +zsda_comp_request_build(void *op_in, const struct zsda_queue *queue,
> + void **op_cookies, const uint16_t new_tail)
> +{
> + struct rte_comp_op *op = op_in;
> + struct zsda_comp_xform *xform = op->private_xform;
> + struct zsda_wqe_comp *wqe =
> + (struct zsda_wqe_comp *)(queue->base_addr +
> + (new_tail * queue->msg_size));
> +
> + struct zsda_op_cookie *cookie = op_cookies[new_tail];
> + struct zsda_sgl *sgl_src = (struct zsda_sgl *)&cookie->sgl_src;
> + struct zsda_sgl *sgl_dst = (struct zsda_sgl *)&cookie->sgl_dst;
> + struct comp_head_info comp_head_info;
> +
> + uint8_t opcode;
> + int ret;
> + uint32_t op_offset;
> + uint32_t op_src_len;
> + uint32_t op_dst_len;
> + uint32_t head_len;
> +
> + if ((op->m_dst == NULL) || (op->m_dst == op->m_src)) {
> + ZSDA_LOG(ERR, "Failed! m_dst");
> + return -EINVAL;
> + }
> +
> + opcode = zsda_opcode_get(xform);
> + if (opcode == ZSDA_OPC_INVALID) {
> + ZSDA_LOG(ERR, "Failed! zsda_opcode_get");
> + return -EINVAL;
> + }
> +
> + cookie->used = true;
> + cookie->sid = new_tail;
> + cookie->op = op;
> +
> + if (opcode == ZSDA_OPC_COMP_GZIP)
> + head_len = GZIP_HEADER_SIZE;
> + else if (opcode == ZSDA_OPC_COMP_ZLIB)
> + head_len = ZLIB_HEADER_SIZE;
> + else {
> + ZSDA_LOG(ERR, "Comp, op_code error!");
> + return -EINVAL;
> + }
> +
> + comp_head_info.head_len = head_len;
> + comp_head_info.head_phys_addr = cookie->comp_head_phys_addr;
> +
> + op_offset = op->src.offset;
> + op_src_len = op->src.length;
> + ret = zsda_sgl_fill(op->m_src, op_offset, sgl_src,
> + cookie->sgl_src_phys_addr, op_src_len, NULL);
> +
> + op_offset = op->dst.offset;
> + op_dst_len = op->m_dst->pkt_len - op_offset;
> + op_dst_len += head_len;
> + ret |= zsda_sgl_fill(op->m_dst, op_offset, sgl_dst,
> + cookie->sgl_dst_phys_addr, op_dst_len,
> + &comp_head_info);
> +
> + if (ret) {
> + ZSDA_LOG(ERR, "Failed! zsda_sgl_fill");
> + return ret;
> + }
> +
> + memset(wqe, 0, sizeof(struct zsda_wqe_comp));
> + wqe->rx_length = op_src_len;
> + wqe->tx_length = op_dst_len;
> + wqe->valid = queue->valid;
> + wqe->op_code = opcode;
> + wqe->sid = cookie->sid;
> + wqe->rx_sgl_type = WQE_ELM_TYPE_LIST;
> + wqe->tx_sgl_type = WQE_ELM_TYPE_LIST;
> +
> + wqe->rx_addr = cookie->sgl_src_phys_addr;
> + wqe->tx_addr = cookie->sgl_dst_phys_addr;
> +
> + return ret;
> +}
> +
> +int
> +zsda_decomp_request_build(void *op_in, const struct zsda_queue *queue,
> + void **op_cookies, const uint16_t new_tail)
> +{
> + struct rte_comp_op *op = op_in;
> + struct zsda_comp_xform *xform = op->private_xform;
> +
> + struct zsda_wqe_comp *wqe =
> + (struct zsda_wqe_comp *)(queue->base_addr +
> + (new_tail * queue->msg_size));
> + struct zsda_op_cookie *cookie = op_cookies[new_tail];
> + struct zsda_sgl *sgl_src = (struct zsda_sgl *)&cookie->sgl_src;
> + struct zsda_sgl *sgl_dst = (struct zsda_sgl *)&cookie->sgl_dst;
> + uint8_t opcode;
> + int ret;
> +
> + uint32_t op_offset;
> + uint32_t op_src_len;
> + uint32_t op_dst_len;
> +
> + uint8_t *head_data;
> + uint16_t head_len;
> + struct comp_head_info comp_head_info;
> + uint8_t head_zlib[ZLIB_HEADER_SIZE] = {0x78, 0xDA};
> + uint8_t head_gzip[GZIP_HEADER_SIZE] = {0x1F, 0x8B, 0x08, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x03};
> +
> + if ((op->m_dst == NULL) || (op->m_dst == op->m_src)) {
> + ZSDA_LOG(ERR, "Failed! m_dst");
> + return -EINVAL;
> + }
> +
> + opcode = zsda_opcode_get(xform);
> + if (opcode == ZSDA_OPC_INVALID) {
> + ZSDA_LOG(ERR, "Failed! zsda_opcode_get");
> + return -EINVAL;
> + }
> +
> + cookie->used = true;
> + cookie->sid = new_tail;
> + cookie->op = op;
> +
> + if (opcode == ZSDA_OPC_DECOMP_GZIP) {
> + head_data = head_gzip;
> + head_len = GZIP_HEADER_SIZE;
> + } else if (opcode == ZSDA_OPC_DECOMP_ZLIB) {
> + head_data = head_zlib;
> + head_len = ZLIB_HEADER_SIZE;
> + } else {
> + ZSDA_LOG(ERR, "Comp, op_code error!");
> + return -EINVAL;
> + }
> +
> + op_offset = op->src.offset;
> + op_src_len = op->src.length;
> + op_src_len += head_len;
> + comp_head_info.head_len = head_len;
> + comp_head_info.head_phys_addr = cookie->comp_head_phys_addr;
> + cookie->decomp_no_tail = true;
> + for (int i = 0; i < head_len; i++)
> + cookie->comp_head[i] = head_data[i];
> +
> + ret = zsda_sgl_fill(op->m_src, op_offset, sgl_src,
> + cookie->sgl_src_phys_addr, op_src_len,
> + &comp_head_info);
> +
> + op_offset = op->dst.offset;
> + op_dst_len = op->m_dst->pkt_len - op_offset;
> + ret |= zsda_sgl_fill(op->m_dst, op_offset, sgl_dst,
> + cookie->sgl_dst_phys_addr, op_dst_len, NULL);
> +
> + if (ret) {
> + ZSDA_LOG(ERR, "Failed! zsda_sgl_fill");
> + return ret;
> + }
> +
> + memset(wqe, 0, sizeof(struct zsda_wqe_comp));
> +
> + wqe->rx_length = op_src_len;
> + wqe->tx_length = op_dst_len;
> + wqe->valid = queue->valid;
> + wqe->op_code = opcode;
> + wqe->sid = cookie->sid;
> + wqe->rx_sgl_type = WQE_ELM_TYPE_LIST;
> + wqe->tx_sgl_type = WQE_ELM_TYPE_LIST;
> + wqe->rx_addr = cookie->sgl_src_phys_addr;
> + wqe->tx_addr = cookie->sgl_dst_phys_addr;
> +
> + return ret;
> +}
> diff --git a/drivers/compress/zsda/zsda_comp.h
> b/drivers/compress/zsda/zsda_comp.h
> new file mode 100644
> index 0000000000..0f312accdf
> --- /dev/null
> +++ b/drivers/compress/zsda/zsda_comp.h
> @@ -0,0 +1,36 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2024 ZTE Corporation
> + */
> +
> +#ifndef _ZSDA_COMP_H_
> +#define _ZSDA_COMP_H_
> +
> +#include "zsda_comp_pmd.h"
> +
> +struct compress_cfg {
> +} __rte_packed;
> +
> +struct zsda_wqe_comp {
> + uint8_t valid;
> + uint8_t op_code;
> + uint16_t sid;
> + uint8_t resv[3];
> + uint8_t rx_sgl_type : 4;
> + uint8_t tx_sgl_type : 4;
> + uint64_t rx_addr;
> + uint32_t rx_length;
> + uint64_t tx_addr;
> + uint32_t tx_length;
> + struct compress_cfg cfg;
> +} __rte_packed;
> +
> +int zsda_comp_match(const void *op_in);
> +int zsda_decomp_match(const void *op_in);
> +
> +int zsda_comp_request_build(void *op_in, const struct zsda_queue *queue,
> + void **op_cookies, const uint16_t new_tail);
> +
> +int zsda_decomp_request_build(void *op_in, const struct zsda_queue *queue,
> + void **op_cookies, const uint16_t new_tail);
> +
> +#endif /* _ZSDA_COMP_H_ */
> diff --git a/drivers/compress/zsda/zsda_comp_pmd.c
> b/drivers/compress/zsda/zsda_comp_pmd.c
> index 19a4932525..d9e444972b 100644
> --- a/drivers/compress/zsda/zsda_comp_pmd.c
> +++ b/drivers/compress/zsda/zsda_comp_pmd.c
> @@ -8,6 +8,7 @@
> #include "zsda_qp_common.h"
> #include "zsda_qp.h"
> #include "zsda_comp_pmd.h"
> +#include "zsda_comp.h"
>
> static int
> zsda_comp_xform_size(void)
> @@ -245,10 +246,14 @@ zsda_comp_qp_setup(struct rte_compressdev *dev,
> uint16_t qp_id,
>
> task_q_info.type = ZSDA_SERVICE_COMPRESSION;
> task_q_info.service_str = "comp";
> + task_q_info.tx_cb = zsda_comp_request_build;
> + task_q_info.match = zsda_comp_match;
> ret = zsda_task_queue_setup(zsda_pci_dev, qp_new, &task_q_info);
>
> task_q_info.type = ZSDA_SERVICE_DECOMPRESSION;
> task_q_info.service_str = "decomp";
> + task_q_info.tx_cb = zsda_decomp_request_build;
> + task_q_info.match = zsda_decomp_match;
> ret |= zsda_task_queue_setup(zsda_pci_dev, qp_new, &task_q_info);
>
> if (ret) {
> @@ -287,6 +292,14 @@ static const char zsda_comp_drv_name[] =
> RTE_STR(COMPRESSDEV_NAME_ZSDA_PMD);
> static const struct rte_driver compdev_zsda_driver = {
> .name = zsda_comp_drv_name, .alias = zsda_comp_drv_name};
>
> +static uint16_t
> +zsda_comp_pmd_enqueue_op_burst(void *qp, struct rte_comp_op **ops,
> + uint16_t nb_ops)
> +{
> + return zsda_enqueue_burst((struct zsda_qp *)qp, (void **)ops,
> + nb_ops);
> +}
> +
> int
> zsda_comp_dev_create(struct zsda_pci_device *zsda_pci_dev)
> {
> @@ -324,7 +337,7 @@ zsda_comp_dev_create(struct zsda_pci_device
> *zsda_pci_dev)
>
> compressdev->dev_ops = &compress_zsda_ops;
>
> - compressdev->enqueue_burst = NULL;
> + compressdev->enqueue_burst = zsda_comp_pmd_enqueue_op_burst;
> compressdev->dequeue_burst = NULL;
>
> compressdev->feature_flags = RTE_COMPDEV_FF_HW_ACCELERATED;
> --
> 2.27.0
@@ -20,7 +20,7 @@ zsda_compress_path = 'compress/zsda'
zsda_compress_relpath = '../../' + zsda_compress_path
includes += include_directories(zsda_compress_relpath)
if zsda_compress
- foreach f: ['zsda_comp_pmd.c']
+ foreach f: ['zsda_comp_pmd.c', 'zsda_comp.c']
sources += files(join_paths(zsda_compress_relpath, f))
endforeach
endif
@@ -783,3 +783,109 @@ zsda_task_queue_setup(struct zsda_pci_device *zsda_pci_dev,
return ret;
}
+
+static int
+zsda_free_cookie_find(const struct zsda_queue *queue, void **op_cookie,
+ uint16_t *idx)
+{
+ uint16_t old_tail = queue->tail;
+ uint16_t tail = queue->tail;
+ struct zsda_op_cookie *cookie;
+
+ do {
+ cookie = op_cookie[tail];
+ if (!cookie->used) {
+ *idx = tail & (queue->queue_size - 1);
+ return ZSDA_SUCCESS;
+ }
+ tail = zsda_modulo_16(tail++, queue->modulo_mask);
+ } while (old_tail != tail);
+
+ return -EINVAL;
+}
+
+static int
+zsda_enqueue(void *op, struct zsda_qp *qp)
+{
+ uint16_t new_tail;
+ enum zsda_service_type type;
+ void **op_cookie;
+ int ret = ZSDA_SUCCESS;
+ struct zsda_queue *queue;
+
+ for (type = 0; type < ZSDA_SERVICE_INVALID; type++) {
+ if (qp->srv[type].used) {
+ if (!qp->srv[type].match(op))
+ continue;
+ queue = &qp->srv[type].tx_q;
+ op_cookie = qp->srv[type].op_cookies;
+
+ if (zsda_free_cookie_find(queue, op_cookie,
+ &new_tail)) {
+ ret = -EBUSY;
+ break;
+ }
+ ret = qp->srv[type].tx_cb(op, queue, op_cookie,
+ new_tail);
+ if (ret) {
+ qp->srv[type].stats.enqueue_err_count++;
+ ZSDA_LOG(ERR, "Failed! config wqe");
+ break;
+ }
+ qp->srv[type].stats.enqueued_count++;
+
+ queue->tail = zsda_modulo_16(new_tail + 1,
+ queue->queue_size - 1);
+
+ if (new_tail > queue->tail)
+ queue->valid =
+ zsda_modulo_8(queue->valid + 1,
+ (uint8_t)(queue->cycle_size - 1));
+
+ queue->pushed_wqe++;
+ break;
+ }
+ }
+
+ return ret;
+}
+
+static void
+zsda_tx_tail_write(struct zsda_queue *queue)
+{
+ if (queue->pushed_wqe)
+ WRITE_CSR_WQ_TAIL(queue->io_addr, queue->hw_queue_number,
+ queue->tail);
+
+ queue->pushed_wqe = 0;
+}
+
+uint16_t
+zsda_enqueue_burst(struct zsda_qp *qp, void **ops, const uint16_t nb_ops)
+{
+ int ret = ZSDA_SUCCESS;
+ enum zsda_service_type type;
+ uint16_t i;
+ uint16_t nb_send = 0;
+ void *op;
+
+ if (nb_ops > ZSDA_MAX_DESC) {
+ ZSDA_LOG(ERR, "Enqueue number bigger than %d", ZSDA_MAX_DESC);
+ return 0;
+ }
+
+ for (i = 0; i < nb_ops; i++) {
+ op = ops[i];
+ ret = zsda_enqueue(op, qp);
+ if (ret < 0)
+ break;
+ nb_send++;
+ }
+
+ for (type = 0; type < ZSDA_SERVICE_INVALID; type++)
+ if (qp->srv[type].used)
+ zsda_tx_tail_write(&qp->srv[type].tx_q);
+
+ return nb_send;
+}
+
@@ -48,7 +48,6 @@
#define SET_CYCLE 0xff
#define SET_HEAD_INTI 0x0
-
#define ZSDA_TIME_SLEEP_US 100
#define ZSDA_TIME_NUM 500
@@ -95,6 +94,15 @@
u_base); \
} while (0)
+#define READ_CSR_WQ_HEAD(csr_base_addr, ring) \
+ ZSDA_CSR_RD(csr_base_addr, WQ_TAIL + (ring << 3))
+#define WRITE_CSR_WQ_TAIL(csr_base_addr, ring, value) \
+ ZSDA_CSR_WC_WR(csr_base_addr, WQ_TAIL + (ring << 3), value)
+#define READ_CSR_CQ_HEAD(csr_base_addr, ring) \
+ ZSDA_CSR_RD(csr_base_addr, WQ_TAIL + (ring << 3))
+#define WRITE_CSR_CQ_HEAD(csr_base_addr, ring, value) \
+ ZSDA_CSR_WC_WR(csr_base_addr, CQ_HEAD + (ring << 3), value)
+
extern struct zsda_num_qps zsda_nb_qps;
enum zsda_admin_msg_id {
@@ -179,4 +187,7 @@ zsda_qps_hw_per_service(struct zsda_pci_device *zsda_pci_dev,
int zsda_task_queue_setup(struct zsda_pci_device *zsda_pci_dev,
struct zsda_qp *qp, struct task_queue_info *task_q_info);
+
+uint16_t zsda_enqueue_burst(struct zsda_qp *qp, void **ops, const uint16_t nb_ops);
+
#endif /* _ZSDA_QP_H_ */
@@ -118,3 +118,75 @@ zsda_stats_reset(void **queue_pairs, const uint32_t nb_queue_pairs)
}
}
}
+
+int
+zsda_sgl_fill(const struct rte_mbuf *buf, uint32_t offset, struct zsda_sgl *sgl,
+ const phys_addr_t sgl_phy_addr, uint32_t remain_len,
+ struct comp_head_info *comp_head_info)
+{
+ uint32_t nr;
+ uint16_t put_in_len;
+ bool head_set = false;
+
+ for (nr = 0; (buf && (nr < (ZSDA_SGL_MAX_NUMBER - 1)));) {
+ if (offset >= rte_pktmbuf_data_len(buf)) {
+ offset -= rte_pktmbuf_data_len(buf);
+ buf = buf->next;
+ continue;
+ }
+ memset(&(sgl->buffers[nr]), 0, sizeof(struct zsda_buf));
+ if ((nr > 0) && (((nr + 1) % ZSDA_SGL_FRAGMENT_SIZE) == 0) &&
+ (buf->next != NULL)) {
+ sgl->buffers[nr].len = SGL_TYPE_PHYS_ADDR;
+ sgl->buffers[nr].addr =
+ sgl_phy_addr +
+ ((nr + 1) * sizeof(struct zsda_buf));
+ sgl->buffers[nr].type = SGL_TYPE_NEXT_LIST;
+ ++nr;
+ continue;
+ }
+ if (comp_head_info && !head_set) {
+ sgl->buffers[nr].len = comp_head_info->head_len;
+ sgl->buffers[nr].addr = comp_head_info->head_phys_addr;
+ sgl->buffers[nr].type = SGL_TYPE_PHYS_ADDR;
+ ++nr;
+ head_set = true;
+ remain_len -= comp_head_info->head_len;
+ continue;
+ } else {
+ put_in_len = rte_pktmbuf_data_len(buf) - (offset & 0xffff);
+ if (remain_len <= put_in_len)
+ put_in_len = remain_len;
+ remain_len -= put_in_len;
+
+ sgl->buffers[nr].len = put_in_len;
+ sgl->buffers[nr].addr = rte_pktmbuf_iova_offset(buf, offset);
+ sgl->buffers[nr].type = SGL_TYPE_PHYS_ADDR;
+ }
+ offset = 0;
+ ++nr;
+ buf = buf->next;
+
+ if (remain_len == 0)
+ break;
+ }
+
+ if (nr == 0) {
+ ZSDA_LOG(ERR, "In fill_sgl, nr == 0");
+ return ZSDA_FAILED;
+ }
+
+ sgl->buffers[nr - 1].type = SGL_TYPE_LAST_PHYS_ADDR;
+
+ if (buf) {
+ if (unlikely(buf->next)) {
+ if (nr == (ZSDA_SGL_MAX_NUMBER - 1)) {
+ ZSDA_LOG(ERR, "ERR! segs size (%u)",
+ (ZSDA_SGL_MAX_NUMBER));
+ return -EINVAL;
+ }
+ }
+ }
+
+ return ZSDA_SUCCESS;
+}
@@ -43,6 +43,27 @@ enum zsda_service_type {
#define ZSDA_MAX_CYCLE 256
#define ZSDA_MAX_DEV RTE_PMD_ZSDA_MAX_PCI_DEVICES
#define MAX_NUM_OPS 0x1FF
+#define ZSDA_SGL_FRAGMENT_SIZE 32
+
+#define ZSDA_OPC_COMP_GZIP 0x10 /* Encomp deflate-Gzip */
+#define ZSDA_OPC_COMP_ZLIB 0x11 /* Encomp deflate-Zlib */
+#define ZSDA_OPC_DECOMP_GZIP 0x18 /* Decomp inflate-Gzip */
+#define ZSDA_OPC_DECOMP_ZLIB 0x19 /* Decomp inflate-Zlib */
+#define ZSDA_OPC_INVALID 0xff
+
+enum wqe_element_type {
+ WQE_ELM_TYPE_PHYS_ADDR = 1,
+ WQE_ELM_TYPE_LIST,
+ WQE_ELM_TYPE_LIST_ADDR,
+ WQE_ELM_TYPE_LIST_SGL32,
+};
+
+enum sgl_element_type {
+ SGL_TYPE_PHYS_ADDR = 0,
+ SGL_TYPE_LAST_PHYS_ADDR,
+ SGL_TYPE_NEXT_LIST,
+ SGL_TYPE_EC_LEVEL1_SGL32,
+};
struct zsda_admin_req {
uint16_t msg_type;
@@ -159,10 +180,19 @@ struct __rte_cache_aligned zsda_sgl {
struct zsda_buf buffers[ZSDA_SGL_MAX_NUMBER];
};
+struct comp_head_info {
+ uint32_t head_len;
+ phys_addr_t head_phys_addr;
+};
+
void zsda_queue_delete(const struct zsda_queue *queue);
int zsda_queue_pair_release(struct zsda_qp **qp_addr);
void zsda_stats_get(void **queue_pairs, const uint32_t nb_queue_pairs,
struct zsda_qp_stat *stats);
void zsda_stats_reset(void **queue_pairs, const uint32_t nb_queue_pairs);
+int zsda_sgl_fill(const struct rte_mbuf *buf, uint32_t offset,
+ struct zsda_sgl *sgl, const phys_addr_t sgl_phy_addr,
+ uint32_t remain_len, struct comp_head_info *comp_head_info);
+
#endif /* _ZSDA_QP_COMMON_H_ */
new file mode 100644
@@ -0,0 +1,233 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 ZTE Corporation
+ */
+
+#include "zsda_comp.h"
+
+#define ZLIB_HEADER_SIZE 2
+#define ZLIB_TRAILER_SIZE 4
+#define GZIP_HEADER_SIZE 10
+#define GZIP_TRAILER_SIZE 8
+#define CHECKSUM_SIZE 4
+
+int
+zsda_comp_match(const void *op_in)
+{
+ const struct rte_comp_op *op = op_in;
+ const struct zsda_comp_xform *xform = op->private_xform;
+
+ if (op->op_type != RTE_COMP_OP_STATELESS)
+ return 0;
+
+ if (xform->type != RTE_COMP_COMPRESS)
+ return 0;
+
+ return 1;
+}
+
+int
+zsda_decomp_match(const void *op_in)
+{
+ const struct rte_comp_op *op = op_in;
+ const struct zsda_comp_xform *xform = op->private_xform;
+
+ if (op->op_type != RTE_COMP_OP_STATELESS)
+ return 0;
+
+ if (xform->type != RTE_COMP_DECOMPRESS)
+ return 0;
+ return 1;
+}
+
+static uint8_t
+zsda_opcode_get(const struct zsda_comp_xform *xform)
+{
+ if (xform->type == RTE_COMP_COMPRESS) {
+ if (xform->checksum_type == RTE_COMP_CHECKSUM_NONE ||
+ xform->checksum_type == RTE_COMP_CHECKSUM_CRC32)
+ return ZSDA_OPC_COMP_GZIP;
+ else if (xform->checksum_type == RTE_COMP_CHECKSUM_ADLER32)
+ return ZSDA_OPC_COMP_ZLIB;
+ }
+ if (xform->type == RTE_COMP_DECOMPRESS) {
+ if (xform->checksum_type == RTE_COMP_CHECKSUM_CRC32 ||
+ xform->checksum_type == RTE_COMP_CHECKSUM_NONE)
+ return ZSDA_OPC_DECOMP_GZIP;
+ else if (xform->checksum_type == RTE_COMP_CHECKSUM_ADLER32)
+ return ZSDA_OPC_DECOMP_ZLIB;
+ }
+
+ return ZSDA_OPC_INVALID;
+}
+
+int
+zsda_comp_request_build(void *op_in, const struct zsda_queue *queue,
+ void **op_cookies, const uint16_t new_tail)
+{
+ struct rte_comp_op *op = op_in;
+ struct zsda_comp_xform *xform = op->private_xform;
+ struct zsda_wqe_comp *wqe =
+ (struct zsda_wqe_comp *)(queue->base_addr +
+ (new_tail * queue->msg_size));
+
+ struct zsda_op_cookie *cookie = op_cookies[new_tail];
+ struct zsda_sgl *sgl_src = (struct zsda_sgl *)&cookie->sgl_src;
+ struct zsda_sgl *sgl_dst = (struct zsda_sgl *)&cookie->sgl_dst;
+ struct comp_head_info comp_head_info;
+
+ uint8_t opcode;
+ int ret;
+ uint32_t op_offset;
+ uint32_t op_src_len;
+ uint32_t op_dst_len;
+ uint32_t head_len;
+
+ if ((op->m_dst == NULL) || (op->m_dst == op->m_src)) {
+ ZSDA_LOG(ERR, "Failed! m_dst");
+ return -EINVAL;
+ }
+
+ opcode = zsda_opcode_get(xform);
+ if (opcode == ZSDA_OPC_INVALID) {
+ ZSDA_LOG(ERR, "Failed! zsda_opcode_get");
+ return -EINVAL;
+ }
+
+ cookie->used = true;
+ cookie->sid = new_tail;
+ cookie->op = op;
+
+ if (opcode == ZSDA_OPC_COMP_GZIP)
+ head_len = GZIP_HEADER_SIZE;
+ else if (opcode == ZSDA_OPC_COMP_ZLIB)
+ head_len = ZLIB_HEADER_SIZE;
+ else {
+ ZSDA_LOG(ERR, "Comp, op_code error!");
+ return -EINVAL;
+ }
+
+ comp_head_info.head_len = head_len;
+ comp_head_info.head_phys_addr = cookie->comp_head_phys_addr;
+
+ op_offset = op->src.offset;
+ op_src_len = op->src.length;
+ ret = zsda_sgl_fill(op->m_src, op_offset, sgl_src,
+ cookie->sgl_src_phys_addr, op_src_len, NULL);
+
+ op_offset = op->dst.offset;
+ op_dst_len = op->m_dst->pkt_len - op_offset;
+ op_dst_len += head_len;
+ ret |= zsda_sgl_fill(op->m_dst, op_offset, sgl_dst,
+ cookie->sgl_dst_phys_addr, op_dst_len,
+ &comp_head_info);
+
+ if (ret) {
+ ZSDA_LOG(ERR, "Failed! zsda_sgl_fill");
+ return ret;
+ }
+
+ memset(wqe, 0, sizeof(struct zsda_wqe_comp));
+ wqe->rx_length = op_src_len;
+ wqe->tx_length = op_dst_len;
+ wqe->valid = queue->valid;
+ wqe->op_code = opcode;
+ wqe->sid = cookie->sid;
+ wqe->rx_sgl_type = WQE_ELM_TYPE_LIST;
+ wqe->tx_sgl_type = WQE_ELM_TYPE_LIST;
+
+ wqe->rx_addr = cookie->sgl_src_phys_addr;
+ wqe->tx_addr = cookie->sgl_dst_phys_addr;
+
+ return ret;
+}
+
+int
+zsda_decomp_request_build(void *op_in, const struct zsda_queue *queue,
+ void **op_cookies, const uint16_t new_tail)
+{
+ struct rte_comp_op *op = op_in;
+ struct zsda_comp_xform *xform = op->private_xform;
+
+ struct zsda_wqe_comp *wqe =
+ (struct zsda_wqe_comp *)(queue->base_addr +
+ (new_tail * queue->msg_size));
+ struct zsda_op_cookie *cookie = op_cookies[new_tail];
+ struct zsda_sgl *sgl_src = (struct zsda_sgl *)&cookie->sgl_src;
+ struct zsda_sgl *sgl_dst = (struct zsda_sgl *)&cookie->sgl_dst;
+ uint8_t opcode;
+ int ret;
+
+ uint32_t op_offset;
+ uint32_t op_src_len;
+ uint32_t op_dst_len;
+
+ uint8_t *head_data;
+ uint16_t head_len;
+ struct comp_head_info comp_head_info;
+ uint8_t head_zlib[ZLIB_HEADER_SIZE] = {0x78, 0xDA};
+ uint8_t head_gzip[GZIP_HEADER_SIZE] = {0x1F, 0x8B, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03};
+
+ if ((op->m_dst == NULL) || (op->m_dst == op->m_src)) {
+ ZSDA_LOG(ERR, "Failed! m_dst");
+ return -EINVAL;
+ }
+
+ opcode = zsda_opcode_get(xform);
+ if (opcode == ZSDA_OPC_INVALID) {
+ ZSDA_LOG(ERR, "Failed! zsda_opcode_get");
+ return -EINVAL;
+ }
+
+ cookie->used = true;
+ cookie->sid = new_tail;
+ cookie->op = op;
+
+ if (opcode == ZSDA_OPC_DECOMP_GZIP) {
+ head_data = head_gzip;
+ head_len = GZIP_HEADER_SIZE;
+ } else if (opcode == ZSDA_OPC_DECOMP_ZLIB) {
+ head_data = head_zlib;
+ head_len = ZLIB_HEADER_SIZE;
+ } else {
+ ZSDA_LOG(ERR, "Comp, op_code error!");
+ return -EINVAL;
+ }
+
+ op_offset = op->src.offset;
+ op_src_len = op->src.length;
+ op_src_len += head_len;
+ comp_head_info.head_len = head_len;
+ comp_head_info.head_phys_addr = cookie->comp_head_phys_addr;
+ cookie->decomp_no_tail = true;
+ for (int i = 0; i < head_len; i++)
+ cookie->comp_head[i] = head_data[i];
+
+ ret = zsda_sgl_fill(op->m_src, op_offset, sgl_src,
+ cookie->sgl_src_phys_addr, op_src_len,
+ &comp_head_info);
+
+ op_offset = op->dst.offset;
+ op_dst_len = op->m_dst->pkt_len - op_offset;
+ ret |= zsda_sgl_fill(op->m_dst, op_offset, sgl_dst,
+ cookie->sgl_dst_phys_addr, op_dst_len, NULL);
+
+ if (ret) {
+ ZSDA_LOG(ERR, "Failed! zsda_sgl_fill");
+ return ret;
+ }
+
+ memset(wqe, 0, sizeof(struct zsda_wqe_comp));
+
+ wqe->rx_length = op_src_len;
+ wqe->tx_length = op_dst_len;
+ wqe->valid = queue->valid;
+ wqe->op_code = opcode;
+ wqe->sid = cookie->sid;
+ wqe->rx_sgl_type = WQE_ELM_TYPE_LIST;
+ wqe->tx_sgl_type = WQE_ELM_TYPE_LIST;
+ wqe->rx_addr = cookie->sgl_src_phys_addr;
+ wqe->tx_addr = cookie->sgl_dst_phys_addr;
+
+ return ret;
+}
new file mode 100644
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 ZTE Corporation
+ */
+
+#ifndef _ZSDA_COMP_H_
+#define _ZSDA_COMP_H_
+
+#include "zsda_comp_pmd.h"
+
+struct compress_cfg {
+} __rte_packed;
+
+struct zsda_wqe_comp {
+ uint8_t valid;
+ uint8_t op_code;
+ uint16_t sid;
+ uint8_t resv[3];
+ uint8_t rx_sgl_type : 4;
+ uint8_t tx_sgl_type : 4;
+ uint64_t rx_addr;
+ uint32_t rx_length;
+ uint64_t tx_addr;
+ uint32_t tx_length;
+ struct compress_cfg cfg;
+} __rte_packed;
+
+int zsda_comp_match(const void *op_in);
+int zsda_decomp_match(const void *op_in);
+
+int zsda_comp_request_build(void *op_in, const struct zsda_queue *queue,
+ void **op_cookies, const uint16_t new_tail);
+
+int zsda_decomp_request_build(void *op_in, const struct zsda_queue *queue,
+ void **op_cookies, const uint16_t new_tail);
+
+#endif /* _ZSDA_COMP_H_ */
@@ -8,6 +8,7 @@
#include "zsda_qp_common.h"
#include "zsda_qp.h"
#include "zsda_comp_pmd.h"
+#include "zsda_comp.h"
static int
zsda_comp_xform_size(void)
@@ -245,10 +246,14 @@ zsda_comp_qp_setup(struct rte_compressdev *dev, uint16_t qp_id,
task_q_info.type = ZSDA_SERVICE_COMPRESSION;
task_q_info.service_str = "comp";
+ task_q_info.tx_cb = zsda_comp_request_build;
+ task_q_info.match = zsda_comp_match;
ret = zsda_task_queue_setup(zsda_pci_dev, qp_new, &task_q_info);
task_q_info.type = ZSDA_SERVICE_DECOMPRESSION;
task_q_info.service_str = "decomp";
+ task_q_info.tx_cb = zsda_decomp_request_build;
+ task_q_info.match = zsda_decomp_match;
ret |= zsda_task_queue_setup(zsda_pci_dev, qp_new, &task_q_info);
if (ret) {
@@ -287,6 +292,14 @@ static const char zsda_comp_drv_name[] = RTE_STR(COMPRESSDEV_NAME_ZSDA_PMD);
static const struct rte_driver compdev_zsda_driver = {
.name = zsda_comp_drv_name, .alias = zsda_comp_drv_name};
+static uint16_t
+zsda_comp_pmd_enqueue_op_burst(void *qp, struct rte_comp_op **ops,
+ uint16_t nb_ops)
+{
+ return zsda_enqueue_burst((struct zsda_qp *)qp, (void **)ops,
+ nb_ops);
+}
+
int
zsda_comp_dev_create(struct zsda_pci_device *zsda_pci_dev)
{
@@ -324,7 +337,7 @@ zsda_comp_dev_create(struct zsda_pci_device *zsda_pci_dev)
compressdev->dev_ops = &compress_zsda_ops;
- compressdev->enqueue_burst = NULL;
+ compressdev->enqueue_burst = zsda_comp_pmd_enqueue_op_burst;
compressdev->dequeue_burst = NULL;
compressdev->feature_flags = RTE_COMPDEV_FF_HW_ACCELERATED;