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 75F3CA0613 for ; Fri, 27 Sep 2019 08:26:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 73B802E8F; Fri, 27 Sep 2019 08:26:39 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 4933B2C4F for ; Fri, 27 Sep 2019 08:26: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 x8R5nYPM002300; Thu, 26 Sep 2019 23:26:34 -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=qWZaXb377d12GHJUYkTExINLk+YYlwb4Xx+ZxpsvOjc=; b=mO8J3M535lBMy8Mjc99d5bpFK8ms1DfOQGB3PtAuSBkYW7a/LyUk8PsCMGRM6FyKxcfd yrwhdoi/JULxyJ9Y5BFWDgd9VYAHly1g8Dc7s7pmqd6A8C6kVuYQD7+nUDze27SsApab FhOn9uli1/96Y4BY0uqzP4KZgvf7c79IxMLYwz0fvbxvfkQk4TTCPOg5qRAeomrgjCKN wU6buEHquBzdg1XNr9zZOVrvrUTTKGCIDv7CqnAcXc5CRW9SJ73OljgD3DbHX/co9Xvd v/aJoTOWWlxAMvdvGK4tDkWEtimJk6zyNl7BDGi8mbi3PdQm8X790SDHz8BktaZaEynF rA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2v8vf2468m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 26 Sep 2019 23:26:34 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 23:26:32 -0700 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.50) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 26 Sep 2019 23:26:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bXVEV6gczgZyQoPdcLQM4GMXsVcv0y56+NN6wlLfzF7oKMXmsh6VfKtTGnBvfkBcEvV/nKtgthx4i7qfo7gSHIUOXT8S1WvLlrzdg0ORYdkDsJYbT3oJdNLtzzYL3M0giS5NYL0iBJRVYTyt29ZEHEaao8KQBzxKRpboUpKs11RwY/fJGeOasVBgx4fbGl5vRL8LGS/jzJXMd5pajzVM3Z/E6m9KgjzeUOarR6DO3zdjOvtAywKoK/1I13j+hHf6crVOKOrSWYxjc2E6J3ugrNBgSoxL598nB2d8IR00PXH7JxGgP5x+kOLQmlc6jmlfPxfVfuHpCPWtm2kTte1/rw== 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=qWZaXb377d12GHJUYkTExINLk+YYlwb4Xx+ZxpsvOjc=; b=Gf2cRAyr4DsVsvWhgM6dCJA79XAqLN9YQrkB/zV6+xaCMqKazBha8gzTNoqTJH8F2diQT4qHuwsAmPfwdw/AQ77mgRfBD+9vp+BPzDv6JExk07X5elNJeYhMsWNa4gb2u5ngtxxRSz6OA97kkUSmyFrUZT1zZkHDipB/02JkRaZRe2iLCu/OfOwo4JhoEEg1Zqx7Azii0qJHbo21Ggwmyt+kf4OrBcjuXZz6CLkCjVPIXQuhxGz49m3OGHaUPV35vYhv4cS9u7o4bwXXd3Ep06M9Cl5OL0RUSc3yZKw1Ovo1NQPkd/XJhToqbZUN+Q/ZkNMkkI0I/rE5yENjNp84WQ== 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=qWZaXb377d12GHJUYkTExINLk+YYlwb4Xx+ZxpsvOjc=; b=g0uMrpGhvPLRZOzs9wASNiEsUJUx+MrDQYtjqsmCacT1sBnCB+Gkl2bQAUocHNvBME0RcsUK3gkP+VQzow/z384N+qXpCjHVvhtIQmENuzzuYQN+YDSN/Cg35s7OZZBO1R1w9RAMznZ/RS8psQMBbzLcbEe9irrkvMvDfeHBZcY= Received: from BYAPR18MB2792.namprd18.prod.outlook.com (20.179.56.216) by BYAPR18MB2984.namprd18.prod.outlook.com (20.179.59.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.19; Fri, 27 Sep 2019 06:26:31 +0000 Received: from BYAPR18MB2792.namprd18.prod.outlook.com ([fe80::7112:68c6:eb44:e9aa]) by BYAPR18MB2792.namprd18.prod.outlook.com ([fe80::7112:68c6:eb44:e9aa%3]) with mapi id 15.20.2284.028; Fri, 27 Sep 2019 06:26:30 +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 v6 3/8] crypto/nitrox: add software queue management functionality Thread-Index: AQHVdPyAa/zfL6axCUa0pSOyTCZmJw== Date: Fri, 27 Sep 2019 06:26:30 +0000 Message-ID: <20190927062533.19005-4-rnagadheeraj@marvell.com> References: <20190716091016.4788-1-rnagadheeraj@marvell.com> <20190927062533.19005-1-rnagadheeraj@marvell.com> In-Reply-To: <20190927062533.19005-1-rnagadheeraj@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR0101CA0025.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::11) To BYAPR18MB2792.namprd18.prod.outlook.com (2603:10b6:a03:105::24) 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: a9f92f2e-9bf7-40fd-47a8-08d74313a27f x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:BYAPR18MB2984; x-ms-traffictypediagnostic: BYAPR18MB2984: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:61; x-forefront-prvs: 0173C6D4D5 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(376002)(136003)(366004)(39860400002)(346002)(189003)(199004)(6436002)(26005)(30864003)(2906002)(107886003)(14444005)(102836004)(3846002)(1076003)(66066001)(14454004)(6486002)(55236004)(36756003)(305945005)(256004)(478600001)(186003)(6506007)(66946007)(110136005)(76176011)(8936002)(8676002)(54906003)(6116002)(71190400001)(5660300002)(71200400001)(52116002)(386003)(66556008)(66446008)(446003)(11346002)(2501003)(86362001)(81166006)(64756008)(316002)(4326008)(66476007)(25786009)(50226002)(99286004)(2616005)(476003)(7736002)(486006)(81156014)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR18MB2984; H:BYAPR18MB2792.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: c/hi24k2bnB98+Jd+a2a01lW7wJjxrTFidHFJAeGf2mZEqPjZDvxvt8fIK9dR/RNqpO5Z9323eXrHKoFCL8ceSo06Z1OKi3/S9qhPK9r7t0ohb03cb5DH1g2RL4gIueBqjYRm87m2bf3CuqLGXooF74SH7JMkGw6XMhJW/Z2PhGWqKq9T6jjm09HmIUA1rSlaxX3QqyAZBEDe8Zu7K5z1BNMThn6+mtbBVi326YpgaqVzwIkJb0QWjI9/rbTZpuiFdYUrre3JI4cPHj6Sit+aFgr5V5/kRE4KHlVAi3aEUTfngTh4xbhL4uT4wsYfxL3SzbrY6SdjcS+8pf4ywzzISqrZI19H+W/lKoPqgTTf7Bq0G2pgVb8WKG+ADBGFraopcmWeFm5glL5Twe49rxRtuwV7ccDktA3qHanpgQ37XM= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a9f92f2e-9bf7-40fd-47a8-08d74313a27f X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Sep 2019 06:26:30.7993 (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: eklEpUdft/SdaX3BtIVISl4PcCEppkilF0W5VqFEklSKo7rqsYJ62FYpPdCgPEoTY/TCLsMNjiHT1ytPMmuzgPoAc59+LKEowbHpepmvtCM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2984 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-09-27_04:2019-09-25,2019-09-27 signatures=0 Subject: [dpdk-dev] [PATCH v6 3/8] crypto/nitrox: add software queue management functionality 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 software queue management code corresponding to queue pair setup and release functions. Signed-off-by: Nagadheeraj Rottela --- drivers/crypto/nitrox/Makefile | 2 + drivers/crypto/nitrox/meson.build | 2 + drivers/crypto/nitrox/nitrox_qp.c | 74 +++++++++++++++++ drivers/crypto/nitrox/nitrox_qp.h | 40 +++++++++ drivers/crypto/nitrox/nitrox_sym.c | 131 ++++++++++++++++++++++++++= ++-- drivers/crypto/nitrox/nitrox_sym_reqmgr.c | 56 +++++++++++++ drivers/crypto/nitrox/nitrox_sym_reqmgr.h | 13 +++ 7 files changed, 311 insertions(+), 7 deletions(-) create mode 100644 drivers/crypto/nitrox/nitrox_qp.c create mode 100644 drivers/crypto/nitrox/nitrox_qp.h create mode 100644 drivers/crypto/nitrox/nitrox_sym_reqmgr.c create mode 100644 drivers/crypto/nitrox/nitrox_sym_reqmgr.h diff --git a/drivers/crypto/nitrox/Makefile b/drivers/crypto/nitrox/Makefil= e index 06c96ccd7..72530ee1d 100644 --- a/drivers/crypto/nitrox/Makefile +++ b/drivers/crypto/nitrox/Makefile @@ -27,5 +27,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) +=3D nitrox_device.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) +=3D nitrox_hal.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) +=3D nitrox_logs.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) +=3D nitrox_sym.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) +=3D nitrox_sym_reqmgr.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) +=3D nitrox_qp.c =20 include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/crypto/nitrox/meson.build b/drivers/crypto/nitrox/meso= n.build index 1277cf58e..06e006e24 100644 --- a/drivers/crypto/nitrox/meson.build +++ b/drivers/crypto/nitrox/meson.build @@ -13,4 +13,6 @@ sources =3D files( 'nitrox_hal.c', 'nitrox_logs.c', 'nitrox_sym.c', + 'nitrox_sym_reqmgr.c', + 'nitrox_qp.c' ) diff --git a/drivers/crypto/nitrox/nitrox_qp.c b/drivers/crypto/nitrox/nitr= ox_qp.c new file mode 100644 index 000000000..9673bb4f3 --- /dev/null +++ b/drivers/crypto/nitrox/nitrox_qp.c @@ -0,0 +1,74 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include + +#include "nitrox_qp.h" +#include "nitrox_hal.h" +#include "nitrox_logs.h" + +#define MAX_CMD_QLEN 16384 + +static int +nitrox_setup_ridq(struct nitrox_qp *qp, int socket_id) +{ + size_t ridq_size =3D qp->count * sizeof(*qp->ridq); + + qp->ridq =3D rte_zmalloc_socket("nitrox ridq", ridq_size, + RTE_CACHE_LINE_SIZE, + socket_id); + if (!qp->ridq) { + NITROX_LOG(ERR, "Failed to create rid queue\n"); + return -ENOMEM; + } + + return 0; +} + +int +nitrox_qp_setup(struct nitrox_qp *qp, uint8_t *bar_addr, const char *dev_n= ame, + uint32_t nb_descriptors, uint8_t instr_size, int socket_id) +{ + int err; + uint32_t count; + + RTE_SET_USED(bar_addr); + RTE_SET_USED(instr_size); + count =3D rte_align32pow2(nb_descriptors); + if (count > MAX_CMD_QLEN) { + NITROX_LOG(ERR, "%s: Number of descriptors too big %d," + " greater than max queue length %d\n", + dev_name, count, + MAX_CMD_QLEN); + return -EINVAL; + } + + qp->count =3D count; + qp->head =3D qp->tail =3D 0; + rte_atomic16_init(&qp->pending_count); + err =3D nitrox_setup_ridq(qp, socket_id); + if (err) + goto ridq_err; + + return 0; + +ridq_err: + return err; + +} + +static void +nitrox_release_ridq(struct nitrox_qp *qp) +{ + rte_free(qp->ridq); +} + +int +nitrox_qp_release(struct nitrox_qp *qp, uint8_t *bar_addr) +{ + RTE_SET_USED(bar_addr); + nitrox_release_ridq(qp); + return 0; +} diff --git a/drivers/crypto/nitrox/nitrox_qp.h b/drivers/crypto/nitrox/nitr= ox_qp.h new file mode 100644 index 000000000..cf0102ff9 --- /dev/null +++ b/drivers/crypto/nitrox/nitrox_qp.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef _NITROX_QP_H_ +#define _NITROX_QP_H_ + +#include + +#include + +struct nitrox_softreq; + +struct rid { + struct nitrox_softreq *sr; +}; + +struct nitrox_qp { + struct rid *ridq; + uint32_t count; + uint32_t head; + uint32_t tail; + struct rte_mempool *sr_mp; + struct rte_cryptodev_stats stats; + uint16_t qno; + rte_atomic16_t pending_count; +}; + +static inline bool +nitrox_qp_is_empty(struct nitrox_qp *qp) +{ + return (rte_atomic16_read(&qp->pending_count) =3D=3D 0); +} + +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); +int nitrox_qp_release(struct nitrox_qp *qp, uint8_t *bar_addr); + +#endif /* _NITROX_QP_H_ */ diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nit= rox_sym.c index 12817c6c7..0ac490829 100644 --- a/drivers/crypto/nitrox/nitrox_sym.c +++ b/drivers/crypto/nitrox/nitrox_sym.c @@ -9,9 +9,12 @@ =20 #include "nitrox_sym.h" #include "nitrox_device.h" +#include "nitrox_qp.h" +#include "nitrox_sym_reqmgr.h" #include "nitrox_logs.h" =20 #define CRYPTODEV_NAME_NITROX_PMD crypto_nitrox_sym +#define NPS_PKT_IN_INSTR_SIZE 64 =20 struct nitrox_sym_device { struct rte_cryptodev *cdev; @@ -89,12 +92,126 @@ nitrox_sym_dev_info_get(struct rte_cryptodev *cdev, info->sym.max_nb_sessions =3D 0; } =20 +static void +nitrox_sym_dev_stats_get(struct rte_cryptodev *cdev, + struct rte_cryptodev_stats *stats) +{ + int qp_id; + + for (qp_id =3D 0; qp_id < cdev->data->nb_queue_pairs; qp_id++) { + struct nitrox_qp *qp =3D cdev->data->queue_pairs[qp_id]; + + if (!qp) + continue; + + stats->enqueued_count +=3D qp->stats.enqueued_count; + stats->dequeued_count +=3D qp->stats.dequeued_count; + stats->enqueue_err_count +=3D qp->stats.enqueue_err_count; + stats->dequeue_err_count +=3D qp->stats.dequeue_err_count; + } +} + +static void +nitrox_sym_dev_stats_reset(struct rte_cryptodev *cdev) +{ + int qp_id; + + for (qp_id =3D 0; qp_id < cdev->data->nb_queue_pairs; qp_id++) { + struct nitrox_qp *qp =3D cdev->data->queue_pairs[qp_id]; + + if (!qp) + continue; + + memset(&qp->stats, 0, sizeof(qp->stats)); + } +} + static int -nitrox_sym_dev_qp_release(struct rte_cryptodev *cdev, uint16_t qp_id) +nitrox_sym_dev_qp_setup(struct rte_cryptodev *cdev, uint16_t qp_id, + const struct rte_cryptodev_qp_conf *qp_conf, + int socket_id) { - RTE_SET_USED(cdev); - RTE_SET_USED(qp_id); + struct nitrox_sym_device *sym_dev =3D cdev->data->dev_private; + struct nitrox_device *ndev =3D sym_dev->ndev; + struct nitrox_qp *qp =3D NULL; + int err; + + NITROX_LOG(DEBUG, "queue %d\n", qp_id); + if (qp_id >=3D ndev->nr_queues) { + NITROX_LOG(ERR, "queue %u invalid, max queues supported %d\n", + qp_id, ndev->nr_queues); + return -EINVAL; + } + + if (cdev->data->queue_pairs[qp_id]) { + err =3D nitrox_sym_dev_qp_release(cdev, qp_id); + if (err) + return err; + } + + qp =3D rte_zmalloc_socket("nitrox PMD qp", sizeof(*qp), + RTE_CACHE_LINE_SIZE, + socket_id); + if (!qp) { + NITROX_LOG(ERR, "Failed to allocate nitrox qp\n"); + return -ENOMEM; + } + + qp->qno =3D qp_id; + err =3D nitrox_qp_setup(qp, ndev->bar_addr, cdev->data->name, + qp_conf->nb_descriptors, NPS_PKT_IN_INSTR_SIZE, + socket_id); + if (unlikely(err)) + goto qp_setup_err; + + qp->sr_mp =3D nitrox_sym_req_pool_create(cdev, qp->count, qp_id, + socket_id); + if (unlikely(!qp->sr_mp)) + goto req_pool_err; + + cdev->data->queue_pairs[qp_id] =3D qp; + NITROX_LOG(DEBUG, "queue %d setup done\n", qp_id); return 0; + +req_pool_err: + nitrox_qp_release(qp, ndev->bar_addr); +qp_setup_err: + rte_free(qp); + return err; +} + +static int +nitrox_sym_dev_qp_release(struct rte_cryptodev *cdev, uint16_t qp_id) +{ + struct nitrox_sym_device *sym_dev =3D cdev->data->dev_private; + struct nitrox_device *ndev =3D sym_dev->ndev; + struct nitrox_qp *qp; + int err; + + NITROX_LOG(DEBUG, "queue %d\n", qp_id); + if (qp_id >=3D ndev->nr_queues) { + NITROX_LOG(ERR, "queue %u invalid, max queues supported %d\n", + qp_id, ndev->nr_queues); + return -EINVAL; + } + + qp =3D cdev->data->queue_pairs[qp_id]; + if (!qp) { + NITROX_LOG(DEBUG, "queue %u already freed\n", qp_id); + return 0; + } + + if (!nitrox_qp_is_empty(qp)) { + NITROX_LOG(ERR, "queue %d not empty\n", qp_id); + return -EAGAIN; + } + + cdev->data->queue_pairs[qp_id] =3D NULL; + err =3D nitrox_qp_release(qp, ndev->bar_addr); + nitrox_sym_req_pool_free(qp->sr_mp); + rte_free(qp); + NITROX_LOG(DEBUG, "queue %d release done\n", qp_id); + return err; } =20 static struct rte_cryptodev_ops nitrox_cryptodev_ops =3D { @@ -103,10 +220,10 @@ static struct rte_cryptodev_ops nitrox_cryptodev_ops = =3D { .dev_stop =3D nitrox_sym_dev_stop, .dev_close =3D nitrox_sym_dev_close, .dev_infos_get =3D nitrox_sym_dev_info_get, - .stats_get =3D NULL, - .stats_reset =3D NULL, - .queue_pair_setup =3D NULL, - .queue_pair_release =3D NULL, + .stats_get =3D nitrox_sym_dev_stats_get, + .stats_reset =3D nitrox_sym_dev_stats_reset, + .queue_pair_setup =3D nitrox_sym_dev_qp_setup, + .queue_pair_release =3D nitrox_sym_dev_qp_release, .sym_session_get_size =3D NULL, .sym_session_configure =3D NULL, .sym_session_clear =3D NULL diff --git a/drivers/crypto/nitrox/nitrox_sym_reqmgr.c b/drivers/crypto/nit= rox/nitrox_sym_reqmgr.c new file mode 100644 index 000000000..42d67317c --- /dev/null +++ b/drivers/crypto/nitrox/nitrox_sym_reqmgr.c @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include +#include + +#include "nitrox_sym_reqmgr.h" +#include "nitrox_logs.h" + +struct nitrox_softreq { + rte_iova_t iova; +}; + +static void +softreq_init(struct nitrox_softreq *sr, rte_iova_t iova) +{ + memset(sr, 0, sizeof(*sr)); + sr->iova =3D iova; +} + +static void +req_pool_obj_init(__rte_unused struct rte_mempool *mp, + __rte_unused void *opaque, void *obj, + __rte_unused unsigned int obj_idx) +{ + softreq_init(obj, rte_mempool_virt2iova(obj)); +} + +struct rte_mempool * +nitrox_sym_req_pool_create(struct rte_cryptodev *cdev, uint32_t nobjs, + uint16_t qp_id, int socket_id) +{ + char softreq_pool_name[RTE_RING_NAMESIZE]; + struct rte_mempool *mp; + + snprintf(softreq_pool_name, RTE_RING_NAMESIZE, "%s_sr_%d", + cdev->data->name, qp_id); + mp =3D rte_mempool_create(softreq_pool_name, + RTE_ALIGN_MUL_CEIL(nobjs, 64), + sizeof(struct nitrox_softreq), + 64, 0, NULL, NULL, req_pool_obj_init, NULL, + socket_id, 0); + if (unlikely(!mp)) + NITROX_LOG(ERR, "Failed to create req pool, qid %d, err %d\n", + qp_id, rte_errno); + + return mp; +} + +void +nitrox_sym_req_pool_free(struct rte_mempool *mp) +{ + rte_mempool_free(mp); +} diff --git a/drivers/crypto/nitrox/nitrox_sym_reqmgr.h b/drivers/crypto/nit= rox/nitrox_sym_reqmgr.h new file mode 100644 index 000000000..5953c958c --- /dev/null +++ b/drivers/crypto/nitrox/nitrox_sym_reqmgr.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef _NITROX_SYM_REQMGR_H_ +#define _NITROX_SYM_REQMGR_H_ + +struct rte_mempool *nitrox_sym_req_pool_create(struct rte_cryptodev *cdev, + uint32_t nobjs, uint16_t qp_id, + int socket_id); +void nitrox_sym_req_pool_free(struct rte_mempool *mp); + +#endif /* _NITROX_SYM_REQMGR_H_ */ --=20 2.13.6