From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0068.outbound.protection.outlook.com [104.47.41.68]) by dpdk.org (Postfix) with ESMTP id 70A911B1CC for ; Tue, 9 Oct 2018 11:09:29 +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=yzHXyLFwY6HSXwXYSoo1S49WuQJmg+AdON5mlqRKWBk=; b=c+NGFmT0FnExiSpXli8J1/dQac0UWi+3fnlsQ7CemMmJXuPbK90FGPv0W4QL3AE9dkTSau9SwtIDNOiIxmub1W5Lcw4dGkpX2NPl5EWLmv2Xyg+7w2LKPsimkxRJdbuU8kcVFjnoTlappTZ2b/Wjq3HGpzKRsrQwaczXcurfBms= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.com (115.113.156.2) by BN7PR07MB4897.namprd07.prod.outlook.com (2603:10b6:406:ef::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.28; Tue, 9 Oct 2018 09:09:24 +0000 From: Anoob Joseph To: Akhil Goyal , Pablo de Lara , Thomas Monjalon Cc: Nithin Dabilpuram , Jerin Jacob , Narayana Prasad , Ankur Dwivedi , Anoob Joseph , Murthy NSSR , Ragothaman Jayaraman , Srisivasubramanian S , Tejasree Kondoj , dev@dpdk.org Date: Tue, 9 Oct 2018 14:37:45 +0530 Message-Id: <1539076076-19786-13-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539076076-19786-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1538744363-30340-1-git-send-email-anoob.joseph@caviumnetworks.com> <1539076076-19786-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: PN1PR0101CA0004.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::14) To BN7PR07MB4897.namprd07.prod.outlook.com (2603:10b6:406:ef::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d2a76a7a-6ca9-4148-c7a6-08d62dc6ea73 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB4897; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4897; 3:74Knt8KqAwIFzZoInUj9n4Hq3S3C6RqGUCKuUiNWN+/Gsk5ybIcIy4v7lcqCBXf7TRwpHpRyvCTyhknBi2OOxrd6evKYNk5io3cGRDpBfoepY1eY1Mcz3jeJ4KDF3HZH0An1jLA2ztFnGdXz6cydDQEU9piHQe6LBvuhsTkafVmWgenSsYgU3nEyvEj0mx/Q5oHdKhQZESjWTMdLGKfaAeueUUlBuQ5V1uutn5fzQ9gIE/PgPNVRuXkO0lDmeeqI; 25:86geQZ5ClaGat6LnuXvZ65iDXK3iNTenneM/gy8LFQ2BrJiRK6E4Y9Qi/wDBb07u32LncalpVEvNw9GZxpTlKwDAUy3tfCCNwgYp/lPJd8GNpyTPJKjJxORppaLrZotks/NunIFE27VFLpsPAUsxKxiVRg/QnbKZaJyT6lDFiycGUmcqHTRN/yi5kYiAQj84HV7PYyBTx7mxDUia4KkzLm7penbecbxkEyUDAuns6RhiiyuL+E00b7E0plwKkloQOgtWJ129PufmGuFnnL1DcOITQuYmZrBSyFFKuwzNPrFAt0EQmfZNI2VkZGspvDK4hzDklFlY8EUbEbDzlT1ytA==; 31:91NGVfDCMZfSCm9gAhUso5PVj+MI0E0MfIvCljXdzRbFr6rKBBGdLZrsiRY55YCMkJN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aZwReWmta8m4naGyF3EF26IRov+WmAR0AMOTY3lxBHUKvVbKB0JlpggMk2TBADwidCjtnGtIkMYDHZ2uGVYAQPpMSZGfizftT4NReoWaUTF2nnMxrbC 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)(5005006)(8121501046)(3002001)(93006095)(10201501046)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(201708071742011)(7699051); SRVR:BN7PR07MB4897; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB4897; X-Forefront-PRVS: 08200063E9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(366004)(376002)(136003)(346002)(39860400002)(199004)(189003)(42882007)(47776003)(106356001)(6666003)(186003)(5660300001)(26005)(68736007)(16526019)(8936002)(25786009)(6116002)(2906002)(81156014)(50226002)(305945005)(81166006)(7736002)(3846002)(105586002)(478600001)(8676002)(54906003)(110136005)(48376002)(16586007)(14444005)(6486002)(6506007)(50466002)(316002)(53936002)(386003)(51416003)(52116002)(76176011)(11346002)(6512007)(44832011)(446003)(36756003)(55236004)(956004)(2616005)(486006)(4326008)(66066001)(97736004)(72206003)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4897; 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; BN7PR07MB4897; 23:DVHvQtnidFpXYCE3a51SXraWkA6Do+2lOC+b8kji2?= =?us-ascii?Q?E+U9Sic99QMGg8LhJrAQie2AIAqzTbmxV9iDFcaH2TkMP0jYiC6WnYZ+mGd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0yZK+cf5Ly7z2/JGP?= =?us-ascii?Q?uReO4pls2T/w0mCLZ3CwrbTzNA4qGx5638OXj9VFGe7+rNmAoD7aihKvCY7b?= =?us-ascii?Q?1+4VhE+sdaadkPIWmZv7jFFUST7/hvr4KL3cKsEC3OWWAK59gdWS+tEkbMhN?= =?us-ascii?Q?od7XsnfHesAVBY8wSmewrYx9u7blw3WPWlYBBHXrWuzKTGCwSOk7BVZ1DPuG?= =?us-ascii?Q?7Ek45t3N0HkwMbKgoNRjE4E7EPAeSQ5mtIv3ieR5vg+BzqlN6VcaP1xyzFU1?= =?us-ascii?Q?nGzypgD1940FaSpyolKKNQLAdklRuKvd8FylovQ?= X-Microsoft-Antispam-Message-Info: +VjvnUVLwAO6eTUUIXr+ocoBysgUH8f7+gX3Yb/zVljqeRAONW2HOjEZexSqJLYGmgiKZxZu2yNabxFO8S6upMJCkNt0NTOcsFh/caP1rezQy+CV9NoTfwN1CbL3qHigN2FekcW695oD63QM+093HfPsWN5EKDVpf5WEqJ6Fr7zbNdEW0btYkSQNBLbJmglTCcEAWfbuiJqORUPQbAgmh6jSnxGin1qCyD8BZfQo/fXQSTCpDd+pIiGIAkTtOJET3gglfhJfGdD6H4U/4hN1HFEPdvHaIrPx2d+pAISBm8MzvK0vUTgTe1lhzuidHidzyOtkwA4ugsBQ2dzecEzFvoA0RmTpBorOdQvgcVR/k/8= X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4897; 6:RZ2zrlaV611NTaCNv8RXXlPS26VqghwFEAoWkUu0dePEHP5zRhCarUSxYbALmpwHMFDism0tlA25n7QyDS/1+T+t42TDN2vuDeCvjLGJLhfP5o1Qb3Pf8URq7XYrRhujkyE8rO2cRQfGRl7v4MliWdfanWtKhdIFCVxHlCwI3mw2YJS9FC9WhASsIZHwtk10AvD9UCOiGQUi201Usal2aaOgXFg4yrwKZ14iuJE48Q1a2xejJ7U0JqAang3cVCBSGSeXCWOgqstr7IkoP9+hS1O2KVvxa4rwG7LnChXaL4SFU43vTVZo0O0X+gZ93TpTYOExCJRnNTQqtWeC9/e4xU3aQXLpMa+p2rHxj1onL33nrxXGdijF2svxomWYAXbcUCCNPLUObNna1pKmFTyTvHy0iw5W/hud/ivhMqoweeDE4uETHZrIXpYm26FICECpAyKp6rrYbXF2bH3BQ1gzwg==; 5:xKCzjS9zwwNzP9YDTU2uAIVasHhlM37i9PR+iXjkbdsdfqR/cHjPaI2sFMxK4vsFtNHkUGSUG1OoY+UWyglSKxCUSYjBRPJG0lhal15AFXyuJLWYojnjjNY1ZhHfsFrngY92clA7+CoSnZUrf4QORbFJcKg/lKvL7Jkm0i1SBxk=; 7:2SQ5NDvYfbMaMZGVTN4vTFhdR7v59KEkBuwk2qGbwuK8w+SgW8RMMsWHbRdAbDvBt193PlOZlFYq3+Vogz+m3wyi7y5jJ5bIEn1vWW7TsFa7hkRaODppPVyGc5ZZ71Svro4PyiY8VpAL1C3EixBCBAuEQtLYNfhtcXsQcqDLh8smEjkhriszwLuCskotpUo/8ewk/YofYaIyO+Tfx2+ja5AoR11bfT4r2eBKyXu5kXh0vbxbcZ7qSaaOZYq+sm/A SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2018 09:09:24.6781 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d2a76a7a-6ca9-4148-c7a6-08d62dc6ea73 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4897 Subject: [dpdk-dev] [PATCH v4 12/23] 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: Tue, 09 Oct 2018 09:09:30 -0000 From: Nithin Dabilpuram 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