From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM05-BY2-obe.outbound.protection.outlook.com (mail-by2nam05hn0226.outbound.protection.outlook.com [104.47.50.226]) by dpdk.org (Postfix) with ESMTP id 0035F235 for ; Sat, 21 Jul 2018 20:18:24 +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=lptheu4xQsj+zjJRKDw/HqbzEw7JrJWMkCo5E0xBlNA=; b=oGi4KLCbOhrWg6MNgNV7G8UBUkYYN5eK+QxXr+kid7ABMH1I7nVhuysMTv7jRR7gnNnCi9BkeYk97injCYDgf5TyhkmuDwFgx3V49LXBxDKkIGgapYpY0uKKvcKcLdDjgBWnyV697m2PCEwsMYZFXCe7w5xbSAaeleE3prCPogo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; Received: from hyd1sverma-dt.caveonetworks.com (115.113.156.2) by CY4PR0701MB3634.namprd07.prod.outlook.com (2603:10b6:910:92::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Sat, 21 Jul 2018 18:18:21 +0000 From: Shally Verma To: pablo.de.lara.guarch@intel.com Cc: dev@dpdk.org, pathreya@caviumnetworks.com, mchalla@caviumnetworks.com, ashish.gupta@caviumnetworks.com, sunila.sahu@caviumnetworks.com Date: Sat, 21 Jul 2018 23:47:45 +0530 Message-Id: <1532197069-24224-2-git-send-email-shally.verma@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1532197069-24224-1-git-send-email-shally.verma@caviumnetworks.com> References: <1532197069-24224-1-git-send-email-shally.verma@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: MA1PR01CA0103.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::19) To CY4PR0701MB3634.namprd07.prod.outlook.com (2603:10b6:910:92::36) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6e793fc9-4bb5-4bd2-da36-08d5ef3658a3 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:CY4PR0701MB3634; X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3634; 3:cYmjjaTOXUs5Sh7XDt/3OXaoIEfYUFt8YhHtg9xmyiN6T8eZB2BilFEu2FwzNOIuSZuO1CwMhqZvemDz8byWSEfb8akPD1VPu+krMk6B/OGNz8z/QLmRVsc/unLRAGHkxnJXqaJub4O8xrFOYLaJJUWT4ZglGXOnBR29jOofsFgjvjXbe/C8l/993azvI57uLe4fELjd+eMoqaozjaFuuYvn0eDkWSCJ6BjTrJ8uHT63nTp9etv3az0+tz6l6LDu; 25:vDiMLelNmnYGfDwhBIHQBJaqAzDGKiJ/ok9rNsfem7BXR+03amqWsPoW1IznZcIKSohkCMSFRgGc3ysa7UyeeRjia6+atI0KDWBgVhdFcAM8kvyW4EN/znXmiyBFmbXFsBOeipWc4+Vnjy+QSJohq20ZjQfKebfRYrkAkwaRPCxIs+iGCqZHiz4PWY+1tLa1JrIMqZ7zxSqbptnYmnenELzsF6rv7juhBKzm0jlIeGnz8g5V1HTKe5Py5iWnaFRhOMf5IGOexUFBalYvW9kIu/oyWKopqgv/ewNXbWuc9EoHUstrIpzPjU1pxYClzta6wAZw3nQZ/lMhrmcO7YswNw==; 31:JGoIXgZXSjm+dTJANqpBdV/9T+/EFY4pgtYxW/4M1jRxK/K7XQssTorcmrhSSrWBXLdwl2E4uTi+dO9qtewMy6hL8pg/9R3fIHFo+LIgjrJkS6J7k569Opsgcoa835/BVa01eyQpOQWTvAv0AU/WYvOGDqE8FEzntHm7I1yEL9hPhDLbeAogkYJspR+Vg0DhJoteWMnup2bWLmY6VPRp1TFX2H3hG+HT5wEvWWBwLYo= X-MS-TrafficTypeDiagnostic: CY4PR0701MB3634: X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3634; 20:N8ihCUxvDNHbDr5iv7gAHI7eEkx3Mo0Nu6ifwi7sFiAVUr/36wtFX1cBrxKapdkIv0ZI0fAFNILZD85LkcKpEXkbn+zPAqr1mSkDELXvtv8mooVk/PMiua6xs+ISv6oWJyMimTe9DkEjmaFF23O+FG6t+CPefefG8YuzewxrsTEcHSzL6tHQjFwDiT3BgDzCqJc8cebmIxY+3DuWAgRUipCuOizfqKqFyWv57DG8cxI1YrdPBjVEM9snkX1DpeIk2e3IsWJeUATkv3pdj7r5TEbzKctcPFx+VC+107BMk3C4M1MaVGZLTtgaP2COXAHIKy8wG7lgT2ysnGrUYhu63tVGtNHjHNyjvLrLOaNLQn1bgFPVrHPTZ0sZ/YzggQrMje7aIo+TGAS8iD4/8j67iWiaSKfNvDmrlcvOOMImnUDC3sIcCNtxAKxRCrWaI+yJStvKkvkhxnVttLW4xvFtzL+0/3+MB8a8sZggUs58PWXWz6x2Hv7HUrpPS13LRem2RaSPpDmgosmVP/SRWIDF9RHGyNuWVSBdKnbF7uNctEHRrzPmSAajanM1168TpvmOnG2ALqaJEv+CcYCj4PnMAvAopGB+lJEmWd4bs3pLgcc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(66839620246622)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(3231311)(2232096)(944501410)(52105095)(149027)(150027)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:CY4PR0701MB3634; BCL:0; PCL:0; RULEID:; SRVR:CY4PR0701MB3634; X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3634; 4:GwsvG9lWsTDXIDbH1GowOpRwd6iSGanP+bKT7LKmfdreQl8oAG/rOWtVcbVLYuuXHCyoHdfIJnXSiziLms6CfC9f1UAYvaYVpWPyNt3CGy1PWo9eD2Ydw8WvdD0VeJKc5/7cJRnKTDyuSiqyFKpTgEXABydTaPk8bPQB5EpNhyePfdiUPY9GMoSNq0w5/3oZ4UqcTn9Ael6MCP6LLLU4OoCKKsH7gObdtVrLPUiXO1pygsbQUuNKi3Y2LmSyJQuDYWMBEyP+iBLGReLgnlCjXC21VkMxCsW6Dpa4j4zeEzlnaQgplTii4UP5yoNv7MlblifVHnMGWPUsOxobKpQpO8pNIGjgUQcbnIHKUmxGglM= X-Forefront-PRVS: 074040B844 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(366004)(136003)(346002)(396003)(39850400004)(376002)(199004)(189003)(69596002)(25786009)(6512007)(316002)(6116002)(3846002)(55236004)(7736002)(305945005)(26005)(4326008)(107886003)(53936002)(16526019)(186003)(16586007)(97736004)(575784001)(478600001)(6486002)(72206003)(2351001)(48376002)(8676002)(47776003)(2361001)(66066001)(50466002)(36756003)(106356001)(81156014)(81166006)(53416004)(105586002)(11346002)(486006)(68736007)(5660300001)(446003)(476003)(2616005)(956004)(14444005)(44832011)(42882007)(76176011)(6506007)(6666003)(6916009)(8936002)(386003)(51416003)(50226002)(2906002)(52116002)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:CY4PR0701MB3634; H:hyd1sverma-dt.caveonetworks.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; CY4PR0701MB3634; 23:zsxwWBgBAVzF2uZs4D6zyG1wCogFS49GxQSKDkh?= =?us-ascii?Q?iaIjWBTFBNiEu0iG/Aa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8DNVJpmPfJRzfRP48oyKQ9IIEBnhdopSUSVWTSBz3Xz42TgXv5IgzgFew4Y+U0RBK1lsiG4cs0Jn333S5S5yY8FBkQm+w9cZTMawflNt8jpv8eVknjx+fn2OFj7fZpN3ZzCoKfW9hc/51Na5ND2JQufP2dlF87KiVzjMgE/fUYiyuD4kX SpamDiagnosticOutput: 1:22 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2018 18:18:21.7274 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e793fc9-4bb5-4bd2-da36-08d5ef3658a3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR0701MB3634 Subject: [dpdk-dev] [PATCH v3 1/5] compress/zlib: add ZLIB PMD 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: Sat, 21 Jul 2018 18:18:25 -0000 From: Ashish Gupta Add initial PMD setup routines in compressdev framework. ZLIB PMD appears as virtual compression device. User would need to install zlib prior to enabling this PMD. Signed-off-by: Sunila Sahu Signed-off-by: Shally Verma Signed-off-by: Ashish Gupta --- MAINTAINERS | 3 + config/common_base | 5 ++ drivers/compress/Makefile | 1 + drivers/compress/meson.build | 2 +- drivers/compress/zlib/Makefile | 28 +++++++++ drivers/compress/zlib/meson.build | 14 +++++ drivers/compress/zlib/rte_pmd_zlib_version.map | 3 + drivers/compress/zlib/zlib_pmd.c | 78 ++++++++++++++++++++++++++ drivers/compress/zlib/zlib_pmd_private.h | 32 +++++++++++ mk/rte.app.mk | 2 + 10 files changed, 167 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 7b2414d..ca27c6f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -872,6 +872,9 @@ M: Fiona Trahe F: drivers/compress/qat/ F: drivers/common/qat/ +ZLIB +M: Sunila Sahu +F: drivers/compress/zlib/ Eventdev Drivers ---------------- diff --git a/config/common_base b/config/common_base index a061c21..d9b238c 100644 --- a/config/common_base +++ b/config/common_base @@ -582,6 +582,11 @@ CONFIG_RTE_COMPRESSDEV_TEST=n CONFIG_RTE_LIBRTE_PMD_ISAL=n # +# Compile PMD for ZLIB compression device +# +CONFIG_RTE_LIBRTE_PMD_ZLIB=n + +# # Compile generic event device library # CONFIG_RTE_LIBRTE_EVENTDEV=y diff --git a/drivers/compress/Makefile b/drivers/compress/Makefile index 592497f..1f159a5 100644 --- a/drivers/compress/Makefile +++ b/drivers/compress/Makefile @@ -4,5 +4,6 @@ include $(RTE_SDK)/mk/rte.vars.mk DIRS-$(CONFIG_RTE_LIBRTE_PMD_ISAL) += isal +DIRS-$(CONFIG_RTE_LIBRTE_PMD_ZLIB) += zlib include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/compress/meson.build b/drivers/compress/meson.build index 2352ad5..d2ca8fc 100644 --- a/drivers/compress/meson.build +++ b/drivers/compress/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Intel Corporation -drivers = ['isal', 'qat'] +drivers = ['isal', 'qat', 'zlib'] std_deps = ['compressdev'] # compressdev pulls in all other needed deps config_flag_fmt = 'RTE_LIBRTE_@0@_PMD' diff --git a/drivers/compress/zlib/Makefile b/drivers/compress/zlib/Makefile new file mode 100644 index 0000000..bd322c9 --- /dev/null +++ b/drivers/compress/zlib/Makefile @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium Networks + +include $(RTE_SDK)/mk/rte.vars.mk + +# library name +LIB = librte_pmd_zlib.a + +# build flags +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DALLOW_EXPERIMENTAL_API + +# library version +LIBABIVER := 1 + +# versioning export map +EXPORT_MAP := rte_pmd_zlib_version.map + +# external library dependencies +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring -lz +LDLIBS += -lrte_compressdev +LDLIBS += -lrte_bus_vdev + +# library source files +SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZLIB) += zlib_pmd.c + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/compress/zlib/meson.build b/drivers/compress/zlib/meson.build new file mode 100644 index 0000000..3f0a77b --- /dev/null +++ b/drivers/compress/zlib/meson.build @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium Networks + +dep = dependency('zlib', required: false) +if not dep.found() + build = false +endif + +deps += 'bus_vdev' +sources = files('zlib_pmd.c') +ext_deps += dep +pkgconfig_extra_libs += '-lz' + +allow_experimental_apis = true diff --git a/drivers/compress/zlib/rte_pmd_zlib_version.map b/drivers/compress/zlib/rte_pmd_zlib_version.map new file mode 100644 index 0000000..ad6e191 --- /dev/null +++ b/drivers/compress/zlib/rte_pmd_zlib_version.map @@ -0,0 +1,3 @@ +DPDK_18.08 { + local: *; +}; diff --git a/drivers/compress/zlib/zlib_pmd.c b/drivers/compress/zlib/zlib_pmd.c new file mode 100644 index 0000000..39d3628 --- /dev/null +++ b/drivers/compress/zlib/zlib_pmd.c @@ -0,0 +1,78 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Cavium Networks + */ + +#include +#include + +#include "zlib_pmd_private.h" + +static int +zlib_create(const char *name, + struct rte_vdev_device *vdev, + struct rte_compressdev_pmd_init_params *init_params) +{ + struct rte_compressdev *dev; + + dev = rte_compressdev_pmd_create(name, &vdev->device, + sizeof(struct zlib_private), init_params); + if (dev == NULL) { + ZLIB_PMD_ERR("driver %s: create failed", init_params->name); + return -ENODEV; + } + + return 0; +} + +static int +zlib_probe(struct rte_vdev_device *vdev) +{ + struct rte_compressdev_pmd_init_params init_params = { + "", + rte_socket_id() + }; + const char *name; + const char *input_args; + + name = rte_vdev_device_name(vdev); + + if (name == NULL) + return -EINVAL; + input_args = rte_vdev_device_args(vdev); + rte_compressdev_pmd_parse_input_args(&init_params, input_args); + + return zlib_create(name, vdev, &init_params); +} + +static int +zlib_remove(struct rte_vdev_device *vdev) +{ + struct rte_compressdev *compressdev; + const char *name; + + name = rte_vdev_device_name(vdev); + if (name == NULL) + return -EINVAL; + + compressdev = rte_compressdev_pmd_get_named_dev(name); + if (compressdev == NULL) + return -ENODEV; + + return rte_compressdev_pmd_destroy(compressdev); +} + +static struct rte_vdev_driver zlib_pmd_drv = { + .probe = zlib_probe, + .remove = zlib_remove +}; + +RTE_PMD_REGISTER_VDEV(COMPRESSDEV_NAME_ZLIB_PMD, zlib_pmd_drv); +RTE_INIT(zlib_init_log); + +static void +zlib_init_log(void) +{ + zlib_logtype_driver = rte_log_register("pmd.compress.zlib"); + if (zlib_logtype_driver >= 0) + rte_log_set_level(zlib_logtype_driver, RTE_LOG_INFO); +} diff --git a/drivers/compress/zlib/zlib_pmd_private.h b/drivers/compress/zlib/zlib_pmd_private.h new file mode 100644 index 0000000..d26a740 --- /dev/null +++ b/drivers/compress/zlib/zlib_pmd_private.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Cavium Networks + */ + +#ifndef _RTE_ZLIB_PMD_PRIVATE_H_ +#define _RTE_ZLIB_PMD_PRIVATE_H_ + +#include +#include +#include + +#define COMPRESSDEV_NAME_ZLIB_PMD compress_zlib +/**< ZLIB PMD device name */ + +#define DEF_MEM_LEVEL 8 + +int zlib_logtype_driver; +#define ZLIB_PMD_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, zlib_logtype_driver, "%s(): "fmt "\n", \ + __func__, ##args) + +#define ZLIB_PMD_INFO(fmt, args...) \ + ZLIB_PMD_LOG(INFO, fmt, ## args) +#define ZLIB_PMD_ERR(fmt, args...) \ + ZLIB_PMD_LOG(ERR, fmt, ## args) +#define ZLIB_PMD_WARN(fmt, args...) \ + ZLIB_PMD_LOG(WARNING, fmt, ## args) + +struct zlib_private { +}; + +#endif /* _RTE_ZLIB_PMD_PRIVATE_H_ */ diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 1590838..5b7c684 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -228,6 +228,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ISAL) += -lisal ifeq ($(CONFIG_RTE_LIBRTE_PMD_QAT_SYM),n) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat endif # CONFIG_RTE_LIBRTE_PMD_QAT_SYM +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZLIB) += -lrte_pmd_zlib +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZLIB) += -lz endif # CONFIG_RTE_LIBRTE_COMPRESSDEV ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y) -- 2.9.5