From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01hn0211.outbound.protection.outlook.com [104.47.34.211]) by dpdk.org (Postfix) with ESMTP id 40F171B563 for ; Mon, 2 Jul 2018 18:57:56 +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=xmnaADEsWz7WeYZIVZJYQQptZxdZ7IytErZs8sq8MjA=; b=U6bfbnNyTwRZNsTgCXqt++B4QUdawQfBMs8pROweGt7Y75XSu7gd6zit8YXjVx/LoHsSHGkrHg8oolE0eGiQRVUf2AI79rhS1uKbaj86jrrHsJRi1og4rr9t2/X6xI/Kz53p0moE51nqd/78uDXv0r5UWjtycL+38WTirHpW+QY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; Received: from hyd1sverma-dt.caveonetworks.com (115.113.156.2) by CY4PR0701MB3635.namprd07.prod.outlook.com (2603:10b6:910:93::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.23; Mon, 2 Jul 2018 16:57:52 +0000 From: Shally Verma To: pablo.de.lara.guarch@intel.com Cc: dev@dpdk.org, pathreya@caviumnetworks.com, mchalla@caviumnetworks.com, Ashish Gupta , Sunila Sahu Date: Mon, 2 Jul 2018 22:27:07 +0530 Message-Id: <1530550631-22841-2-git-send-email-shally.verma@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1530550631-22841-1-git-send-email-shally.verma@caviumnetworks.com> References: <1530550631-22841-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: MA1PR01CA0081.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00::21) To CY4PR0701MB3635.namprd07.prod.outlook.com (2603:10b6:910:93::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5dd8dcca-7acd-44a7-9c1b-08d5e03cf4b3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:CY4PR0701MB3635; X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3635; 3:CuAdJIriVyDlf8rzMXItrQEmd31hQTbYEqSnaiV1k5pstUqQfrZWiv/kbJM2mcre8Ob4i1RJlOEmFvzZYF5pqg51AzIaGotcqySyVbbx667K9Pj9dPDjsmntiR3lXNjK9wVt5/jJZUBv6ASj6f94YoLLVNrozr5FKfLNKKfoY08pMVTBrjHBW/7IE8r07hRQQu87kFkMRPQumYXoIk+tHNSR1B6xre1mkhZgokz5hRXfNDUtYWlPpuQ8Vb9K7mVL; 25:1AeissqJnYoe738Y/+0GFeLAC/3cdMta/UC7W112f8S1Zho7eodwrI2U8oxEkT5rSYm5hQVIiZj3coLrsO0egXtU0ZPE77u23HaqsAmrCITJ3HsMIOZroN6ZFkTUtS9W42bWY/LiHZnq1GgmV3uK7Xolcg1RKQaDiKRKtmb6jykNlzOHU3dKpWusfvgnOIkgt5hqfSHRSsaa5njZcBxrbfC+AxfQM3jx1CQEW5wFNOgaVsiRRAPU+aki0k+pCRnA9f7p2WhZOKsW+a4dF555xynu2RAUGbyE5EwEC0mpE/0m3C8Zw5Srkg/3WZNysoqWRiQGX1ky48PEFFlj20qVyQ==; 31:m5fW8YxZ6+vvMVCJdYP8ecGC7lh/ykMLy1/eJ/tzjTqQrNedonjDi1/z+E/JKIq4hEygm9Y1dZA6rh8G7zCmSU6o0KDxr6hHxMsVohgqSO/IoMFaISVAz4YG3IRlG0kT5A4wPtKQIx+NAVNRpO6tZgZVtba120fXxjp11ca2ti7K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microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(66839620246622); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(3231254)(2232096)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:CY4PR0701MB3635; BCL:0; PCL:0; RULEID:; SRVR:CY4PR0701MB3635; X-Forefront-PRVS: 07215D0470 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(346002)(396003)(39860400002)(376002)(366004)(136003)(199004)(189003)(478600001)(72206003)(106356001)(6486002)(42882007)(4326008)(53936002)(107886003)(25786009)(476003)(26005)(8936002)(16526019)(6666003)(8676002)(55236004)(2616005)(11346002)(6512007)(51416003)(76176011)(186003)(6506007)(446003)(956004)(52116002)(6916009)(81166006)(7736002)(81156014)(44832011)(575784001)(486006)(305945005)(386003)(66066001)(16586007)(47776003)(316002)(50226002)(54906003)(5660300001)(3846002)(6116002)(14444005)(50466002)(48376002)(68736007)(2906002)(2351001)(2361001)(97736004)(105586002)(53416004)(36756003)(69596002)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:CY4PR0701MB3635; 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; CY4PR0701MB3635; 23:5Ffde9814JYn9Lv40Kp39S3e2MFXuyB1tlBte4P?= =?us-ascii?Q?Xnu6dx+8eFFtcYwTaOVcpmGl9WkGWQY3eBlGnLe/lDgVJdNwNypG79Dkly5s?= =?us-ascii?Q?MRTDaLAqP3o6wPUdpaqU25ll2UkBAJqhLA+QR8+XtUj5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ft-Exchange-Diagnostics: 1; CY4PR0701MB3635; 7:d6IOqj6drH4Ylls1PzVbIPFt8aMj7Vz15mqfM9Xlb/k/eeUfSLwgsPi3iSwFe3j1ZZMLUci/qvmyx9nfDwdla5lOrsS8FKNzooE/e66uOz+Mr17LAiWEsNgM+ug9fe8n4EVHqqo6xoG6vQUSVnNv6pKP/WQWIepIQwah6G+8zXSYMKUWwpAvhahz7dQT1itOdLD2O2NuG6qRWZtSt/kKDl1AQRGOo7WYt6KnVDhgBLCdvO3LyYBZyx2jRohkAnFK X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2018 16:57:52.6697 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5dd8dcca-7acd-44a7-9c1b-08d5e03cf4b3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR0701MB3635 Subject: [dpdk-dev] [PATCH v2 1/5] compress/zlib: add ZLIB PMD support 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: Mon, 02 Jul 2018 16:57:57 -0000 From: Ashish Gupta Add sw zlib pmd support in compressdev driver. Add device probe and remove support. Add ZLIB build file support. 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 | 81 ++++++++++++++++++++++++++ drivers/compress/zlib/zlib_pmd_private.h | 33 +++++++++++ mk/rte.app.mk | 2 + 10 files changed, 171 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index dabb12d..448bbe1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -851,6 +851,9 @@ F: drivers/compress/isal/ F: doc/guides/compressdevs/isal.rst F: doc/guides/compressdevs/features/isal.ini +ZLIB +M: Sunila Sahu +F: drivers/compress/zlib/ Eventdev Drivers ---------------- diff --git a/config/common_base b/config/common_base index 721e59b..dabc269 100644 --- a/config/common_base +++ b/config/common_base @@ -585,6 +585,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 fb136e1..e4d5e5c 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'] +drivers = ['isal','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..7748de2 --- /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', 'zlib_pmd_ops.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..1a99a33 --- /dev/null +++ b/drivers/compress/zlib/rte_pmd_zlib_version.map @@ -0,0 +1,3 @@ +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..f667ccc --- /dev/null +++ b/drivers/compress/zlib/zlib_pmd.c @@ -0,0 +1,81 @@ +/* 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; + } + + dev->feature_flags = RTE_COMP_FF_NONCOMPRESSED_BLOCKS; + + 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_PMD_REGISTER_ALIAS(COMPRESSDEV_NAME_ZLIB_PMD, compressdev_zlib_pmd); + +RTE_INIT(zlib_init_log); + +static void +zlib_init_log(void) +{ + zlib_logtype_driver = rte_log_register("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..d4c80b1 --- /dev/null +++ b/drivers/compress/zlib/zlib_pmd_private.h @@ -0,0 +1,33 @@ +/* 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 { + char mp_name[RTE_MEMPOOL_NAMESIZE]; +}; + +#endif /* _RTE_ZLIB_PMD_PRIVATE_H_ */ diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 87a0c80..f884b8a 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -213,6 +213,8 @@ endif # CONFIG_RTE_LIBRTE_CRYPTODEV ifeq ($(CONFIG_RTE_LIBRTE_COMPRESSDEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ISAL) += -lrte_pmd_isal_comp _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ISAL) += -lisal +_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