From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id AD1FD4C9C; Thu, 27 Dec 2018 11:42:24 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Dec 2018 02:42:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,404,1539673200"; d="scan'208";a="133164526" Received: from tjozwiax-mobl.ger.corp.intel.com (HELO tojo-Virtual-Machine.mshome.net) ([10.103.104.47]) by fmsmga001.fm.intel.com with ESMTP; 27 Dec 2018 02:42:22 -0800 From: Tomasz Jozwiak To: dev@dpdk.org, fiona.trahe@intel.com, tomaszx.jozwiak@intel.com, akhil.goyal@nxp.com, stable@dpdk.org Date: Thu, 27 Dec 2018 11:42:19 +0100 Message-Id: <1545907339-16639-2-git-send-email-tomaszx.jozwiak@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545907339-16639-1-git-send-email-tomaszx.jozwiak@intel.com> References: <1545383571-13224-1-git-send-email-tomaszx.jozwiak@intel.com> <1545907339-16639-1-git-send-email-tomaszx.jozwiak@intel.com> Subject: [dpdk-dev] [PATCH v2] compress/qat: fix return correct status on qat overflow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Dec 2018 10:42:25 -0000 This patch fixes correct status in case of overflow on QAT is detected. In that case RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED value is set in rte_comp_op.status field instead of RTE_COMP_OP_STATUS_ERROR Fixes: 32842f2a6d7d ("compress/qat: create FW request and process response") Cc: stable@dpdk.org Signed-off-by: Tomasz Jozwiak --- drivers/compress/qat/qat_comp.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c index bb00610..450cfd6 100644 --- a/drivers/compress/qat/qat_comp.c +++ b/drivers/compress/qat/qat_comp.c @@ -117,6 +117,9 @@ qat_comp_process_response(void **op, uint8_t *resp, uint64_t *dequeue_err_count) (resp_msg->opaque_data); struct qat_comp_xform *qat_xform = (struct qat_comp_xform *) (rx_op->private_xform); + int err = resp_msg->comn_resp.comn_status & + ((1 << QAT_COMN_RESP_CMP_STATUS_BITPOS) | + (1 << QAT_COMN_RESP_XLAT_STATUS_BITPOS)); #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG QAT_DP_LOG(DEBUG, "Direction: %s", @@ -140,21 +143,31 @@ qat_comp_process_response(void **op, uint8_t *resp, uint64_t *dequeue_err_count) } } - 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) { - - if (unlikely((ICP_QAT_FW_COMN_RESP_XLAT_STAT_GET( - resp_msg->comn_resp.comn_status) != - ICP_QAT_FW_COMN_STATUS_FLAG_OK) && - (qat_xform->qat_comp_request_type - == QAT_COMP_REQUEST_DYNAMIC_COMP_STATELESS))) + if (err) { + if (unlikely((err & (1 << QAT_COMN_RESP_XLAT_STATUS_BITPOS)) + && (qat_xform->qat_comp_request_type + == QAT_COMP_REQUEST_DYNAMIC_COMP_STATELESS))) { QAT_DP_LOG(ERR, "QAT intermediate buffer may be too " "small for output, try configuring a larger size"); + } + + int8_t cmp_err_code = + (int8_t)resp_msg->comn_resp.comn_error.cmp_err_code; + int8_t xlat_err_code = + (int8_t)resp_msg->comn_resp.comn_error.xlat_err_code; + + if ((cmp_err_code == ERR_CODE_OVERFLOW_ERROR && !xlat_err_code) + || + (!cmp_err_code && xlat_err_code == ERR_CODE_OVERFLOW_ERROR) + || + (cmp_err_code == ERR_CODE_OVERFLOW_ERROR && + xlat_err_code == ERR_CODE_OVERFLOW_ERROR)) + rx_op->status = + RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED; + else + rx_op->status = RTE_COMP_OP_STATUS_ERROR; ++(*dequeue_err_count); - rx_op->status = RTE_COMP_OP_STATUS_ERROR; rx_op->debug_status = *((uint16_t *)(&resp_msg->comn_resp.comn_error)); } else { -- 2.7.4