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 5247FA0471 for ; Fri, 19 Jul 2019 14:35:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D4CA01B9CD; Fri, 19 Jul 2019 14:34:04 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 5D4B41B956 for ; Fri, 19 Jul 2019 14:33:47 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6JCQVM6013467 for ; Fri, 19 Jul 2019 05:33:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=BopgPuU9BTudWZosKkdIPK8sB/pDodrDjPPkbRBlUqc=; b=LC4I4IT+Eaz/bW2mCPSr5YRwQObYbacNlPIihx7zx8n7iUCY7Q1oHQ1KPybjBxyNFiiR rT6cVztczgxhBPvvn3n1kQ0cdJY6iroo2lIwyH38VMiaFtD9CF6ZLK5MYvnMpn0INqgJ 5iysoJCVH5dJb6XZrK5r+7H4Yusd8I8eJNfffHE92YdMV6rRkEGq1vsSE5EIMeOBHdPS 5/iDRFuWIr1DBD73nkY0IucDaP7qJ2YMmVWs8zwkRG480q55W00CtGBFcp8qpXYiPbIZ mhe04AnxITA6udMbAcP4o30Lgtqi5Yza7ZlvJuZ5+Ao+3PrB49ZwfwYjkXSFOxdfFM0I bg== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2ts07vse64-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 19 Jul 2019 05:33:46 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 19 Jul 2019 05:33:45 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (104.47.42.50) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 19 Jul 2019 05:33:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bECMGCyFwXdw6a76bAmfxDaaZXhVwKlqc+4y4GAUlpfZgYRpchlQieZh/xlmyjJ/DQr98lRTF2jpqW4x5pXQC/KnEjtOCcZh/0l6ypsuQ0Qt2YiAqLRZgvCkE2NUabP4DzqixYPjozJxI3HeRbji0/MKAY9Y85XRB0Rz+i81CPagZZ/kgo65cQ2wVK2uys4G6r8iQoFf7sN1Pf7pWw2g5X9xvICtHwdRsuGjclj/orXePqTA1aQFtQrQdof7Llubfcruj+yKcr5YxZCPdz9Fln25hFjQGZcoHNcQqPN+OIrkOORGgwrrRswIF2N7nCkhe74M++2MKk4zm4o3VQdg/w== 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=BopgPuU9BTudWZosKkdIPK8sB/pDodrDjPPkbRBlUqc=; b=Y5uOKGiFVBYbkTlO5iSJn/ANzbOXpZUCDNjASrKSRGDxhBWTOAFHaN0lgLlI98YS939nLpLsxOTtnaNIZ2IL8RMpZe5VqtTcu0hPl/8GPCu+CJi0NDFtby0x+qAvrtlE1jeBpRbYMYeh4Y2gdkhRshsYEvUOSPdQa8pEtwjiATdgmhcFoPr72VPcVJWZmKqdyZ8SQuRbFsqWkwroZzTeeZMfd2lQve0d6NibaVO317wvbfPwpcrVL1UzNzbmJTk6lK8e7JwNRBWqXKxtt6XT5HqBkcoreQS3H+L/IK6cLltautCp0x6k3wNP6zf6udZgszFbKezI5pNoccue7jY+Yg== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=marvell.com;dmarc=pass action=none header.from=marvell.com;dkim=pass header.d=marvell.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BopgPuU9BTudWZosKkdIPK8sB/pDodrDjPPkbRBlUqc=; b=lSanHi5U3Zls30UOPT24K6kFN5tdwEkBc3TxvIu7npgKj2cO4Li2oC1J3lCvygto+a0v/EcdagPYVLYPgR7t0LO1hAQCFu3lGoMLaIB+foqOx2eVFrWlUlDDqbHlAhuXhZH5u7e3amPEjKXizg/wdc7CWPa2Bayi/QvDnyOFF/k= Received: from MN2PR18MB2797.namprd18.prod.outlook.com (20.179.22.16) by MN2PR18MB2527.namprd18.prod.outlook.com (20.179.82.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.14; Fri, 19 Jul 2019 12:33:44 +0000 Received: from MN2PR18MB2797.namprd18.prod.outlook.com ([fe80::5d53:ac2e:80ec:cd8f]) by MN2PR18MB2797.namprd18.prod.outlook.com ([fe80::5d53:ac2e:80ec:cd8f%6]) with mapi id 15.20.2094.011; Fri, 19 Jul 2019 12:33:44 +0000 From: Nagadheeraj Rottela To: "dev@dpdk.org" CC: Srikanth Jampala , Nagadheeraj Rottela Thread-Topic: [PATCH v2 08/10] crypto/nitrox: add burst enqueue and dequeue operations Thread-Index: AQHVPi4zMoPjfO6JJ0WP7m84w+HMCg== Date: Fri, 19 Jul 2019 12:33:43 +0000 Message-ID: <20190719123309.24417-9-rnagadheeraj@marvell.com> References: <20190717052837.647-1-rnagadheeraj@marvell.com> <20190719123309.24417-1-rnagadheeraj@marvell.com> In-Reply-To: <20190719123309.24417-1-rnagadheeraj@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0048.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::34) To MN2PR18MB2797.namprd18.prod.outlook.com (2603:10b6:208:a0::16) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.13.6 x-originating-ip: [115.113.156.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 67a533fe-0caa-4f35-40b2-08d70c455661 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:MN2PR18MB2527; x-ms-traffictypediagnostic: MN2PR18MB2527: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:119; x-forefront-prvs: 01039C93E4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(346002)(39860400002)(396003)(366004)(376002)(199004)(189003)(2616005)(6486002)(107886003)(36756003)(486006)(5660300002)(316002)(99286004)(30864003)(6116002)(14454004)(102836004)(1076003)(476003)(86362001)(6916009)(6512007)(5640700003)(8936002)(76176011)(53936002)(186003)(26005)(54906003)(6436002)(2501003)(8676002)(81166006)(1730700003)(81156014)(478600001)(3846002)(66476007)(66446008)(64756008)(52116002)(25786009)(68736007)(50226002)(4326008)(2906002)(66946007)(71200400001)(446003)(71190400001)(11346002)(14444005)(66066001)(55236004)(2351001)(7736002)(6506007)(305945005)(66556008)(256004)(386003); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2527; H:MN2PR18MB2797.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 86M0HUVRwrpBklNL178KVjEzF+fnLDfdb+KTxnmXxKZcoMcn35sKK1G7L/B+b3p5xOqhjhwauqCYD8VM2N3l15gdBxX0Fze7WTD6SgoN+yTYX5GtGzANDHX0GfOwYktSZ6H4J5Gsm7Stugs0/afZf/OhSwJBlEwEvYDmitc6RnhS9goLsXiGgEJWDSqDP/IQ6nEKhLb1Vd3oYIWJpGRgqWgKMGf9gbvDcCqWAK7YYQoMQ+5aorthPK5RoobJ1SYG7mHCJ/p870po72cyp1loOCIw0NgemIEvEhKcMNNRLWq7pKzHHIydl18k35trX7Ww+QD6fpR2GxvlQ0B4b3tIAobeA7yUQ/2kQdmxFgrmRlX42qHY6Vdwxdr5xz3GE+qDrXC1mYRd++Abs1HES780G61pz2wusfLZJgMqYGAo2OE= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 67a533fe-0caa-4f35-40b2-08d70c455661 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jul 2019 12:33:43.9304 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rnagadheeraj@marvell.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2527 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-19_09:2019-07-19,2019-07-19 signatures=0 Subject: [dpdk-dev] [PATCH v2 08/10] crypto/nitrox: add burst enqueue and dequeue operations 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" Add burst enqueue and dequeue operations along with interface for symmetric request manager. Signed-off-by: Nagadheeraj Rottela --- drivers/crypto/nitrox/nitrox_qp.h | 55 ++++++++++ drivers/crypto/nitrox/nitrox_sym.c | 123 ++++++++++++++++++++- drivers/crypto/nitrox/nitrox_sym_reqmgr.c | 174 ++++++++++++++++++++++++++= ++++ drivers/crypto/nitrox/nitrox_sym_reqmgr.h | 10 ++ 4 files changed, 360 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/nitrox/nitrox_qp.h b/drivers/crypto/nitrox/nitr= ox_qp.h index 0244c4dbf..645fa8925 100644 --- a/drivers/crypto/nitrox/nitrox_qp.h +++ b/drivers/crypto/nitrox/nitrox_qp.h @@ -34,12 +34,67 @@ struct nitrox_qp { rte_atomic16_t pending_count; }; =20 +static inline uint16_t +nitrox_qp_free_count(struct nitrox_qp *qp) +{ + uint16_t pending_count =3D rte_atomic16_read(&qp->pending_count); + + RTE_ASSERT(qp->count >=3D pending_count); + return (qp->count - pending_count); +} + static inline bool nitrox_qp_is_empty(struct nitrox_qp *qp) { return (rte_atomic16_read(&qp->pending_count) =3D=3D 0); } =20 +static inline uint16_t +nitrox_qp_used_count(struct nitrox_qp *qp) +{ + return rte_atomic16_read(&qp->pending_count); +} + +static inline struct nitrox_softreq * +nitrox_qp_get_softreq(struct nitrox_qp *qp) +{ + uint32_t tail =3D qp->tail % qp->count; + + return qp->ridq[tail].sr; +} + +static inline void +nitrox_ring_dbell(struct nitrox_qp *qp, uint16_t cnt) +{ + struct command_queue *cmdq =3D &qp->cmdq; + + if (!cnt) + return; + + rte_write64(cnt, cmdq->dbell_csr_addr); +} + +static inline void +nitrox_qp_enqueue(struct nitrox_qp *qp, void *instr, struct nitrox_softreq= *sr) +{ + uint32_t head =3D qp->head % qp->count; + + memcpy(&qp->cmdq.ring[head * qp->cmdq.instr_size], + instr, qp->cmdq.instr_size); + qp->ridq[head].sr =3D sr; + qp->head++; + rte_atomic16_inc(&qp->pending_count); + rte_wmb(); +} + +static inline void +nitrox_qp_dequeue(struct nitrox_qp *qp) +{ + qp->tail++; + rte_atomic16_dec(&qp->pending_count); + rte_smp_mb(); +} + int nitrox_qp_setup(struct nitrox_qp *qp, uint8_t *bar_addr, const char *dev_name, uint32_t nb_descriptors, uint8_t inst_size, int socket_id); diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nit= rox_sym.c index 34c62b02e..9ccc28755 100644 --- a/drivers/crypto/nitrox/nitrox_sym.c +++ b/drivers/crypto/nitrox/nitrox_sym.c @@ -521,6 +521,125 @@ nitrox_sym_dev_sess_clear(struct rte_cryptodev *cdev, rte_mempool_put(sess_mp, ctx); } =20 +static struct nitrox_crypto_ctx * +get_crypto_ctx(struct rte_crypto_op *op) +{ + if (op->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) { + if (likely(op->sym->session)) + return get_sym_session_private_data(op->sym->session, + nitrox_sym_drv_id); + + } + + return NULL; +} + +static int +nitrox_enq_single_op(struct nitrox_qp *qp, struct rte_crypto_op *op) +{ + struct nitrox_crypto_ctx *ctx; + struct nitrox_softreq *sr; + int err; + + op->status =3D RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; + + ctx =3D get_crypto_ctx(op); + if (unlikely(!ctx)) { + op->status =3D RTE_CRYPTO_OP_STATUS_INVALID_SESSION; + return -EINVAL; + } + + if (unlikely(rte_mempool_get(qp->sr_mp, (void **)&sr))) + return -ENOMEM; + + err =3D nitrox_process_se_req(qp->qno, op, ctx, sr); + if (unlikely(err)) { + rte_mempool_put(qp->sr_mp, sr); + op->status =3D RTE_CRYPTO_OP_STATUS_ERROR; + return err; + } + + nitrox_qp_enqueue(qp, nitrox_sym_instr_addr(sr), sr); + return 0; +} + +static uint16_t +nitrox_sym_dev_enq_burst(void *queue_pair, struct rte_crypto_op **ops, + uint16_t nb_ops) +{ + struct nitrox_qp *qp =3D queue_pair; + uint16_t free_slots =3D 0; + uint16_t cnt =3D 0; + bool err =3D false; + + free_slots =3D nitrox_qp_free_count(qp); + if (nb_ops > free_slots) + nb_ops =3D free_slots; + + for (cnt =3D 0; cnt < nb_ops; cnt++) { + if (unlikely(nitrox_enq_single_op(qp, ops[cnt]))) { + err =3D true; + break; + } + } + + nitrox_ring_dbell(qp, cnt); + qp->stats.enqueued_count +=3D cnt; + if (unlikely(err)) + qp->stats.enqueue_err_count++; + + return cnt; +} + +static int +nitrox_deq_single_op(struct nitrox_qp *qp, struct rte_crypto_op **op_ptr) +{ + struct nitrox_softreq *sr; + int ret; + struct rte_crypto_op *op; + + sr =3D nitrox_qp_get_softreq(qp); + ret =3D nitrox_check_se_req(sr, op_ptr); + if (ret < 0) + return -EAGAIN; + + op =3D *op_ptr; + nitrox_qp_dequeue(qp); + rte_mempool_put(qp->sr_mp, sr); + if (!ret) { + op->status =3D RTE_CRYPTO_OP_STATUS_SUCCESS; + qp->stats.dequeued_count++; + + return 0; + } + + if (ret =3D=3D MC_MAC_MISMATCH_ERR_CODE) + op->status =3D RTE_CRYPTO_OP_STATUS_AUTH_FAILED; + else + op->status =3D RTE_CRYPTO_OP_STATUS_ERROR; + qp->stats.dequeue_err_count++; + + return 0; +} + +static uint16_t +nitrox_sym_dev_deq_burst(void *queue_pair, struct rte_crypto_op **ops, + uint16_t nb_ops) +{ + struct nitrox_qp *qp =3D queue_pair; + uint16_t filled_slots =3D nitrox_qp_used_count(qp); + int cnt =3D 0; + + if (nb_ops > filled_slots) + nb_ops =3D filled_slots; + + for (cnt =3D 0; cnt < nb_ops; cnt++) + if (nitrox_deq_single_op(qp, &ops[cnt])) + break; + + return cnt; +} + static struct rte_cryptodev_ops nitrox_cryptodev_ops =3D { .dev_configure =3D nitrox_sym_dev_config, .dev_start =3D nitrox_sym_dev_start, @@ -565,8 +684,8 @@ nitrox_sym_pmd_create(struct nitrox_device *ndev) ndev->rte_sym_dev.name =3D cdev->data->name; cdev->driver_id =3D nitrox_sym_drv_id; cdev->dev_ops =3D &nitrox_cryptodev_ops; - cdev->enqueue_burst =3D NULL; - cdev->dequeue_burst =3D NULL; + cdev->enqueue_burst =3D nitrox_sym_dev_enq_burst; + cdev->dequeue_burst =3D nitrox_sym_dev_deq_burst; cdev->feature_flags =3D RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | RTE_CRYPTODEV_FF_HW_ACCELERATED | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | diff --git a/drivers/crypto/nitrox/nitrox_sym_reqmgr.c b/drivers/crypto/nit= rox/nitrox_sym_reqmgr.c index 42d67317c..a37b754f2 100644 --- a/drivers/crypto/nitrox/nitrox_sym_reqmgr.c +++ b/drivers/crypto/nitrox/nitrox_sym_reqmgr.c @@ -4,12 +4,113 @@ =20 #include #include +#include #include =20 #include "nitrox_sym_reqmgr.h" #include "nitrox_logs.h" =20 +#define PENDING_SIG 0xFFFFFFFFFFFFFFFFUL +#define CMD_TIMEOUT 2 + +union pkt_instr_hdr { + uint64_t value; + struct { +#if RTE_BYTE_ORDER =3D=3D RTE_BIG_ENDIAN + uint64_t raz_48_63 : 16; + uint64_t g : 1; + uint64_t gsz : 7; + uint64_t ihi : 1; + uint64_t ssz : 7; + uint64_t raz_30_31 : 2; + uint64_t fsz : 6; + uint64_t raz_16_23 : 8; + uint64_t tlen : 16; +#else + uint64_t tlen : 16; + uint64_t raz_16_23 : 8; + uint64_t fsz : 6; + uint64_t raz_30_31 : 2; + uint64_t ssz : 7; + uint64_t ihi : 1; + uint64_t gsz : 7; + uint64_t g : 1; + uint64_t raz_48_63 : 16; +#endif + } s; +}; + +union pkt_hdr { + uint64_t value[2]; + struct { +#if RTE_BYTE_ORDER =3D=3D RTE_BIG_ENDIAN + uint64_t opcode : 8; + uint64_t arg : 8; + uint64_t ctxc : 2; + uint64_t unca : 1; + uint64_t raz_44 : 1; + uint64_t info : 3; + uint64_t destport : 9; + uint64_t unc : 8; + uint64_t raz_19_23 : 5; + uint64_t grp : 3; + uint64_t raz_15 : 1; + uint64_t ctxl : 7; + uint64_t uddl : 8; +#else + uint64_t uddl : 8; + uint64_t ctxl : 7; + uint64_t raz_15 : 1; + uint64_t grp : 3; + uint64_t raz_19_23 : 5; + uint64_t unc : 8; + uint64_t destport : 9; + uint64_t info : 3; + uint64_t raz_44 : 1; + uint64_t unca : 1; + uint64_t ctxc : 2; + uint64_t arg : 8; + uint64_t opcode : 8; +#endif + uint64_t ctxp; + } s; +}; + +union slc_store_info { + uint64_t value[2]; + struct { +#if RTE_BYTE_ORDER =3D=3D RTE_BIG_ENDIAN + uint64_t raz_39_63 : 25; + uint64_t ssz : 7; + uint64_t raz_0_31 : 32; +#else + uint64_t raz_0_31 : 32; + uint64_t ssz : 7; + uint64_t raz_39_63 : 25; +#endif + uint64_t rptr; + } s; +}; + +struct nps_pkt_instr { + uint64_t dptr0; + union pkt_instr_hdr ih; + union pkt_hdr irh; + union slc_store_info slc; + uint64_t fdata[2]; +}; + +struct resp_hdr { + uint64_t orh; + uint64_t completion; +}; + struct nitrox_softreq { + struct nitrox_crypto_ctx *ctx; + struct rte_crypto_op *op; + struct nps_pkt_instr instr; + struct resp_hdr resp; + uint64_t timeout; rte_iova_t iova; }; =20 @@ -20,6 +121,79 @@ softreq_init(struct nitrox_softreq *sr, rte_iova_t iova= ) sr->iova =3D iova; } =20 +static int +process_cipher_auth_data(struct nitrox_softreq *sr) +{ + RTE_SET_USED(sr); + return 0; +} + +static int +process_softreq(struct nitrox_softreq *sr) +{ + struct nitrox_crypto_ctx *ctx =3D sr->ctx; + int err =3D 0; + + switch (ctx->nitrox_chain) { + case NITROX_CHAIN_CIPHER_AUTH: + case NITROX_CHAIN_AUTH_CIPHER: + err =3D process_cipher_auth_data(sr); + break; + default: + err =3D -EINVAL; + break; + } + + return err; +} + +int +nitrox_process_se_req(uint16_t qno, struct rte_crypto_op *op, + struct nitrox_crypto_ctx *ctx, + struct nitrox_softreq *sr) +{ + RTE_SET_USED(qno); + softreq_init(sr, sr->iova); + sr->ctx =3D ctx; + sr->op =3D op; + process_softreq(sr); + sr->timeout =3D rte_get_timer_cycles() + CMD_TIMEOUT * rte_get_timer_hz()= ; + return 0; +} + +int +nitrox_check_se_req(struct nitrox_softreq *sr, struct rte_crypto_op **op) +{ + uint64_t cc; + uint64_t orh; + int err; + + rte_rmb(); + cc =3D *(volatile uint64_t *)(&sr->resp.completion); + orh =3D *(volatile uint64_t *)(&sr->resp.orh); + if (cc !=3D PENDING_SIG) + err =3D 0; + else if ((orh !=3D PENDING_SIG) && (orh & 0xff)) + err =3D orh & 0xff; + else if (rte_get_timer_cycles() >=3D sr->timeout) + err =3D 0xff; + else + return -EAGAIN; + + if (unlikely(err)) + NITROX_LOG(ERR, "Request err 0x%x, orh 0x%"PRIx64"\n", err, + sr->resp.orh); + + *op =3D sr->op; + return err; +} + +void * +nitrox_sym_instr_addr(struct nitrox_softreq *sr) +{ + return &sr->instr; +} + static void req_pool_obj_init(__rte_unused struct rte_mempool *mp, __rte_unused void *opaque, void *obj, diff --git a/drivers/crypto/nitrox/nitrox_sym_reqmgr.h b/drivers/crypto/nit= rox/nitrox_sym_reqmgr.h index 5953c958c..fa2637bdb 100644 --- a/drivers/crypto/nitrox/nitrox_sym_reqmgr.h +++ b/drivers/crypto/nitrox/nitrox_sym_reqmgr.h @@ -5,6 +5,16 @@ #ifndef _NITROX_SYM_REQMGR_H_ #define _NITROX_SYM_REQMGR_H_ =20 +#include "nitrox_sym_ctx.h" + +struct nitrox_qp; +struct nitrox_softreq; + +int nitrox_process_se_req(uint16_t qno, struct rte_crypto_op *op, + struct nitrox_crypto_ctx *ctx, + struct nitrox_softreq *sr); +int nitrox_check_se_req(struct nitrox_softreq *sr, struct rte_crypto_op **= op); +void *nitrox_sym_instr_addr(struct nitrox_softreq *sr); struct rte_mempool *nitrox_sym_req_pool_create(struct rte_cryptodev *cdev, uint32_t nobjs, uint16_t qp_id, int socket_id); --=20 2.13.6