From patchwork Mon Apr 2 07:36:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 132653 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp2290552ljb; Mon, 2 Apr 2018 00:39:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx49eOwPlCd3mqqLoxTV4iPo75INyKwQ++Q4T2jGi/5YFvHxksw26rI1jSoAGuXu+zeO50ifi X-Received: by 10.223.153.167 with SMTP id y36mr5822283wrb.136.1522654776354; Mon, 02 Apr 2018 00:39:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522654776; cv=none; d=google.com; s=arc-20160816; b=XeeBu/RNTFD6jcoj6rQOQ0sXGgm5GZfO0S7tMNiDjsjCR4nOk3c5B5wfEbinCeRT09 y6comjlHak+mVeMpEbrFII+MSjRK/Dj7onecfT06XKGxSLVBAnT2WusFjDOz+jK1RAYM f4Tf6KYXUtPJfdgTej+ayVVSjq0Ghsx3n4QXyyXvNQrYGi9caKA2y9qMt902tibiOS3h yyPC/AE3SK0nshvfOkYSaoX+DyqIh2GYSxs204xMnxFcIgeTxoAjyaC+K3uaaB2L+SXc bGq0iUWo0fGyQLzR1dVBVt/M5oCW0dkBcU8YA8th4cfDnI5H6Lwk0gH8dFGRI/X31PwY hj5w== 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=AZuH60iM7A0uf2oc4iZPlgDFeAOTxtBQH+DaAscR1hzezCfcN7LzScIpwJtAYzrtmw b7tsR8liJ/bj/4KZCQZG7cAbKDjWSy+ia8bWz1ujvbBQPtUBxEJj6beEmWpbxdDZtK6/ YrPClhVTcwKkaT8x75epu7XKG9mSTMnKBw+yJLM/GTFPR5/+2Zr+8LyFEXnLwkTt4vL7 gMpFqnUS++BfRFSN+vRge3csURqjc32dvTsPS0VnCV9HMFVBPYkxttuVFkcRk31JWuLu McUaj/n8ve5OTrlIiUqQ2fUvCgIZaWd83TWpcmlF7zMXqwyCwx787z4JF9ffQHG6+iYo F/TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=c/GNJaPp; 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 a91si11189215wrc.50.2018.04.02.00.39.36; Mon, 02 Apr 2018 00:39:36 -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=c/GNJaPp; 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 A4FCBAADE; Mon, 2 Apr 2018 09:38:39 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0048.outbound.protection.outlook.com [104.47.0.48]) by dpdk.org (Postfix) with ESMTP id CD9A7AAD1 for ; Mon, 2 Apr 2018 09:38:36 +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=c/GNJaPpypD0h8bpHqhvT0H5Vgutw8rva1HnqEUPmiKxYLBiKd7ckABcXBNZWwatoQtlt8MGAoOi9qF74QHyiHirObxFxNhviTCBD9ZUkLrnwdpXJPDGR3Nn1hEe2oNdEoOEko7oiIhaSAmcgiIlDo/S3Fb9zj47MQbOcgBLur4= 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; Mon, 2 Apr 2018 07:38:33 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com, akhil.goyal@nxp.com Date: Mon, 2 Apr 2018 13:06:33 +0530 Message-Id: <1522654594-2757-7-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522654594-2757-1-git-send-email-hemant.agrawal@nxp.com> References: <1522152039-32493-1-git-send-email-hemant.agrawal@nxp.com> <1522654594-2757-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: MA1PR0101CA0048.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::34) 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: ec3d7e31-0585-409a-c00e-08d5986cbdb0 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; AM2PR04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t8nh0LLvfMFP3eMuVwBxe33tSR42xbmq3VGdbEUwxqpsoJX3p9C485PUaBuz+ogHSqHjscUpqL1ukSMEKnzBUFqt//rgj45GJDa6aivni9WbDAjp0/GQ52wgJtvDpG1/jKaBPwi3lTxfpq1bJEtUmY+Db6t3Ovg51Oq6JHSTtoaAFQrn0+UhJdfTnnKW8XIIHyJ5t26L5FQ7HR0LUNJT6AZ2rTQJfydBXvNvYVw8vFW8ouprHbJDBYqNV9M8bBl1c+OBSe7Q+xzP4DBrGuN2u2TZOQCUvPSHGTiuPZkax8yvOtai22tqdwQWBlNmUxv/Y5WkE07rL2tk5+6fDopF2QehjsU; 4:XhtForeMxu7nkhlwWI139QCEm7W6g7lSaCcHfuHt9h0YarjgJUgod/0zPQRI7LDbQQhgLnz/8zSJMQWi+nqfS54BGDd7kbWgDWZcQ4iSROSPAaW7zvbngIvbdaZRlhTGnivqISMfXyVOIjhsbnIQDM96hZDY3RyLp32rDL7tVgv8KytTnIkO1kK2v5EW8glQDdw/l7izh0xVqQj6PRaxwNZNrOfnml0XhxqdnsBSuhyj3rQItfjnAKXo4v0A0PHkh6+fN6PujXQ2xv+tCnwQTKyRYwiqBdqbtfiex77CxpOYP6x0FXNEKn3TYfm8rougVtV95q7prYumXsf4Ogj/Qh0qMzHeGJV+jHrPGN0TtuA= 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)(10201501046)(93006095)(93001095)(3002001)(3231221)(944501327)(52105095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:AM2PR04MB0753; BCL:0; PCL:0; RULEID:; SRVR:AM2PR04MB0753; X-Forefront-PRVS: 0630013541 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39380400002)(366004)(396003)(376002)(39860400002)(199004)(189003)(2616005)(106356001)(76176011)(68736007)(16526019)(50466002)(59450400001)(486005)(5009440100003)(55236004)(6116002)(48376002)(3846002)(11346002)(47776003)(16586007)(53936002)(66066001)(305945005)(316002)(386003)(6512007)(956004)(446003)(105586002)(7736002)(6506007)(186003)(486005)(2351001)(6916009)(26005)(476003)(4326008)(2361001)(36756003)(86362001)(478600001)(2906002)(5660300001)(8676002)(50226002)(8936002)(81156014)(81166006)(51416003)(6486002)(25786009)(97736004)(52116002)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR04MB0753; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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:siILsvY2iLu6LVDaCAiqb2vhukvx0H/4afXjANzw1?= 4tnrMMi7VpGEgp2SmnxLsQV5YTnikqwMJLO/u3JsBBONyQe3heMXOUnMUDvpPersaVru09EzvWQh7zblMciEiS6UvJ4j+mf+U24uHB0LuwGK/NJds17eQPGjqixdB0pxramdqtP8pBe4Htsg83Ja4cQMBDoymkvv2d8IyHKf1cEZW/owk98Lbt+iI8Qur3cMb/OE13vKYsNB3jU6/TmKENpOWWona0PwUjbQ+KqGGYuSALtUedGsLVRmU7K3H/C/C0q4m7QLxjWQusw3Rv3vBOwynF5IAYocYk3jlHsKhmesl0BwJtLtl9R7V7wKpip2r1yvKULNaNORmH8Z8rrUhprTjq0BHLUros/7JG5dxaQR5AMdpsaa3SVXUcIg5GHPfkrydp6D9VrxzCgMoqbg9qcf0lVJQJWSc85Q/GK69MA7o6CvnUnxIEC46q6ggt/k71f3LF7IxxwtEYp6D8IkgRJgIsKfF2DrQhBNUvv3LpbkTN7GxTsWR7tMYYBhyUg1vY1WcJJmPF9coaZ3iCkZmTSdOgeOm4pyl/MfbFYxHM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HxOh2YAavk4p9FX9bTfJrhSsrUmGNab1XdDYCvcyjlyr3BTHreqWQPHgrN0lRCR/50bEXegVvnRIS4+jq7DiQ2XKdEaUYmvgMeXll8ptRxu1eOJdEfDF856AH+kBbaPiqloBhE1pa2zEA5S4rbgCatU6dYaRNvT7nPxGUUBDXs/o5wv7MVBo007g5+X8xjN6cxEgFLeu3MUusI6J4yUT+IX7pSGqX2g1UHefhtG0QIbXAjlcZ2bwI4O+qfW3Sg5gKokEtvQfREW14gfkI5jeh7bNp/5EQBF4iTmMHYbw9c0gQ47sGR9BcLVVCPE29DymSX4WU+y/k/5i/GTcZ3bDPJiRaPQfNsPDHcExPjJQ==; 5:blqVNL8IWcRhc31IPm/KXC6nFRTdRzjQz77ThijnCQUrMBPE49Xirze6Rcq21jbYyx4cSSx6HxRlMPlDrJ5HgthMyaPG5N1HaZOX3T2wIfzN/JugVzF7z4LWcfsBiVSC3eX4k0xrwbxjNAvgcI/d7WXLWSqg1YLOIkGrD5wps0M=; 24:uqDiL8Hg/8CKs5VAsrDDA2I+DK3kCXrO4vHOZSj2DMFEXdO3iUq6nUCA3i2EqXZ5CUrdhmpTDcz+jbnEURqKTjVRRLljUx82hr1b4crRNeY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0753; 7:hx3jpkqalp835hrNcC24gu7N++PWFSUErWYnSNKVaim8vYC6R/yhZOFlIoJpQ+FCZeU+zu9V7rdXVEFpVpvvk8b3N24/D5lhQhZhjbEFT7hrtGGyhjHuyDEn+beVRsC+Lju51Kzw/ty3yTCg/n8VgY5Q4XSbHsNMmZQo9kYUkXSqKuTLzDUGn4AJN5+qJ+EEQuE+heWPWL0jFMNVzHI6Jr58Z2+XWMuCv+8PP7mcllgj1UITxQdwdXh7ULCKcPiK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2018 07:38:33.8261 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec3d7e31-0585-409a-c00e-08d5986cbdb0 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 v2 7/8] 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;