From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0057.outbound.protection.outlook.com [104.47.41.57]) by dpdk.org (Postfix) with ESMTP id 0F03E1B202 for ; Tue, 9 Oct 2018 11:09:41 +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=ZYXvs5fOe6gKeL457FtJP+Rpf7XUdxAJmNypfUcRkOqVf8VPGOGmOHPXs/1zWltzzB1kIFRGW7pJ+qKDmJdRhZekwPnchmux6dkY8bANqGfR8ACPkiVq4ru9V6ZLGptwEkEn3OQQ6HPJ8+OS+j+aRY09u5qBB8Wv1NfWinxP82g= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.com (115.113.156.2) by BN7PR07MB4897.namprd07.prod.outlook.com (2603:10b6:406:ef::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.28; Tue, 9 Oct 2018 09:09:36 +0000 From: Anoob Joseph To: Akhil Goyal , Pablo de Lara , Thomas Monjalon Cc: Ragothaman Jayaraman , Jerin Jacob , Narayana Prasad , Ankur Dwivedi , Anoob Joseph , Murthy NSSR , Nithin Dabilpuram , Srisivasubramanian S , Tejasree Kondoj , dev@dpdk.org Date: Tue, 9 Oct 2018 14:37:48 +0530 Message-Id: <1539076076-19786-16-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539076076-19786-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1538744363-30340-1-git-send-email-anoob.joseph@caviumnetworks.com> <1539076076-19786-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: PN1PR0101CA0004.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::14) To BN7PR07MB4897.namprd07.prod.outlook.com (2603:10b6:406:ef::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1272337e-5d67-4fcd-d07d-08d62dc6f1a4 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB4897; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4897; 3:Uwbct/oM15S+3KSg3CYy4rvoaB3fnslPxi0oRjGTKlWNAe9p2Q233+bhcEQHkdYeMnf1znnnPNKhf6cQf2SGlFGcTvCnrAA1Wi/ooNTexdTX/Blo1bsVhTChNFQ0NWPZwBre9DrwPIruuXWQIq9FpJHSJ5aMHeSFhHXNwYFBF6HvDPI0hy/EJCfv9X02+CkDPr5QGBcpkVHN9PEeuGOvA0xwgir5NsYC5nkfltuawRI10pBjLaMyrUAMI4Jmi58A; 25:/Savgq6yqddpC83ZL7r3Kv0m7joLr0bG+2YjzRDJonbV9DmuhnBMR9kruXm1x6x3VIBw8XjQ8HVZvLKJ5BkkCJMmeJnoLmuCJ+LOUZwrkzy4fm14+Ko0mMgDD9I86G8wZyr+v3bdX/K9+ltv6gMaPhF59DdYlIPYSuC8VxjS5ZbhvQrOdNMH8EOfkYmH93/s7KFGRBfwbX/Lj/lpnmLqIC+WllIUnKoOkFMYZpiWRUPyu/9Ihxw8ueSTB/PbvBruzDnY0H8Znul+ZAW4RjzbvxQtlKT946zu0FrxrcHO7zLAp5O1Sbl4p06gEm7wgY+WjgY4ftuV1Q61m5jx/r91sA==; 31:4NNxabrl4Cof/UOWi0vnULblKP1VJ7OuNTnhkvlvxWJ0KC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ufAmhweHUYY7wy+7wtMCHq+4zE4NfrLx41K3nYZRJkluTA8yMZwTCqmF+Tmjlx6LefZMRqNDdMLcIZ2A== 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)(5005006)(8121501046)(3002001)(93006095)(10201501046)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(201708071742011)(7699051); SRVR:BN7PR07MB4897; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB4897; X-Forefront-PRVS: 08200063E9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(366004)(376002)(136003)(346002)(39860400002)(199004)(189003)(42882007)(47776003)(106356001)(6666003)(186003)(5660300001)(26005)(68736007)(16526019)(8936002)(25786009)(6116002)(2906002)(81156014)(50226002)(305945005)(81166006)(7736002)(3846002)(105586002)(478600001)(8676002)(54906003)(110136005)(48376002)(16586007)(14444005)(6486002)(6506007)(50466002)(316002)(53936002)(386003)(51416003)(52116002)(76176011)(11346002)(6512007)(44832011)(446003)(36756003)(55236004)(956004)(2616005)(486006)(4326008)(66066001)(97736004)(72206003)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4897; 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; BN7PR07MB4897; 23:aMCNMazbOcwi6usCat6dYU3gYIgcP0U08hnvmmR98?= =?us-ascii?Q?FoFoO+FbId3eqhR6Jm4i/E/AxEA8aCr9pWMDSGup/D4gJ1iaHzAN9UG9VjJ5?= =?us-ascii?Q?Rc9mEjaXJc/UGkq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J2wTB1Q5KxlClrdxz5D9WIFAD7pYexomhwqmiEHO8GGFVft56ABXAxOjDXIS/AJuAjou+M2A34PiYj/YVchyGPHZQod+may053X5BL0aFavapj6lSCRy6cEyBt1dvLDm+YF0HNvPzev5bcJeHaTB1au/HD5A==; 5:BNj3z+3BhR2anD08zYL/4lM/d3wducPeMoe3StBBW9JRoJ+LRSo5ASycfLIDEXYLysO6BXJq8gX36JK2azzKOy56lO3fU+MuFYRGyfvKM7IuaVn7T92fK5JOZH3afAvN7fy+z0jNG0n6RSi1jYwLTs8e6w5P/SAZcpL6yIzrR30=; 7:eiAkMKWB80X5gMOQBxQ2EiNkWz2hdpfpua+ameow0YBD+wVtSt4vVh7bLx2ppmMIF3BbMprXDudm7o0ZnOKdoyX3Vvsbjr0rOGwD+3J8oze0Evyc/pQ20lYC1+/wRkaYXhRBjzyJeG8zvWMfk51IL91dQK3gLVUlEuLmQ4Ae2JSQKTYgjLjKdhd6QsUzZ6RVr0jZfWPEzVP/NnxphpkwHoE7xDBPvfqcoM4aKfNrw7QDte2OjPQ96sjUsmUf4416 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2018 09:09:36.3943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1272337e-5d67-4fcd-d07d-08d62dc6f1a4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4897 Subject: [dpdk-dev] [PATCH v4 15/23] 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: Tue, 09 Oct 2018 09:09:42 -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