From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0064.outbound.protection.outlook.com [104.47.42.64]) by dpdk.org (Postfix) with ESMTP id C76E81B18A for ; Fri, 5 Oct 2018 15:02:38 +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=VJREV0u5W2T+QNsgQpShQqUs9R7p65XXKs3Z4QMoElU=; b=CYOYp2df5TENmUEA+Gc934HDcVBxnpPWrEH9HGmzLK+L6xd9OoCLw+OKW2780WLRirm9sLUE16yYV21sGP9KrypR/yKy0xyygexiVSTGjzlSGmK1nqOmAFEQwtGgi7HLIQlw9MCwWGNyYR51qDriJAX5nQfx+rZsmwpwkiD3lfI= 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:32 +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:20 +0530 Message-Id: <1538744363-30340-30-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: 56a551fc-21d6-410c-2479-08d62ac2d2fb 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:7T2NgkpiY/UQidPxJ5/HTzUuogQkHpV8ULC80APWb6SUiyybaWykVV4f/KcI/PTj9SADgfFl9Mq5h3PQY6GphqqMVPO8wWvAnuly7igTiP8j2Qb653IjbsMiaA/sYOgLilu6jKC4Cc+SYgMxXnIC19rPF0VQhNWfQCn9W7RINg7yXOBswY5vj+ad9cEKrfZEX6njoUZZPUPTpczge1asFAaT/VRNDle0lO/IZt/5D/6jq5Xpr49ptndOGW4dVLuS; 25:90SgdpCXRpC1nKXHuFk2Owjn1e+wsCfNYqN/DFdUOfIlROpwMe2T03TKW7hpngHf4ZxeV4hy195+aj1pwHJN9QUDWxO5D7AZ/CvruGEDCnqcxjPjPhFLB5AqpQPyz8BwB6CnSGVbIcW/Ac2ks8YNd/H8o9sd+uKxxJraLMtezhys0PDBf9t78RlGAZHcc245QaGAUlG6sLFR8y7ZybkSnOCj16HbkZ6DzCkcW/1umiL5+8dqiEoATjfXqFQOoqreDZbLOAq0m6SKN0k20casw6bdbnQaGVPAOciWYnrpLHfLIkRpuduWtV2OII+uW38e8t9hrF9zZi24HQBNiHAcsw==; 31:j2OTFlyxxuR1rzaBksdrsaO1MZ8Dn/3jkAK0ZLNccdudBYTho4o9GSi6cP2DqSY495xS1g9bKyw0qW/DwgQVSrfI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7xkYgxjXrHS0hzdxqZam6mB7g6WN4EWcs+tSK5VTQ== 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:3b9TMjXwtYlk9MaBAYBmJcrXU+stW9nuQoxEBjBmY?= =?us-ascii?Q?gCKSephPmNnU8kfCox5PiRn0MJrHTzMx907QDZmGX93LaxqBZ7biKXqQX1bh?= =?us-ascii?Q?29RAOuhda1GeRTjT+ld783Egk2CmSHnahn0hMHxzdNrcV3MxrLcE/A34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bwCixHO2BuXdOI5gEM48SfWAiGKg9Qknvg77GtnjcLbgpVQy+pvDcjzIOfQ1KJQ4tsNRVm+Wqop+n0ZAjgI1EQMOWcDJtVRJoJqFAD3htzflQFY/azwPFIk+rx8nUqGM+r9vTTBLgEguJtahqwqfQ/Bm5EYjla5g==; 5:+8g7Lw0/WFwXBbOH2OKNVF2vHE0o8MLSriIp5FsD1Ae7Ats6jAJFJlpcxVY5gunVUTBBf0d0HmFKQ03bqGAjaL9XZLMX+2eDQfZq5VgN+7xoq5bMeJUXGntDVXScmhCnDaEVY8bYB3qyjNrGAkLAcF7JqH8QWr5EEcmmRENZxuk=; 7:BdS+t05/iHcsElF9aR/WLhSUCd5PJrXjZvJsOEybqRtVfrBs4943yv68tc51UzhHIqDHHAYqhTU8nCU+WAf7wVX3JK/jfidbnDPEPp9CQEoZs9RLaxRkk1ukx6/UUEw6FeJmL5SYUAVL06ilGe3cnNqQmLMUBpPCxLMk+NqoaUofBU7ItScOowFGmSHmcyjV9IdP2rUtUQcEajBM96RgaDd53ghOhm4663Vko3DnMC+Usv3U58BktjZ/WG4N353H SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2018 13:02:32.5116 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56a551fc-21d6-410c-2479-08d62ac2d2fb 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 29/32] 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: Fri, 05 Oct 2018 13:02:39 -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 | 2 ++ 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, 82 insertions(+) diff --git a/drivers/common/cpt/cpt_common.h b/drivers/common/cpt/cpt_common.h index 1823939..8461cd6 100644 --- a/drivers/common/cpt/cpt_common.h +++ b/drivers/common/cpt/cpt_common.h @@ -15,6 +15,8 @@ */ #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 60be8b3..becc14f 100644 --- a/drivers/common/cpt/cpt_mcode_defines.h +++ b/drivers/common/cpt/cpt_mcode_defines.h @@ -175,6 +175,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 dea89f8..4463cfb 100644 --- a/drivers/common/cpt/cpt_request_mgr.h +++ b/drivers/common/cpt/cpt_request_mgr.h @@ -143,4 +143,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 4d892f2..c5a9f34 100644 --- a/drivers/common/cpt/cpt_ucode.h +++ b/drivers/common/cpt/cpt_ucode.h @@ -3373,6 +3373,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