From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0066.outbound.protection.outlook.com [104.47.32.66]) by dpdk.org (Postfix) with ESMTP id 2ED2A5688 for ; Tue, 4 Sep 2018 06:03:17 +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=kaZP1K4T2G+nl1VcgfMX7K8yIE9+4HDCkj81FHX2gQU=; b=m3p81/ibgQYJk56RsnuaQQfZV9K/b7B8nkfmJx+3wqU3fpMKKdj3Oxqe9h7tHq390p3RWIDZ14gUD7UZw2ePV5ZHjFHEwTiywFp79RhCaLI6INnN7hh7U7+LCZLpKxk5GsF4A/+N27b8LmFDLXowx88psKA81dpIsSaGhRjJ71s= 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:11 +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: Tue, 4 Sep 2018 09:29:07 +0530 Message-Id: <1536033560-21541-21-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: 9f5e4f4a-0962-488c-a938-08d6121b5739 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:SS4q/5sq71xR+LHOuZJGXNUNzoNtmP4+xLe72TDCFafcjuwK7oCNUmNQ1js72NizkI6nh6hdAzxaaqtm9dyhqgRGsNA00XsY5QCv+1IUu14Trozff02SiD9KKZ6FVoCdENnfftd/x+lOWwlt86oV3vkqHeceDY14Yf0RxjehBNvtbW+4o77TFLcuf0drRrMGuHKpOcFbMiTMQ9yX0Tq0H3qdqcGVQzrZkshtNxs+XxdDon+2zrch9w+kot4ZuFQB; 25:s0YDCY+v5tgnEVtTCmG563JxqP4bTPPvKwV6381EWXnedinyOFec5mmEd89Mw9xGeMHSeh5zdOa37ou/WgjGe8higAt7i+Ni4n2xQJS+qwkbQXaq2EIZUvSTZfR4nIteeLX4OXYdkJvApkDbtLAddx81pKTuwX0+jnDCU3c9BbR4aNPx9DIWu/X+4gHZQzqjPUAnrUqxK/q3T0uGlQGTIwaUXU7onLUoWdqGxVSxFWcCs6yVnm1nrnH1Ar+Q5pLNLjqJBi9E5nIQxtyULKc6/LDWfZ6mopr4RhT34R/+y7wTl61xd0CJw5CZFNAKel/mF+zwJyHl567Nm31LXJwdqQ==; 31:mvETSe9JNvhp0C5324TNXRb6BTA1ldJSS3AhjZJm4nBYE+ueQ2A5KhFn7eSY043AmCW+VbdeZGUHjRIZpo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2zft0RG2lc/ThcSluVX5vpUJq0BAqh1TpGOnunBGBdz2fq9W73JRGm5YyWKO9Uo8SLQZUiOQZC1dxVocloCg0cfsTu++La15u1 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)(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)(575784001)(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:7d9FJy3gBVcR6xlvulHNMvo5RQarYNrBL81rnf+hv?= =?us-ascii?Q?3ES0EXVN/z/OPhIN+AXPLzF5xXZFTB9H+fCzYadlZfb2K4jimjr+6glnm0UX?= =?us-ascii?Q?9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Jq9wX5i+gXYhTf?= =?us-ascii?Q?WRjT/CojEQebqvRu8dR0eXGS15HqXHoShXg/tOanoeUE7CwxMROHDMP1PNMq?= =?us-ascii?Q?bDVq8ni43jhCz+8khL537GNDxhaGYZ5wUbW1EfIxkL0gNOoog9jL2wyYw8mc?= =?us-ascii?Q?nE7de2GHSslYvmIf5IAm7NoSY7uzMT5NGB4DfpFJdI7oRL6bhe4UV0avpk8M?= =?us-ascii?Q?p5P4vCTeRkKm93id3VKlXe8uedCUaKSfuDlkRT+yS5PCumUY0M5vA5RCdmf7?= =?us-ascii?Q?eDOZ8JdYgWZhRqOMyClF1MfKq3Gz0aGt6D96s7S?= X-Microsoft-Antispam-Message-Info: n9zWit592wALcBF/w6w+OATAY9/9ao9xfWYd1omd5sBzrhk8QFSHtc4LusgBaIqAK9bRW+UptFGFUD1nna8AOAOB8OggB79r9deushFLpsXqJ96hgTIzoqVqLImbX25LRNSazYiSUvqaq/+WyzDJ6W3pALGZo3YvplGW5D+rtxD2PeNq0VxJIICBBri145G2yybUnlJeFAEmDdvyBnuJNh04XQsdQ8lkOy0dBwl8YmIswC7WydgOXulgR874m36IZS0VlIwdSlUWRzagJbijIAK5LJhUMLqZYeQtLnP/1+GK22GWugdlRmvpQ9cgVHgCwMt/yExme/qLAidboysjDU3H0YBBQa7s05Kdmvy8q80= X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4902; 6:xrA7yXNcBz2DlDvM6k1pW4Oz3WcfQZOBEn7ptG6uzvtFk7m9AFK5JwnHGifi77oPIDucAh4x1xuO2LHas6ZoUqUEgmjLWcOnmYIlluE9iIXfAGo5i76SNSPXjItwQ4l51qatshcqqIHK7xwySCCkV9Cwo3U4bfNEoAVB8q2Sjcc4kvV4dQLgKtzhdqfQ9NJC+yQ+BqMCAlb1yO5ARWbcp+VCDa8cg2Q3FiJbgEoP9ixGhTqsUtkNIHZQjIIYxRqsB83xEsooLft2prZgheoACnVqVstcJ2v7KAhOvltLO/Ac2BuIERd1sbOhyPEDYL8hAUXHW16sArQf7p8A8zPaMo85lOX3AH/UOKiwjJwnfhNPyDC6/22M4oSOrONWpNZmXDx4ROq6T/LTqqvZR/71kQ9+Hvr/hFExQWcQHRW0AYcxMLwHKU7euPX5UN3mXk656cm5g1uiTeWyNdxdG39LaQ==; 5:abvTTHeCNx8KOLJgZr/QHca1hzRlvgeMgCnz1tgc5ymco1H8abgLfniD0SGkorehUoykoqSkFrHSIqkK0Ly3N3oKFGVPE4HXOuAD0BapQNjR9pbacPU4my2Ql4RQs68yRm8l7+IcIwgEXpgxHSlB1E9vsRMbXw9gitdnYa2OZmU=; 7:YTTwq+xbyKerVz6lQ12TcfESj06DinpxiaxFKdsQp8PssExyMePidi/ke1xp2KzGUpdWRezJPwv/etx3HYBbpRpUVtsLio87oY61MKpvw+bGuTQqHZXtp7MnAhlxTGp2plgLCC8NQOIPkPo3+j7Imgp/3wHsefinP0K33jE/ApmvWgU6M5xHzcpllPQM4yyz+kVWcFP2+uaUoCy2QxTam1c0j+ripJfz/Y5b3sl5XiY2Glj/wmaBF6BdJc6YN9Vt SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2018 04:03:11.2567 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f5e4f4a-0962-488c-a938-08d6121b5739 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 20/33] 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, 04 Sep 2018 04:03:17 -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 | 121 +++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/drivers/common/cpt/cpt_mcode_defines.h b/drivers/common/cpt/cpt_mcode_defines.h index 0d2d0db..17b0de3 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 @@ -30,6 +36,10 @@ #define CPT_FROM_CTX 0 #define CPT_FROM_DPTR 1 +#define SE_CORE_REQ 1 + +#define CTRL_DMA_MODE_SGIO 2 /* DMA Mode but SGIO is already setup */ + #define FC_GEN 0x1 #define ZUC_SNOW3G 0x2 #define KASUMI 0x3 @@ -54,6 +64,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, @@ -104,6 +133,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 { @@ -220,6 +291,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 */ @@ -228,8 +342,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