From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 0E50B5F38 for ; Tue, 4 Sep 2018 06:03:31 +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=hA8WSbHbn3xjjwP+DC1CiDbSnmMqNflHR7F/mjGyt6w=; b=TOTl4BmEMALWBjp6jPtqMcR6si4vxzoade3nKFCOzFYkopPXEq5JEf9tn7riYXpkIQWUOq5MVs4Qxqv6PzA7jBYM3GrdS9cTmeX6/+rIqEcDDCvu1bM1fncuK/dvnjtUvhuM2/tLMgEJOjLJsW9CqsFG/iC6ZurW9P5XemWTVK0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.com (115.113.156.2) by BYAPR07MB4902.namprd07.prod.outlook.com (2603:10b6:a02:ef::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1101.15; Tue, 4 Sep 2018 04:03:25 +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: Tue, 4 Sep 2018 09:29:10 +0530 Message-Id: <1536033560-21541-24-git-send-email-ajoseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536033560-21541-1-git-send-email-ajoseph@caviumnetworks.com> References: <1528476325-15585-1-git-send-email-anoob.joseph@caviumnetworks.com> <1536033560-21541-1-git-send-email-ajoseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BMXPR01CA0023.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:d::33) To BYAPR07MB4902.namprd07.prod.outlook.com (2603:10b6:a02:ef::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf2bc238-5ac9-4e58-0db4-08d6121b5f7a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4902; X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4902; 3:cVxTvxNM3sAsBTk48MfsNZMtP6jlorqNottxkgxGob5x1mua1w9ZlGeF+Otq21FtVeFzayLYYk8vdSG2wOhoxBO8k+0dpMIWwutqC/HKb32Oag83SdD7HS9e58HV+d2NwfG58hKIqBXHXtQyIOBMwzto99jrk8FaMHpbDnho5kQ/SD5J1smgymoEjZGaqJnpSuBhQMeywqjPInWMRKtToJswjxO49xWVeU8bE3xm4Tr8MtN/Q0qRbNqz72C2wHMU; 25:OssAKLAzWku9eTtXIvtclJZWNjRcFtUbdm9Mx+6gWqqL5Mqeumeh3AyxTf6f8weR1ZI+9GMQ645eL7efD35vT9mZl6bAVBZ/f7sZ3Z8odqiM4TdhpEuyM/4RdxW6ebGn0Cep1MhwRHdXDezXL0TvIyJX7vWBQz+npGdj9TgEM4g4zoKfcUwjb5Cqec/ZiNLlCv0wFhokrK76O0o1CRyuJ9YKPp6ayp9NzC6vTIPZDRtuvghDgQIKHycI19fLja8HpNvjBSX2oeAqDxTAZoGD3CnWx1FNxs42kPgMmUI2eYBP3pBlBVFbJCQN/2yAqBJIkJkVih25ZZC4Ickw/nXoAQ==; 31:3J+UzSWFYGLYiNd8Tw5l+M3WlaLnlBilABlsnANtCbs/154VSXqEultGSDRtXCNwWg5m+UszOpxj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1Qpg1RH35hvB/ob1pMHldSL391W9sUK/ofizf3dDmOG6nMhM+iTg== 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)(10201501046)(93006095)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699016); SRVR:BYAPR07MB4902; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4902; X-Forefront-PRVS: 0785459C39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(346002)(376002)(39860400002)(199004)(189003)(26005)(51416003)(52116002)(76176011)(81166006)(305945005)(81156014)(7736002)(105586002)(316002)(6506007)(106356001)(6512007)(8936002)(446003)(54906003)(25786009)(6666003)(68736007)(50226002)(110136005)(53936002)(16586007)(42882007)(386003)(5660300001)(2906002)(72206003)(50466002)(6486002)(36756003)(6116002)(107886003)(2616005)(14444005)(186003)(3846002)(478600001)(66066001)(476003)(8676002)(47776003)(486006)(956004)(48376002)(11346002)(4326008)(97736004)(16526019); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4902; 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; BYAPR07MB4902; 23:Cll3na8dEAUyeke5k7lSTbrhtCkjOenaiMDjNv49f?= =?us-ascii?Q?nwOy3MvhswS9RsDV+9xwS5xQ3K30gBp1WShmX8PMkM9IB6If92NYbrDm/Dg8?= =?us-ascii?Q?Z+rwEuPWIH1gW85FmKVMBGrGTpgbmRxxSHoJcQtyYTvHiIFQcYTh8J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dpdkcXxUb0JXeSZvz5ZIgTQIe6NBCctQLGj8LcgTuEnagCN2kpFJHDfbftLWS4mbMubpXYBP6tzCZD1FxEuEgeiRZXKHNlM7852Qpbt4rdovlSFTGQxBPnT6uo/2n8ujw==; 5:C30X2VwSauekb8mSHSm9/6hu9kqCpbgND9uCwlbUiIlPcA7nAlDDZVE9nTHVzDUvC5JGyLm0IG3ZNE78YnXUykMPIJVHa7VblZtmk67GW3e1JYYjGpCDRVG6z1HfTe4I1WATHdyIN0H0H81EuIrhDeDDVkTeNpPvbEn0r2+gSDg=; 7:Cnfv1c/lzR5H1jqm83tDwN/v+yDBolGhQf33Uy3Sku9tuYO7gC+SvdS3XTrxdnVpQbmL6WuediCS63GmVivriebZ4g5F9kxC7UK5sgpPeIDBAkmAMIbwdhALgFGHMIinP+SzIIufXcUxEcZTS5Zmpmp13u5Px/DRwW5B5MbWR0Gdumc4uRzL/xcsyf+LYApYIFGcGHEyL0pYe/NGfQHA4jWZSJ3GGghOCzgy29FGGcoKqzkcdWhREsrGulM212Ky SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2018 04:03:25.6317 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf2bc238-5ac9-4e58-0db4-08d6121b5f7a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4902 Subject: [dpdk-dev] [PATCH v2 23/33] 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, 04 Sep 2018 04:03:31 -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 733c402..c082e21 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 OcteonTX 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\n", 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\n", 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 e14d9c3..6949d35 100644 --- a/drivers/common/cpt/cpt_ucode.h +++ b/drivers/common/cpt/cpt_ucode.h @@ -2057,4 +2057,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