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 AD4E6A2EDB for ; Tue, 1 Oct 2019 08:42:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 708D81BEA8; Tue, 1 Oct 2019 08:41:37 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id BA7881BE99 for ; Tue, 1 Oct 2019 08:41:35 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x916f326024592; Mon, 30 Sep 2019 23:41:35 -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=gWjLCPz0PwvB20tqKbwvRijI7IjcufLSCVoIjUjZU04=; b=hy+oA7L1rUIGikSbLJ5juc72mox1oQuBPjz9liuLFN2XnuJY/kzvIe4ugUfEMOBzcdwk 00azi26svD228/GpzNwvZiOXcLQPgrTgrnEp35DQyAJv/FrYC9X72ycs1qxZt34PCw5y JmbpG3WFcHd6291VvA3ZhtRot/OmVJLiNQy2d/4bj5ZBMJidN8GH4xWacjIFeAJpVrEr U16zN3bW1tHW0TiIGXp3i69PLJSEbh8nch6F7SHv1+iKGOwWkelh14MlqusQ8gK4YOEN EJ0fFAO0Dhd1wwQ+fu16uAbasd84kbXD/3lDrAoDvmQL7XDG0dKpFyzAftDR3jbwbtI/ cg== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2va71mh7vp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 30 Sep 2019 23:41:34 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 30 Sep 2019 23:41:33 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (104.47.44.53) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 30 Sep 2019 23:41:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ccfqrz/l9cMm0h61BtAygAb+dTecp+d5MgNRwyye0ALHfvibfGwYSqz9H0x3KvqgonFVa11EIxKIe40dfwaZQ0K/Z2c21qF+5bYFCqF/YmJ220NYvdH8EmqkbzrTpaqhCuG0IUUO5ydODEh9+kdSAtzsinAlDXEaixTt00wRnV/Is/Z/NJfSDoAjhT9iwKBNt1vEgGGcEqrjSHiLIWwG0blus3MB8d8KPCRx2XMUY7MaZb3SjQnhJb80sATfR0F8iEhmyqy+MOfMJHoybi3siBNVsmbX/r4sitSKpo/NlSj/IjJKtSlQqjQd/8od0d3IExan8ltaDt7czvP4E8a2tw== 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=gWjLCPz0PwvB20tqKbwvRijI7IjcufLSCVoIjUjZU04=; b=Bbn7qMJYwtEU8KTZPItuXc+4AOUBzvyMPpsl/3YIlSxy5/o9c3wdAngRrTzW7nx7E2UvLKuyrN8U4dlA6oawbNc7E8fDBT71BDlY+k8hEjiar5Gm1x3hqPfH70u4dUwtbLz6QzgWoHn+Efhs/URorSztYF1VYAUTbcbSzjrkmDec2pFczFHYUQXEtWj0zGMyEPUsb+m6ekVUFDVsW5jpa8Tofl2P4bb2qWpelhrCUFrYqGkb5RyePe+xVCvMB94t7s2b3WL1G+yj4GxO5Cximffwm6ldkuFPDd1wDoZuUxdwZCQugtXX1ZmN4DXTAB4v6md3r4jIORcjCeFeunyICQ== 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=gWjLCPz0PwvB20tqKbwvRijI7IjcufLSCVoIjUjZU04=; b=l+OjTrgFxjhtY4S3eg1xfN6vAUTKSzbX1CJYu8RXcD58dvVyio52ZePVEofx/lQRs0e3MBONDV5suYFaE0ElIEqeYvtB5xkgtvVbEtmLltbG1Cx843Ng5YD1rm0xO0z/5iPgQIJZDU7lAi71fpWMOMOFxXkkGUPQye4h2nYY1s4= Received: from MN2PR18MB2797.namprd18.prod.outlook.com (20.179.22.16) by MN2PR18MB3375.namprd18.prod.outlook.com (10.255.238.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.15; Tue, 1 Oct 2019 06:41:32 +0000 Received: from MN2PR18MB2797.namprd18.prod.outlook.com ([fe80::259c:a73e:a83:ccfe]) by MN2PR18MB2797.namprd18.prod.outlook.com ([fe80::259c:a73e:a83:ccfe%4]) with mapi id 15.20.2305.017; Tue, 1 Oct 2019 06:41:31 +0000 From: Nagadheeraj Rottela To: "akhil.goyal@nxp.com" , "pablo.de.lara.guarch@intel.com" CC: Srikanth Jampala , "dev@dpdk.org" , Nagadheeraj Rottela Thread-Topic: [PATCH v7 6/8] crypto/nitrox: add burst enqueue and dequeue operations Thread-Index: AQHVeCNCLilmd9oX5USDblOzdefbAQ== Date: Tue, 1 Oct 2019 06:41:31 +0000 Message-ID: <20191001064048.5624-7-rnagadheeraj@marvell.com> References: <20190716091016.4788-1-rnagadheeraj@marvell.com> <20191001064048.5624-1-rnagadheeraj@marvell.com> In-Reply-To: <20191001064048.5624-1-rnagadheeraj@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR0101CA0050.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:d::12) 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: ceaecc84-5bee-48c6-f378-08d7463a651a x-ms-traffictypediagnostic: MN2PR18MB3375: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:119; x-forefront-prvs: 0177904E6B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(4636009)(366004)(396003)(39850400004)(346002)(136003)(376002)(199004)(189003)(66946007)(76176011)(6512007)(66556008)(476003)(81166006)(66476007)(478600001)(446003)(14444005)(52116002)(256004)(99286004)(486006)(81156014)(8936002)(305945005)(2616005)(64756008)(5660300002)(4326008)(66066001)(316002)(11346002)(6436002)(25786009)(2906002)(386003)(71200400001)(71190400001)(14454004)(107886003)(6486002)(55236004)(102836004)(110136005)(54906003)(8676002)(2501003)(186003)(66446008)(6116002)(3846002)(50226002)(86362001)(30864003)(26005)(36756003)(1076003)(7736002)(6506007)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB3375; 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: BCL:0; x-microsoft-antispam-message-info: X6xwCZzROas1wcx5/ZOg4F6tETHapsSxbqsr5kP52X+o7gfCArC/gOUHWLz13HAkXaNCPD+o1Mjn6aPmOpeq2/G6cHhfKtUPOSZrUE2ZWhsD9u1MmHvhWONN7VImWy/WzoOFSmGu59bepUTQpsOzEcD3TXrgCI127byUxPX7K0JhgsNMwbSHj/P+4xKrLL9JVaa5b8Hl6sjAhS1kzupxOgmGnI34Rdx5BSvM8DsMD6aAdkT26/bk3bonDEe+OTu713A8Hq0hqmGHC+4CZ/yqDNYN6Y+IjsJqLoxv+reX8eFfJkZb7qsw/vl7zoZDxV+ioA1CIz2rrp1suDZ+x+bQz/nG/wDr8240Jf8R/yHdLjrlrf5sdilBaLpaFr0O6aCT4wgKiKONaghyy2DKavsIG2H7mG8rE8TenJ/+GTYaIcY= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: ceaecc84-5bee-48c6-f378-08d7463a651a X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Oct 2019 06:41:31.6295 (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: jFEIrwh1KmT2Nnm/+KRwg74GJftHgQKIowuy+4K46/sXeexqQrj2VXcrk/zm8I19i8xqYKcSlFxqEUOVYItue7O7dRl682TydzfYp/FD5i8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3375 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-01_03:2019-09-30,2019-10-01 signatures=0 Subject: [dpdk-dev] [PATCH v7 6/8] 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 | 56 ++++++++++ drivers/crypto/nitrox/nitrox_sym.c | 121 ++++++++++++++++++++- drivers/crypto/nitrox/nitrox_sym_reqmgr.c | 173 ++++++++++++++++++++++++++= ++++ drivers/crypto/nitrox/nitrox_sym_reqmgr.h | 10 ++ 4 files changed, 358 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/nitrox/nitrox_qp.h b/drivers/crypto/nitrox/nitr= ox_qp.h index 0244c4dbf..d42d53f92 100644 --- a/drivers/crypto/nitrox/nitrox_qp.h +++ b/drivers/crypto/nitrox/nitrox_qp.h @@ -34,12 +34,68 @@ 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; + + rte_smp_rmb(); + 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_io_wmb(); + 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; + + qp->head++; + memcpy(&qp->cmdq.ring[head * qp->cmdq.instr_size], + instr, qp->cmdq.instr_size); + qp->ridq[head].sr =3D sr; + rte_smp_wmb(); + rte_atomic16_inc(&qp->pending_count); +} + +static inline void +nitrox_qp_dequeue(struct nitrox_qp *qp) +{ + qp->tail++; + rte_atomic16_dec(&qp->pending_count); +} + 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 c7d3b8d49..56337604a 100644 --- a/drivers/crypto/nitrox/nitrox_sym.c +++ b/drivers/crypto/nitrox/nitrox_sym.c @@ -539,6 +539,123 @@ 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, @@ -580,8 +697,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..e47275094 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,78 @@ 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; + + 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