From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0088.outbound.protection.outlook.com [104.47.37.88]) by dpdk.org (Postfix) with ESMTP id 586C01AFFA for ; Tue, 4 Sep 2018 06:04:02 +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=OuK7iTFjvXABfBkEDvomNvrumEdwL8cznxr7CM3gfCw=; b=DcKEm+cgZnayXXxdTKJbYWtodTrSsiRbKAoHFRdOVI4SqhzSo06Lp4sejhQUyzAq+BZHykEywnIbbUsKpk3b0ZixwyAFvRf5sXNwetTPX8DSK+aIqGiB5eVkG2cdezKXXiBTRDr3lzkuU6EoBPQanKMMvQnVi7hRew9tkD3xzuw= 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:57 +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: Tue, 4 Sep 2018 09:29:17 +0530 Message-Id: <1536033560-21541-31-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: 64a0d57b-2e1a-4ae8-a8be-08d6121b7234 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:RcfwB9/rSaUUxTq+tnzX81+tv8FF20M7jiREW7d8T9iabmrzo5ZJZ0lCmFS2OYjb2VLoPiVYxfyHHsly9AWgimt73nQLjfHxPZ9l01x8boV/dMK50Uo6mm518jCO2fjAtiZ0buVXTELh4+uTO3ej0Xf7M+/KmcKUqrxNJAhti5WKUocb8RAgY/3T3rpvnYLnulbfsNNhlxYWntiRJykQHPUfq2mA70/FS2+fgaZK9qiGXm/SMIEfi0+jtByqJFNV; 25:jD+lw2B/gLdxCy1pkhvsVzTyttkw9CT7obSN9pstx0TWV40+pmPzD7A+zkZIdmvOYjuQeeoFU1fbWgPOFRBMcOhg9qStJs7j3t3XhCCmJePqVFqEzncfsBdNV+c4ZVNcLHe3BVbQtzfFJu9gLH98LbZ4dcBlkQOT6HPwQ4N60y3XSbEAF5ORI4cH/iZe3diaGK+6s7vxFEIoBcBbKoZ3QCYThX5ewGJux4VT8lRJ0C+2VSjnABECrM2Tvly7Q1n5XkRDSIVh3dwOXSiETHuaHw7U3my09KDwCHax4sRSYzlYZ96x4B/p0pLBA7sCcdvbyVy/zQJOwLqKKNYGvIIZug==; 31:BmFCuVfALNEIdpJRBUDwFVHR1CvjB1zkzr+sN1MA8vgvpFxJPMy9gKsq/mToy8dworHvZlLarXonZE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7Ev9rhKvN2WyHB4a5mO1VDlD3hSUwgATw4jrlMeGjiF+DKGvl0yV3h8s7/ZdGgrw== 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:wTt/7KCVNgNGzjPljh5gTYADfiQ0wvddK38iCU/j/?= =?us-ascii?Q?0cKgZ9FX+skJb+UEMI41fpK27PJ8Fj9HOpP0Wk8/RL0HtptBtul9FsdA2It5?= =?us-ascii?Q?aOqKXc0/TWnIt+oN5UVkMeO5w4tE18WNFzk2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3ljHEfYnXW4p5u34PQzjEcudr0V+Be3jxTSuVMU/Npyp5juIAG0XmNu/d0C/PVFomrdlfT6w6o1eLne80TNCowTwSgWtz6+buVbHzwooGRw8iiDG6li83D4rnxXcPvS5/MPetw==; 5:GZTAiv9h72xKNg0WKGk5ARuA6+H5A171D5NBla4/LiTfQ7uOcliIKWg4uQiY3HMnJglJzDYrJ3hsufdtwDdb3gLcCU+BsistBoz8q4Lc6cEugPg8SMUPF2233gZmYoFzW/HREcq/ZMrb+NJnNGS34MOfM5GO8acyYXNXLi2x9Fs=; 7:oyzKHDCVIKRHOJuEfk5BhvN8F1X1uFfzxSVNs5N+98SOTtX034Ynx7iSt6wYESksNsGeodGOuCiz1H+sGwPxtuMSvau2fx4WqGPKMJ6SegtQbIN0uzcngrykVLoTBRd5UkY0VBhgDdG9diS74jCEeAQljnMhQ6KLYwORucul3mFicB//yYTbuAMOfhFOeHvWCMkEzIrdS8djP4PqLJmATAWwhJJuxM3EDJncc185KuyQjDr+JZFpYtX66AXFFEtc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2018 04:03:57.0693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64a0d57b-2e1a-4ae8-a8be-08d6121b7234 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 30/33] common/cpt: add common code for cpt dequeue 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:04:03 -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/common/cpt/cpt_common.h | 1 + drivers/common/cpt/cpt_mcode_defines.h | 15 +++++++++++++ drivers/common/cpt/cpt_request_mgr.h | 39 ++++++++++++++++++++++++++++++++++ drivers/common/cpt/cpt_ucode.h | 26 +++++++++++++++++++++++ 4 files changed, 81 insertions(+) diff --git a/drivers/common/cpt/cpt_common.h b/drivers/common/cpt/cpt_common.h index 6debf42..a9e179a 100644 --- a/drivers/common/cpt/cpt_common.h +++ b/drivers/common/cpt/cpt_common.h @@ -15,6 +15,7 @@ */ #define CRYPTO_OCTEONTX 0x1 +#define TIME_IN_RESET_COUNT 5 /* Default command timeout in seconds */ #define DEFAULT_COMMAND_TIMEOUT 4 diff --git a/drivers/common/cpt/cpt_mcode_defines.h b/drivers/common/cpt/cpt_mcode_defines.h index b580289..3b64698 100644 --- a/drivers/common/cpt/cpt_mcode_defines.h +++ b/drivers/common/cpt/cpt_mcode_defines.h @@ -176,6 +176,21 @@ typedef enum { ERR_ENODEV, } mc_error_code_t; +/** + * Enumeration cpt_comp_e + * + * CPT Completion Enumeration + * Enumerates the values of CPT_RES_S[COMPCODE]. + */ +typedef enum { + CPT_8X_COMP_E_NOTDONE = (0x00), + CPT_8X_COMP_E_GOOD = (0x01), + CPT_8X_COMP_E_FAULT = (0x02), + CPT_8X_COMP_E_SWERR = (0x03), + CPT_8X_COMP_E_HWERR = (0x04), + CPT_8X_COMP_E_LAST_ENTRY = (0xFF) +} cpt_comp_e_t; + typedef struct sglist_comp { union { uint64_t len; diff --git a/drivers/common/cpt/cpt_request_mgr.h b/drivers/common/cpt/cpt_request_mgr.h index 4bf8de3..fb11c4f 100644 --- a/drivers/common/cpt/cpt_request_mgr.h +++ b/drivers/common/cpt/cpt_request_mgr.h @@ -147,4 +147,43 @@ cpt_pmd_crypto_operation(struct cpt_instance *instance, return ret; } +static __rte_always_inline int32_t __hot +cpt_dequeue_burst(struct cpt_instance *instance, uint16_t cnt, + void *resp[], uint8_t cc[], struct pending_queue *pqueue) +{ + struct cpt_request_info *user_req; + struct rid *rid_e; + int i, count, pcount; + uint8_t ret; + + pcount = pqueue->pending_count; + count = (cnt > pcount) ? pcount : cnt; + + for (i = 0; i < count; i++) { + rid_e = &pqueue->rid_queue[pqueue->deq_head]; + user_req = (struct cpt_request_info *)(rid_e->rid); + + if (likely((i+1) < count)) + rte_prefetch_non_temporal((void *)rid_e[1].rid); + + ret = check_nb_command_id(user_req, instance); + + if (unlikely(ret == ERR_REQ_PENDING)) { + /* Stop checking for completions */ + break; + } + + /* Return completion code and op handle */ + cc[i] = (uint8_t)ret; + resp[i] = user_req->op; + CPT_LOG_DP_DEBUG("Request %p Op %p completed with code %d", + user_req, user_req->op, ret); + + MOD_INC(pqueue->deq_head, DEFAULT_CMD_QLEN); + pqueue->pending_count -= 1; + } + + return i; +} + #endif /* _CPT_REQUEST_MGR_H_ */ diff --git a/drivers/common/cpt/cpt_ucode.h b/drivers/common/cpt/cpt_ucode.h index 7d2b3ef..eff71c9 100644 --- a/drivers/common/cpt/cpt_ucode.h +++ b/drivers/common/cpt/cpt_ucode.h @@ -3366,6 +3366,32 @@ fill_fc_params(struct rte_crypto_op *cop, return prep_req; } +static __rte_always_inline void +compl_auth_verify(struct rte_crypto_op *op, + uint8_t *gen_mac, + uint64_t mac_len) +{ + uint8_t *mac; + struct rte_crypto_sym_op *sym_op = op->sym; + + if (sym_op->auth.digest.data) + mac = sym_op->auth.digest.data; + else + mac = rte_pktmbuf_mtod_offset(sym_op->m_src, + uint8_t *, + sym_op->auth.data.length + + sym_op->auth.data.offset); + if (!mac) { + op->status = RTE_CRYPTO_OP_STATUS_ERROR; + return; + } + + if (memcmp(mac, gen_mac, mac_len)) + op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED; + else + op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; +} + static __rte_always_inline int instance_session_cfg(struct rte_crypto_sym_xform *xform, void *sess) { -- 2.7.4