From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0062.outbound.protection.outlook.com [104.47.42.62]) by dpdk.org (Postfix) with ESMTP id A62EE5F16 for ; Fri, 5 Oct 2018 15:02:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l9Y72uun4cnS8iu28tYInJOAbPL3C7aY+v9pIFoGzus=; b=cODaDWnXG9jKBpzzF6Vc0Ds52k7u3EoCrAXrP5lDfI+3jjQHQ7YKtB6qP8K5/5LjqpzqBcH5OBYRHlRjFmbvlQo8xnTfLf/tsr/shlCfojeWjn0gYXW/NGN6OsW0pzKbCm/r8s+d3GDBRaEHMYbsNP3IoFH4bhc0ibsMs/8aSsU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.com (115.113.156.2) by SN6PR07MB4910.namprd07.prod.outlook.com (2603:10b6:805:39::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.21; Fri, 5 Oct 2018 13:01:54 +0000 From: Anoob Joseph To: Akhil Goyal , Pablo de Lara , Thomas Monjalon Cc: Ragothaman Jayaraman , Jerin Jacob , Narayana Prasad , dev@dpdk.org, Ankur Dwivedi , Anoob Joseph , Murthy NSSR , Nithin Dabilpuram , Srisivasubramanian S , Tejasree Kondoj Date: Fri, 5 Oct 2018 18:29:13 +0530 Message-Id: <1538744363-30340-23-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538744363-30340-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1536033560-21541-1-git-send-email-ajoseph@caviumnetworks.com> <1538744363-30340-1-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) To SN6PR07MB4910.namprd07.prod.outlook.com (2603:10b6:805:39::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b30c4b7e-834f-4baf-8c58-08d62ac2bc82 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4910; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4910; 3:0lX96z20TkWol7fNqNxGGL9Ju1BDQIjjGy0btIbTgCZwxMk27qH5fA712m7t66XcZCVwVdlp/6Hs+QRW+wsiWVvQOtE/xwFKItCFLJ1106ZNiYS7zygusFCNYLWitnYyuyl1GZoEvMFYlZvpoJstyoXiZSs3ALR56UV0Fjo/xQn2j4rTYFmq21V+Q0aFFhqwtF2nSBUG5rYjGrtKB4XDn8tttnamw/GGChUI/RPK9AU+VzzxQhbta4P3wi9t/7bM; 25:BTX4yhkshVaVBUA2El/GdZQJShEDVX87zXtYGxdJ4Ohvd82aiuQw2mrTqHwfpc4ys9RllD3mjX7Uz2ld4eurpfP4orYxDxerxGbP1V6kavGLAtDAnNALeUzm50VEBCRFeUc4VJgRTv/CSRd+R+jY/IsmPphJtXe7MIqNTdP5GYiGJTpvwD9iybbl72iK0V1l2Ar+fxEcEJxIOr/zP5nbUCQkwtk2gTGFMqTGN+I6FQYzUh6c++iIEwWOxji9nIB3y3h+MrshKdunRtx/r3/iXI2KT8/HDyB9Sq7NYY/oH9FPG+dhjyavC4c/1cHxTsz7I2vOA2h5YYB4NBEgxXeEmQ==; 31:pl9KbxIYRxZZ/21Nhw5tiqMmMelxcdkR52wYBACEWx/ji32/k0RAmntNaGl97Rg0w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33eVtMk+NSDYujR6h7du2JILts5R3qn3llmTWRMF45g7T31jN9W3xUzA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; 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)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:SN6PR07MB4910; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4910; X-Forefront-PRVS: 0816F1D86E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(136003)(396003)(366004)(199004)(189003)(51416003)(76176011)(11346002)(50226002)(25786009)(8936002)(48376002)(305945005)(186003)(16526019)(110136005)(6486002)(3846002)(446003)(52116002)(6116002)(81156014)(8676002)(97736004)(5660300001)(50466002)(4326008)(956004)(42882007)(2616005)(68736007)(478600001)(54906003)(7736002)(81166006)(6666003)(16586007)(107886003)(26005)(55236004)(66066001)(386003)(47776003)(6512007)(72206003)(44832011)(476003)(316002)(14444005)(36756003)(105586002)(106356001)(486006)(6506007)(2906002)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4910; H:ajoseph83.caveonetworks.com.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN6PR07MB4910; 23:+0fB0EFbs6sCT3G0vuuFvDmZfaT7O0zpW8zUVsrG+?= =?us-ascii?Q?4rZUrhwWrxihbGQgfW6xGplnlfvc4k+ObZAtewhph4QsGQDUPnGcMlAuZ+5w?= =?us-ascii?Q?XT8rvvW26dJZx2SP8dsfuvVih1KQyc/zQd87zp9ioF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jiyb1xMDAEnT+V6UMAxsefQ7RIjQSt5Qany7esthrtoR/89posxcL79WKx?= =?us-ascii?Q?stkh7YycDOvAusYayNHRofz/bOlk+bXprXjRFNpq7eoXV85hidV+0CDUDLa6?= =?us-ascii?Q?cU6uRHpjp4see9Ay0NcD0MWgr2FSmKVLc+cbX/o9viiW1nwR40YVeRVdBOvn?= =?us-ascii?Q?T3AckSw3SmOC25j+LayIGq5o7aelMiTNgGIHnZJvHcYacWbfQ91Tgw36FEv7?= =?us-ascii?Q?cf2iTXaAQbL/9Prm9BnTQIRrSg+KmnEPei/wxsqB4hyRB3QXY4ChD97/pIaz?= =?us-ascii?B?Zz09?= X-Microsoft-Antispam-Message-Info: FrlJMzaCBtYzzBmuYLpG40MvBiWNWUxaY0TAtaVpUiLSRKoPzJotmSNnX6z+/0RAl0+mh4EhptIxaWCvpeF8Bt2+iGHYrf7tfCPTY262NoPYBSbCiRtqLTfNiz7IANZq70q66tFWGqOrO4g/x5z0WeGFplZIxrE0kXRoZt9fN0WRPEKmmWp3DskvZnRwrsECm5EHhaAXr/C4Vb71A0pK1OUNDYl/6s9ROsV0AKq15paj+zH7qmT2OoVmxXMMkBEm98C0f4rM1DwIFsMhFk7j71b0HoMpMTuZ5nBKVurlpMDf048sIv+zn35TqYmlstb7gheaZISDgOA9y6E2Ii/oDP7/JT5/ECZI523kN1mPADQ= X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4910; 6:jyQwaF/eeUV1e6GaqnHk6p325t7welvObTlX1x74xCLiIs58gq04YFK1AmZPHuFe8U7gdkH7Mqd8KH7kznEtemc1hl1iYT1Fh7r6IgDstytTMtBBREj4z5hLJK4kM2KjCT6FTY1sMYxUdOIrsNxtj2KZmCcFWXNBitLUG/w4w+3p5M8qe3ybd+2n0V9tWPUf9HLQ28DZJTQUwNsHukmhPcPpTUFRj6MI25Omq0jkroI2SenE125OMBwrD6AMKu/8i32abtAJqdq+Nlw0MXrlFgoIAS5qnmRo0NtQIqj6T8akD+EoSXDWsCZPmlJ5/YlFQNIHQ8UR75emo1+0tHJP4d0UVIObnE3ecE2DPPFP3mVNMzvjKE2cIuR4sHj1yKTgOPXuNSGXqf7sLScaIxJZosBt78jby6GJ+oA9nAzMiE0iJvpzgKpYdTIhuOA8720aitG6P8ZnjpnGgS45IBmYjQ==; 5:bJBZKJuOkOWolz2x977sbvErjI89TP0MM6yWapTA/lSM4n2EMPnOieBhsy2ZJyKyYau1qM+uBfibsE6UYpxeKWTxBxRt8Jbb6OfgviEt/uAWFQmrFGP06wUrB4NsYiLNEtPdDo7jU3emJoww7xTD/mfqnPYF4aCbbIH/EJpfamE=; 7:cvk9h/AgKtRQLbNBQUGkRfoAZqM6hLfCnmS6RLTLuMuruaEw13EptxCGMR385Phz3BEMWiaRfYLLOuZpITWhH5MSYrjartbIJy1IFszAbrkzarSNvg3v2bf4yQSkWviDyFj3rNVdY3X0SAi8wX8z3hC6AxHhXlVxS3gWHLzKmagNyyJwVkoUI0KT5w5Jv20kDzJO+NvHYnHOhRbO2JrG0AuXEDEkR+/G/jyrctCVHwXsF3dArtRgYYYV4naZgMeI SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2018 13:01:54.9865 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b30c4b7e-834f-4baf-8c58-08d62ac2bc82 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4910 Subject: [dpdk-dev] [PATCH v3 22/32] common/cpt: add crypo op enqueue request manager framework 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: , X-List-Received-Date: Fri, 05 Oct 2018 13:02:04 -0000 From: Ragothaman Jayaraman Adding crypto enqueue op request manager framework. This routine won't submit to the hardware yet. Signed-off-by: Ankur Dwivedi Signed-off-by: Anoob Joseph Signed-off-by: Murthy NSSR Signed-off-by: Nithin Dabilpuram Signed-off-by: Ragothaman Jayaraman Signed-off-by: Srisivasubramanian S Signed-off-by: Tejasree Kondoj --- drivers/common/cpt/cpt_request_mgr.h | 68 ++++++++++++++++++++++++++++++++++++ drivers/common/cpt/cpt_ucode.h | 43 +++++++++++++++++++++++ 2 files changed, 111 insertions(+) diff --git a/drivers/common/cpt/cpt_request_mgr.h b/drivers/common/cpt/cpt_request_mgr.h index fe184fe..58a87c3 100644 --- a/drivers/common/cpt/cpt_request_mgr.h +++ b/drivers/common/cpt/cpt_request_mgr.h @@ -5,8 +5,13 @@ #ifndef _CPT_REQUEST_MGR_H_ #define _CPT_REQUEST_MGR_H_ +#include "cpt_common.h" #include "cpt_mcode_defines.h" +#if CPT_MODEL == CRYPTO_OCTEONTX +#include "../../crypto/octeontx/otx_cryptodev_hw_access.h" +#endif + /* * This file defines the agreement between the common layer and the individual * crypto drivers for OCTEON TX series. Datapath in otx* directory include this @@ -29,4 +34,67 @@ cpt_get_session_size(void) return (sizeof(struct cpt_sess_misc) + RTE_ALIGN_CEIL(ctx_len, 8)); } +static __rte_always_inline int __hot +cpt_pmd_crypto_operation(struct cpt_instance *instance, + struct rte_crypto_op *op, struct pending_queue *pqueue, + uint8_t cpt_driver_id) +{ + struct cpt_sess_misc *sess = NULL; + struct rte_crypto_sym_op *sym_op = op->sym; + void *prep_req = NULL, *mdata = NULL; + int ret = 0; + uint64_t cpt_op; + struct cpt_vf *cptvf = (struct cpt_vf *)instance; + RTE_SET_USED(pqueue); + + if (unlikely(op->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) { + int sess_len; + + sess_len = cpt_get_session_size(); + + sess = rte_calloc(__func__, 1, sess_len, 8); + if (!sess) + return -ENOMEM; + + sess->ctx_dma_addr = rte_malloc_virt2iova(sess) + + sizeof(struct cpt_sess_misc); + + ret = instance_session_cfg(sym_op->xform, (void *)sess); + if (unlikely(ret)) + return -EINVAL; + } else { + sess = (struct cpt_sess_misc *) + get_sym_session_private_data(sym_op->session, + cpt_driver_id); + } + + cpt_op = sess->cpt_op; + + mdata = &(cptvf->meta_info); + + if (likely(cpt_op & CPT_OP_CIPHER_MASK)) + prep_req = fill_fc_params(op, sess, &mdata, &ret); + + if (unlikely(!prep_req)) { + CPT_LOG_DP_ERR("prep cryto req : op %p, cpt_op 0x%x " + "ret 0x%x", op, (unsigned int)cpt_op, ret); + goto req_fail; + } + + if (unlikely(ret)) { + if (unlikely(ret == -EAGAIN)) + goto req_fail; + CPT_LOG_DP_ERR("Error enqueing crypto request : error " + "code %d", ret); + goto req_fail; + } + + return 0; + +req_fail: + if (mdata) + free_op_meta(mdata, cptvf->meta_info.cptvf_meta_pool); + return ret; +} + #endif /* _CPT_REQUEST_MGR_H_ */ diff --git a/drivers/common/cpt/cpt_ucode.h b/drivers/common/cpt/cpt_ucode.h index 9d4d4c8..9085667 100644 --- a/drivers/common/cpt/cpt_ucode.h +++ b/drivers/common/cpt/cpt_ucode.h @@ -2117,4 +2117,47 @@ fill_fc_params(struct rte_crypto_op *cop, return prep_req; } +static __rte_always_inline int +instance_session_cfg(struct rte_crypto_sym_xform *xform, void *sess) +{ + struct rte_crypto_sym_xform *chain; + + CPT_PMD_INIT_FUNC_TRACE(); + + if (cpt_is_algo_supported(xform)) + goto err; + + chain = xform; + while (chain) { + switch (chain->type) { + case RTE_CRYPTO_SYM_XFORM_AEAD: + if (fill_sess_aead(chain, sess)) + goto err; + break; + case RTE_CRYPTO_SYM_XFORM_CIPHER: + if (fill_sess_cipher(chain, sess)) + goto err; + break; + case RTE_CRYPTO_SYM_XFORM_AUTH: + if (chain->auth.algo == RTE_CRYPTO_AUTH_AES_GMAC) { + if (fill_sess_gmac(chain, sess)) + goto err; + } else { + if (fill_sess_auth(chain, sess)) + goto err; + } + break; + default: + CPT_LOG_DP_ERR("Invalid crypto xform type"); + break; + } + chain = chain->next; + } + + return 0; + +err: + return -1; +} + #endif /*_CPT_UCODE_H_ */ -- 2.7.4