From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10077.outbound.protection.outlook.com [40.107.1.77]) by dpdk.org (Postfix) with ESMTP id 8CCDF58EC for ; Mon, 22 Oct 2018 15:31:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ihKZ9xNCyLkZNYh1dUWL948WCuw74idVeFokFtzzSUI=; b=dIafy3s8fqP1DFmaEwdCO5oFFajg3rS8U4eCUB4Gry7TPh78oeKxl4kaXp2XohShX4qSrFKT5XYMy50qHVXTypGrPCHXnYiO/ImalYGkyg+dDZW6PCQ0F931huWJCm81acVqMqmvcqi0Fjt+Va+SRdMjwJ/PUXucKYmZ1GOqYQ8= Received: from HE1PR04MB1530.eurprd04.prod.outlook.com (10.164.48.20) by HE1PR04MB3131.eurprd04.prod.outlook.com (10.171.196.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.30; Mon, 22 Oct 2018 13:31:14 +0000 Received: from HE1PR04MB1530.eurprd04.prod.outlook.com ([fe80::95cd:198:d5c5:59a4]) by HE1PR04MB1530.eurprd04.prod.outlook.com ([fe80::95cd:198:d5c5:59a4%5]) with mapi id 15.20.1250.028; Mon, 22 Oct 2018 13:31:14 +0000 From: Gagandeep Singh To: "dev@dpdk.org" , Akhil Goyal CC: Gagandeep Singh , Hemant Agrawal Thread-Topic: [PATCH v3 06/15] crypto/caam_jr: add device basic ops Thread-Index: AQHUaguA5FPldCvWVkuS82GlFqT7wA== Date: Mon, 22 Oct 2018 13:31:13 +0000 Message-ID: <20181022133021.11264-7-g.singh@nxp.com> References: <20181012144055.9461-1-g.singh@nxp.com> <20181022133021.11264-1-g.singh@nxp.com> In-Reply-To: <20181022133021.11264-1-g.singh@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::26) To HE1PR04MB1530.eurprd04.prod.outlook.com (2a01:111:e400:59a8::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=G.Singh@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [14.142.187.166] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR04MB3131; 6:M4CeaDeHRd6wpBUQVvteFlywFc45XXdBPDpp2KJI4S7scD+LKj/goidXqPu6IlAnGa13sJbfgMosUmnNT3arJft/nSKhw+7nHgNbAqF85ZY5i8X8h/o9c33c3IIluW7OSpe5hRECMFqth+1xs3CGEue1V33QuVZ2PeNAaxNBgPgmxsrnpgOxMwAVmAbXFyJg9s4G8p2GQkgr0piU7PtJbW5/nN+Q99oF8r6m9YB4hXL1HqxaGQ47fh0BFeYBzLY0pqHhaOsRw8tX2g98VoNiuUWZxxX1K+Zep8ihDvQ+CbdAMAd5CqT08jQRoz7Q508JqlfOu90ZZ+2y/l21CY68iNvt4UnzEmTide2tcbikBrDZSdyby8EHSIGeyh/OBr5pxgmTc/oupefldm4QRGybrZRt/Earwm15+zoCFGOx8bySxOFsK5N81wwKm01blNECwCHmPWwBCSTl/jhLHN4vBA==; 5:YNImamAmkxqd52hAlm4Dh4lCdT7Mpu5VgGjZmZtqh8sKliN3wmzwZ9BjB8nJd3/zlWAbGuOxpTS7NeuYYdzQIqX1pPRv7t0qQ2H+JMCWrFvvlz8l4HDlj2rLzN44tpaXt30sjoRR+Inl9l4JgjPMm66DcFqkmuQSNR9/OJzb99o=; 7:Lk9+ATp4MUcDlKWIlKzRuvrRX57aSfkmT2nUeI/W89vrbtH4bIG72ZubqHc7KHE81Kohdy2y7+krF5gCpo1EQPv4x+pAQhelLpszt8tQSZdxguzTY+24UlcR3XFEz/Yzj6qWDGCV1zoJQmlK+pUqRUhZ2OEeXb94nn9f3lRGLmCL8CY06KhJweYpDaLuWFNZrRS1Gq6o6dxWR062okee4AWJGsCGaDxsX04epd4wBD3wLmbkBABwsDFFDXHJljK+ x-ms-office365-filtering-correlation-id: 08eb0f78-ded4-4de4-8199-08d63822a2f2 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR04MB3131; x-ms-traffictypediagnostic: HE1PR04MB3131: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:HE1PR04MB3131; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB3131; x-forefront-prvs: 08331F819E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(39860400002)(136003)(346002)(396003)(189003)(199004)(110136005)(99286004)(316002)(54906003)(81156014)(14454004)(25786009)(72206003)(81166006)(2900100001)(8936002)(106356001)(8676002)(6116002)(3846002)(86362001)(2616005)(476003)(6506007)(386003)(102836004)(1076002)(11346002)(446003)(26005)(186003)(305945005)(478600001)(4326008)(2906002)(76176011)(68736007)(7736002)(6636002)(97736004)(486006)(52116002)(36756003)(55236004)(105586002)(71190400001)(5660300001)(6436002)(6486002)(78486010)(53936002)(14444005)(2501003)(256004)(66066001)(71200400001)(5250100002)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB3131; H:HE1PR04MB1530.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: JrXVBF/aGuqo/grU4iMSanfCj4zYNAudaKRycZsBxhrzdwYgMzYNe4zsQd5HmAM1V4fJwSb/EEWZwfgYFLGIg49LrNbhhQyVk7+ER+xEoO+4EAx2+m99z4f4nqgbu8lesUaiAHe31OLIqCTgHxQzeRtboIltkb54W/a2AJoIVebdztAFISXymFjlsCYmk8oHMx5kZ9UzrxMShVl3ugRguEuRdiSQ0TLcF2PxalXa1bVVkHqnjGT4cjeaJ+tpS/pjcK/qvU1e0aTgfsC7qYJlm50YPZPrPNA6F6+AFyezj0Y+MB+aMAHM3TFvGTdsGpFzO2x4KxyxrWtBtvC3RnXDOz6KXs+6lVVafWH1NjSoqNA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08eb0f78-ded4-4de4-8199-08d63822a2f2 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2018 13:31:13.8813 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB3131 Subject: [dpdk-dev] [PATCH v3 06/15] crypto/caam_jr: add device basic ops 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: , X-List-Received-Date: Mon, 22 Oct 2018 13:31:16 -0000 This patch adds following device operations - dev_configure - dev_start - dev_stop - dev_close - dev_infos_get Signed-off-by: Gagandeep Singh Signed-off-by: Hemant Agrawal Acked-by: Akhil Goyal --- drivers/crypto/caam_jr/caam_jr.c | 98 +++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam= _jr.c index cb024a979..cdae2a4fc 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -98,6 +98,89 @@ hw_flush_job_ring(struct sec_job_ring_t *job_ring, } =20 =20 +static int +caam_jr_dev_configure(struct rte_cryptodev *dev, + struct rte_cryptodev_config *config __rte_unused) +{ + char str[20]; + struct sec_job_ring_t *internals; + + PMD_INIT_FUNC_TRACE(); + + internals =3D dev->data->dev_private; + sprintf(str, "ctx_pool_%d", dev->data->dev_id); + if (!internals->ctx_pool) { + internals->ctx_pool =3D rte_mempool_create((const char *)str, + CTX_POOL_NUM_BUFS, + sizeof(struct caam_jr_op_ctx), + CTX_POOL_CACHE_SIZE, 0, + NULL, NULL, NULL, NULL, + SOCKET_ID_ANY, 0); + if (!internals->ctx_pool) { + CAAM_JR_ERR("%s create failed\n", str); + return -ENOMEM; + } + } else + CAAM_JR_INFO("mempool already created for dev_id : %d", + dev->data->dev_id); + + return 0; +} + +static int +caam_jr_dev_start(struct rte_cryptodev *dev __rte_unused) +{ + PMD_INIT_FUNC_TRACE(); + return 0; +} + +static void +caam_jr_dev_stop(struct rte_cryptodev *dev __rte_unused) +{ + PMD_INIT_FUNC_TRACE(); +} + +static int +caam_jr_dev_close(struct rte_cryptodev *dev) +{ + struct sec_job_ring_t *internals; + + PMD_INIT_FUNC_TRACE(); + + if (dev =3D=3D NULL) + return -ENOMEM; + + internals =3D dev->data->dev_private; + rte_mempool_free(internals->ctx_pool); + internals->ctx_pool =3D NULL; + + return 0; +} + +static void +caam_jr_dev_infos_get(struct rte_cryptodev *dev, + struct rte_cryptodev_info *info) +{ + struct sec_job_ring_t *internals =3D dev->data->dev_private; + + PMD_INIT_FUNC_TRACE(); + if (info !=3D NULL) { + info->max_nb_queue_pairs =3D internals->max_nb_queue_pairs; + info->feature_flags =3D dev->feature_flags; + info->sym.max_nb_sessions =3D internals->max_nb_sessions; + info->driver_id =3D cryptodev_driver_id; + } +} + +static struct rte_cryptodev_ops caam_jr_ops =3D { + .dev_configure =3D caam_jr_dev_configure, + .dev_start =3D caam_jr_dev_start, + .dev_stop =3D caam_jr_dev_stop, + .dev_close =3D caam_jr_dev_close, + .dev_infos_get =3D caam_jr_dev_infos_get, +}; + + /* @brief Flush job rings of any processed descs. * The processed descs are silently dropped, * WITHOUT being notified to UA. @@ -361,7 +444,20 @@ caam_jr_dev_init(const char *name, } =20 dev->driver_id =3D cryptodev_driver_id; - dev->dev_ops =3D NULL; + dev->dev_ops =3D &caam_jr_ops; + + /* register rx/tx burst functions for data path */ + dev->dequeue_burst =3D NULL; + dev->enqueue_burst =3D NULL; + dev->feature_flags =3D RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | + RTE_CRYPTODEV_FF_HW_ACCELERATED | + RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | + RTE_CRYPTODEV_FF_SECURITY | + RTE_CRYPTODEV_FF_IN_PLACE_SGL | + RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | + RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT; =20 /* For secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different --=20 2.17.1