DPDK patches and discussions
 help / color / mirror / Atom feed
From: Fiona Trahe <fiona.trahe@intel.com>
To: dev@dpdk.org
Cc: pablo.de.lara.guarch@intel.com, fiona.trahe@intel.com,
	tomaszx.jozwiak@intel.com
Subject: [dpdk-dev] [PATCH v3 05/16] compress/qat: create fw request and process response
Date: Thu,  5 Jul 2018 18:32:49 +0100	[thread overview]
Message-ID: <1530811980-24334-6-git-send-email-fiona.trahe@intel.com> (raw)
In-Reply-To: <1530806730-11822-1-git-send-email-fiona.trahe@intel.com>

Add functions to create the request message to send to
firmware and to process the firmware response.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
 drivers/compress/qat/qat_comp.c     | 101 ++++++++++++++++++++++++++++++++++++
 drivers/compress/qat/qat_comp.h     |   8 +++
 drivers/compress/qat/qat_comp_pmd.h |   1 +
 3 files changed, 110 insertions(+)

diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c
index cb2005a..a32d6ef 100644
--- a/drivers/compress/qat/qat_comp.c
+++ b/drivers/compress/qat/qat_comp.c
@@ -19,6 +19,107 @@
 #include "qat_comp.h"
 #include "qat_comp_pmd.h"
 
+
+int
+qat_comp_build_request(void *in_op, uint8_t *out_msg,
+		       void *op_cookie __rte_unused,
+		       enum qat_device_gen qat_dev_gen __rte_unused)
+{
+	struct rte_comp_op *op = in_op;
+	struct qat_comp_xform *qat_xform = op->private_xform;
+	const uint8_t *tmpl = (uint8_t *)&qat_xform->qat_comp_req_tmpl;
+	struct icp_qat_fw_comp_req *comp_req =
+	    (struct icp_qat_fw_comp_req *)out_msg;
+
+	if (unlikely(op->op_type != RTE_COMP_OP_STATELESS)) {
+		QAT_DP_LOG(ERR, "QAT PMD only supports stateless compression "
+				"operation requests, op (%p) is not a "
+				"stateless operation.", op);
+		return -EINVAL;
+	}
+
+	rte_mov128(out_msg, tmpl);
+	comp_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)op;
+
+	/* common for sgl and flat buffers */
+	comp_req->comp_pars.comp_len = op->src.length;
+	comp_req->comp_pars.out_buffer_sz = rte_pktmbuf_pkt_len(op->m_dst);
+
+	/* sgl */
+	if (op->m_src->next != NULL || op->m_dst->next != NULL) {
+		QAT_DP_LOG(ERR, "QAT PMD doesn't support scatter gather");
+		return -EINVAL;
+
+	} else {
+		ICP_QAT_FW_COMN_PTR_TYPE_SET(comp_req->comn_hdr.comn_req_flags,
+				QAT_COMN_PTR_TYPE_FLAT);
+		comp_req->comn_mid.src_length = rte_pktmbuf_data_len(op->m_src);
+		comp_req->comn_mid.dst_length = rte_pktmbuf_data_len(op->m_dst);
+
+		comp_req->comn_mid.src_data_addr =
+		    rte_pktmbuf_mtophys_offset(op->m_src, op->src.offset);
+		comp_req->comn_mid.dest_data_addr =
+		    rte_pktmbuf_mtophys_offset(op->m_dst, op->dst.offset);
+	}
+
+#if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
+	QAT_DP_LOG(DEBUG, "Direction: %s",
+	    qat_xform->qat_comp_request_type == QAT_COMP_REQUEST_DECOMPRESS ?
+			    "decompression" : "compression");
+	QAT_DP_HEXDUMP_LOG(DEBUG, "qat compression message:", comp_req,
+		    sizeof(struct icp_qat_fw_comp_req));
+#endif
+	return 0;
+}
+
+int
+qat_comp_process_response(void **op, uint8_t *resp)
+{
+	struct icp_qat_fw_comp_resp *resp_msg =
+			(struct icp_qat_fw_comp_resp *)resp;
+	struct rte_comp_op *rx_op = (struct rte_comp_op *)(uintptr_t)
+			(resp_msg->opaque_data);
+
+#if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
+	QAT_DP_LOG(DEBUG, "Direction: %s",
+	    qat_xform->qat_comp_request_type == QAT_COMP_REQUEST_DECOMPRESS ?
+	    "decompression" : "compression");
+	QAT_DP_HEXDUMP_LOG(DEBUG,  "qat_response:", (uint8_t *)resp_msg,
+			sizeof(struct icp_qat_fw_comp_resp));
+#endif
+
+	if ((ICP_QAT_FW_COMN_RESP_CMP_STAT_GET(resp_msg->comn_resp.comn_status)
+		| ICP_QAT_FW_COMN_RESP_XLAT_STAT_GET(
+				resp_msg->comn_resp.comn_status)) !=
+				ICP_QAT_FW_COMN_STATUS_FLAG_OK) {
+
+		rx_op->status = RTE_COMP_OP_STATUS_ERROR;
+		rx_op->debug_status =
+			*((uint16_t *)(&resp_msg->comn_resp.comn_error));
+	} else {
+		struct qat_comp_xform *qat_xform = rx_op->private_xform;
+		struct icp_qat_fw_resp_comp_pars *comp_resp =
+		  (struct icp_qat_fw_resp_comp_pars *)&resp_msg->comp_resp_pars;
+
+		rx_op->status = RTE_COMP_OP_STATUS_SUCCESS;
+		rx_op->consumed = comp_resp->input_byte_counter;
+		rx_op->produced = comp_resp->output_byte_counter;
+
+		if (qat_xform->checksum_type != RTE_COMP_CHECKSUM_NONE) {
+			if (qat_xform->checksum_type == RTE_COMP_CHECKSUM_CRC32)
+				rx_op->output_chksum = comp_resp->curr_crc32;
+			else if (qat_xform->checksum_type ==
+					RTE_COMP_CHECKSUM_ADLER32)
+				rx_op->output_chksum = comp_resp->curr_adler_32;
+			else
+				rx_op->output_chksum = comp_resp->curr_chksum;
+		}
+	}
+	*op = (void *)rx_op;
+
+	return 0;
+}
+
 unsigned int
 qat_comp_xform_size(void)
 {
diff --git a/drivers/compress/qat/qat_comp.h b/drivers/compress/qat/qat_comp.h
index 0f58a76..46105b4 100644
--- a/drivers/compress/qat/qat_comp.h
+++ b/drivers/compress/qat/qat_comp.h
@@ -10,6 +10,7 @@
 #include <rte_compressdev.h>
 #include <rte_compressdev_pmd.h>
 
+#include "qat_common.h"
 #include "icp_qat_hw.h"
 #include "icp_qat_fw_comp.h"
 #include "icp_qat_fw_la.h"
@@ -28,6 +29,13 @@ struct qat_comp_xform {
 	enum rte_comp_checksum_type checksum_type;
 };
 
+int
+qat_comp_build_request(void *in_op, uint8_t *out_msg, void *op_cookie,
+		       enum qat_device_gen qat_dev_gen __rte_unused);
+
+int
+qat_comp_process_response(void **op, uint8_t *resp);
+
 
 int
 qat_comp_private_xform_create(struct rte_compressdev *dev,
diff --git a/drivers/compress/qat/qat_comp_pmd.h b/drivers/compress/qat/qat_comp_pmd.h
index fd97cbf..cd04f11 100644
--- a/drivers/compress/qat/qat_comp_pmd.h
+++ b/drivers/compress/qat/qat_comp_pmd.h
@@ -10,6 +10,7 @@
 #include <rte_compressdev.h>
 #include <rte_compressdev_pmd.h>
 
+#include "qat_device.h"
 
 /** private data structure for a QAT compression device.
  * This QAT device is a device offering only a compression service,
-- 
2.7.4

  parent reply	other threads:[~2018-07-05 17:33 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 18:40 [dpdk-dev] [PATCH] compress/qat: add compression PMD Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 00/16] " Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 " Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 " Fiona Trahe
2018-07-11 11:56       ` [dpdk-dev] [PATCH v5 " Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 " Fiona Trahe
2018-07-13  2:28           ` [dpdk-dev] [PATCH v7 " Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 01/16] common/qat: updated firmware headers Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 02/16] compress/qat: add makefiles for PMD Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 03/16] compress/qat: add meson build Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 04/16] compress/qat: add xform processing Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 05/16] compress/qat: create FW request and process response Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 06/16] compress/qat: check that correct firmware is in use Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 07/16] compress/qat: add stats functions Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 08/16] compress/qat: setup queue-pairs for compression service Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 09/16] compress/qat: add fns to configure and clear device Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 10/16] compress/qat: add fn to return device info Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 11/16] compress/qat: add enqueue/dequeue functions Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 12/16] compress/qat: add device start and stop fns Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 13/16] compress/qat: create and populate the ops structure Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 14/16] compress/qat: add fns to create and destroy the PMD Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 15/16] compress/qat: prevent device usage if incorrect firmware Pablo de Lara
2018-07-13  2:28             ` [dpdk-dev] [PATCH v7 16/16] doc/qat: refactor docs adding compression guide Pablo de Lara
2018-07-13 14:22             ` [dpdk-dev] [PATCH v7 00/16] compress/qat: add compression PMD De Lara Guarch, Pablo
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 01/16] common/qat: updated firmware headers Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 02/16] compress/qat: add makefiles for PMD Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 03/16] compress/qat: add meson build Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 04/16] compress/qat: add xform processing Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 05/16] compress/qat: create fw request and process response Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 06/16] compress/qat: check that correct firmware is in use Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 07/16] compress/qat: add stats functions Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 08/16] compress/qat: setup queue-pairs for compression service Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 09/16] compress/qat: add fns to configure and clear device Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 10/16] compress/qat: add fn to return device info Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 11/16] compress/qat: add enqueue/dequeue functions Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 12/16] compress/qat: add device start and stop fns Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 13/16] compress/qat: create and populate the ops structure Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 14/16] compress/qat: add fns to create and destroy the PMD Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 15/16] compress/qat: prevent device usage if incorrect firmware Fiona Trahe
2018-07-12 16:04         ` [dpdk-dev] [PATCH v6 16/16] docs/qat: refactor docs adding compression guide Fiona Trahe
2018-07-11 11:56       ` [dpdk-dev] [PATCH v5 01/16] common/qat: updated firmware headers Fiona Trahe
2018-07-11 11:56       ` [dpdk-dev] [PATCH v5 02/16] compress/qat: add makefiles for PMD Fiona Trahe
2018-07-12 12:41         ` De Lara Guarch, Pablo
2018-07-11 11:56       ` [dpdk-dev] [PATCH v5 03/16] compress/qat: add meson build Fiona Trahe
2018-07-11 11:56       ` [dpdk-dev] [PATCH v5 04/16] compress/qat: add xform processing Fiona Trahe
2018-07-11 11:56       ` [dpdk-dev] [PATCH v5 05/16] compress/qat: create fw request and process response Fiona Trahe
2018-07-11 11:56       ` [dpdk-dev] [PATCH v5 06/16] compress/qat: check that correct firmware is in use Fiona Trahe
2018-07-11 11:57       ` [dpdk-dev] [PATCH v5 07/16] compress/qat: add stats functions Fiona Trahe
2018-07-11 11:57       ` [dpdk-dev] [PATCH v5 08/16] compress/qat: setup queue-pairs for compression service Fiona Trahe
2018-07-11 11:57       ` [dpdk-dev] [PATCH v5 09/16] compress/qat: add fns to configure and clear device Fiona Trahe
2018-07-11 11:57       ` [dpdk-dev] [PATCH v5 10/16] compress/qat: add fn to return device info Fiona Trahe
2018-07-11 11:57       ` [dpdk-dev] [PATCH v5 11/16] compress/qat: add enqueue/dequeue functions Fiona Trahe
2018-07-11 11:57       ` [dpdk-dev] [PATCH v5 12/16] compress/qat: add device start and stop fns Fiona Trahe
2018-07-11 11:57       ` [dpdk-dev] [PATCH v5 13/16] compress/qat: create and populate the ops structure Fiona Trahe
2018-07-11 11:57       ` [dpdk-dev] [PATCH v5 14/16] compress/qat: add fns to create and destroy the PMD Fiona Trahe
2018-07-11 11:57       ` [dpdk-dev] [PATCH v5 15/16] compress/qat: prevent device usage if incorrect firmware Fiona Trahe
2018-07-11 11:57       ` [dpdk-dev] [PATCH v5 16/16] docs/qat: refactor docs adding compression guide Fiona Trahe
2018-07-12 15:56         ` De Lara Guarch, Pablo
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 01/16] common/qat: updated firmware headers Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 02/16] compress/qat: add makefiles for PMD Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 03/16] compress/qat: add meson build Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 04/16] compress/qat: add xform processing Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 05/16] compress/qat: create fw request and process response Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 06/16] compress/qat: check that correct firmware is in use Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 07/16] compress/qat: add stats functions Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 08/16] compress/qat: setup queue-pairs for compression service Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 09/16] compress/qat: add fns to configure and clear device Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 10/16] compress/qat: add fn to return device info Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 11/16] compress/qat: add enqueue/dequeue functions Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 12/16] compress/qat: add device start and stop fns Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 13/16] compress/qat: create and populate the ops structure Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 14/16] compress/qat: add fns to create and destroy the PMD Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 15/16] compress/qat: prevent device usage if incorrect firmware Fiona Trahe
2018-07-10  0:41     ` [dpdk-dev] [PATCH v4 16/16] docs/qat: refactor docs adding compression guide Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 01/16] common/qat: updated firmware headers Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 02/16] compress/qat: add makefiles for PMD Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 03/16] compress/qat: add meson build Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 04/16] compress/qat: add xform processing Fiona Trahe
2018-07-05 17:32   ` Fiona Trahe [this message]
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 06/16] compress/qat: check that correct firmware is in use Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 07/16] compress/qat: add stats functions Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 08/16] compress/qat: setup queue-pairs for compression service Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 09/16] compress/qat: add fns to configure and clear device Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 10/16] compress/qat: add fn to return device info Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 11/16] compress/qat: add enqueue/dequeue functions Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 12/16] compress/qat: add device start and stop fns Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 13/16] compress/qat: create and populate the ops structure Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 14/16] compress/qat: add fns to create and destroy the PMD Fiona Trahe
2018-07-05 17:32   ` [dpdk-dev] [PATCH v3 15/16] compress/qat: prevent device usage if incorrect firmware Fiona Trahe
2018-07-05 17:33   ` [dpdk-dev] [PATCH v3 16/16] docs/qat: refactor docs adding compression guide Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 01/16] common/qat: updated firmware headers Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 02/16] compress/qat: add makefiles for PMD Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 03/16] compress/qat: add meson build Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 04/16] compress/qat: add xform processing Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 05/16] compress/qat: create fw request and process response Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 06/16] compress/qat: check that correct firmware is in use Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 07/16] compress/qat: add stats functions Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 08/16] compress/qat: setup queue-pairs for compression service Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 09/16] compress/qat: add fns to configure and clear device Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 10/16] compress/qat: add fn to return device info Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 11/16] compress/qat: add enqueue/dequeue functions Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 12/16] compress/qat: add device start and stop fns Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 13/16] compress/qat: create and populate the ops structure Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 14/16] compress/qat: add fns to create and destroy the PMD Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 15/16] compress/qat: prevent device usage if incorrect firmware Fiona Trahe
2018-07-05 16:05 ` [dpdk-dev] [PATCH v2 16/16] docs/qat: refactor docs adding compression guide Fiona Trahe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1530811980-24334-6-git-send-email-fiona.trahe@intel.com \
    --to=fiona.trahe@intel.com \
    --cc=dev@dpdk.org \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=tomaszx.jozwiak@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).