DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adam Dybkowski <adamx.dybkowski@intel.com>
To: dev@dpdk.org, fiona.trahe@intel.com, tomaszx.jozwiak@intel.com,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH] compress/qat: fixed overflow status return from qat pmd
Date: Tue, 21 May 2019 17:09:41 +0200	[thread overview]
Message-ID: <20190521150941.12689-1-adamx.dybkowski@intel.com> (raw)

This patch fixes fail status returned from compression PMD
in case destination buffer size in not enough to store
all data.

Fixes: 3dc9ef2d23fe ("compress/qat: fix returned status on overflow")
Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
---
 drivers/compress/qat/qat_comp.c | 21 +++++++++++++++++++++
 drivers/compress/qat/qat_comp.h |  2 ++
 2 files changed, 23 insertions(+)

diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c
index dd0fe1b..ef6cda5 100644
--- a/drivers/compress/qat/qat_comp.c
+++ b/drivers/compress/qat/qat_comp.c
@@ -170,6 +170,19 @@ qat_comp_build_request(void *in_op, uint8_t *out_msg,
 		    rte_pktmbuf_mtophys_offset(op->m_dst, op->dst.offset);
 	}
 
+	if (unlikely(rte_pktmbuf_pkt_len(op->m_dst) < QAT_MIN_OUT_BUF_SIZE)) {
+		/* QAT doesn't support dest. buffer lower
+		 * than QAT_MIN_OUT_BUF_SIZE. Propagate error mark
+		 * by converting this request to the null one
+		 * and check the status in the response.
+		 */
+		QAT_DP_LOG(ERR, "QAT dest. buffer overflow");
+		comp_req->comn_hdr.service_type = ICP_QAT_FW_COMN_REQ_NULL;
+		comp_req->comn_hdr.service_cmd_id = ICP_QAT_FW_NULL_REQ_SERV_ID;
+		op->status = RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED;
+	} else
+		op->status = RTE_COMP_OP_STATUS_SUCCESS;
+
 #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
 	QAT_DP_LOG(DEBUG, "Direction: %s",
 	    qat_xform->qat_comp_request_type == QAT_COMP_REQUEST_DECOMPRESS ?
@@ -201,6 +214,14 @@ qat_comp_process_response(void **op, uint8_t *resp, uint64_t *dequeue_err_count)
 			sizeof(struct icp_qat_fw_comp_resp));
 #endif
 
+	if (unlikely(rx_op->status != RTE_COMP_OP_STATUS_SUCCESS)) {
+		++(*dequeue_err_count);
+		rx_op->debug_status =
+			*((uint16_t *)(&resp_msg->comn_resp.comn_error));
+		*op = (void *)rx_op;
+		return 0;
+	}
+
 	if (likely(qat_xform->qat_comp_request_type
 			!= QAT_COMP_REQUEST_DECOMPRESS)) {
 		if (unlikely(ICP_QAT_FW_COMN_HDR_CNV_FLAG_GET(
diff --git a/drivers/compress/qat/qat_comp.h b/drivers/compress/qat/qat_comp.h
index 1312ee9..aadf01e 100644
--- a/drivers/compress/qat/qat_comp.h
+++ b/drivers/compress/qat/qat_comp.h
@@ -24,6 +24,8 @@
 /* fallback to fixed compression threshold */
 #define QAT_FALLBACK_THLD ((uint32_t)(RTE_PMD_QAT_COMP_IM_BUFFER_SIZE / 1.1))
 
+#define QAT_MIN_OUT_BUF_SIZE 47
+
 enum qat_comp_request_type {
 	QAT_COMP_REQUEST_FIXED_COMP_STATELESS,
 	QAT_COMP_REQUEST_DYNAMIC_COMP_STATELESS,
-- 
2.7.5


             reply	other threads:[~2019-05-21 15:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 15:09 Adam Dybkowski [this message]
2019-05-27 17:24 ` Trahe, Fiona
2019-07-05 17:15 ` [dpdk-dev] [PATCH v2] " Fiona Trahe
2019-07-18 12:47   ` Dybkowski, AdamX
2019-07-18 15:24     ` Akhil Goyal

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=20190521150941.12689-1-adamx.dybkowski@intel.com \
    --to=adamx.dybkowski@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=stable@dpdk.org \
    --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).