DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
To: dev@dpdk.org, fiona.trahe@intel.com, tomaszx.jozwiak@intel.com
Subject: [dpdk-dev] [PATCH] compress/qat: add fallback to fixed compression
Date: Fri, 15 Feb 2019 10:44:32 +0100	[thread overview]
Message-ID: <1550223873-17119-2-git-send-email-tomaszx.jozwiak@intel.com> (raw)
In-Reply-To: <1550223873-17119-1-git-send-email-tomaszx.jozwiak@intel.com>

This patch adds fallback to fixed compression
feature during dynamic compression, when the input data size
is greater than IM buffer size / 1.1. This feature doesn't
stop compression proccess when IM buffer can be too small
to handle produced data.

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
 doc/guides/cryptodevs/qat.rst   | 10 +++++-----
 drivers/compress/qat/qat_comp.c | 24 ++++++++++++++++++++++++
 drivers/compress/qat/qat_comp.h |  3 +++
 3 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index b079aa3..907c2a9 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -188,11 +188,11 @@ allocated while for GEN1 devices, 12 buffers are allocated, plus 1472 bytes over
 
 	If the compressed output of a Deflate operation using Dynamic Huffman
         Encoding is too big to fit in an intermediate buffer, then the
-        operation will return RTE_COMP_OP_STATUS_ERROR and an error will be
-        displayed. Options for the application in this case
-        are to split the input data into smaller chunks and resubmit
-        in multiple operations or to configure QAT with
-        larger intermediate buffers.
+	operation will fall back to fixed compression rather than failing the operation.
+	To avoid this less performant case, applications should configure
+	the intermediate buffer size to be larger than the expected input data size
+	(compressed output size is usually unknown, so the only option is to make
+	larger than the input size).
 
 
 Device and driver naming
diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c
index 32ca753..b9367d3 100644
--- a/drivers/compress/qat/qat_comp.c
+++ b/drivers/compress/qat/qat_comp.c
@@ -43,6 +43,30 @@ qat_comp_build_request(void *in_op, uint8_t *out_msg,
 	rte_mov128(out_msg, tmpl);
 	comp_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)op;
 
+	if (likely(qat_xform->qat_comp_request_type ==
+		    QAT_COMP_REQUEST_DYNAMIC_COMP_STATELESS)) {
+		if (unlikely(op->src.length > QAT_FALLBACK_THLD)) {
+
+			/* fallback to fixed compression */
+			comp_req->comn_hdr.service_cmd_id =
+					ICP_QAT_FW_COMP_CMD_STATIC;
+
+			ICP_QAT_FW_COMN_NEXT_ID_SET(&comp_req->comp_cd_ctrl,
+					ICP_QAT_FW_SLICE_DRAM_WR);
+
+			ICP_QAT_FW_COMN_NEXT_ID_SET(&comp_req->u2.xlt_cd_ctrl,
+					ICP_QAT_FW_SLICE_NULL);
+			ICP_QAT_FW_COMN_CURR_ID_SET(&comp_req->u2.xlt_cd_ctrl,
+					ICP_QAT_FW_SLICE_NULL);
+
+			QAT_DP_LOG(DEBUG, "QAT PMD: fallback to fixed "
+				   "compression! IM buffer size can be too low "
+				   "for produced data.\n Please use input "
+				   "buffer length lower than %d bytes",
+				   QAT_FALLBACK_THLD);
+		}
+	}
+
 	/* 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) -
diff --git a/drivers/compress/qat/qat_comp.h b/drivers/compress/qat/qat_comp.h
index 19f48df..12b37b1 100644
--- a/drivers/compress/qat/qat_comp.h
+++ b/drivers/compress/qat/qat_comp.h
@@ -21,6 +21,9 @@
 
 #define ERR_CODE_QAT_COMP_WRONG_FW -99
 
+/* fallback to fixed compression threshold */
+#define QAT_FALLBACK_THLD ((uint32_t)(RTE_PMD_QAT_COMP_IM_BUFFER_SIZE / 1.1))
+
 enum qat_comp_request_type {
 	QAT_COMP_REQUEST_FIXED_COMP_STATELESS,
 	QAT_COMP_REQUEST_DYNAMIC_COMP_STATELESS,
-- 
2.7.4

  reply	other threads:[~2019-02-15  9:44 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15  9:44 [dpdk-dev] [PATCH] compress/qat: add dynamic sgl allocation Tomasz Jozwiak
2019-02-15  9:44 ` Tomasz Jozwiak [this message]
2019-02-15 17:01   ` [dpdk-dev] [PATCH] compress/qat: add fallback to fixed compression Trahe, Fiona
2019-03-19 14:04     ` Akhil Goyal
2019-03-19 14:04       ` Akhil Goyal
2019-02-15  9:44 ` [dpdk-dev] [PATCH] test/compress: add max mbuf size test case Tomasz Jozwiak
2019-03-27 14:02   ` Akhil Goyal
2019-03-27 14:02     ` Akhil Goyal
2019-04-02 12:16   ` [dpdk-dev] [PATCH v2 0/1] " Tomasz Cel
2019-04-02 12:16     ` Tomasz Cel
2019-04-02 12:16     ` [dpdk-dev] [PATCH v2 1/1] test/compress: " Tomasz Cel
2019-04-02 12:16       ` Tomasz Cel
2019-04-02 12:22       ` Cel, TomaszX
2019-04-02 12:22         ` Cel, TomaszX
2019-04-18 22:42         ` Yongseok Koh
2019-04-18 22:42           ` Yongseok Koh
2019-04-19  9:07           ` Thomas Monjalon
2019-04-19  9:07             ` Thomas Monjalon
2019-04-19  9:25             ` David Marchand
2019-04-19  9:25               ` David Marchand
2019-04-19  9:30               ` Thomas Monjalon
2019-04-19  9:30                 ` Thomas Monjalon
2019-04-19  9:32                 ` Jozwiak, TomaszX
2019-04-19  9:32                   ` Jozwiak, TomaszX
2019-04-19  9:39                   ` David Marchand
2019-04-19  9:39                     ` David Marchand
2019-04-19  9:58           ` Jozwiak, TomaszX
2019-04-19  9:58             ` Jozwiak, TomaszX
2019-04-16 14:53     ` [dpdk-dev] [PATCH v2 0/1] " Akhil Goyal
2019-04-16 14:53       ` Akhil Goyal
2019-03-01 11:00 ` [dpdk-dev] [PATCH v2] add dynamic sgl allocation Tomasz Jozwiak
2019-03-01 11:00   ` [dpdk-dev] [PATCH v2] compress/qat: " Tomasz Jozwiak
2019-03-01 11:17 ` [dpdk-dev] [PATCH v3 0/1] " Tomasz Jozwiak
2019-03-01 11:17   ` [dpdk-dev] [PATCH v3 1/1] compress/qat: " Tomasz Jozwiak
2019-03-07 12:02   ` [dpdk-dev] [PATCH v4 0/1] " Tomasz Jozwiak
2019-03-07 12:02     ` [dpdk-dev] [PATCH v4 1/1] compress/qat: " Tomasz Jozwiak
2019-03-07 18:58       ` Trahe, Fiona
2019-03-17 18:00       ` Akhil Goyal
2019-03-17 18:00         ` Akhil Goyal
2019-03-18  8:12         ` Jozwiak, TomaszX
2019-03-18  8:12           ` Jozwiak, TomaszX
2019-03-18  8:23           ` arpita das
2019-03-18  8:23             ` arpita das
2019-03-26 13:51     ` [dpdk-dev] [PATCH v5 0/1] " Tomasz Jozwiak
2019-03-26 13:51       ` Tomasz Jozwiak
2019-03-26 13:51       ` [dpdk-dev] [PATCH v5 1/1] compress/qat: " Tomasz Jozwiak
2019-03-26 13:51         ` Tomasz Jozwiak
2019-03-28 14:37         ` Trahe, Fiona
2019-03-28 14:37           ` Trahe, Fiona
2019-03-29 14:40           ` Akhil Goyal
2019-03-29 14:40             ` Akhil Goyal
2019-04-03  8:39             ` Akhil Goyal
2019-04-03  8:39               ` 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=1550223873-17119-2-git-send-email-tomaszx.jozwiak@intel.com \
    --to=tomaszx.jozwiak@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@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).