From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0076.outbound.protection.outlook.com [104.47.42.76]) by dpdk.org (Postfix) with ESMTP id 8241B5F2B for ; Fri, 5 Oct 2018 15:02:43 +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=kU8um0qBuTQLLGKvtM8evuWKkel84z/Btsk3GoGOFZ0=; b=IjjVaVDf8RLwKTbfS7GwT1O48ZSZyociONi9Sswe38va9Ffn6KB6B/NC1pIG6Lgvzs6IBGnVOXkHsgXlR5h1gQxXEJbG2qhXJe6armrNmd66JL7faqAuDMULnfhQQh8pq/DpB6vxTavAkdChOFbfJqFLTVtvGQ14HJtVneRz0Mk= 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:02:37 +0000 From: Anoob Joseph To: Akhil Goyal , Pablo de Lara , Thomas Monjalon Cc: Tejasree Kondoj , Jerin Jacob , Narayana Prasad , dev@dpdk.org, Ankur Dwivedi , Anoob Joseph , Murthy NSSR , Nithin Dabilpuram , Ragothaman Jayaraman , Srisivasubramanian S Date: Fri, 5 Oct 2018 18:29:21 +0530 Message-Id: <1538744363-30340-31-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: 83d841a5-7608-4304-b253-08d62ac2d5e3 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:amVI49MzRb1+zarTCxTIkz4AroiqiNzlJyQjuurLz7keaR4BSibAcUF6lNp5o6vTY/NsLlsycnjZefAI/e1wOa7mu5CpUq4BWfGQ+H7iktHUjcdTiZkv8ZQGfyEkMtDO6iY6JjBd0tEu72FZHyOavGY2JgPFi2UU4EJ9Q4tn0xU7NFAy6qfYn5mTMUOJj0vbRyIQ2KCoTiPhoyQAhis6w2i/gQEf0c0p+WVXQBBeJxfI4Z8Eiso4GBIcIcp1ohvj; 25:XUCXS69tR3D7s69ZErp6A4sFUy1V1Lz91zxS+bb7hWttB1tpq1wl3w6z+jTrofBdmDIf9JZr97jjj8NcVs+0Yp3+0afq9aCjSPWfkiw2/HDQeYb+07YuKKo8k4lwyNyiqqOpGsLUk4GRVsPDq5uwZaLbk4tAM9NsU2wQpqkBCSiWCXLrCAEkYh3QWfIyqk3DJ3E9VhW19xNImCCw2oiyPF3nscYvOQ4x862f34+JP9XYZSJczfhN07WSlTLE6/gdUdrnJbpP1qsnylXQRIxy2kDJNq6fXZkwy3E69Nv3sFgv6dMdCyr8FK6FOHb2mojXt3nvTpskFsmBRUsl68gfMw==; 31:wDxsQDbdEXuCTYsJGWkP75O8SR6XWASYY1yW2dJmBm29F3odi4M6xIkTsPtLUGB+gbEQf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e6sxaZY6ELkf0MJsA6SxjQrgGi2YOw3pQ1TQaQV5d3gtBPW7kNNlpfbS1hregwsXRHxSoOlUA== 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:YtpwjKDSPcCec0+vcrGXnZxGJ4QuJJs3rbhQQWA15?= =?us-ascii?Q?LODQgvmr60C70OlWSVffPQM5N/wb5MwLptzZKTcXRMCbQF3DuYrc+nvI/kPE?= =?us-ascii?Q?reTvJQfpHm29O7+6Zpe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IGp6ZxLPaKqcIT08WpK43TZk2/ydq2V+C2yh5MITjGZZa65ygsVGZngDum+kPCCfFbOAnNQRLZ0T31kIK9k7HbTuQ2fyODKzyNYPJ/C2KIocvf1TYs+jBUA/Ru2McMj2DA+OpPO36906nY5S0+Zy7Isndb+o4MgvPLAGAynAJFxBjWn8CyvmHDioFqN3v4KkTjN50Sw==; 5:EE9F+NczCMUid3OirJdWT6cktfzEEFBXruGjr29107WWcFprUqkkB5bu/jyBWmGuUEBY44sGvEdCWfVmfaE/ta69776Awj7IHjJB7UGifq79P2NB9gLf8A14qtzHUVCjhgW1aWrmuvdq8S/IWaWAqtjCaIGKuFCTdZEC4StIhlk=; 7:XlbQlBWukKl6h2wmZoxdn50WEtraZcqojihUrwpcSq7beW97smoJ68LmJUnaSkRsUoCZ9U5CU1Hy/BlEvOl7oP9ymjyVh0Ye67TYxt/72rTrnhgnHbnJ5NJjH/9oJi1C2j4HvS7BHOZKtESX8wI5BXNKpl5vDiCoR7At7MhI15E2y1+lGESji0ofTsTdrjwf3SsKomn3Zl9qqetYgTA6i3CvzGbyKbc3uCLO28S4w5F6ExxtU4E/X4TAr/Jc354b SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2018 13:02:37.8505 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 83d841a5-7608-4304-b253-08d62ac2d5e3 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 30/32] crypto/octeontx: add dequeue burst op 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:44 -0000 From: Tejasree Kondoj 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/crypto/octeontx/otx_cryptodev_hw_access.h | 69 +++++++++++++++++++++-- drivers/crypto/octeontx/otx_cryptodev_ops.c | 47 ++++++++++++++- 2 files changed, 110 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h index 6f4d6e1..82b15ee 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h +++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h @@ -1,19 +1,20 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2018 Cavium, Inc */ - #ifndef _OTX_CRYPTODEV_HW_ACCESS_H_ #define _OTX_CRYPTODEV_HW_ACCESS_H_ #include #include +#include #include #include #include #include "cpt_common.h" #include "cpt_hw_types.h" +#include "cpt_mcode_defines.h" #include "cpt_pmd_logs.h" #define CPT_INTR_POLL_INTERVAL_MS (50) @@ -252,10 +253,68 @@ static __rte_always_inline uint8_t check_nb_command_id(struct cpt_request_info *user_req, struct cpt_instance *instance) { - /* Required for dequeue operation. Adding a dummy routine for now */ - RTE_SET_USED(user_req); - RTE_SET_USED(instance); - return 0; + uint8_t ret = ERR_REQ_PENDING; + struct cpt_vf *cptvf = (struct cpt_vf *)instance; + volatile cpt_res_s_t *cptres; + + cptres = (volatile cpt_res_s_t *)user_req->completion_addr; + + if (unlikely(cptres->s8x.compcode == CPT_8X_COMP_E_NOTDONE)) { + /* + * Wait for some time for this command to get completed + * before timing out + */ + if (rte_get_timer_cycles() < user_req->time_out) + return ret; + /* + * TODO: See if alternate caddr can be used to not loop + * longer than needed. + */ + if ((cptres->s8x.compcode == CPT_8X_COMP_E_NOTDONE) && + (user_req->extra_time < TIME_IN_RESET_COUNT)) { + user_req->extra_time++; + return ret; + } + + if (cptres->s8x.compcode != CPT_8X_COMP_E_NOTDONE) + goto complete; + + ret = ERR_REQ_TIMEOUT; + CPT_LOG_DP_ERR("Request %p timedout", user_req); + otx_cpt_poll_misc(cptvf); + goto exit; + } + +complete: + if (likely(cptres->s8x.compcode == CPT_8X_COMP_E_GOOD)) { + ret = 0; /* success */ + if (unlikely((uint8_t)*user_req->alternate_caddr)) { + ret = (uint8_t)*user_req->alternate_caddr; + CPT_LOG_DP_ERR("Request %p : failed with microcode" + " error, MC completion code : 0x%x", user_req, + ret); + } + CPT_LOG_DP_DEBUG("MC status %.8x\n", + *((volatile uint32_t *)user_req->alternate_caddr)); + CPT_LOG_DP_DEBUG("HW status %.8x\n", + *((volatile uint32_t *)user_req->completion_addr)); + } else if ((cptres->s8x.compcode == CPT_8X_COMP_E_SWERR) || + (cptres->s8x.compcode == CPT_8X_COMP_E_FAULT)) { + ret = (uint8_t)*user_req->alternate_caddr; + if (!ret) + ret = ERR_BAD_ALT_CCODE; + CPT_LOG_DP_DEBUG("Request %p : failed with %s : err code :%x", + user_req, + (cptres->s8x.compcode == CPT_8X_COMP_E_FAULT) ? + "DMA Fault" : "Software error", ret); + } else { + CPT_LOG_DP_ERR("Request %p : unexpected completion code %d", + user_req, cptres->s8x.compcode); + ret = (uint8_t)*user_req->alternate_caddr; + } + +exit: + return ret; } #endif /* _OTX_CRYPTODEV_HW_ACCESS_H_ */ diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c index 4240051..23f9659 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_ops.c +++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c @@ -366,6 +366,51 @@ otx_cpt_pkt_enqueue(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops) return count; } +static uint16_t +otx_cpt_pkt_dequeue(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops) +{ + struct cpt_instance *instance = (struct cpt_instance *)qptr; + struct cpt_vf *cptvf = (struct cpt_vf *)instance; + struct pending_queue *pqueue = &cptvf->pqueue; + uint16_t nb_completed, i = 0; + uint8_t compcode[nb_ops]; + + nb_completed = cpt_dequeue_burst(instance, nb_ops, + (void **)ops, compcode, pqueue); + while (likely(i < nb_completed)) { + struct rte_crypto_op *cop; + void *metabuf; + uintptr_t *rsp; + uint8_t status; + + rsp = (void *)ops[i]; + status = compcode[i]; + if (likely((i + 1) < nb_completed)) + rte_prefetch0(ops[i+1]); + metabuf = (void *)rsp[0]; + cop = (void *)rsp[1]; + + ops[i] = cop; + + if (likely(status == 0)) { + if (likely(!rsp[2])) + cop->status = + RTE_CRYPTO_OP_STATUS_SUCCESS; + else + compl_auth_verify(cop, (uint8_t *)rsp[2], + rsp[3]); + } else if (status == ERR_GC_ICV_MISCOMPARE) { + /*auth data mismatch */ + cop->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED; + } else { + cop->status = RTE_CRYPTO_OP_STATUS_ERROR; + } + free_op_meta(metabuf, cptvf->meta_info.cptvf_meta_pool); + i++; + } + return nb_completed; +} + static struct rte_cryptodev_ops cptvf_ops = { /* Device related operations */ .dev_configure = otx_cpt_dev_config, @@ -458,7 +503,7 @@ otx_cpt_dev_create(struct rte_cryptodev *c_dev) c_dev->dev_ops = &cptvf_ops; c_dev->enqueue_burst = otx_cpt_pkt_enqueue; - c_dev->dequeue_burst = NULL; + c_dev->dequeue_burst = otx_cpt_pkt_dequeue; c_dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | RTE_CRYPTODEV_FF_HW_ACCELERATED | -- 2.7.4