From patchwork Thu Jul 12 16:04:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fiona Trahe X-Patchwork-Id: 42988 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D7EEF1B4FD; Thu, 12 Jul 2018 18:05:34 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 166E91B4F0 for ; Thu, 12 Jul 2018 18:05:32 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2018 09:05:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,343,1526367600"; d="scan'208";a="245184186" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by fmsmga006.fm.intel.com with ESMTP; 12 Jul 2018 09:05:17 -0700 From: Fiona Trahe To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com, fiona.trahe@intel.com, tomaszx.jozwiak@intel.com Date: Thu, 12 Jul 2018 17:04:49 +0100 Message-Id: <1531411499-13156-7-git-send-email-fiona.trahe@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1531310229-17448-1-git-send-email-fiona.trahe@intel.com> References: <1531310229-17448-1-git-send-email-fiona.trahe@intel.com> Subject: [dpdk-dev] [PATCH v6 06/16] compress/qat: check that correct firmware is in use 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Check bit in response message to verify that correct firmware is in use for compression. If not return an error. Signed-off-by: Fiona Trahe Signed-off-by: Tomasz Jozwiak --- drivers/compress/qat/qat_comp.c | 16 +++++++++++++++- drivers/compress/qat/qat_comp.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c index a32d6ef..e8019eb 100644 --- a/drivers/compress/qat/qat_comp.c +++ b/drivers/compress/qat/qat_comp.c @@ -2,7 +2,6 @@ * Copyright(c) 2018 Intel Corporation */ - #include #include #include @@ -79,6 +78,8 @@ qat_comp_process_response(void **op, uint8_t *resp) (struct icp_qat_fw_comp_resp *)resp; 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 *) + (rx_op->private_xform); #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG QAT_DP_LOG(DEBUG, "Direction: %s", @@ -88,6 +89,19 @@ qat_comp_process_response(void **op, uint8_t *resp) sizeof(struct icp_qat_fw_comp_resp)); #endif + if (likely(qat_xform->qat_comp_request_type + != QAT_COMP_REQUEST_DECOMPRESS)) { + if (unlikely(ICP_QAT_FW_COMN_HDR_CNV_FLAG_GET( + resp_msg->comn_resp.hdr_flags) + == ICP_QAT_FW_COMP_NO_CNV)) { + rx_op->status = RTE_COMP_OP_STATUS_ERROR; + rx_op->debug_status = ERR_CODE_QAT_COMP_WRONG_FW; + *op = (void *)rx_op; + QAT_DP_LOG(ERR, "QAT has wrong firmware"); + return 0; + } + } + 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)) != diff --git a/drivers/compress/qat/qat_comp.h b/drivers/compress/qat/qat_comp.h index 46105b4..937f3c8 100644 --- a/drivers/compress/qat/qat_comp.h +++ b/drivers/compress/qat/qat_comp.h @@ -15,6 +15,8 @@ #include "icp_qat_fw_comp.h" #include "icp_qat_fw_la.h" +#define ERR_CODE_QAT_COMP_WRONG_FW -99 + enum qat_comp_request_type { QAT_COMP_REQUEST_FIXED_COMP_STATELESS, QAT_COMP_REQUEST_DYNAMIC_COMP_STATELESS,