From patchwork Mon Apr 2 15:33:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 132666 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp2711321ljb; Mon, 2 Apr 2018 08:36:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+0vbCrPtzVu9+FToUXSnkp9+lz/6nvpcbNR7PElEOymUQt3NhY1qLg9+d8XZgw/3/wDNue X-Received: by 10.28.215.147 with SMTP id o141mr1257635wmg.28.1522683405280; Mon, 02 Apr 2018 08:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522683405; cv=none; d=google.com; s=arc-20160816; b=jZ0N3pmb2PcOgm4WQ4aOQCzsUm5xuAmesfQo3KbDjeTkX3TP4kwfNPJQo1RBRSGIK1 oJs/wkfuOi1nctw+JcJYpC2wbiPGXhc+k6Dq+LuH8nszI2x5rRhyc89qLqtQwzEZl9Pm 24F0y9na+SPh2Ullby6CQyBKPvOytKsQqlRDLM8ZFOPhTtHGbywhXGR3M99be4MZnPhX rkijL/9N+5aTdsqOPXH54wNkID9WLO3v04hSuyNybIZi5cC4VaxmkyIJ1gUen7NaA4ah TyffdAskY+N0ltT21aoP+KRnvcMs7AH/CCwygOBZz/WNaKYlZZ304pkmVHI2e6ssi0K6 hEbg== 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=S1u+Av+jqzeiJja21K6c4J9HNmai7F1d7oaoePJLhNNF/jWOqqo/btzaiQIXZ8TJ8g b7FgtXvGd8/rhWRVAQ9/VqfN4g4qc4h4zhZxvinpSmQXmtvVR7kOg2bWwh4Pa+uJ1mwb FBpL0pLqaWn3UzqP+RyBqmhUTKcCWmkJr5HDVOs1SFg1dd0e+RVhMEaqo5Y9noBY9bd+ cy/zDeKLnVxrbXcZVNu5+OePJZLdVje7TEswX8pD1lv6+jsbiPRroMHgEEMNeSyLoFQP KkzANNnTZbpXDSMOz+pogEPeQm52Ha7AKZ2Sr980JqNnD0Tk2fa8ExZE7alsTRohAHhn Y4Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=TfrS0blf; 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 z76si438349wrb.25.2018.04.02.08.36.44; Mon, 02 Apr 2018 08:36:45 -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=TfrS0blf; 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 83E6C1B3D2; Mon, 2 Apr 2018 17:35:36 +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 6AA641B03F for ; Mon, 2 Apr 2018 17:35:30 +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=TfrS0blfBfMeAIhROb6+Pw2Y77tdR3KFr+MPNkkcPCUtdxNyk/a9Tj+FVzVTULuZuktyWVLZq5kz0ec/c2jnePGih8XgvA2fX5H9Xz/vsSetx9/LxOW6LaMdIfvnmE+go2DTWylrKddymB9p0gYsNH5CIB7wnE+4fslAvqjkIR4= 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 DB4PR04MB0767.eurprd04.prod.outlook.com (2a01:111:e400:984d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Mon, 2 Apr 2018 15:35:26 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com, akhil.goyal@nxp.com, dpdk-up@NXP1.onmicrosoft.com Date: Mon, 2 Apr 2018 21:03:20 +0530 Message-Id: <1522683201-23963-8-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522683201-23963-1-git-send-email-hemant.agrawal@nxp.com> References: <1522654594-2757-1-git-send-email-hemant.agrawal@nxp.com> <1522683201-23963-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: MA1PR01CA0090.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00::30) To DB4PR04MB0767.eurprd04.prod.outlook.com (2a01:111:e400:984d::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 812ddbb5-d742-4f4b-26e8-08d598af5c6e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB4PR04MB0767; X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0767; 3:z2MPTnroF80AaoyLvLnoxsl/+kq1uI9Uke2S2AVfWpvceQK8BTLZIaAe0DFT1SV7mP1Gh1oHQxEhFD9D9BAe1hQpDiSr1BvRL50QrzuVoSpzQqBYwFlz/O9lRcQDpVXzpQCMHKWY5GHuOZVpZ6w+tYs/Lu8l/tAv509pJZ2tNEVfT7u8opq5mcW0NHQ3LL6O4aOePNTMm22k8AZ2pPQyb27bSJg2D4h0j8i7TUUFxhpce9jjhRcUd0onTAIQMw5Y; 25:YkV006AeYvM2QVh74OfR9X/Rx1P9LkgP3sXwj24MV2cGTOuEYUtZb0Uzg9NZw4/YwhYTFsUumFROlNEiJj6bb4oc6TRiDfmbwTtqytAHXpKkriNlBetOGpuBxGMOPg8rRSbJeGq9laT/ctPZWO2c0b81vNOvxc4JyBjna4yTzvbfqhT8JxtEoHEcZD3P5bAET6CT2CdchllCb3mJzXsUc9VX/2BKY2Uck8np+gQkGCjJRq0xwcKjHL07t068poInnUBdchYa6GnZyTnv/60ipdv23UKycoLpnEMh3g7sSjEpdYg9FLon+p5bjdCjvuP8RQkEAyhSLF8nCKwzefliRw==; 31:UFXgziIi0txoDRCDg904MuKQvCVBAHOFKxVEeb/DjCRWC4LFvCnC/ujOX+Zsy0frgjSVbHnh4YISJ63762veQngwfyzL4ZvkDvPwY0PhiUChI2qaM2aIqtBPVoR/1oyUy2G78LisZD8s3vvyZbdNuvHVYN2ZtlFgIV6NEKWEzd+kbwlYJahNiN7zlHjqXpyR1B3jBCevOW3YyROb5rJzCG7VuKTs+ZDI+SoQEx962Ws= X-MS-TrafficTypeDiagnostic: DB4PR04MB0767: X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0767; 20:almvyL/R1sSOt5EpTxdaD9TQpf82iqoIBjJSsvInZfQufauglAK+uxVguI/SVxi3HQSKGkZdt6oZQouMdvV2tjzZJkv7Dmnn9J+AI/S4aoU2H85QByEYkY8fr3lmxds7XTfAUD4Ip0WQhujyk6xSi8YWk9duyZOd4OTx2ClNbc1I/y+DCJIv4/QMEpuqR4Kj/mMmC5YjHOXk1OtRP/9ny+UxLZQvoumURur/hN8+kvBsNfum6oHLzySMz80TcJFwsc4Y7PagAG8gW/seZp86KpS3u5KA6VhvFsEu4isFoaESBcT2dM2oOGk4OVrGFo4SZedktWKHKfGiBBJ/p3LRdhsw7nNXp0EJo2iIx/eE7wLS3qH4vAG90kwgnNbaJj3UayKnid/LtmmYb+fFGwecUUhLWql7bB0/EDeqGDj1ve6Bvmbp2GhEX2V6gBjVYpLFuar8PGYzLAjtwIhN2kke+7LLcsKCLUwQuAP14/kYLnUpSyaSakxuZPBVdk4A1YAP; 4:NtmFwCyGxaNBf+ZAekqFepttzezc5tzKvUtnwqLtVyzu/z9q4EhrFv+4c2sCpSglgZKP6PCwjQyxZTv5YyOVZnpTYLfRMXpHBEPCUeDsBQvA10W0RrdbZ7aPaUmEPtxO9fJz8CYTrOxgi6YPLgrof/HVrnqla26wXeDC8V0jqogOvK7+zLF1KbJHHt3ox4Ef6fEqF+zq8B1mZ7Mn/tgi82rlfbd5VYrGsB3xrtmkxBhKwcRUA1JerchC8bMBlzahB9yqH4Pxrd8g4K4SzFJ8skj1pjkeUQRzVqe1h4BQMnlenn5MgiwL3o2yxT4fy+W7BVTiY/IBrc8FXq3eL8Kc9c3SQKaR6Nc81KMC778nYnI= 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)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:DB4PR04MB0767; BCL:0; PCL:0; RULEID:; SRVR:DB4PR04MB0767; X-Forefront-PRVS: 0630013541 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39380400002)(39860400002)(346002)(366004)(396003)(199004)(189003)(16586007)(16526019)(86362001)(6486002)(50466002)(76176011)(186003)(48376002)(2906002)(6512007)(55236004)(47776003)(2351001)(5660300001)(73566003)(6506007)(386003)(97736004)(2361001)(52116002)(51416003)(305945005)(105586002)(486005)(7736002)(81166006)(5009440100003)(26005)(8936002)(3846002)(53936002)(36756003)(107886003)(476003)(6666003)(59450400001)(6916009)(25786009)(316002)(4326008)(6116002)(66066001)(478600001)(956004)(8676002)(106356001)(50226002)(68736007)(11346002)(446003)(81156014)(2616005)(486005)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR04MB0767; H:bf-netperf1.ap.freescale.net; 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) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB4PR04MB0767; 23:6AO8Dz7pYvzv7CX/+ZMrPIFppT5pMDfH8Z1XpEqgF?= naGog+tiNc0tX9NV3j0qw3+iKNHfc96gsK0SpNbWyxKE/fgUsy09v0dOPNQqIIAxbFR5S2F2ggpkBFv/ztbnuuMyxWTuOva58NKRGyv0PFAgpVyQ9OZbtSAXybP21e+91lNe8gJToP3wjk45zVd/LTpEp3NUGJmAly5Pw4F/rEwSjMxc4oQBaV56TEqQ/LBbwf8GSF0eqz/izo36e0ICdMAO4fBMa6oEPI3NDkuToeUK/xW7T5a6Aa6A3C7swEqMPyNtsIsN2ubTv5WnEcxehFiQORqiUmLc1k3+DP51778o3frH5x+TYjpeQyRNEN/hRqdSII3eTkq80vU6ozqf+0qhV4tVmd+kmkxnA9m7NXduvEHQ7YzVgXjvSqLtrL7F7e52G6bJpyrxrZ0/8uORJvrUprC1Fa8urjP9DtM3ehLKd3NYgH0YnCDR1glWlZ9ELkeEGM9/j/kykDedgffeEE0Rk59LcIA9RF6amEB7a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-Exchange-Diagnostics: 1; DB4PR04MB0767; 6:+/bTza5aJBM5BJwvdTEFIRr+xK49W9nPiBV7M59aLGiomYPuJuEjxHZ0bdLHpZMM+hhBLs3inG3lafPxcUQckIOlpXx9hNKWD9b46LB6NHQX8H3pQ4HmhEOFVC78oo6uSUyErap1J10fYa7CTM1evQn1L5dkH2KpK2jL9rldX/8YsdpSE+nSzgE5NPeSLxZU6Z96JkuQdRYgH0UQ34Ci+yGe57lOlqXA9GOKEwJ4GJatS6thsKtmc0Olk28/bTlnT/Y9qK2krY94Yz8ApaEccjS5lW0PJ0BjtvZ1CRPuVF6QtN/Of1BLYijShtdARxN1MDFWrbCJp+K/FIiswznqf5WWj839nWo7nSfiH8weQZ0rmZKlrKxkYZyxPSTLzBMEd3uAnllIyh95CmdMRNjRi1D7IukNZWNVwldobt6Ckc3cMnzVRNxOUToSzuuPOGfHn7qbcI507nszStovvZbxrQ==; 5:1/+vtIVjkPmaWv0gGVYqF7Afl3aTJwNTz13oKKKEds2ZfelkWKWwhcNnP4SbptpjBzmZzCcvRrHhB2hmDhWUHhE3zUBAIew5AYwgr0gOOZyTB85dNNwxPTXp9UnLvhoPowS0xuQMZOGM50RZJEb1Ii56z3VCp9bXplVGGVFEZQk=; 24:g5I3B83lM0nMYw1RQWNEBU6Yo9hjtm9MijKoojPhweVH80IR/AnsYcdJf8MOKQ5dHr14ZiPWxgXfayq5uLiudsdstLICRefjvF7kVDnZP6U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0767; 7:0GJimG84PG4mk9Y94HKM+jF3w4YKVjrvJedyfuY3pFS8IHt/jJM7BTerW6nvzc7EijDcOtjc4SiBJq2M1kEZdfN6zaH0p+pXdIvAUj60imci83Yj5xcXaKKTK+C3SazlmANEikoRt9qV54qKHR9GXkbkrHSy385srJZHQtN4lxbTuxbWjQ1zzeIM0smrToSJ1ZRnLtUtlhX/oR8ZKLCuS91oNutITzz5LRwwc5l9EmeMcuxr6XaJsfTEPNGJjAdG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2018 15:35:26.8964 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 812ddbb5-d742-4f4b-26e8-08d598af5c6e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR04MB0767 Subject: [dpdk-dev] [PATCH v3 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;