From patchwork Mon Jan 15 06:35:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 124475 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp573694lje; Sun, 14 Jan 2018 22:40:09 -0800 (PST) X-Google-Smtp-Source: ACJfBoumTIsJMBi4+pVl1/Tdn9ACgzc3sApv2s4GtPqWhaM1Y5qIevtbMHeP/fJJ67gqoql2SRow X-Received: by 10.28.19.210 with SMTP id 201mr8725626wmt.4.1515998409353; Sun, 14 Jan 2018 22:40:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515998409; cv=none; d=google.com; s=arc-20160816; b=uT91dLZzNueID9F+7MD64aP2AdM8mIRp8Bwc8K9pChL8KZa7MsBnjGw2klkJDys4M5 RXWunNHsF6D7eI0ptWzKkqGh+n8fQgvmLvmnGrnmfm8QvTI4Fnauzq0Ks6LY+sef1OtB tBHMgQHwi2fRxdw4Nabldu6sGaqfoe7sWMoqtJlq9hgaUX5ZjvfV9fKt2Q/JHVFuws9B PW2i9S4Rp+xZVt645vb2irsC2qSLP+7opuXn1AvMdbVfWL7GuQ5Ng+x+1eava1imdilj bHw6P6Zdfqxh9VKs5qQsfls+KChvHCJJ3q/sr1VWmsst41wvGWt4TmkQCJPr7yFy3eoy LOkA== 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:arc-authentication-results; bh=Zpizh7N1xpPY9YneJeYUA9OwrNADARdF7mpwgyRJh6o=; b=c7zlSBc8BjbdG/o7WqpdXXWWYD4jw/AXlsT/oc9heYhHmrJ0utt+q+MeMRnJjVLSpB GGqdAKYV84P1rHYt1iJXVCoyDIx+WAPknN+yWgiVBHWEamXgLLMQfttfIM0RUlqp3HFA oqnS3bL5Ew0j6mms903u4r7X0eEhPD2JEvs+pxUir+jaX75W8w03PTByn6sWApu9s0Bu Y16U/Bw37Icz5CObCAaefjHdHP1Qsa84aTmlj+MMRdQ/vLedwL6uK5tT7V5K/bTtygM8 e8F9uzkvZGkRhjHRdE7sL8b63kwQ3/iVoJB2PtR0UN5wMe9ayx2bXDJBIznHnsVaG6Y1 Ny5Q== ARC-Authentication-Results: i=1; mx.google.com; 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 x90si2859069wrb.344.2018.01.14.22.40.09; Sun, 14 Jan 2018 22:40:09 -0800 (PST) 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; 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 19C61A48B; Mon, 15 Jan 2018 07:40:06 +0100 (CET) Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0063.outbound.protection.outlook.com [104.47.32.63]) by dpdk.org (Postfix) with ESMTP id 4CE4925B3 for ; Mon, 15 Jan 2018 07:40:04 +0100 (CET) Received: from BN3PR03CA0103.namprd03.prod.outlook.com (10.174.66.21) by CO2PR03MB2358.namprd03.prod.outlook.com (10.166.93.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Mon, 15 Jan 2018 06:40:03 +0000 Received: from BN1AFFO11FD024.protection.gbl (2a01:111:f400:7c10::109) by BN3PR03CA0103.outlook.office365.com (2603:10b6:400:4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Mon, 15 Jan 2018 06:40:02 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; NXP1.onmicrosoft.com; dkim=none (message not signed) header.d=none;NXP1.onmicrosoft.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD024.mail.protection.outlook.com (10.58.52.84) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Mon, 15 Jan 2018 06:40:00 +0000 Received: from netperf2.ap.freescale.net ([10.232.133.164]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0F6drN7007259; Sun, 14 Jan 2018 23:39:58 -0700 From: Akhil Goyal To: CC: , Date: Mon, 15 Jan 2018 12:05:51 +0530 Message-ID: <20180115063553.12703-2-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180115063553.12703-1-akhil.goyal@nxp.com> References: <20180111113304.19709-1-akhil.goyal@nxp.com> <20180115063553.12703-1-akhil.goyal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131604720022597385; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(39860400002)(396003)(376002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(2351001)(47776003)(4326008)(77096006)(81156014)(104016004)(68736007)(53936002)(81166006)(105606002)(8676002)(50226002)(86362001)(5660300001)(6666003)(2950100002)(106466001)(8936002)(6916009)(85426001)(305945005)(356003)(51416003)(1076002)(2906002)(76176011)(50466002)(48376002)(54906003)(16586007)(97736004)(316002)(498600001)(8656006)(296002)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2358; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD024; 1:rGQd+QzcoHNCBBWjJnoH4SVLt43Ju9+ojwF459HynRyBZTpaTjp+JQImVKO9XT2kmaRGraq/sB8oSNni4ztE7xwWWflyRCHSz4CQ5pNOV1ieIxHLcz2p57YOZwItRJ2A MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1bcf6f08-aa2a-4dc0-2f09-08d55be2ce2d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:CO2PR03MB2358; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2358; 3:kCQ/r6S5f3xpe468wjxTJLU1CSngwWAVCp+/WNh6y3YmHu6ZKmxETFtVNStUCnBKwoIB5O0/ZovGW6bfdbGj/f1WiwwIzILWNWBWpP0DWlc2RADNl2GFXNpk2bX3c35Kffh3SkaqRCsRpKnfViLveP+QxEnL/hDw48Gr4r+p9k6EL/klbzmaBEm07NnJD3fd7T0G7g28kikgNscBdiw9zt6boSIkifRW020M7uY+6FRx3jqXmw86oOXlGqG3BthBEfoH5CWn+/VlxkzAGZaaeENkG8oIMAz3ZXLzB+bN33ZgEZjkGJqpfjMyEmx17iiPY5VJWYrAp49WEUk4qD/oKyNT/AhYaxXwHUBN/MAqnT8=; 25:Qxnd132knXVe/fqM8rtxThcPVTzdjCTI0p9YBFPwJ/YaSL0uoj+pa0H1ysuA23lSGxArx6nKIqQMt8XFDoGV+36W/dK/KTV7YZCA4uWk9vRndxDHdsNwAidRahYNNfzVASFZUL8pqgrlbnuDYnULl0jqRBygFjAl4Mfr/PERbk/YEGbMJ/cilvvkILOrmD5sQejm7QFqlVgk28OKyJ103USPyBajQPWY/64S0XR4Huxe1mp0iBMZShN2Sp2blblw6diMINgOY5arbQXTXcf7b5DecpdXD3dwWxCeMmw9Tdkf28LvvD4KoieIj6PJBS57wVxmJy7o2BZCrpJgv71DsQ== X-MS-TrafficTypeDiagnostic: CO2PR03MB2358: X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2358; 31:a1Ckvy8gCRdPEnitnNFo1ro0LMb5eFmfr0waVWf+/RIqtCBHvp32V/8wR7bZM0Ft8ko5o5xJufDGd3DOux2FyyQ0cFWj1Voofr4Y8dE9TGmmFu0ZgJwwedf4FBe8LnBSEV/LW1CLa/SO8AIQ85+5inLFtib3hcp5pOi2od9ynV/if5cjexVaQo38SB5c3PioqFUkSTHNMe7zNIw0+BiMaZPG1GLNxqW5SGMkMMVtzeA=; 4:SF4ZMEkfwl3EM5SwbQ0N5DDdBDWx/dUmReEweVQiDV85njXwNsIG/LA7xubttfWw4NZFe1bmEDKjK2VFUWoVECg2EwR1MIkBDIsOdoBmm38TqCboy9Jl/JM/GbQdniLnR478MFOHr1+siebnueoP3FjI7WXrQp5WFAfImlAIKsL/gTyoGHd/3QyGyMnLLaE4K6VvBhcKti6fgO147Mq5OUuB8H/4/U7k9/gpDG/3OrZOr+nKAVj0ppSOGIV0Omg6eqg9TmZLl+t51M94CtnLFUi6jESEfphcXlGIuslQvvkbC1KoYrIJ5DEPZ8P5D9I3 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231023)(944501161)(3002001)(6055026)(6096035)(20161123559100)(20161123565025)(201703131430075)(201703131520075)(201703131448075)(201703131433075)(201703151042153)(20161123556025)(20161123561025)(20161123563025)(201708071742011); SRVR:CO2PR03MB2358; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CO2PR03MB2358; X-Forefront-PRVS: 0553CBB77A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2358; 23:9zAw2EpVVO4bxo0b5VmxcnJNBHM+l6BWEs6lEOhzy?= oibX1eGtLHNeqpXiN8cx2/qWShGuQp3N0ezbn7mXG/GbroJCjESBp4NEjeLr9fCcblZr9DUg/MYDJB2+4AA4IrPYuajIDWaxdg3Zvz+6Yh/GR5Tz2+pnzg+Kw9vIswe+qOddhluyY0Cm60Ja2tWHTbKrcdPesJUvGr8GbVyAj2JPgcn/61Y4OnDw/OWejCpD5S0tZXp7obO+TNB97BaiZPHXLqJuYiihPckfH9sd6sixNC4RR8lFtFZjX2nQGWnSUSbf1UTaqSM5RCLHXqfUILFnPPFjBvAY7j9xJuTLB5Xh6MtO2rCkLncCSPpmETs8StwamHpsfLzzarGCoX0zEySvF4y62G43kuo8w/8sHrZS8McFOgplJhP0ZfwyYI5vBZND3yDBlt5cBVNdYpiffl2TIdWicnBxyJqzwoV8mSOq+gj76xjJrNQS7cAznZBgtubGUZMtF3IrxLtrFLk4YKmoVAZ+/4EHG0EWTTUd0PHG/sB7hdRJ6401m4h/OcMva9Aik0g8r8cLA15yhaTQDO3uYifhQBzCNYWtGP0op6ImT+Vcmu3VG7CJXACViAEtPFoSiZlFLlHBpFfX3VUmEh/L73HAt8ADlFqU9JOGhaG3m0LLDJmTMlBcO/Foo8zVzNFL8mOnIuZ9nYp+MlzJXHd09JAJJ+gILly7PvdS0KxafWogJPXUb5P2n4wcy0VOfWV6c9/+2TBB6y76ZzSpauD5w3RjylvPLxorbXdmIiGW1Jo4mX9c15xRePTii7Adw5PZxu68aBsIi/PXZxuDl4eseSOsJ+bPwT2rwgXh7om/vy1DlR5C88k88j+CXMey4sJC4qpvPKRzCF2Hid5ao60M7CNLZH/B76o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m4Nv3sZCsxXGkhHZBMuKpTTH0y6IC6GlC6ovn+HP0syhiqxc933EuZ3XVZV1Xu97eDYd1pu52QyzsxhbEcO SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2018 06:40:00.6997 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1bcf6f08-aa2a-4dc0-2f09-08d55be2ce2d X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR03MB2358 Subject: [dpdk-dev] [PATCH v3 1/3] crypto/dpaa_sec: optimize virt to phy conversion 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: Hemant Agrawal Context memory is allocated from mempool. Ideally it will get all memory from single segment, so simple offset calculation is used for address conversion for such addresses from context memory. Signed-off-by: Hemant Agrawal Acked-by: Akhil Goyal --- drivers/crypto/dpaa_sec/dpaa_sec.c | 27 ++++++++++++++++++--------- drivers/crypto/dpaa_sec/dpaa_sec.h | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) -- 2.9.3 diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index ad1b309..157eace 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -80,6 +80,8 @@ dpaa_sec_alloc_ctx(dpaa_sec_session *ses) dcbz_64(&ctx->job.sg[SG_CACHELINE_3]); ctx->ctx_pool = ses->ctx_pool; + ctx->vtop_offset = (uint64_t) ctx + - rte_mempool_virt2iova(ctx); return ctx; } @@ -104,6 +106,13 @@ dpaa_mem_vtop(void *vaddr) return (rte_iova_t)(NULL); } +/* virtual address conversin when mempool support is available for ctx */ +static inline phys_addr_t +dpaa_mem_vtop_ctx(struct dpaa_sec_op_ctx *ctx, void *vaddr) +{ + return (uint64_t)vaddr - ctx->vtop_offset; +} + static inline void * dpaa_mem_ptov(rte_iova_t paddr) { @@ -563,7 +572,7 @@ build_auth_only(struct rte_crypto_op *op, dpaa_sec_session *ses) if (is_decode(ses)) { /* need to extend the input to a compound frame */ sg->extension = 1; - qm_sg_entry_set64(sg, dpaa_mem_vtop(&cf->sg[2])); + qm_sg_entry_set64(sg, dpaa_mem_vtop_ctx(ctx, &cf->sg[2])); sg->length = sym->auth.data.length + ses->digest_length; sg->final = 1; cpu_to_hw_sg(sg); @@ -577,7 +586,7 @@ build_auth_only(struct rte_crypto_op *op, dpaa_sec_session *ses) cpu_to_hw_sg(sg); /* let's check digest by hw */ - start_addr = dpaa_mem_vtop(old_digest); + start_addr = dpaa_mem_vtop_ctx(ctx, old_digest); sg++; qm_sg_entry_set64(sg, start_addr); sg->length = ses->digest_length; @@ -631,7 +640,7 @@ build_cipher_only(struct rte_crypto_op *op, dpaa_sec_session *ses) sg->extension = 1; sg->final = 1; sg->length = sym->cipher.data.length + ses->iv.length; - qm_sg_entry_set64(sg, dpaa_mem_vtop(&cf->sg[2])); + qm_sg_entry_set64(sg, dpaa_mem_vtop_ctx(ctx, &cf->sg[2])); cpu_to_hw_sg(sg); sg = &cf->sg[2]; @@ -677,7 +686,7 @@ build_cipher_auth_gcm(struct rte_crypto_op *op, dpaa_sec_session *ses) /* input */ rte_prefetch0(cf->sg); sg = &cf->sg[2]; - qm_sg_entry_set64(&cf->sg[1], dpaa_mem_vtop(sg)); + qm_sg_entry_set64(&cf->sg[1], dpaa_mem_vtop_ctx(ctx, sg)); if (is_encode(ses)) { qm_sg_entry_set64(sg, dpaa_mem_vtop(IV_ptr)); sg->length = ses->iv.length; @@ -722,7 +731,7 @@ build_cipher_auth_gcm(struct rte_crypto_op *op, dpaa_sec_session *ses) ses->digest_length); sg++; - qm_sg_entry_set64(sg, dpaa_mem_vtop(ctx->digest)); + qm_sg_entry_set64(sg, dpaa_mem_vtop_ctx(ctx, ctx->digest)); sg->length = ses->digest_length; length += sg->length; sg->final = 1; @@ -736,7 +745,7 @@ build_cipher_auth_gcm(struct rte_crypto_op *op, dpaa_sec_session *ses) /* output */ sg++; - qm_sg_entry_set64(&cf->sg[0], dpaa_mem_vtop(sg)); + qm_sg_entry_set64(&cf->sg[0], dpaa_mem_vtop_ctx(ctx, sg)); qm_sg_entry_set64(sg, dst_start_addr + sym->aead.data.offset - ses->auth_only_len); sg->length = sym->aead.data.length + ses->auth_only_len; @@ -788,7 +797,7 @@ build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses) /* input */ rte_prefetch0(cf->sg); sg = &cf->sg[2]; - qm_sg_entry_set64(&cf->sg[1], dpaa_mem_vtop(sg)); + qm_sg_entry_set64(&cf->sg[1], dpaa_mem_vtop_ctx(ctx, sg)); if (is_encode(ses)) { qm_sg_entry_set64(sg, dpaa_mem_vtop(IV_ptr)); sg->length = ses->iv.length; @@ -818,7 +827,7 @@ build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses) ses->digest_length); sg++; - qm_sg_entry_set64(sg, dpaa_mem_vtop(ctx->digest)); + qm_sg_entry_set64(sg, dpaa_mem_vtop_ctx(ctx, ctx->digest)); sg->length = ses->digest_length; length += sg->length; sg->final = 1; @@ -832,7 +841,7 @@ build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses) /* output */ sg++; - qm_sg_entry_set64(&cf->sg[0], dpaa_mem_vtop(sg)); + qm_sg_entry_set64(&cf->sg[0], dpaa_mem_vtop_ctx(ctx, sg)); qm_sg_entry_set64(sg, dst_start_addr + sym->cipher.data.offset); sg->length = sym->cipher.data.length; length = sg->length; diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h index 9342949..e82f4fb 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.h +++ b/drivers/crypto/dpaa_sec/dpaa_sec.h @@ -155,6 +155,7 @@ struct dpaa_sec_op_ctx { struct rte_crypto_op *op; struct rte_mempool *ctx_pool; /* mempool pointer for dpaa_sec_op_ctx */ uint32_t fd_status; + int64_t vtop_offset; uint8_t digest[DPAA_MAX_NB_MAX_DIGEST]; }; From patchwork Mon Jan 15 06:35:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 124476 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp573746lje; Sun, 14 Jan 2018 22:40:20 -0800 (PST) X-Google-Smtp-Source: ACJfBou8J0fYdZVoha4RnSmELTON7qw9BVHgvXZTdrvU1FByzraR+0h8b/7vn4dQ3Umru8a2CsjD X-Received: by 10.28.230.13 with SMTP id d13mr9997615wmh.125.1515998420776; Sun, 14 Jan 2018 22:40:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515998420; cv=none; d=google.com; s=arc-20160816; b=hkHQ1hvZKeK6lCUJQBmtgPH40MRtUodzCuUtSMnCwJploJlVJek3z8+Y9AgnQNO671 +VYBMWQgA8dKynx6cl2+LDKj64Bypnzw0WkSVFDk9DmJfZ2B6seSoT6GBcVi3qxmpXo0 MQXloEeZNeaeav/9oeqrvZTskqy3QIoCznaudw/7AMZwXc1xx4T6VYc6GotBZttNxVvV n0XWlbC3P4IkGsIMvmo2dkbMHWxDXzHqBV7WFi1pkIp+f+Eimw8RR5wn7AsTriN91GCb V2419JEcaRHyeKvWprrwm7KI3YwyhzDnh/j7CyDT8RS4Uo8ysxsDSeXqDYXjsaJ5nOVo mShg== 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:arc-authentication-results; bh=Fu7eAo93WCkXOzj4uiCNzBvIu0B/pbINiZjHU1qVZyk=; b=sm4YJPrQT4scMfYYNXL6QF1h1Yh7zs3YlP0z8/OGLOAO8uMpIEMDjJ98QxZa2sOQ62 dJr7wC2ZFwUjODzkvk3YAzc3E9UlKCdfu4vyS09sEAPFT5AhJZeFy2VmbNKiSHjxbszi Hybxfl/Xy4pyFjK/JsXbRItFY67dj37kZjfnf1pC5L5yT4SxcZNKYmU4jP3USAOTfWxK zQsrC/gMfZwhFtdSgNRZ7B6Qyiikb+R+ZbDQlS3Yv8VcaO9YBMbv1uowJhUgnV4y6WiB lq1fGoZIoc/WL6a61EUctEBDjj+iNi2BcmllyntdH3iMXXWAHWvYW7vTneXcxOR4gtv3 YFTA== ARC-Authentication-Results: i=1; mx.google.com; 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 v1si7829130wrd.66.2018.01.14.22.40.20; Sun, 14 Jan 2018 22:40:20 -0800 (PST) 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; 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 36208A495; Mon, 15 Jan 2018 07:40:09 +0100 (CET) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0067.outbound.protection.outlook.com [104.47.41.67]) by dpdk.org (Postfix) with ESMTP id 9F42EA48C for ; Mon, 15 Jan 2018 07:40:07 +0100 (CET) Received: from BN3PR03CA0116.namprd03.prod.outlook.com (10.174.66.34) by DM5PR03MB2698.namprd03.prod.outlook.com (10.168.197.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Mon, 15 Jan 2018 06:40:06 +0000 Received: from BN1AFFO11FD030.protection.gbl (2a01:111:f400:7c10::171) by BN3PR03CA0116.outlook.office365.com (2603:10b6:400:4::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Mon, 15 Jan 2018 06:40:06 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; NXP1.onmicrosoft.com; dkim=none (message not signed) header.d=none;NXP1.onmicrosoft.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD030.mail.protection.outlook.com (10.58.52.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Mon, 15 Jan 2018 06:40:03 +0000 Received: from netperf2.ap.freescale.net ([10.232.133.164]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0F6drN8007259; Sun, 14 Jan 2018 23:40:01 -0700 From: Akhil Goyal To: CC: , Date: Mon, 15 Jan 2018 12:05:52 +0530 Message-ID: <20180115063553.12703-3-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180115063553.12703-1-akhil.goyal@nxp.com> References: <20180111113304.19709-1-akhil.goyal@nxp.com> <20180115063553.12703-1-akhil.goyal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131604720054556228; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(39380400002)(39860400002)(346002)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(2906002)(81166006)(305945005)(8936002)(36756003)(105606002)(68736007)(50226002)(356003)(498600001)(51416003)(77096006)(8676002)(81156014)(4326008)(5660300001)(97736004)(48376002)(86362001)(53936002)(575784001)(59450400001)(76176011)(16586007)(6666003)(296002)(316002)(2950100002)(2351001)(1076002)(106466001)(104016004)(54906003)(5890100001)(47776003)(6916009)(50466002)(8656006)(85426001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2698; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD030; 1:zg307D0qo8L15zfaTxHOMwW20RH4RR0WhP8t2dk8VXY2L5xkZWVlMRGsVHpT2SW1rEV/1pfAbynBtGITtJN56XP+WzmrIZuOsFSqaKDDSWFXpmuBOnvUbAQDuGmape3k MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9a3ef24c-1c1f-487d-d644-08d55be2d014 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:DM5PR03MB2698; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2698; 3:TCnG5Ap/D0Af4j90QIEXKUB6kWtoWxzeSSx0OAVdrZR1bO/t2qxKgNO8Vevzn5gC2cdDs3pSLpE7aVFScOW+VUIK3F5+J4M9DL+zVRo0r0A4i1CkQuG+3sW8T6fbLp2yemPIl/DE8h6k+n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8g5iLTNyeWQKOl6Kugnu+vpUjJhMyg50cmMXmoR/LiD/8cFrbh4Lia80GrhAsteDspcUdiQI1GMfV6Wgoa4zeB/yjOtyMmqwhBsu5hsEJnP/2gRtAqh8qhPOVXcDxmP6Xz26MJFZYRSnkT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(3231023)(944501161)(3002001)(93006095)(93001095)(10201501046)(6055026)(6096035)(20161123556025)(20161123565025)(20161123563025)(20161123561025)(201703131430075)(201703131520075)(201703131433075)(201703131448075)(201703151042153)(20161123559100)(201708071742011); SRVR:DM5PR03MB2698; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:DM5PR03MB2698; X-Forefront-PRVS: 0553CBB77A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2698; 23:Vc05xHEkfLjZZ1LT1w5qkt3mbbRwS4qmB58ajua/q?= xwRj12o10s9RQcLoWwOEfv/Z7SARi56OPMQNPY0bY3fWfgG0MI3QjJ5CBQWO8wpmPvR5MXQzC5yiXJ2VWu13LaOA/8xZQcLJr4Y9ItzZ8DkOiWHaVxZp9FwPBkMPBU/sMfC1/zJNCLSOugAaeDZp3TNxm894hNvqs3u9Rzgy/SKSvvroONYZsZBKrTHc97tIcrj2rjpzv7WFGCwI31Xgq5rF4ITn0HS+PRexVkhLCrW4aY1vYKFHfdCS379WiVvwibeDteFKdxfDFnD6PqhmKmNHxgCoWbh4jM1e8Mr4gi+XwD/ynOs6SLTapNPdTm07v0m64LTTDbiwRm0oZwPCHL9H1FV6Ud9+V1dZgSqfoclk580nSq9cMEXKdSwHGbiFDatc131NMOsbvIZMcpnvMt+RynLHJYPOR+qkSpXeXtRVCYx5Q5PqXBsRjOyXXoiRtPGeJqByhnthcxMdAX67OL3VSPKpztKwj8oCRS/pflJkA+UgS9KA24dhMc5r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qySm+XyRK4FcdXeZXoqzs3ARlWLVfPnEdzblnS7Mi5eTWe3E3v+gU6sICPGJCjZsxVx7ZhbfmcgkmBjwrQ9JESVSMGZXiJjQQqkGW3Cwa4oWLlQdn/P9o6S2Uc4ATvEU2GUzL0A=; 24:v86U7igePypWfjslCe0tTQBGAdlRilixEbMt321NHmfVtaZ8A8bmB3gPikLc8Wtbdz7GYXyXtFJabYAODHKf4q4+WRdGUKYvIbcp070lReQ=; 7:Ho1+X0NuNhyO1VrL7TEAVL/g+x/jPmNTnmdZvdzl33vHZjn6i/Zp8Sj4+ANcfMfMnSiTMdE0Qj1ssbHJleki6FGJNbJ9waOa7i0WY9FzCWPlvtikb5IQise74pE7d28p7js8r3B/ATt007e1qCzXOCEWHzOc42T/L48gEENLFCevwgtufpq4po8wCVEunkTudl0urQ3S+rIto80qmcZW/emL5MgKAQ+O3R0QqOfGDlKT2i/ehCzU1N4HQ2WZLfNx SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2018 06:40:03.8956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a3ef24c-1c1f-487d-d644-08d55be2d014 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2698 Subject: [dpdk-dev] [PATCH v3 2/3] crypto/dpaa_sec: support multiple sessions per qp 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: Hemant Agrawal Signed-off-by: Hemant Agrawal Acked-by: Akhil Goyal --- drivers/crypto/dpaa_sec/dpaa_sec.c | 154 +++++++++++++++++++++++++------------ drivers/crypto/dpaa_sec/dpaa_sec.h | 74 +++++++++--------- 2 files changed, 145 insertions(+), 83 deletions(-) -- 2.9.3 diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 157eace..f433f0a 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -43,6 +43,9 @@ static uint8_t cryptodev_driver_id; static __thread struct rte_crypto_op **dpaa_sec_ops; static __thread int dpaa_sec_op_nb; +static int +dpaa_sec_attach_sess_q(struct dpaa_sec_qp *qp, dpaa_sec_session *sess); + static inline void dpaa_sec_op_ending(struct dpaa_sec_op_ctx *ctx) { @@ -151,15 +154,6 @@ dpaa_sec_init_rx(struct qman_fq *fq_in, rte_iova_t hwdesc, /* Clear FQ options */ memset(&fq_opts, 0x00, sizeof(struct qm_mcc_initfq)); - flags = QMAN_FQ_FLAG_LOCKED | QMAN_FQ_FLAG_DYNAMIC_FQID | - QMAN_FQ_FLAG_TO_DCPORTAL; - - ret = qman_create_fq(0, flags, fq_in); - if (unlikely(ret != 0)) { - PMD_INIT_LOG(ERR, "qman_create_fq failed"); - return ret; - } - flags = QMAN_INITFQ_FLAG_SCHED; fq_opts.we_mask = QM_INITFQ_WE_DESTWQ | QM_INITFQ_WE_CONTEXTA | QM_INITFQ_WE_CONTEXTB; @@ -171,9 +165,11 @@ dpaa_sec_init_rx(struct qman_fq *fq_in, rte_iova_t hwdesc, fq_in->cb.ern = ern_sec_fq_handler; + PMD_INIT_LOG(DEBUG, "in-%x out-%x", fq_in->fqid, fqid_out); + ret = qman_init_fq(fq_in, flags, &fq_opts); if (unlikely(ret != 0)) - PMD_INIT_LOG(ERR, "qman_init_fq failed"); + PMD_INIT_LOG(ERR, "qman_init_fq failed %d", ret); return ret; } @@ -357,7 +353,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) { struct alginfo alginfo_c = {0}, alginfo_a = {0}, alginfo = {0}; uint32_t shared_desc_len = 0; - struct sec_cdb *cdb = &ses->qp->cdb; + struct sec_cdb *cdb = &ses->cdb; int err; #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN int swap = false; @@ -877,12 +873,10 @@ dpaa_sec_enqueue_op(struct rte_crypto_op *op, struct dpaa_sec_qp *qp) ses = (dpaa_sec_session *)get_session_private_data(op->sym->session, cryptodev_driver_id); - if (unlikely(!qp->ses || qp->ses != ses)) { - qp->ses = ses; - ses->qp = qp; - ret = dpaa_sec_prep_cdb(ses); - if (ret) - return ret; + if (unlikely(!ses->qp || ses->qp != qp)) { + PMD_INIT_LOG(DEBUG, "sess->qp - %p qp %p", ses->qp, qp); + if (dpaa_sec_attach_sess_q(qp, ses)) + return -1; } /* @@ -918,7 +912,7 @@ dpaa_sec_enqueue_op(struct rte_crypto_op *op, struct dpaa_sec_qp *qp) if (auth_only_len) fd.cmd = 0x80000000 | auth_only_len; do { - ret = qman_enqueue(&qp->inq, &fd, 0); + ret = qman_enqueue(ses->inq, &fd, 0); } while (ret != 0); return 0; @@ -1134,43 +1128,82 @@ dpaa_sec_aead_init(struct rte_cryptodev *dev __rte_unused, return 0; } -static int -dpaa_sec_qp_attach_sess(struct rte_cryptodev *dev, uint16_t qp_id, void *ses) +static struct qman_fq * +dpaa_sec_attach_rxq(struct dpaa_sec_dev_private *qi) { - dpaa_sec_session *sess = ses; - struct dpaa_sec_qp *qp; + unsigned int i; - PMD_INIT_FUNC_TRACE(); + for (i = 0; i < qi->max_nb_sessions; i++) { + if (qi->inq_attach[i] == 0) { + qi->inq_attach[i] = 1; + return &qi->inq[i]; + } + } + PMD_DRV_LOG(ERR, "All ses session in use %x", qi->max_nb_sessions); + + return NULL; +} - qp = dev->data->queue_pairs[qp_id]; - if (qp->ses != NULL) { - PMD_INIT_LOG(ERR, "qp in-use by another session\n"); - return -EBUSY; +static int +dpaa_sec_detach_rxq(struct dpaa_sec_dev_private *qi, struct qman_fq *fq) +{ + unsigned int i; + + for (i = 0; i < qi->max_nb_sessions; i++) { + if (&qi->inq[i] == fq) { + qi->inq_attach[i] = 0; + return 0; + } } + return -1; +} + +static int +dpaa_sec_attach_sess_q(struct dpaa_sec_qp *qp, dpaa_sec_session *sess) +{ + int ret; - qp->ses = sess; sess->qp = qp; + ret = dpaa_sec_prep_cdb(sess); + if (ret) { + PMD_DRV_LOG(ERR, "Unable to prepare sec cdb"); + return -1; + } - return dpaa_sec_prep_cdb(sess); + ret = dpaa_sec_init_rx(sess->inq, dpaa_mem_vtop(&sess->cdb), + qman_fq_fqid(&qp->outq)); + if (ret) + PMD_DRV_LOG(ERR, "Unable to init sec queue"); + + return ret; +} + +static int +dpaa_sec_qp_attach_sess(struct rte_cryptodev *dev __rte_unused, + uint16_t qp_id __rte_unused, + void *ses __rte_unused) +{ + PMD_INIT_FUNC_TRACE(); + return 0; } static int -dpaa_sec_qp_detach_sess(struct rte_cryptodev *dev, uint16_t qp_id, void *ses) +dpaa_sec_qp_detach_sess(struct rte_cryptodev *dev, + uint16_t qp_id __rte_unused, + void *ses) { dpaa_sec_session *sess = ses; - struct dpaa_sec_qp *qp; + struct dpaa_sec_dev_private *qi = dev->data->dev_private; PMD_INIT_FUNC_TRACE(); - qp = dev->data->queue_pairs[qp_id]; - if (qp->ses != NULL) { - qp->ses = NULL; - sess->qp = NULL; - return 0; - } + if (sess->inq) + dpaa_sec_detach_rxq(qi, sess->inq); + sess->inq = NULL; - PMD_DRV_LOG(ERR, "No session attached to qp"); - return -EINVAL; + sess->qp = NULL; + + return 0; } static int @@ -1233,8 +1266,20 @@ dpaa_sec_set_session_parameters(struct rte_cryptodev *dev, return -EINVAL; } session->ctx_pool = internals->ctx_pool; + session->inq = dpaa_sec_attach_rxq(internals); + if (session->inq == NULL) { + PMD_DRV_LOG(ERR, "unable to attach sec queue"); + goto err1; + } return 0; + +err1: + rte_free(session->cipher_key.data); + rte_free(session->auth_key.data); + memset(session, 0, sizeof(dpaa_sec_session)); + + return -EINVAL; } static int @@ -1267,6 +1312,7 @@ dpaa_sec_session_configure(struct rte_cryptodev *dev, set_session_private_data(sess, dev->driver_id, sess_private_data); + return 0; } @@ -1275,16 +1321,22 @@ static void dpaa_sec_session_clear(struct rte_cryptodev *dev, struct rte_cryptodev_sym_session *sess) { - PMD_INIT_FUNC_TRACE(); + struct dpaa_sec_dev_private *qi = dev->data->dev_private; uint8_t index = dev->driver_id; void *sess_priv = get_session_private_data(sess, index); + + PMD_INIT_FUNC_TRACE(); + dpaa_sec_session *s = (dpaa_sec_session *)sess_priv; if (sess_priv) { + struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv); + + if (s->inq) + dpaa_sec_detach_rxq(qi, s->inq); rte_free(s->cipher_key.data); rte_free(s->auth_key.data); memset(s, 0, sizeof(dpaa_sec_session)); - struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv); set_session_private_data(sess, index, NULL); rte_mempool_put(sess_mp, sess_priv); } @@ -1332,7 +1384,8 @@ dpaa_sec_dev_infos_get(struct rte_cryptodev *dev, info->capabilities = dpaa_sec_capabilities; info->sym.max_nb_sessions = internals->max_nb_sessions; info->sym.max_nb_sessions_per_qp = - RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS / RTE_MAX_NB_SEC_QPS; + RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS / + RTE_DPAA_MAX_NB_SEC_QPS; info->driver_id = cryptodev_driver_id; } } @@ -1377,7 +1430,7 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) { struct dpaa_sec_dev_private *internals; struct dpaa_sec_qp *qp; - uint32_t i; + uint32_t i, flags; int ret; char str[20]; @@ -1393,7 +1446,7 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING; internals = cryptodev->data->dev_private; - internals->max_nb_queue_pairs = RTE_MAX_NB_SEC_QPS; + internals->max_nb_queue_pairs = RTE_DPAA_MAX_NB_SEC_QPS; internals->max_nb_sessions = RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS; for (i = 0; i < internals->max_nb_queue_pairs; i++) { @@ -1404,10 +1457,15 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) PMD_INIT_LOG(ERR, "config tx of queue pair %d", i); goto init_error; } - ret = dpaa_sec_init_rx(&qp->inq, dpaa_mem_vtop(&qp->cdb), - qman_fq_fqid(&qp->outq)); - if (ret) { - PMD_INIT_LOG(ERR, "config rx of queue pair %d", i); + } + + flags = QMAN_FQ_FLAG_LOCKED | QMAN_FQ_FLAG_DYNAMIC_FQID | + QMAN_FQ_FLAG_TO_DCPORTAL; + for (i = 0; i < internals->max_nb_sessions; i++) { + /* create rx qman fq for sessions*/ + ret = qman_create_fq(0, flags, &internals->inq[i]); + if (unlikely(ret != 0)) { + PMD_INIT_LOG(ERR, "sec qman_create_fq failed"); goto init_error; } } diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h index e82f4fb..93369e4 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.h +++ b/drivers/crypto/dpaa_sec/dpaa_sec.h @@ -38,36 +38,6 @@ enum dpaa_sec_op_type { DPAA_SEC_MAX }; -typedef struct dpaa_sec_session_entry { - uint8_t dir; /*!< Operation Direction */ - enum rte_crypto_cipher_algorithm cipher_alg; /*!< Cipher Algorithm*/ - enum rte_crypto_auth_algorithm auth_alg; /*!< Authentication Algorithm*/ - enum rte_crypto_aead_algorithm aead_alg; /*!< Authentication Algorithm*/ - union { - struct { - uint8_t *data; /**< pointer to key data */ - size_t length; /**< key length in bytes */ - } aead_key; - struct { - struct { - uint8_t *data; /**< pointer to key data */ - size_t length; /**< key length in bytes */ - } cipher_key; - struct { - uint8_t *data; /**< pointer to key data */ - size_t length; /**< key length in bytes */ - } auth_key; - }; - }; - struct { - uint16_t length; - uint16_t offset; - } iv; /**< Initialisation vector parameters */ - uint16_t auth_only_len; /*!< Length of data for Auth only */ - uint32_t digest_length; - struct dpaa_sec_qp *qp; - struct rte_mempool *ctx_pool; /* session mempool for dpaa_sec_op_ctx */ -} dpaa_sec_session; #define DPAA_SEC_MAX_DESC_SIZE 64 /* code or cmd block to caam */ @@ -117,11 +87,41 @@ struct sec_cdb { uint32_t sh_desc[DPAA_SEC_MAX_DESC_SIZE]; }; +typedef struct dpaa_sec_session_entry { + uint8_t dir; /*!< Operation Direction */ + enum rte_crypto_cipher_algorithm cipher_alg; /*!< Cipher Algorithm*/ + enum rte_crypto_auth_algorithm auth_alg; /*!< Authentication Algorithm*/ + enum rte_crypto_aead_algorithm aead_alg; /*!< Authentication Algorithm*/ + union { + struct { + uint8_t *data; /**< pointer to key data */ + size_t length; /**< key length in bytes */ + } aead_key; + struct { + struct { + uint8_t *data; /**< pointer to key data */ + size_t length; /**< key length in bytes */ + } cipher_key; + struct { + uint8_t *data; /**< pointer to key data */ + size_t length; /**< key length in bytes */ + } auth_key; + }; + }; + struct { + uint16_t length; + uint16_t offset; + } iv; /**< Initialisation vector parameters */ + uint16_t auth_only_len; /*!< Length of data for Auth only */ + uint32_t digest_length; + struct dpaa_sec_qp *qp; + struct qman_fq *inq; + struct sec_cdb cdb; /**< cmd block associated with qp */ + struct rte_mempool *ctx_pool; /* session mempool for dpaa_sec_op_ctx */ +} dpaa_sec_session; + struct dpaa_sec_qp { struct dpaa_sec_dev_private *internals; - struct sec_cdb cdb; /* cmd block associated with qp */ - dpaa_sec_session *ses; /* session associated with qp */ - struct qman_fq inq; struct qman_fq outq; int rx_pkts; int rx_errs; @@ -129,12 +129,16 @@ struct dpaa_sec_qp { int tx_errs; }; -#define RTE_MAX_NB_SEC_QPS RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS +#define RTE_DPAA_MAX_NB_SEC_QPS 1 +#define RTE_DPAA_MAX_RX_QUEUE RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS + /* internal sec queue interface */ struct dpaa_sec_dev_private { void *sec_hw; struct rte_mempool *ctx_pool; /* per dev mempool for dpaa_sec_op_ctx */ - struct dpaa_sec_qp qps[RTE_MAX_NB_SEC_QPS]; /* i/o queue for sec */ + struct dpaa_sec_qp qps[RTE_DPAA_MAX_NB_SEC_QPS]; /* i/o queue for sec */ + struct qman_fq inq[RTE_DPAA_MAX_RX_QUEUE]; + unsigned char inq_attach[RTE_DPAA_MAX_RX_QUEUE]; unsigned int max_nb_queue_pairs; unsigned int max_nb_sessions; };