From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-dm3nam05hn0205.outbound.protection.outlook.com [104.47.49.205]) by dpdk.org (Postfix) with ESMTP id 5AD943195 for ; Mon, 23 Jul 2018 16:51:47 +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=If5ElUh0i4yvNa/OSfducXh5c02rcIcbmBRMasKFMF2y/PwelPB1v1bNhNFvN+G3cNCk8hCfXVlrA1g8r8VQZfxDeJiDqcRJA4uZI8e3e/DUn2C0gChHqfCDD0i+sUWHsDAhxhx4UQkhuwH1AzPBddrjyJcr/ttwyZj/j4fKCJs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; Received: from hyd1sverma-dt.caveonetworks.com (115.113.156.2) by MWHPR0701MB3641.namprd07.prod.outlook.com (2603:10b6:301:7d::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.16; Mon, 23 Jul 2018 14:51:44 +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, 23 Jul 2018 20:21:10 +0530 Message-Id: <1532357474-9544-2-git-send-email-shally.verma@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1532357474-9544-1-git-send-email-shally.verma@caviumnetworks.com> References: <1532357474-9544-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: PN1PR0101CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::27) To MWHPR0701MB3641.namprd07.prod.outlook.com (2603:10b6:301:7d::34) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 987cdfa2-0b0f-4554-5e74-08d5f0abcfe4 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:MWHPR0701MB3641; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3641; 3:OADOCDp2LkGJ7uF/K7ShWq9FajMs5I9JbnaseJrNu9S+4eRPQPo6R6N4OC+QbbNZ3vha9qJvG/+H+jwSidUFhYkQHu6eqpxvbHCkaWgYdXVd5wpDL+CP0OIB6vhdvAW2rYy8O3LY+s0GoBzIyYQRjdX5or1sSZJ6F6Iu3ylG0SSbYc6Yq2QVfIaFeZHCaT5r0k+YF1VqyEUin+FH/K5pXTCKbjB8Fr76yxaybjLrWRJCVGkJa9/mky9PELIiwioL; 25:JbxY5uRF1PXhLhC0VFRSoLlUugY8ffzOD8FYWATupCQbUgN0ZOcirCITvaIK82Xl5V5m/NrzPE+dNSLg3CkY+qJyfzEnlYYUzmrBc4+Jm/LLwgL6J4Sz/qWF1Q+gKxiqDwJ6BlS66QEGl4+3d8BugqjLYriJCH1Wa4p5lCGNL5IHYHA/AoePz+7d9W7BWEBziWJRF+MJPYQliKDOkZMkSUgU5fUJGJB1CRw6fm002kpZBDN5RXNnpNnxqy8BFcdHz3FDhbi+MzI1Hc5oCje3Tm1WRn7F5ExFZBSKWd9GzIByjsR4nDFHj+5EydTXm3o2wOAsnQt5b6zMZgvKDtZNCA==; 31:OU4kaowy/WqCzKFCXGLGcGvLPBgotKBSbAJBAZzDIVHnkhkZh/DsV2Iqw5YZTrZ6DTCCueHftqsEjS1N94niswDa4MKO9Bp/ed9sixHwJ4vxx82QScrvJCSPO3yNDVERTSTGFkIyXORTw4XIDMy/k91MLEmFaSOpyn/VKOzj2ekMGpbjG+FGr0r6151+uCM0AbU4j4HCIu79PXnoMmVB2JfIaEhHrSzUkz7XVM/cz34= X-MS-TrafficTypeDiagnostic: MWHPR0701MB3641: X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3641; 20:NzKjG+rj8eHc56YX1OSlTfzgk1yLZ+0T6OL/JM7k99C6sADO1tCgcUrCOYETlagfat8I6Vptwy03PbHZBSQkiSqDDy2oDhbfJAjm1r00HMWJiU0k3tyDkP6foIXLeeYmezeQGmmiwGE22OhgpjAMYQumgu0wOWaWZqo+r2+pquOPLozEMRSizCuK4RwQuKUCS4c16AMH+ql6taGPVqbVq8V8y51RpOVWBQ6jvcmOKb/NmMQOqK1tVEoxJxIzC3irjx1HrSBJRsPQgtNmSSA8egwd6mgFMtmKxr3waEeNyBdJ0+FpZ7uN/WUdI8CvPC9S1j+FBGPfZ1lhLqog8mueaiyv8gJ/YB9C4IuCLWQlJaPzb2RclT9gB4jv1B7zJZ6Yxmrjh/zdtmaqD7QZo6FwxthqbdqNnGIWsDMvgPfhvUIznlS5Haka+nIman0tn4P2DstrvIZ0lFChVLFlkL6sytI0wLVw/AyIW6msSo3XW6GgntvoTpiSjc7mV+ElrVsXvoDo40GUozwbLZvj+skaFe4/pVRsh8QyYlvSiqp4K0P5Low8MO+K5GLiFF0+HeZ1Fc5rA6ODSIrRwlvor22hGhNENAXo2NjtT8gUtLq+IvA= 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)(5005006)(8121501046)(3231311)(2232096)(944501410)(52105095)(3002001)(10201501046)(93006095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:MWHPR0701MB3641; BCL:0; PCL:0; RULEID:; SRVR:MWHPR0701MB3641; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3641; 4:1fPCvDUu2VYmGjPnMU1lM8HAvUT8MI52zbYPPHnEUIe0Ez0O34HiKn5OziwvRwEDc5tBwVkA0GlWTuQsUBQNru6EwFoiqIyvg5Ov/3DXCTJrQq03ag6Q7OP26R1NHJ1Lj4FhMc0UJJwld9LYh+MuZVKRVO5xOOgn4ZQEc4pX3EEUY3InR5AwEeY2v/MVcRP10CROgvaM1c1/6WpmBVtq1ADc8P/EhM85eAJqKNSik523zKWNB9J9rcRahYyS4+Ge/C3dL09YxvXlkOCMcKHIP7fHPs5D0X3iv9SQnYRd8q7BuWZw5QqqTJF+DuING3fd3GM6+P6M29e0rRX/ev7mjp5Wl02LwxH0eUBsi2D67Sc= X-Forefront-PRVS: 0742443479 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(396003)(366004)(39860400002)(136003)(346002)(376002)(199004)(189003)(6512007)(25786009)(53936002)(48376002)(107886003)(47776003)(66066001)(50466002)(14444005)(50226002)(2351001)(69596002)(55236004)(4326008)(36756003)(446003)(42882007)(7736002)(575784001)(305945005)(5660300001)(3846002)(478600001)(6116002)(72206003)(11346002)(316002)(8676002)(97736004)(44832011)(76176011)(16586007)(81156014)(68736007)(81166006)(52116002)(476003)(956004)(2616005)(486006)(51416003)(26005)(2906002)(386003)(6506007)(2361001)(6486002)(105586002)(6916009)(53416004)(186003)(6666003)(54906003)(16526019)(106356001)(8936002)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:MWHPR0701MB3641; 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; MWHPR0701MB3641; 23:mzhQDaTTdoptEkXBeOFBhb361MRw/TBb+UFYIND?= =?us-ascii?Q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c2xT6S/YEL+/6or45uoxqHYECVEs+p?= =?us-ascii?Q?1793ga9xql7AJR3RCTJ4MqLIzMLWTP+nn2RbdSPvJfCGUDaWnzawZ4sxkXEx?= =?us-ascii?Q?LWsbYpuMUPtAQq9Xa8o5nMnRNhUP/bMPPL8gFsVKm2NaII=3D;7:Kju48pRz?= =?us-ascii?Q?8sJ4CT6YNVN09cxInoVsiveni/hoo6z6xOkTSqhPiJTqex4vlicNXExUvf/7?= =?us-ascii?Q?TlDZp6SATosaXgcqIvvzw3mUA7TYScEK0F2D0NCNJnPtg35bQnxeD+yyQxRl?= =?us-ascii?Q?1pZ0kvvSZhZmVBGBBst61/TemL8roz+VB3cFflRZfW0IMfCNn6NyJEaRiVsT?= =?us-ascii?Q?dYrMiaHbevNbz8TcKsvfvxt+T6O+wKeQX6hct6QGECOjZ0bA9V9Y05rNf9Uk?= =?us-ascii?Q?pSY8FUk6?= SpamDiagnosticOutput: 1:22 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2018 14:51:44.0560 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 987cdfa2-0b0f-4554-5e74-08d5f0abcfe4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0701MB3641 Subject: [dpdk-dev] [PATCH v4 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: Mon, 23 Jul 2018 14:51:48 -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