DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] compress/qat: fixed overflow status return from qat pmd
@ 2019-05-21 15:09 Adam Dybkowski
  2019-05-27 17:24 ` Trahe, Fiona
  2019-07-05 17:15 ` [dpdk-dev] [PATCH v2] " Fiona Trahe
  0 siblings, 2 replies; 5+ messages in thread
From: Adam Dybkowski @ 2019-05-21 15:09 UTC (permalink / raw)
  To: dev, fiona.trahe, tomaszx.jozwiak, stable

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] compress/qat: fixed overflow status return from qat pmd
  2019-05-21 15:09 [dpdk-dev] [PATCH] compress/qat: fixed overflow status return from qat pmd Adam Dybkowski
@ 2019-05-27 17:24 ` Trahe, Fiona
  2019-07-05 17:15 ` [dpdk-dev] [PATCH v2] " Fiona Trahe
  1 sibling, 0 replies; 5+ messages in thread
From: Trahe, Fiona @ 2019-05-27 17:24 UTC (permalink / raw)
  To: Dybkowski, AdamX, dev, Jozwiak, TomaszX, stable; +Cc: Trahe, Fiona



> -----Original Message-----
> From: Dybkowski, AdamX
> Sent: Tuesday, May 21, 2019 4:10 PM
> To: dev@dpdk.org; Trahe, Fiona <fiona.trahe@intel.com>; Jozwiak, TomaszX
> <tomaszx.jozwiak@intel.com>; stable@dpdk.org
> Subject: [PATCH] compress/qat: fixed overflow status return from qat pmd
> 
> 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>
> ---
Nack - we'll send a v2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] compress/qat: fixed overflow status return from qat pmd
  2019-05-21 15:09 [dpdk-dev] [PATCH] compress/qat: fixed overflow status return from qat pmd Adam Dybkowski
  2019-05-27 17:24 ` Trahe, Fiona
@ 2019-07-05 17:15 ` Fiona Trahe
  2019-07-18 12:47   ` Dybkowski, AdamX
  1 sibling, 1 reply; 5+ messages in thread
From: Fiona Trahe @ 2019-07-05 17:15 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, arturx.trybula, tjozwiakgm, fiona.trahe

From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>

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

Fixes: 3dc9ef2d23fe ("compress/qat: fix returned status on overflow")
Cc: stable@dpdk.org

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
---
 drivers/common/qat/qat_qp.c         |  4 +++-
 drivers/common/qat/qat_qp.h         |  3 ++-
 drivers/compress/qat/qat_comp.c     | 28 +++++++++++++++++++++++++++-
 drivers/compress/qat/qat_comp.h     |  5 ++++-
 drivers/compress/qat/qat_comp_pmd.c |  2 ++
 5 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 131215296..03f11f869 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -651,7 +651,8 @@ qat_dequeue_op_burst(void *qp, void **ops, uint16_t nb_ops)
 			qat_sym_process_response(ops, resp_msg);
 		else if (tmp_qp->service_type == QAT_SERVICE_COMPRESSION)
 			qat_comp_process_response(ops, resp_msg,
-					&tmp_qp->stats.dequeue_err_count);
+				tmp_qp->op_cookies[head / rx_queue->msg_size],
+				&tmp_qp->stats.dequeue_err_count);
 		else if (tmp_qp->service_type == QAT_SERVICE_ASYMMETRIC) {
 #ifdef BUILD_QAT_ASYM
 			qat_asym_process_response(ops, resp_msg,
@@ -686,6 +687,7 @@ qat_dequeue_op_burst(void *qp, void **ops, uint16_t nb_ops)
 
 __rte_weak int
 qat_comp_process_response(void **op __rte_unused, uint8_t *resp __rte_unused,
+			  void *op_cookie __rte_unused,
 			  uint64_t *dequeue_err_count __rte_unused)
 {
 	return  0;
diff --git a/drivers/common/qat/qat_qp.h b/drivers/common/qat/qat_qp.h
index 9833bcbd8..980c2ba32 100644
--- a/drivers/common/qat/qat_qp.h
+++ b/drivers/common/qat/qat_qp.h
@@ -108,6 +108,7 @@ qat_qps_per_service(const struct qat_qp_hw_data *qp_hw_data,
 /* Needed for weak function*/
 int
 qat_comp_process_response(void **op __rte_unused, uint8_t *resp __rte_unused,
-			  uint64_t *dequeue_err_count);
+			  void *op_cookie __rte_unused,
+			  uint64_t *dequeue_err_count __rte_unused);
 
 #endif /* _QAT_QP_H_ */
diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c
index dd0fe1b34..835aaa838 100644
--- a/drivers/compress/qat/qat_comp.c
+++ b/drivers/compress/qat/qat_comp.c
@@ -170,6 +170,18 @@ 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(WARNING, "QAT destination buffer too small - resend with larger buffer");
+		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;
+		cookie->error = RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED;
+	}
+
 #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
 	QAT_DP_LOG(DEBUG, "Direction: %s",
 	    qat_xform->qat_comp_request_type == QAT_COMP_REQUEST_DECOMPRESS ?
@@ -181,10 +193,13 @@ qat_comp_build_request(void *in_op, uint8_t *out_msg,
 }
 
 int
-qat_comp_process_response(void **op, uint8_t *resp, uint64_t *dequeue_err_count)
+qat_comp_process_response(void **op, uint8_t *resp, void *op_cookie,
+			  uint64_t *dequeue_err_count)
 {
 	struct icp_qat_fw_comp_resp *resp_msg =
 			(struct icp_qat_fw_comp_resp *)resp;
+	struct qat_comp_op_cookie *cookie =
+			(struct qat_comp_op_cookie *)op_cookie;
 	struct rte_comp_op *rx_op = (struct rte_comp_op *)(uintptr_t)
 			(resp_msg->opaque_data);
 	struct qat_comp_xform *qat_xform = (struct qat_comp_xform *)
@@ -201,6 +216,17 @@ qat_comp_process_response(void **op, uint8_t *resp, uint64_t *dequeue_err_count)
 			sizeof(struct icp_qat_fw_comp_resp));
 #endif
 
+	if (unlikely(cookie->error)) {
+		rx_op->status = cookie->error;
+		cookie->error = 0;
+		++(*dequeue_err_count);
+		rx_op->debug_status = 0;
+		rx_op->consumed = 0;
+		rx_op->produced = 0;
+		*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 1312ee93b..61d12ecf4 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 46
+
 enum qat_comp_request_type {
 	QAT_COMP_REQUEST_FIXED_COMP_STATELESS,
 	QAT_COMP_REQUEST_DYNAMIC_COMP_STATELESS,
@@ -45,6 +47,7 @@ struct qat_comp_op_cookie {
 	phys_addr_t qat_sgl_src_phys_addr;
 	phys_addr_t qat_sgl_dst_phys_addr;
 	/* dynamically created SGLs */
+	uint8_t error;
 	uint8_t socket_id;
 	uint16_t src_nb_elems;
 	uint16_t dst_nb_elems;
@@ -63,7 +66,7 @@ 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,
+qat_comp_process_response(void **op, uint8_t *resp, void *op_cookie,
 			  uint64_t *dequeue_err_count);
 
 int
diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index 1d9d72e8f..072647217 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -168,6 +168,8 @@ qat_comp_qp_setup(struct rte_compressdev *dev, uint16_t qp_id,
 				QAT_PMD_COMP_SGL_DEF_SEGMENTS;
 
 		cookie->socket_id = dev->data->socket_id;
+
+		cookie->error = 0;
 	}
 
 	return ret;
-- 
2.13.6


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] compress/qat: fixed overflow status return from qat pmd
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Dybkowski, AdamX @ 2019-07-18 12:47 UTC (permalink / raw)
  To: Trahe, Fiona, dev; +Cc: akhil.goyal, Trybula, ArturX, tjozwiakgm, Trahe, Fiona

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fiona Trahe
> Sent: Friday, 5 July, 2019 19:16
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Trybula, ArturX <arturx.trybula@intel.com>;
> tjozwiakgm@gmail.com; Trahe, Fiona <fiona.trahe@intel.com>
> Subject: [dpdk-dev] [PATCH v2] compress/qat: fixed overflow status return
> from qat pmd
> 
> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> 
> This patch fixes fail status returned from compression PMD in case
> destination buffer size is not enough to store all data.
> 
> Fixes: 3dc9ef2d23fe ("compress/qat: fix returned status on overflow")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
> ---

Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] compress/qat: fixed overflow status return from qat pmd
  2019-07-18 12:47   ` Dybkowski, AdamX
@ 2019-07-18 15:24     ` Akhil Goyal
  0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2019-07-18 15:24 UTC (permalink / raw)
  To: Dybkowski, AdamX, Trahe, Fiona, dev
  Cc: Trybula, ArturX, tjozwiakgm, Trahe, Fiona



> >
> > From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> >
> > This patch fixes fail status returned from compression PMD in case
> > destination buffer size is not enough to store all data.
> >
> > Fixes: 3dc9ef2d23fe ("compress/qat: fix returned status on overflow")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> > Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
> > ---
> 
> Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>

Applied to dpdk-next-crypto

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-18 15:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 15:09 [dpdk-dev] [PATCH] compress/qat: fixed overflow status return from qat pmd Adam Dybkowski
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

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).