From patchwork Mon Oct 22 14:17:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 47163 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 931AB1B150; Mon, 22 Oct 2018 16:17:58 +0200 (CEST) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40071.outbound.protection.outlook.com [40.107.4.71]) by dpdk.org (Postfix) with ESMTP id 3E6521B107 for ; Mon, 22 Oct 2018 16:17:47 +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=04dAFPdA+rcRRTpfxAzAew/Dr0VzySgIXyzlwOwYHFk=; b=X9ky3G/aPlFMZFxf0lFKqyRxGkhZ8p5niZG5a5TDsN900XUNO7NWoXpxc9Sy/YXjeK0mrXFv0msRV0H5ib0KZA6Y7sWZ/4kgSFTbZSytqn9wQwRp527V91GuSYfo9zt2u+tDPKxR4c9M4esTAorQ32nvMKkwNv7NUyoRvOMwFOw= Received: from HE1PR04MB1530.eurprd04.prod.outlook.com (10.164.48.20) by HE1PR04MB3242.eurprd04.prod.outlook.com (10.170.251.154) 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 14:17:45 +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 14:17:45 +0000 From: Gagandeep Singh To: "dev@dpdk.org" , Akhil Goyal CC: Gagandeep Singh , Hemant Agrawal Thread-Topic: [PATCH v4 06/15] crypto/caam_jr: add device basic ops Thread-Index: AQHUahIAHqKvscr36kyXnASSOTB44g== Date: Mon, 22 Oct 2018 14:17:45 +0000 Message-ID: <20181022141657.4727-7-g.singh@nxp.com> References: <20181022133021.11264-1-g.singh@nxp.com> <20181022141657.4727-1-g.singh@nxp.com> In-Reply-To: <20181022141657.4727-1-g.singh@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0025.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::11) To HE1PR04MB1530.eurprd04.prod.outlook.com (2a01:111:e400:59a8::20) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [14.142.187.166] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR04MB3242; 6:XPxE2diBJFqBPMi9KbvCuszoUBM5aBgCVxM2A8zimTzfIUccy80LuFrMgxhRPMzRQVnazUAHfTBBk2+fjGx8JWl77KGRl1d681FEqy7P3rxWKrA2zpV5+0HI2eN3HLmaKiqLesFZ2jWw1cZrinb9ie0uD9hgYX0TLUzABuN8lV0m/N41Pt5Re2UV2ciqEGG48z8NpWXcSpxXq7lhTWLAub7w4JP4UFAzxiJ0PEHRGWXy9gSJ/QK7F04QMD6G30fEG6NhAAZhrYo3fZlACsvUOyb3U3drfNtxk1jh0WQmNij+7r2XjF9iBXXwh6UqK5W8sJsaK0XPS4ZDEu3H7jmtJ/ZoToM/vOJoR5V1/T6q0/sQ1xDRwyD3DW+/c7pZdSnVeGAegmK+aCGpKnviCf3zS+hbLYP92TO0j33JrrsQqGswanaeLCSXuJ19V0n4ZVt1TjURDlFupyp0THpe5UhY0A==; 5:cHzu9XKc446pC7bGg9B2DTt11e1rVvNUSkoJJ0Cmao9qOCY4OrIbjyUZoRFLqrDUKFzT6TX5bZyHR22AAEAT8Rmk2JYm8cW4G+6yDJ2NqzE2MpEUm5gY39K1Q58GmXYpr5iJUSmXmde/1EMaY9wd+Q46vfS3cBVPysPcd8w82zM=; 7:HjX7b/wsqarM3UcUzpeo/LGy1gIxq7snQS8/752PKdpsbDitJ9A0feSrRYdkgne2QVPzh30zvCCeUSleaxkma5vjK1IRPnVwGSvhjtL1nuQ7QXc0hevQP0ppphoAdH/Ks+W2wELuaq0UZG1fyKgD/8aZtZ0daQEBl01XGSMbMYa0aR74wRWnAN/RbJry2e75k4zgF2MFrZ03kM5RmKZdjwhYsZ1ub7kpLqotVM1x9WHV1olwiRMoxr8NczAoBYzm x-ms-office365-filtering-correlation-id: c5026e4f-bbe4-4c11-8b57-08d63829230d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR04MB3242; x-ms-traffictypediagnostic: HE1PR04MB3242: 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)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:HE1PR04MB3242; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB3242; x-forefront-prvs: 08331F819E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(136003)(396003)(376002)(346002)(39860400002)(199004)(189003)(86362001)(68736007)(72206003)(1076002)(3846002)(6116002)(5660300001)(71200400001)(71190400001)(110136005)(54906003)(105586002)(78486010)(106356001)(6636002)(2906002)(7736002)(8936002)(305945005)(478600001)(81166006)(316002)(81156014)(8676002)(4326008)(25786009)(2900100001)(476003)(53936002)(66066001)(6486002)(14444005)(446003)(6436002)(6512007)(99286004)(52116002)(76176011)(36756003)(14454004)(256004)(6346003)(97736004)(2616005)(11346002)(486006)(186003)(26005)(2501003)(5250100002)(55236004)(102836004)(6506007)(386003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB3242; H:HE1PR04MB1530.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=G.Singh@nxp.com; x-microsoft-antispam-message-info: aDpAIYywj+KtlV9z3vLmiatRdCqiUnNPhIfe9xvhFMSoDgW1d3CAvTRGOsrXn9PekkXbxXDU+aFQNw+cUe2y0CSZKZxl8F+smJ8KrZjACkwtdku3hDn/jjRQrOQCJHVQkOft3okALrIYz38MPpN6E/tmgx35RWYLU6C5dTKlXwEkZGU65fcP0AtuQHQ7XOq5HbtLuoAQW1O4an1ApnYnAdPUy1CKhY68C7TKEHMqsy9HLWnZulqo8rIc2I3SXRcIBobwNNwFk/ML2HV2ucXvkUkRw2Op5HkFu2ECJfN0Px5aER++M3UWgBTRW7n5nRb4lCP56anoA4F4sLAif6u7JDzHlBkicdt5SGdMRWu3P3Y= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5026e4f-bbe4-4c11-8b57-08d63829230d X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2018 14:17:45.7462 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB3242 Subject: [dpdk-dev] [PATCH v4 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 1a04a3ce6..b03b9625b 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -97,6 +97,89 @@ hw_flush_job_ring(struct sec_job_ring_t *job_ring, } +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 = dev->data->dev_private; + sprintf(str, "ctx_pool_%d", dev->data->dev_id); + if (!internals->ctx_pool) { + internals->ctx_pool = 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 == NULL) + return -ENOMEM; + + internals = dev->data->dev_private; + rte_mempool_free(internals->ctx_pool); + internals->ctx_pool = 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 = dev->data->dev_private; + + PMD_INIT_FUNC_TRACE(); + if (info != NULL) { + info->max_nb_queue_pairs = internals->max_nb_queue_pairs; + info->feature_flags = dev->feature_flags; + info->sym.max_nb_sessions = internals->max_nb_sessions; + info->driver_id = cryptodev_driver_id; + } +} + +static struct rte_cryptodev_ops caam_jr_ops = { + .dev_configure = caam_jr_dev_configure, + .dev_start = caam_jr_dev_start, + .dev_stop = caam_jr_dev_stop, + .dev_close = caam_jr_dev_close, + .dev_infos_get = caam_jr_dev_infos_get, +}; + + /* @brief Flush job rings of any processed descs. * The processed descs are silently dropped, * WITHOUT being notified to UA. @@ -360,7 +443,20 @@ caam_jr_dev_init(const char *name, } dev->driver_id = cryptodev_driver_id; - dev->dev_ops = NULL; + dev->dev_ops = &caam_jr_ops; + + /* register rx/tx burst functions for data path */ + dev->dequeue_burst = NULL; + dev->enqueue_burst = NULL; + dev->feature_flags = 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; /* For secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different