From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0060.outbound.protection.outlook.com [104.47.37.60]) by dpdk.org (Postfix) with ESMTP id 0AB862C38 for ; Tue, 4 Sep 2018 06:03:08 +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=oBCme9E2QkYY2AxGWNfLfO+l62sP42U+orw8P7wsA2Q=; b=lWruA2uN7NE7k3SvC50ImP+XiDyP8zMP4oY/6lJX9a/eRrNtkDAHIQxMxJMsxc5iN146gNjkOvBKfH4V5LwKXK8oMwbf/q4wnQMTVKkh6LS5AEY4V5iVtWCUpGU652+j45PAYKvWrXzQcRzyLw0YjbxXPgr1UAxQwCtz8Iw46Kk= 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:02:26 +0000 From: Anoob Joseph To: Akhil Goyal , Pablo de Lara , Thomas Monjalon Cc: Murthy NSSR , Jerin Jacob , Narayana Prasad , dev@dpdk.org, Ankur Dwivedi , Anoob Joseph , Nithin Dabilpuram , Ragothaman Jayaraman , Srisivasubramanian S , Tejasree Kondoj Date: Tue, 4 Sep 2018 09:28:57 +0530 Message-Id: <1536033560-21541-11-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: ed736a39-347a-48e6-7177-08d6121b3c05 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:ytN8nWBqArBDOi8CYqlaADObkbCyjNjT6oLvsb+6k2yYKVVGPe8U5GTsB0IODHRH30QDRQIIXBEhZhEZ7Lmc3LGFqR1eM4C6D3noiyfXGkQ8+iTPRRbNiPG9708IP/+H5Yt0XBilQn3tqeJ6UC8ytnh5MhNzJn3Laj5Vy+sMPxxKfXjCn+mVDFgG22+s1NDgp+RNnuuRYKdCFuMsuF10xQrAmS9eWJS70mwUDCdcss07BI8VDmM9sY0e54NZ+3hn; 25:Xt2Y4Gmvn9TA975Wk9AKpA+Z9LSLEpqMaoD98ESWQQ2tGox/uOgm0t/geqLfxriqIPo2PHavNkcHrCPFaYZ+ROvD/ZZOERFHsRGENe5V2AXOmgtGX6x20drYiTbN9/XoIRtbHBvc2oxGaQSpP/tqiMvEsIEGIOFrlMufwYP10hE6zWs83/3rRh+zy8pgJiE63pCTKOxWMl/n5ETanWnXjRDMHY1KGbeA1ocGYTxzbZ3zYO25B+ShudTBP3yUfBgo4DCE7o01fOThgRSCvRgc/xS0WhVgDTB+B/UPbIswtenh3FyJZo7UKqEJMu77IEHXdlYUGceOnGd8EbMXKv2eQA==; 31:o2fwUT2St52csHa3xLCW9f/3TeUVzCIeorp2TjwAaCjG/hA1ndGSIJaX2EfDb+TP8pWdCWPH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CyG9giW6qVEk9F+fBT55l0WFoiw7nSQwEmE7E4Xfw34CeXUeFIUg== 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:q5gpJWrxQOVL09fkvxJMBY/lH2FOXuqCN1ENRXKhK?= =?us-ascii?Q?MZ5YyPy15QlQmwhxeHp4rzBX4fe8UZg4HzQQvwRsZbn6M86qzjD8zaltBMyR?= =?us-ascii?Q?gRHaR4RZHWPJCY/rqQtUJPNgDdRJQVNQc0I5Gq3UEeL0APaJ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3Me0BOyc/bH2CloDhsHUiKCh1jKsod5kqnktLvmG89fXpIJscjWP8I5AVqz8DmPlCGpfeTZGJNpoM0RmDQ+P4huDdcUWhGzTXTBHOAXXzTsaJYaoVA==; 5:DdBIoA9xyDcpG0OsNJUqkBmaAnGAIkIzxDQnbzR2xQjAI05wft8TI8girQIAVAAOmv1e6QW2iQSWipg8Rbd8Xg7421ZvnyB5UH2qegCjNnkRgM3yLgw4TPfg0K6uzI0Ppi53zUJ7tA/vmEb/SfYtFB1VQE4jkhWh/FEdWlFQAYI=; 7:vfuQ/puKHPwRtav9+rXm+Kj/LgSXLFuhU7mKJfwwa+6IJKRTbqKXFN0NsH6Rh15yxLUJxFu+2jVIaTqiKbWxZQDdswnQAGtEU5CjnyIj6MYMfIK8f7rVdkFd7PObiqeTv1yJpAM/32kj2tlTPmA2Vk+BVV6hKBPtpCA1G298JTp1WIl6LIRtjUBSWwFX31OeGOCTLc4oHpgcMb8fmB/rd7Hoa+58QWTfsLtKNXCp5J3bcP2311pjFYyxeWHYqJ86 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2018 04:02:26.1629 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed736a39-347a-48e6-7177-08d6121b3c05 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 10/33] common/cpt: add PMD ops helper functions 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:08 -0000 From: Murthy NSSR Adding pmd ops helper functions. Control path accessed APIs would be added as helper functions. Adding microcode defined macros etc as dependencies to the helper functions. 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/Makefile | 4 +++ drivers/common/cpt/Makefile | 25 ++++++++++++++++ drivers/common/cpt/cpt_common.h | 41 +++++++++++++++++++++++++++ drivers/common/cpt/cpt_mcode_defines.h | 38 +++++++++++++++++++++++++ drivers/common/cpt/cpt_pmd_ops_helper.c | 41 +++++++++++++++++++++++++++ drivers/common/cpt/cpt_pmd_ops_helper.h | 34 ++++++++++++++++++++++ drivers/common/cpt/meson.build | 8 ++++++ drivers/common/cpt/rte_common_cpt_version.map | 6 ++++ drivers/common/meson.build | 2 +- mk/rte.app.mk | 4 +++ 10 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 drivers/common/cpt/Makefile create mode 100644 drivers/common/cpt/cpt_mcode_defines.h create mode 100644 drivers/common/cpt/cpt_pmd_ops_helper.c create mode 100644 drivers/common/cpt/cpt_pmd_ops_helper.h create mode 100644 drivers/common/cpt/meson.build create mode 100644 drivers/common/cpt/rte_common_cpt_version.map diff --git a/drivers/common/Makefile b/drivers/common/Makefile index 0fd2237..ca4e854 100644 --- a/drivers/common/Makefile +++ b/drivers/common/Makefile @@ -8,4 +8,8 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO DIRS-y += octeontx endif +ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO),y) +DIRS-y += cpt +endif + include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/cpt/Makefile b/drivers/common/cpt/Makefile new file mode 100644 index 0000000..2340aa9 --- /dev/null +++ b/drivers/common/cpt/Makefile @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_common_cpt.a + +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/bus/pci +EXPORT_MAP := rte_common_cpt_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-y += cpt_pmd_ops_helper.c + +LDLIBS += -lrte_eal + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/common/cpt/cpt_common.h b/drivers/common/cpt/cpt_common.h index feca5fe..1f78d42 100644 --- a/drivers/common/cpt/cpt_common.h +++ b/drivers/common/cpt/cpt_common.h @@ -18,6 +18,24 @@ #define AE_TYPE 1 #define SE_TYPE 2 +#ifndef ROUNDUP4 +#define ROUNDUP4(val) (((val) + 3) & 0xfffffffc) +#endif + +#ifndef ROUNDUP8 +#define ROUNDUP8(val) (((val) + 7) & 0xfffffff8) +#endif + +#ifndef ROUNDUP16 +#define ROUNDUP16(val) (((val) + 15) & 0xfffffff0) +#endif + +#ifndef __hot +#define __hot __attribute__((hot)) +#endif + +#define MOD_INC(i, l) ((i) == (l - 1) ? (i) = 0 : (i)++) + /* cpt instance */ struct cpt_instance { uint32_t queue_id; @@ -51,4 +69,27 @@ struct pending_queue { /**< Pending requests count */ }; +struct cpt_request_info { + /* fast path fields */ + uint64_t dma_mode : 2; + /**< DMA mode */ + uint64_t se_req : 1; + /**< To SE core */ + uint64_t comp_baddr : 61; + volatile uint64_t *completion_addr; + volatile uint64_t *alternate_caddr; + void *op; + /**< Reference to operation */ + struct { + uint64_t ei0; + uint64_t ei1; + uint64_t ei2; + uint64_t ei3; + } ist; + + /* slow path fields */ + uint64_t time_out; + uint8_t extra_time; +}; + #endif /* _CPT_COMMON_H_ */ diff --git a/drivers/common/cpt/cpt_mcode_defines.h b/drivers/common/cpt/cpt_mcode_defines.h new file mode 100644 index 0000000..1bbe8c4 --- /dev/null +++ b/drivers/common/cpt/cpt_mcode_defines.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Cavium, Inc + */ + +#ifndef _CPT_MCODE_DEFINES_H_ +#define _CPT_MCODE_DEFINES_H_ + +/* + * This file defines macros and structures according to microcode spec + * + */ + +#define CPT_BYTE_16 16 +#define CPT_BYTE_24 24 +#define CPT_BYTE_32 32 +#define CPT_MAX_SG_IN_OUT_CNT 16 +#define CPT_MAX_SG_CNT (CPT_MAX_SG_IN_OUT_CNT/2) + +#define COMPLETION_CODE_SIZE 8 +#define COMPLETION_CODE_INIT 0 + +#define SG_LIST_HDR_SIZE (8u) +#define SG_ENTRY_SIZE sizeof(sg_comp_t) + +/* #define CPT_ALWAYS_USE_SG_MODE */ +#define CPT_ALWAYS_USE_SEPARATE_BUF + +typedef struct sglist_comp { + union { + uint64_t len; + struct { + uint16_t len[4]; + } s; + } u; + uint64_t ptr[4]; +} sg_comp_t; + +#endif /* _CPT_MCODE_DEFINES_H_ */ diff --git a/drivers/common/cpt/cpt_pmd_ops_helper.c b/drivers/common/cpt/cpt_pmd_ops_helper.c new file mode 100644 index 0000000..1c18180 --- /dev/null +++ b/drivers/common/cpt/cpt_pmd_ops_helper.c @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Cavium, Inc + */ + +#include + +#include "cpt_common.h" +#include "cpt_hw_types.h" +#include "cpt_mcode_defines.h" +#include "cpt_pmd_ops_helper.h" + +#define CPT_MAX_IV_LEN 16 +#define CPT_OFFSET_CONTROL_BYTES 8 + +int32_t +cpt_pmd_ops_helper_get_mlen_direct_mode(void) +{ + uint32_t len = 0; + + /* Request structure */ + len = sizeof(struct cpt_request_info); + + /* CPT HW result structure plus extra as it is aligned */ + len += 2*sizeof(cpt_res_s_t); + + return len; +} + +int +cpt_pmd_ops_helper_get_mlen_sg_mode(void) +{ + uint32_t len = 0; + + len += sizeof(struct cpt_request_info); + len += CPT_OFFSET_CONTROL_BYTES + CPT_MAX_IV_LEN; + len += ROUNDUP8(SG_LIST_HDR_SIZE + + (ROUNDUP4(CPT_MAX_SG_IN_OUT_CNT) >> 2) * SG_ENTRY_SIZE); + len += 2 * COMPLETION_CODE_SIZE; + len += 2 * sizeof(cpt_res_s_t); + return len; +} diff --git a/drivers/common/cpt/cpt_pmd_ops_helper.h b/drivers/common/cpt/cpt_pmd_ops_helper.h new file mode 100644 index 0000000..a9358ae --- /dev/null +++ b/drivers/common/cpt/cpt_pmd_ops_helper.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Cavium, Inc + */ + +#ifndef _CPT_PMD_OPS_HELPER_H_ +#define _CPT_PMD_OPS_HELPER_H_ + +/* + * This file defines the agreement between the common layer and the individual + * crypto drivers for OcteonTX series. Control path in otx* directory can + * directly call functions declared here. + */ + +/* + * Get meta length required when operating in direct mode (single buffer + * in-place) + * + * @return + * - length + */ + +int32_t +cpt_pmd_ops_helper_get_mlen_direct_mode(void); + +/* + * Get size of contiguous meta buffer to be allocated when working in scatter + * gather mode. + * + * @return + * - length + */ +int +cpt_pmd_ops_helper_get_mlen_sg_mode(void); +#endif /* _CPT_PMD_OPS_HELPER_H_ */ diff --git a/drivers/common/cpt/meson.build b/drivers/common/cpt/meson.build new file mode 100644 index 0000000..0a905aa --- /dev/null +++ b/drivers/common/cpt/meson.build @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc + +sources = files('cpt_pmd_ops_helper.c') + +deps = ['kvargs', 'pci', 'cryptodev'] +includes += include_directories('../../crypto/octeontx') +allow_experimental_apis = true diff --git a/drivers/common/cpt/rte_common_cpt_version.map b/drivers/common/cpt/rte_common_cpt_version.map new file mode 100644 index 0000000..dec614f --- /dev/null +++ b/drivers/common/cpt/rte_common_cpt_version.map @@ -0,0 +1,6 @@ +DPDK_18.11 { + global: + + cpt_pmd_ops_helper_get_mlen_direct_mode; + cpt_pmd_ops_helper_get_mlen_sg_mode; +}; diff --git a/drivers/common/meson.build b/drivers/common/meson.build index d7b7d8c..aa88934 100644 --- a/drivers/common/meson.build +++ b/drivers/common/meson.build @@ -2,6 +2,6 @@ # Copyright(c) 2018 Cavium, Inc std_deps = ['eal'] -drivers = ['octeontx', 'qat'] +drivers = ['cpt', 'octeontx', 'qat'] config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' driver_name_fmt = 'rte_common_@0@' diff --git a/mk/rte.app.mk b/mk/rte.app.mk index b530337..08f76c7 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -98,6 +98,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO _LDLIBS-y += -lrte_common_octeontx endif +ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO),y) +_LDLIBS-y += -lrte_common_cpt +endif + _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += -lrte_bus_pci _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += -lrte_bus_dpaa -- 2.7.4