From patchwork Tue Mar 27 12:00:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 132478 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp4988914ljb; Tue, 27 Mar 2018 05:04:22 -0700 (PDT) X-Google-Smtp-Source: AG47ELsFtKkDT+FGUXt1yFBZ7UdPOg8+InUFPxEAzCH9vR+rF91Nx0QPKp/eVx3SoIP0451rq+sU X-Received: by 10.223.167.12 with SMTP id c12mr26741535wrd.194.1522152262394; Tue, 27 Mar 2018 05:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522152262; cv=none; d=google.com; s=arc-20160816; b=icr2RvFpAnP4viD4ozi/ji9WY6SyhR3BFljcbPwkMNEWMJCjZG3tVj0i8o11HOpeNy Y8Kcn2tKYDPhb7ErZhCReU5k8ppSQBQFkxIirHxV8eCZtwUYQMkGaM0iFNpi4SmWBsmH 4OPwklpzGEk+OHCTaExo1e31uJXQc4l6alCZG9YzO9e44uVveQ0pyp7d9+fS8kUhIMI8 y4npJu5Fdj1ID+rFlStB0qRZX9NNggdpUeHhoM7yphnCEX8eiDne/Kjk5vEtiAuK6Soj KiYtaPCX3LMqwiE+4jzlm6goEh5YK8tWO8HgDVY5wzqly/iXPfCTc6zBtQbtcVfBGH9i AMyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:dkim-signature:arc-authentication-results; bh=C3ILFVcUvzaOyCdSE5s3BFLs3uHlTtpg9CMwzlHqOT0=; b=Mp2aeKD/orG6Marhxn50mnsOrThbEIGd8wt6NfsWt5y5ILPT1J2c2QhXKNepi+i996 kEIuzhFIpNI8glpZfW4i80ij11gDlflJGAbSGTV/PvvBGCSyfArhOornWLCcMEpCNNVo cfnc3++FfDsXX8NvkrAWmBNJ0dZ4aumZdcufQSPrxDK3Mlwzpvn8C10UoOuW5bn2kxUo j7E8n87tcCby3Ic1vPJhu62IApQAhVECgEz0si4pmKKVU/fqN+a5bJ1tXOgyTYfa3wjZ CZ0dzrQa44rpOirsd1Km8Qc3EqJCu0am5jlIUpOYMYSTAkAmmYfTdmbaaoTamfYDbTwp jg8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=Jrfy+5ps; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id 3si909836wrv.419.2018.03.27.05.04.22; Tue, 27 Mar 2018 05:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=Jrfy+5ps; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6C3765F18; Tue, 27 Mar 2018 14:02:58 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0044.outbound.protection.outlook.com [104.47.0.44]) by dpdk.org (Postfix) with ESMTP id 67C404F9A for ; Tue, 27 Mar 2018 14:02:54 +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; bh=C3ILFVcUvzaOyCdSE5s3BFLs3uHlTtpg9CMwzlHqOT0=; b=Jrfy+5psiYdc7afOPZj2M748n19Ux/JD53w7bq5LEzwonMn436Ns/FYA6mHXDXYAZ8g0/01dnXd8BVJEjOoUCGecd/n0bKmqtkpemzud6IduINMVHP2jMpMVUngqimYc23Jhyiu7MtzFtulWH0SAbSYAOHyMiCp0Joz78wzc588= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; Received: from bf-netperf1.ap.freescale.net (14.142.187.166) by AM2PR04MB0753.eurprd04.prod.outlook.com (2a01:111:e400:8411::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.10; Tue, 27 Mar 2018 12:02:50 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com, akhil.goyal@nxp.com Date: Tue, 27 Mar 2018 17:30:39 +0530 Message-Id: <1522152039-32493-7-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522152039-32493-1-git-send-email-hemant.agrawal@nxp.com> References: <1522152039-32493-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: MA1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::26) To AM2PR04MB0753.eurprd04.prod.outlook.com (2a01:111:e400:8411::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5f24fc38-4e8f-476e-1b96-08d593daaaa2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM2PR04MB0753; X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0753; 3:6Aa1GqqZZhgt7BZbxIUjaglJ3Siz/XcRhca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OmlIDacgHQevJgCNWglv6wwbUZEHccq84YvH7/DXJ7mudW8hLY5UNmuHc7DPXbRwEYT3T4Jt2bmKJ2rJI9IHBBI6mPXZCBwYCedWhNbAFKIUk7S0JS4EYxATsmBmmLW7Vc2RTmzBGZBxQIioN/kic/j6B2SsomSrRn/D/4EMk0JZ2KB1o9PSIVbbDr4hCDm3lD+umxpuOHfNyjg9z4k71NZvS5MAyafbuUoUdGesb2VCFbYbm3QfOyI2cmxXeWDbHNzmYkWuBsuQrh+QKtVHf9jMT/l/3dvUiUpjsAC69KWmmw9su8ThC676A84hVY5xAhl/eioDd1D7gPiE3; 4:msYdjsRO+snGx1iNWU4MX7X5H6I5vMVKFCYjFJ3F5Hqn+j/OP29fNuOzR5+KZYKe9MMrq4TrV+dsfsoinCjOPDiduqvkMEBCtvSxFHh/Dy0oqxwXHa85en1xg0R0cScqKXY3kK6PFCxIYeAh7AFb/Wg76+FnruCcFrXeVMYGHSOhK/D5PzTO6Q1qLucIvUlm30Bo16bkvigdR7mMJFVC67eX9CDezfPdEOS/rS7K99eVnFxAs1luo6fTc+PwxZ3Xlziydl6SkGx3Xv++NvIePl9ShEdbA1rs28Sl6QjEwQQqbJPEdo3dZXhEiqF8WYxSBNmKTNN8m5NsK/oMx/XNnrQZev/Gz38CYXA6y7CQb2M= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705)(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501327)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:AM2PR04MB0753; BCL:0; PCL:0; RULEID:; SRVR:AM2PR04MB0753; X-Forefront-PRVS: 0624A2429E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(346002)(39380400002)(39860400002)(376002)(366004)(189003)(199004)(50466002)(6506007)(186003)(11346002)(59450400001)(16526019)(446003)(386003)(26005)(53936002)(55236004)(6116002)(48376002)(5009440100003)(3846002)(66066001)(68736007)(316002)(16586007)(6512007)(476003)(2351001)(47776003)(486005)(76176011)(486005)(956004)(105586002)(2616005)(305945005)(6666003)(7736002)(6916009)(106356001)(4326008)(2361001)(97736004)(52116002)(86362001)(8676002)(8936002)(2906002)(81156014)(81166006)(478600001)(5660300001)(51416003)(36756003)(6486002)(50226002)(25786009)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR04MB0753; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM2PR04MB0753; 23:F3y7DL/UtOiv0WK9YNxYkgoYL+NuncRPYIyPYU3/f?= 5wm2fBeVR6wJIfluCHnx3RS2oMWiLXJrVQ4sisOQ4tqRRK/Lr18lL8XrfrgujRB2yOlcUvKSkHKkQTuQx1j/CAAzH3DIWiuvx7zjWqk6GPKYqE01GQ/PCxZ5plyDf9LyQkzBTh6eKD4O+CV0ezeWiwT29WMVNTDh6aXO1OSVbc01zIiDuNVVTtTSadmXENulU5wJKOMgii/TodQnfSzgtQgjyANazixg/7GQFaI5tdS3ciEFm+b0l6tK8T3GyPriqMQvNadQPdOII7GWqlEL4cXUJP67tJ0L0b9gedG/eKGQCQ/jKpfq21fHBfg760DoKSFjYiVlpHkK8K/qPfMytuM/LXTg9eO5Wv/9JQxpY47pidHAhGcf41hMz9twCyIBIGQEv5TE2UOv8r+E7xnQlEwD6cwAzSgBvS6AK6sH1xstzmv5a88nhx3A2uomgjUDl10WurpJ73B6bS1Fqs7AOuMKlYn9+ErHP2t4AmUK0L53MAK/mOb9uaEmlj2cYRHY6zBMlD0rvqkGQTr9TT3pIE4Kex5dCCK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vi18wg6lULhJNiXNiUYUKDC11/avIA3Kk0QYGa4+PTWmkQgDKfum0LP8kwzIvHavuoynl57U/g9fqCjHn2CLhRdjlM/4ZThxLXiDbYJzUq+RiGcV3aQvwG/1hnE3ccq0UdrnjxZGxOFSWWEtZuF8t2rJlnODERSZdpInff9UYQdzeKEr05GpWQCpbpA5or/cIj/RLlFVuBcV939Chg+AQcEws+Y6npzdmil3jTZ9qVcwGTXHnQ+u9DZuB4kkZxhT7q3j4C8J6HRsAMJyGKlSj4p+XAZb0bDel4V6GFwFIwAviBErDOvsVBb/ha9C8EorCY/XEygq+j33c12acS82v07pBC0feDM9xTR+QiZ10NVWY49B39VELP01EpNeNq5yVE++mBkVIjoCQloJ3Z0A/XHWhQQ==; 5:ztNjpPssn1jcZvktLqWfzEbe6eX//x58CyX8mhIuruzCzzeyIndbVr5moRbBHooLnxz6YQo3nwJQgxJSh3SadTInn8Z0fw6xBfSJcd/D1Nx6DfJivAcWzTb0M9IqX/VLqX/q9pe1aXUpQhNQJTMAmQKcOVz7YqolvTXiamsyuWo=; 24:TpCkQEUCJFSZaI1Ra4epW/je2XQR87zivZt/ZLXiM5Z45CjZNAy9JQFfN4diKZsUnC7NzvLraRmdv1QKCfMzsaCv7JKPz8VGG7MWOfNH/bI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0753; 7:7R7J4kI2pflPpudS5+q26e389iCtnE6ULZFCxSKNyXWauyFSL8Ep+n6+yaGwFQ7uugFTE6REbZnDnniNK7XYWMrMD4W1iL1eeb0qXTOVdR0+JV+R+L+9VcJmPLsv5f9sheM/IE6P+4D4MKxs/CdvD78E2BrdBS5oSsjlbsN6XRxOoXwEXaQlizN1dP22X4ro+oz3XH+3yVm7JjYLGt7l7EcNvsCFk5KDLPfIzcos+2qbPuocbd/993IOKKpCaSnO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2018 12:02:50.6878 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f24fc38-4e8f-476e-1b96-08d593daaaa2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR04MB0753 Subject: [dpdk-dev] [PATCH 7/7] crypto/dpaa_sec: move mempool allocation to config 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" From: Akhil Goyal Currently, the context mempools are allocated during device probe. Thus, even if the DPAA SEC devices are not used, any application would still allocate the memory required for working with the contexts. This patch moves the allocation to configuration time so that when the CAAM devices are configured, this allocation would be done. Signed-off-by: Akhil Goyal Signed-off-by: Ashish Jain Tested-by: Shreyansh Jain --- drivers/crypto/dpaa_sec/dpaa_sec.c | 49 ++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) -- 2.7.4 diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 2df5e5c..c7f7cdf 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -2169,11 +2169,32 @@ dpaa_sec_security_session_destroy(void *dev __rte_unused, static int -dpaa_sec_dev_configure(struct rte_cryptodev *dev __rte_unused, +dpaa_sec_dev_configure(struct rte_cryptodev *dev, struct rte_cryptodev_config *config __rte_unused) { + + char str[20]; + struct dpaa_sec_dev_private *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, + CTX_POOL_BUF_SIZE, + CTX_POOL_CACHE_SIZE, 0, + NULL, NULL, NULL, NULL, + SOCKET_ID_ANY, 0); + if (!internals->ctx_pool) { + RTE_LOG(ERR, PMD, "%s create failed\n", str); + return -ENOMEM; + } + } else + RTE_LOG(INFO, PMD, "mempool already created for dev_id : %d\n", + dev->data->dev_id); + return 0; } @@ -2191,9 +2212,19 @@ dpaa_sec_dev_stop(struct rte_cryptodev *dev __rte_unused) } static int -dpaa_sec_dev_close(struct rte_cryptodev *dev __rte_unused) +dpaa_sec_dev_close(struct rte_cryptodev *dev) { + struct dpaa_sec_dev_private *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; } @@ -2260,6 +2291,7 @@ dpaa_sec_uninit(struct rte_cryptodev *dev) internals = dev->data->dev_private; rte_free(dev->security_ctx); + /* In case close has been called, internals->ctx_pool would be NULL */ rte_mempool_free(internals->ctx_pool); rte_free(internals); @@ -2277,7 +2309,6 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) struct dpaa_sec_qp *qp; uint32_t i, flags; int ret; - char str[20]; PMD_INIT_FUNC_TRACE(); @@ -2337,18 +2368,6 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) } } - sprintf(str, "ctx_pool_%d", cryptodev->data->dev_id); - internals->ctx_pool = rte_mempool_create((const char *)str, - CTX_POOL_NUM_BUFS, - CTX_POOL_BUF_SIZE, - CTX_POOL_CACHE_SIZE, 0, - NULL, NULL, NULL, NULL, - SOCKET_ID_ANY, 0); - if (!internals->ctx_pool) { - RTE_LOG(ERR, PMD, "%s create failed\n", str); - goto init_error; - } - PMD_INIT_LOG(DEBUG, "driver %s: created\n", cryptodev->data->name); return 0;