From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 04DC6A0567; Fri, 13 Mar 2020 13:37:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2BFE91BF97; Fri, 13 Mar 2020 13:37:11 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 647952BAA for ; Fri, 13 Mar 2020 13:37:09 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2020 05:37:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,548,1574150400"; d="scan'208";a="442409323" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 13 Mar 2020 05:37:07 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 13 Mar 2020 05:37:07 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 13 Mar 2020 05:37:07 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Fri, 13 Mar 2020 05:37:07 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.172) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 13 Mar 2020 05:37:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OVfJ4iZ8AT7nJJnNvpAxaEl7sfYCiCjpPd/tJpQTr3Jex9lR9pjdt1vD4ndICV+IOUwvVZ3qfIxkY86ZfkdrPFoaykX4ecnlHilwk404N1mGnNcp3lbyl84IYqU1XJBlZZV4BAnOpYsMimBUexU0hFIfTuQI3Pdk3mFvdWdbNQ8eOD+KXF0qhm9aQTEwp7I1YkIEHL1MX1/0Z0O3vQ68jorvhJiFdF6TyriJjZhS1s6gNycFLf5Cl8vAYzDInNXiEmdpAHNHNZUa1Y0YtBwDtPPF7Y0an0YXAvGQOaHCotFPj0HwmxOpV1mxf3aKHc3cqcRxxkjDAvGzUh4a6rgh+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N9+2nWTufqK7UpB3+S8lWdiyuHlHAlxUw9zxVC0aySo=; b=j05wNEvGJA7bXYWANtAPACY+kQlo9fea9kHo2kokdN0YDRrF7Ui3aQGInQh09P0NdXRq+XAqt6FaQLsC2BRSccvyL3MGbUSuD3ZuJEkgX5N128C9XttZ5kggcVoTRf+B6EQ/awbAMKaJ2OK7L0E3N4+fBDTzbhFoGS+7P8v+74Rb3utmc0tbvtC1iuv0MDd4CcHmK8SxWqeD3GzkTZBu3Ja8QMn43r5htr0gzds/Ntol4XXnuvyjPg+dPSf5bw+HW5dTYJ9Q1RkO4WPl+xMTbUzIFUxsTJ7ETUpcFhReRYMTnTDFJeolQ/qfw1pNPjmYTm+Z4EE7nt2bzUebAFsJ8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N9+2nWTufqK7UpB3+S8lWdiyuHlHAlxUw9zxVC0aySo=; b=ToRreU7Fn59mqlH9dNcsBK28pbK1oRRtHZLD2GcaMoaoVvYcmhdyrOY5435jgmugmnstZ8Fyzo8b/le5x+ADiyIczPAIV+YQvhHNOsmL2y4sHFVi2lazhhcbBcZL/Hc8SGnBB9VUxUwJl1yi25EFaarl1e3wVMAd9UApqb9I5u4= Received: from BN6PR11MB1796.namprd11.prod.outlook.com (2603:10b6:404:103::8) by BN6PR11MB1282.namprd11.prod.outlook.com (2603:10b6:404:4a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.16; Fri, 13 Mar 2020 12:37:04 +0000 Received: from BN6PR11MB1796.namprd11.prod.outlook.com ([fe80::4519:125f:2122:de07]) by BN6PR11MB1796.namprd11.prod.outlook.com ([fe80::4519:125f:2122:de07%3]) with mapi id 15.20.2793.018; Fri, 13 Mar 2020 12:37:04 +0000 From: "Trahe, Fiona" To: "Dybkowski, AdamX" , "dev@dpdk.org" , "akhil.goyal@nxp.com" CC: "Trahe, Fiona" Thread-Topic: [PATCH 1/2] common/qat: get version of QAT firmware Thread-Index: AQHV+Hh5YrOqTMYtfEiQI3ArxriT6qhGdCUw Date: Fri, 13 Mar 2020 12:37:04 +0000 Message-ID: References: <20200312141335.13392-1-adamx.dybkowski@intel.com> In-Reply-To: <20200312141335.13392-1-adamx.dybkowski@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: spf=none (sender IP is ) smtp.mailfrom=fiona.trahe@intel.com; x-originating-ip: [192.198.151.180] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dfdf1dea-40ac-4d52-e9d8-08d7c74b3c7b x-ms-traffictypediagnostic: BN6PR11MB1282: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 034119E4F6 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(366004)(39860400002)(136003)(396003)(346002)(199004)(66476007)(478600001)(66556008)(66446008)(64756008)(5660300002)(107886003)(316002)(76116006)(186003)(66946007)(4326008)(52536014)(110136005)(2906002)(6506007)(9686003)(81166006)(81156014)(53546011)(55016002)(33656002)(26005)(8676002)(8936002)(7696005)(86362001)(71200400001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR11MB1282; H:BN6PR11MB1796.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RQ0QpugNkOQgco2RPhsAl5joRh1jGb4KiZly/sLjWqbzA4CygUHfU31SNDBJKevPCjq3i2hSfNzdicWZViqwd2AHo2/ugVBv0lfZMGASAiRgBTX97vidmnJcvDncS3nimD5lz7iE5E2dWxz750Zy+Mky9rRWav1QO0k0SHhyu9TqHeJYn9h+dWvSwK3HvXGl/lu9iiIyhmHs9mnh/gJpT8UUnKdFkVoyU4vY8ik4+NhNoNwdLZuzrSOxNA3LHLzEg7DnoVtpmLJZG+7gbFYPF8vURHFCiRGdfGX3mBzsF8lqHmzEr8MOh/MvhXhbvvVec6n9uXWoUBI0BxCWQAb1/HaQpwcWL76JdRnbpwPeaZS/4mdTTNXuGd8dqA7Z0fcjJ2Jj5pjhP5XR4xdXlO9M0z85J4JFVX4jF74o1PXDqH+3er5Ox6zjV9VqFMCg5ME8 x-ms-exchange-antispam-messagedata: TDyMUJ/QDMOmWSvpIsLtES77T0YIa3HHruT4Uu1aL04TB0sXEwOkkTeha9MQBzaf6XoJ6PR+xoGMoC/VOqqTIasvK/6m4NbZEP1ERmaqhmb9gXoM87KdELvICFYo7xDGX8B7F5doRpmXa/K4X+hXiw== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: dfdf1dea-40ac-4d52-e9d8-08d7c74b3c7b X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Mar 2020 12:37:04.5563 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 764qtSEasE9VukTSJDpC059wWWdqfpvKGvlFHL3s+O2xOyOGZ5DXhDcuDlWG7cZ+452rdkoMFz57ulDY5yvQVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1282 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 1/2] common/qat: get version of QAT firmware 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" Hi Adam, > -----Original Message----- > From: Dybkowski, AdamX > Sent: Thursday, March 12, 2020 2:14 PM > To: dev@dpdk.org; Trahe, Fiona ; akhil.goyal@nxp.c= om > Cc: Dybkowski, AdamX > Subject: [PATCH 1/2] common/qat: get version of QAT firmware >=20 > This patch adds the function for retrieving QAT firmware > version, required to check the internal capabilities that > depend on the FW version. >=20 > Signed-off-by: Adam Dybkowski > --- > drivers/common/qat/qat_adf/icp_qat_fw.h | 2 + > drivers/common/qat/qat_qp.c | 89 +++++++++++++++++++++++++ > drivers/common/qat/qat_qp.h | 3 + > 3 files changed, 94 insertions(+) >=20 > diff --git a/drivers/common/qat/qat_adf/icp_qat_fw.h b/drivers/common/qat= /qat_adf/icp_qat_fw.h > index 1265c2a13..be10fc9bd 100644 > --- a/drivers/common/qat/qat_adf/icp_qat_fw.h > +++ b/drivers/common/qat/qat_adf/icp_qat_fw.h > @@ -121,6 +121,8 @@ struct icp_qat_fw_comn_resp { > #define ICP_QAT_FW_COMN_CNV_FLAG_MASK 0x1 > #define ICP_QAT_FW_COMN_CNVNR_FLAG_BITPOS 5 > #define ICP_QAT_FW_COMN_CNVNR_FLAG_MASK 0x1 > +#define ICP_QAT_FW_COMN_NULL_VERSION_FLAG_BITPOS 0 > +#define ICP_QAT_FW_COMN_NULL_VERSION_FLAG_MASK 0x1 >=20 > #define ICP_QAT_FW_COMN_OV_SRV_TYPE_GET(icp_qat_fw_comn_req_hdr_t) \ > icp_qat_fw_comn_req_hdr_t.service_type > diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c > index 9958789f0..93685aeb0 100644 > --- a/drivers/common/qat/qat_qp.c > +++ b/drivers/common/qat/qat_qp.c > @@ -19,6 +19,7 @@ > #include "qat_comp.h" > #include "adf_transport_access_macros.h" >=20 > +#define QAT_CQ_MAX_DEQ_RETRIES 10 >=20 > #define ADF_MAX_DESC 4096 > #define ADF_MIN_DESC 128 > @@ -695,6 +696,94 @@ qat_dequeue_op_burst(void *qp, void **ops, uint16_t = nb_ops) > return resp_counter; > } >=20 > +/* This is almost same as dequeue_op_burst, without the atomic, without = stats > + * and without the op. Dequeues one response. > + */ > +static uint8_t > +qat_cq_dequeue_response(struct qat_qp *qp, void *out_data) > +{ > + uint8_t result =3D 0; > + uint8_t retries =3D 0; > + struct qat_queue *queue =3D &(qp->rx_q); > + struct icp_qat_fw_comn_resp *resp_msg =3D (struct icp_qat_fw_comn_resp = *) > + ((uint8_t *)queue->base_addr + queue->head); > + > + while (retries++ < QAT_CQ_MAX_DEQ_RETRIES && > + *(uint32_t *)resp_msg =3D=3D ADF_RING_EMPTY_SIG) { > + /* loop waiting for response until we reach the timeout */ > + rte_delay_ms(20); > + } > + > + if (*(uint32_t *)resp_msg !=3D ADF_RING_EMPTY_SIG) { > + /* response received, check status flag */ > + if (ICP_QAT_FW_COMN_RESP_CRYPTO_STAT_GET( > + resp_msg->comn_hdr.comn_status) =3D=3D > + ICP_QAT_FW_COMN_STATUS_FLAG_OK) { > + /* success */ > + memcpy(out_data, resp_msg, queue->msg_size); > + result =3D 1; > + } > + [Fiona] Need to distinguish between the case where no response is received = (something bad happened - can't use this ring) and an error response is received - corner case, but could happen in some older fw= , so ok to assume the issue is only with this message and fw is otherwise ok. So just move the result =3D 1 outside the bracket and return 0 in out_data = in this case.=20 =20 > + queue->head =3D adf_modulo(queue->head + queue->msg_size, > + queue->modulo_mask); > + rxq_free_desc(qp, queue); > + } > + > + return result; > +} > + > +/* Sends a NULL message and extracts QAT fw version from the response. > + * Used to determine detailed capabilities based on the fw version numbe= r. > + * This assumes that there are no inflight messages, i.e. assumes there'= s space > + * on the qp, one message is sent and only one response collected. > + * Returns fw version number or a negative error code. [Fiona] update comment to include the 3rd possible outcome - 0 =3D don't kn= ow fw version. > + */ > +int > +qat_cq_get_fw_version(struct qat_qp *qp) > +{ > + struct qat_queue *queue =3D &(qp->tx_q); > + uint8_t *base_addr =3D (uint8_t *)queue->base_addr; > + struct icp_qat_fw_comn_req null_msg; > + struct icp_qat_fw_comn_resp response; > + > + /* prepare the NULL request */ > + memset(&null_msg, 0, sizeof(null_msg)); > + null_msg.comn_hdr.hdr_flags =3D > + ICP_QAT_FW_COMN_HDR_FLAGS_BUILD(ICP_QAT_FW_COMN_REQ_FLAG_SET); > + null_msg.comn_hdr.service_type =3D ICP_QAT_FW_COMN_REQ_NULL; > + null_msg.comn_hdr.service_cmd_id =3D ICP_QAT_FW_NULL_REQ_SERV_ID; > + > +#if RTE_LOG_DP_LEVEL >=3D RTE_LOG_DEBUG > + QAT_DP_HEXDUMP_LOG(DEBUG, "NULL request", &null_msg, sizeof(null_msg)); > +#endif > + > + /* send the NULL request */ > + memcpy(base_addr + queue->tail, &null_msg, sizeof(null_msg)); > + queue->tail =3D adf_modulo(queue->tail + queue->msg_size, > + queue->modulo_mask); > + txq_write_tail(qp, queue); > + > + /* receive a response */ > + memset(&response, 0, sizeof(response)); > + if (qat_cq_dequeue_response(qp, &response)) { > + > +#if RTE_LOG_DP_LEVEL >=3D RTE_LOG_DEBUG > + QAT_DP_HEXDUMP_LOG(DEBUG, "NULL response:", &response, > + sizeof(response)); > +#endif > + /* if LW0 bit 24 is set - then the fw version was returned */ > + if (QAT_FIELD_GET(response.comn_hdr.hdr_flags, > + ICP_QAT_FW_COMN_NULL_VERSION_FLAG_BITPOS, > + ICP_QAT_FW_COMN_NULL_VERSION_FLAG_MASK)) > + return response.resrvd[0]; /* return LW4 */ > + else > + return 0; /* not set - we don't know fw version */ > + } > + > + QAT_LOG(ERR, "No response received"); > + return -EINVAL; > +} > + > __rte_weak int > qat_comp_process_response(void **op __rte_unused, uint8_t *resp __rte_un= used, > void *op_cookie __rte_unused, > diff --git a/drivers/common/qat/qat_qp.h b/drivers/common/qat/qat_qp.h > index 0b95ea3c9..47ad5dd20 100644 > --- a/drivers/common/qat/qat_qp.h > +++ b/drivers/common/qat/qat_qp.h > @@ -103,6 +103,9 @@ int > qat_qps_per_service(const struct qat_qp_hw_data *qp_hw_data, > enum qat_service_type service); >=20 > +int > +qat_cq_get_fw_version(struct qat_qp *qp); > + > /* Needed for weak function*/ > int > qat_comp_process_response(void **op __rte_unused, uint8_t *resp __rte_un= used, > -- > 2.17.1