From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0049.outbound.protection.outlook.com [104.47.33.49]) by dpdk.org (Postfix) with ESMTP id 7B3D91B115 for ; Fri, 5 Oct 2018 15:01:44 +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=FTOTJXiOCL4Px0slSVc5gxeLj2FojP3VJ8i5pApmYHw=; b=VbyCKWt2SOazJMRI55hn9385DOHsYh2wFjfpREnBxG7OJN9R6R/bfrPrMYNz+Ps6EqRlNFtSX6EUvdSKaoYSusVvNUH3aZm8MIXHIA/QqjrZ4lqZvk1OGb/ynN89EySoGbVPi2Civ1DHFn/Gyw6A85S/Fo4S6b0WYx1ivdIwRAQ= 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:01:39 +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: Fri, 5 Oct 2018 18:29:10 +0530 Message-Id: <1538744363-30340-20-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: 6bfd557a-565c-4104-4374-08d62ac2b2d2 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:z9fiODzOaIm48Ozg2c6MH5fyxzUCDrWVVi3zPgGMRGf0ayuLLV0qI2c1YRttwm+K9KM1QdkD9wlp3szJ205Nkt8TAabzZvgyLxQ8xxm/s5yTG9XedEr18qVtZ6pwLgQ0BpLmQyGzhswq1kxQgPnjq4E2Poe/zzriBK9NAnUgCBwAKQx4PM16RMF/5mptCrzM99LjjDP2jZpTNpz2kysn+7l4sHFepY6DOlje8fSYzWw2xw1hWHuZHeO6iEFN5enH; 25:tOkjBBfhMALaMXymQuiI7Do6xg5VvCTQIxIa4ugtoy7LUHqJRTkWSGpT3XGi+uY1P5amLHALO8S0QCD0QyN2RrXgMYhwegMQHpq5+E0qj0BjQb1IVs7L/a8NwykWrX32gKyDz40z7ZeUUTNY/jK+fEB3jjx6P6CghRDyxP7Z1w7hB1RcgAY4Uv6GhR04EpoeH+nm/mw1wZiShaBxc2pLRpoKokOKqL2iKNsF8GcLbRAgF+/Gm/02++LH2orlpF5/ZaaSh8U2m5wy1xqQlLkMhT1VGywEqXNEsjWJo4tc7FcNGOyH2UIBPN8sYdqNLQTfFWvsYiSYMqisjmSwFvw34A==; 31:Ow8NEg1rEtjNBzymVq+sXeZAMheKbPcWfBiuUqZCnD0UWrjlevYJvIQQ82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CCRMkO0emZLFOMExWu5vGFO4xbL4Ih7bYwtHKkk/jbFpT8wVR9p9UHBmRwKOe82L+1yTqUZQLqIHK88CibGu9JpB2QIWABLdf9POUrbv1VCXu7D X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(163750095850); 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:54duAcAN8V0dirTmmoqhnwD3iXeWWIgW/zlJCb3vi?= =?us-ascii?Q?+6/YpkqMBL3N4sNKJmcbFf4x7nGSAK8ulWqirMFut93VRMkOd79GCJo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ibC5GIeA8VX8ADl4mz/W3SGac/G1yTQbPu/IQm7BRGVJo?= =?us-ascii?Q?hYI8NSJQlYzA9OGtkGUfs2OP94YXPi1JitF7gKUhmQQieY4C96tXHChmqibD?= =?us-ascii?Q?GdojmUFDETfeJA0tZZyzNZkXP8Yl06Do/MGgOkYO4mpRRpmbnpyHVoeYTEHp?= =?us-ascii?Q?+iEHHut32kiYxIqW7dknsVML96G0F+jSj3Nabc+xNSUKAO48e7lckLd4jOf2?= =?us-ascii?Q?u7HQPdoXUsoD3JqfXhEmjCzvhnU6kC8ax5O+i4Q9Amr5WU0L0GCDE0TSeIJz?= =?us-ascii?Q?GPxhPBEOd2yxnownNwPOcC3fJRcKGvQ3Rc7YF3s+tXeorqWShaODb8vNa9Ki?= =?us-ascii?B?dz09?= X-Microsoft-Antispam-Message-Info: Ai3C14gYFzrYaIQzgx/iBVDIDL386k225qktLpcluXo50a+I6upUNOUml8JYFzN6yQ+3P7uuDzwFbzocIfFwSNCt9PJGfp3zFRyfn70MyjrwQBPQ8gQ5Gr30o0GCzUnWl1LSAFuU8pwRIEhWpB/eenyDbnLdvBUFUhJfUKG1SZlBKfIy+ElYhwtzjKY+jgerUE23mKS1xg86Lr5XrWIXRdu1xzx1Wj4PnpWRJuYiQSnFMfZTne+h7b0l48RDuE5mC9UIMG63pNSEU88wbfn1K37PrlI4LMdQ9faccAhPp20k/0SLuchFJCTFxFVYcC0LZeBigUahTcDQoFZkMDke3LbutWjYh4rvZ0DhzA7oOeQ= X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4910; 6:eeKwm6vHIoVPXewNzuof8tYSXE68FBYCZL+0j7wMVCHFrZSAX2bY9P8FJvxqpSIggdosx/8Faw5sE/sD5oLRZ6ckm0hQ42KNjDaSGHjGzzfRrURFW9lt88h8QokFVzDB4tSMPHkTERcaBw6hNTHs+DjVu1OyZiw1Lg5dZHsCGFWfW1TUFpsxI3qq/0/93oPgpJG5HG3QpX7VDBPdgOGsUX+DAntfaphTqEETLq1PxWSb1ke+mYQ/Z18bXAj2ATLBnpdciOGWTFwtHCWnobfqfrgIW7RweDAG+OHbIKgyfiGFZOID2IQWJTd1JbPx+6yREfw1kJIXozKAIjq+eFlI1QZvxTTUIznlLg3aEtHLN+MzpvDTfvvzfU/GYx9LA5F1rRNEeWnWbd35xyHRTYHnL+3izreugDyK9NaacyWdLEocBDhoTSl1pAZStw71h4rQabk+0qa9ah1SHvP7IOqCNg==; 5:C1I2aM/NaEWuY/1zAi8t8kLKCtpdlagu01KjpS9Ils4sEiHhvEMRiEovHqwwsYQxZMLX8IATwTgTvPakeLFEWvqD8bjSaT2UCQzyAgNyeTxMGnc1N3Liohowe2SScgkBa395jz6nUWMnbijU6siODaEtzj7PqmUt7QBLBahMUII=; 7:zmbdbWlrARMsiM8UI/Y8AIC8gFkAsToc4/rIsmlN1a1si5QbJPRBxsGEcafv0eyNuBjfZSAV8YmauIez47BZlG+QEe2HaLiw0w98SbSy4w8SVoXCwb9dwR/Kdi8rHpxE1VTYzJiRG81Dy6HGqIjRps4fYSPOObhGgonx9qRg7UsshlJbh+W3XWw2nTDf5lRwVNMu6ep+j/JIxNUGImLdh0uBRanjyeFYeJcsmCcP/t3R5IxnrGht5cdJmdY4HKvx SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2018 13:01:39.0480 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6bfd557a-565c-4104-4374-08d62ac2b2d2 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 19/32] common/cpt: add common defines for microcode 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:01:44 -0000 From: Ragothaman Jayaraman 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_mcode_defines.h | 117 +++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/drivers/common/cpt/cpt_mcode_defines.h b/drivers/common/cpt/cpt_mcode_defines.h index 50657a2..263fc47 100644 --- a/drivers/common/cpt/cpt_mcode_defines.h +++ b/drivers/common/cpt/cpt_mcode_defines.h @@ -12,6 +12,12 @@ * This file defines macros and structures according to microcode spec * */ +/* SE opcodes */ +#define CPT_MAJOR_OP_FC 0x33 +#define CPT_MAJOR_OP_HASH 0x34 +#define CPT_MAJOR_OP_HMAC 0x35 +#define CPT_MAJOR_OP_ZUC_SNOW3G 0x37 +#define CPT_MAJOR_OP_KASUMI 0x38 #define CPT_BYTE_16 16 #define CPT_BYTE_24 24 @@ -54,6 +60,25 @@ /* #define CPT_ALWAYS_USE_SG_MODE */ #define CPT_ALWAYS_USE_SEPARATE_BUF +/* + * Parameters for Flexi Crypto + * requests + */ +#define VALID_AAD_BUF 0x01 +#define VALID_MAC_BUF 0x02 +#define VALID_IV_BUF 0x04 +#define SINGLE_BUF_INPLACE 0x08 +#define SINGLE_BUF_HEADTAILROOM 0x10 + +#define ENCR_IV_OFFSET(__d_offs) ((__d_offs >> 32) & 0xffff) +#define ENCR_OFFSET(__d_offs) ((__d_offs >> 16) & 0xffff) +#define AUTH_OFFSET(__d_offs) (__d_offs & 0xffff) +#define ENCR_DLEN(__d_lens) (__d_lens >> 32) +#define AUTH_DLEN(__d_lens) (__d_lens & 0xffffffff) + +/* FC offset_control at start of DPTR in bytes */ +#define OFF_CTRL_LEN 8 /**< bytes */ + typedef enum { MD5_TYPE = 1, SHA1_TYPE = 2, @@ -106,6 +131,48 @@ typedef enum { AES_256_BIT = 0x3 } mc_aes_type_t; +typedef enum { + /* Microcode errors */ + NO_ERR = 0x00, + ERR_OPCODE_UNSUPPORTED = 0x01, + + /* SCATTER GATHER */ + ERR_SCATTER_GATHER_WRITE_LENGTH = 0x02, + ERR_SCATTER_GATHER_LIST = 0x03, + ERR_SCATTER_GATHER_NOT_SUPPORTED = 0x04, + + /* SE GC */ + ERR_GC_LENGTH_INVALID = 0x41, + ERR_GC_RANDOM_LEN_INVALID = 0x42, + ERR_GC_DATA_LEN_INVALID = 0x43, + ERR_GC_DRBG_TYPE_INVALID = 0x44, + ERR_GC_CTX_LEN_INVALID = 0x45, + ERR_GC_CIPHER_UNSUPPORTED = 0x46, + ERR_GC_AUTH_UNSUPPORTED = 0x47, + ERR_GC_OFFSET_INVALID = 0x48, + ERR_GC_HASH_MODE_UNSUPPORTED = 0x49, + ERR_GC_DRBG_ENTROPY_LEN_INVALID = 0x4a, + ERR_GC_DRBG_ADDNL_LEN_INVALID = 0x4b, + ERR_GC_ICV_MISCOMPARE = 0x4c, + ERR_GC_DATA_UNALIGNED = 0x4d, + + /* API Layer */ + ERR_BAD_ALT_CCODE = 0xfd, + ERR_REQ_PENDING = 0xfe, + ERR_REQ_TIMEOUT = 0xff, + + ERR_BAD_INPUT_LENGTH = (0x40000000 | 384), /* 0x40000180 */ + ERR_BAD_KEY_LENGTH, + ERR_BAD_KEY_HANDLE, + ERR_BAD_CONTEXT_HANDLE, + ERR_BAD_SCALAR_LENGTH, + ERR_BAD_DIGEST_LENGTH, + ERR_BAD_INPUT_ARG, + ERR_BAD_RECORD_PADDING, + ERR_NB_REQUEST_PENDING, + ERR_EIO, + ERR_ENODEV, +} mc_error_code_t; typedef struct sglist_comp { union { @@ -231,6 +298,49 @@ struct cpt_ctx { uint8_t auth_key[64]; }; +/* Buffer pointer */ +typedef struct buf_ptr { + void *vaddr; + phys_addr_t dma_addr; + uint32_t size; + uint32_t resv; +} buf_ptr_t; + +/* IOV Pointer */ +typedef struct{ + int buf_cnt; + buf_ptr_t bufs[0]; +} iov_ptr_t; + +typedef union opcode_info { + uint16_t flags; + struct { + uint8_t major; + uint8_t minor; + } s; +} opcode_info_t; + +typedef struct fc_params { + /* 0th cache line */ + union { + buf_ptr_t bufs[1]; + struct { + iov_ptr_t *src_iov; + iov_ptr_t *dst_iov; + }; + }; + void *iv_buf; + void *auth_iv_buf; + buf_ptr_t meta_buf; + buf_ptr_t ctx_buf; + uint64_t rsvd2; + + /* 1st cache line */ + buf_ptr_t aad_buf; + buf_ptr_t mac_buf; + +} fc_params_t; + typedef struct fc_params digest_params_t; /* Cipher Algorithms */ @@ -239,8 +349,15 @@ typedef mc_cipher_type_t cipher_type_t; /* Auth Algorithms */ typedef mc_hash_type_t auth_type_t; +/* Helper macros */ + #define CPT_P_ENC_CTRL(fctx) fctx->enc.enc_ctrl.e +#define SRC_IOV_SIZE \ + (sizeof(iov_ptr_t) + (sizeof(buf_ptr_t) * CPT_MAX_SG_CNT)) +#define DST_IOV_SIZE \ + (sizeof(iov_ptr_t) + (sizeof(buf_ptr_t) * CPT_MAX_SG_CNT)) + #define SESS_PRIV(__sess) \ (void *)((uint8_t *)__sess + sizeof(struct cpt_sess_misc)) -- 2.7.4