[v2,1/5] compress/zlib: add ZLIB PMD support

Message ID 1530550631-22841-2-git-send-email-shally.verma@caviumnetworks.com (mailing list archive)
State Changes Requested, archived
Delegated to: Pablo de Lara Guarch
Headers
Series compress: add ZLIB compression PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Shally Verma July 2, 2018, 4:57 p.m. UTC
  From: Ashish Gupta <ashish.gupta@caviumnetworks.com>

Add sw zlib pmd support in compressdev driver.
Add device probe and remove support.
Add ZLIB build file support.

Signed-off-by: Sunila Sahu <sunila.sahu@caviumnetworks.com>
Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>
---
 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(-)
  

Comments

De Lara Guarch, Pablo July 11, 2018, 10:29 a.m. UTC | #1
Hi Shally/Ashish,

> -----Original Message-----
> From: Shally Verma [mailto:shally.verma@caviumnetworks.com]
> Sent: Monday, July 2, 2018 5:57 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; pathreya@caviumnetworks.com;
> mchalla@caviumnetworks.com; Ashish Gupta
> <ashish.gupta@caviumnetworks.com>; Sunila Sahu
> <sunila.sahu@caviumnetworks.com>
> Subject: [PATCH v2 1/5] compress/zlib: add ZLIB PMD support
> 

Remove "support" from title.

Also, add the PMD in devtools/test-build.sh.
Since it depends on ZLIB, add a "sed" line below test "$DPDK_DEP_ZLIB" != y.

More comments inline below.

> From: Ashish Gupta <ashish.gupta@caviumnetworks.com>
> 
> Add sw zlib pmd support in compressdev driver.
> Add device probe and remove support.
> Add ZLIB build file support.
> 
> Signed-off-by: Sunila Sahu <sunila.sahu@caviumnetworks.com>
> Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
> Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>

...

> +++ 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

Zlib_pmd_ops.c is created in the next patch, so remove it from here.

> +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 {

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..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 <rte_bus_vdev.h>
> +#include <rte_common.h>

Leave space between rte_common and zlib_pmd_private.h

> +#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;

This is an algorithm feature flag, so it should go in capabilities.

> +
> +	return 0;
> +}
> +

...

> +RTE_PMD_REGISTER_VDEV(COMPRESSDEV_NAME_ZLIB_PMD, zlib_pmd_drv);
> +RTE_PMD_REGISTER_ALIAS(COMPRESSDEV_NAME_ZLIB_PMD,
> +compressdev_zlib_pmd);

No need to use an alias here. The convention now is driverType_driverName (e.g. compress_zlib).

> +
> +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); }
  
De Lara Guarch, Pablo July 11, 2018, 12:06 p.m. UTC | #2
Hi,

> -----Original Message-----
> From: Shally Verma [mailto:shally.verma@caviumnetworks.com]
> Sent: Monday, July 2, 2018 5:57 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; pathreya@caviumnetworks.com;
> mchalla@caviumnetworks.com; Ashish Gupta
> <ashish.gupta@caviumnetworks.com>; Sunila Sahu
> <sunila.sahu@caviumnetworks.com>
> Subject: [PATCH v2 1/5] compress/zlib: add ZLIB PMD support
> 
> From: Ashish Gupta <ashish.gupta@caviumnetworks.com>
> 
> Add sw zlib pmd support in compressdev driver.
> Add device probe and remove support.
> Add ZLIB build file support.
> 
> Signed-off-by: Sunila Sahu <sunila.sahu@caviumnetworks.com>
> Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
> Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>

...

> +++ b/drivers/compress/zlib/zlib_pmd_private.h

...

> +
> +struct zlib_private {
> +	char mp_name[RTE_MEMPOOL_NAMESIZE];

One extra comment. I think you can store the pointer to the mempool here,
instead of the name (it saves a lookup and space).

> +};
  
De Lara Guarch, Pablo July 11, 2018, 12:14 p.m. UTC | #3
And the last comments, sorry for the multiple replies.

> -----Original Message-----
> From: Shally Verma [mailto:shally.verma@caviumnetworks.com]
> Sent: Monday, July 2, 2018 5:57 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; pathreya@caviumnetworks.com;
> mchalla@caviumnetworks.com; Ashish Gupta
> <ashish.gupta@caviumnetworks.com>; Sunila Sahu
> <sunila.sahu@caviumnetworks.com>
> Subject: [PATCH v2 1/5] compress/zlib: add ZLIB PMD support
> 
> From: Ashish Gupta <ashish.gupta@caviumnetworks.com>
> 
> Add sw zlib pmd support in compressdev driver.
> Add device probe and remove support.
> Add ZLIB build file support.
> 
> Signed-off-by: Sunila Sahu <sunila.sahu@caviumnetworks.com>
> Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
> Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>

...

> +++ b/drivers/compress/zlib/zlib_pmd.c

...

> +static void
> +zlib_init_log(void)
> +{
> +	zlib_logtype_driver = rte_log_register("compress_zlib");

The standard for the name of the logtype for PMDs is "pmd.driverType.driverName",
so in this case it would be "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..d4c80b1
> --- /dev/null
> +++ b/drivers/compress/zlib/zlib_pmd_private.h

...

> +#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)

What do you think of having a single macro ZLIB_LOG(level, fmt, args...)?
  
Verma, Shally July 11, 2018, 12:40 p.m. UTC | #4
Hi Pablo

>-----Original Message-----
>From: De Lara Guarch, Pablo [mailto:pablo.de.lara.guarch@intel.com]
>Sent: 11 July 2018 17:44
>To: Verma, Shally <Shally.Verma@cavium.com>
>Cc: dev@dpdk.org; Athreya, Narayana Prasad <NarayanaPrasad.Athreya@cavium.com>; Challa, Mahipal
><Mahipal.Challa@cavium.com>; Gupta, Ashish <Ashish.Gupta@cavium.com>; Sahu, Sunila <Sunila.Sahu@cavium.com>
>Subject: RE: [PATCH v2 1/5] compress/zlib: add ZLIB PMD support
>
>External Email
>
>And the last comments, sorry for the multiple replies.

No issues.

>
>> -----Original Message-----
>> From: Shally Verma [mailto:shally.verma@caviumnetworks.com]
>> Sent: Monday, July 2, 2018 5:57 PM
>> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
>> Cc: dev@dpdk.org; pathreya@caviumnetworks.com;
>> mchalla@caviumnetworks.com; Ashish Gupta
>> <ashish.gupta@caviumnetworks.com>; Sunila Sahu
>> <sunila.sahu@caviumnetworks.com>
>> Subject: [PATCH v2 1/5] compress/zlib: add ZLIB PMD support
>>
>> From: Ashish Gupta <ashish.gupta@caviumnetworks.com>
>>
>> Add sw zlib pmd support in compressdev driver.
>> Add device probe and remove support.
>> Add ZLIB build file support.
>>
>> Signed-off-by: Sunila Sahu <sunila.sahu@caviumnetworks.com>
>> Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
>> Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>
>
>...
>
>> +++ b/drivers/compress/zlib/zlib_pmd.c
>
>...
>
>> +static void
>> +zlib_init_log(void)
>> +{
>> +     zlib_logtype_driver = rte_log_register("compress_zlib");
>
>The standard for the name of the logtype for PMDs is "pmd.driverType.driverName",
>so in this case it would be "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..d4c80b1
>> --- /dev/null
>> +++ b/drivers/compress/zlib/zlib_pmd_private.h
>
>...
>
>> +#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)
>
>What do you think of having a single macro ZLIB_LOG(level, fmt, args...)?
>
I find it simpler to use ZLIB_PMD_INFO/ERR?DEBUG version . So would prefer to stick to them.

Thanks for review.
Shally
  
De Lara Guarch, Pablo July 13, 2018, 3:57 p.m. UTC | #5
> -----Original Message-----
> From: Verma, Shally [mailto:Shally.Verma@cavium.com]
> Sent: Wednesday, July 11, 2018 1:41 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; Athreya, Narayana Prasad
> <NarayanaPrasad.Athreya@cavium.com>; Challa, Mahipal
> <Mahipal.Challa@cavium.com>; Gupta, Ashish <Ashish.Gupta@cavium.com>;
> Sahu, Sunila <Sunila.Sahu@cavium.com>
> Subject: RE: [PATCH v2 1/5] compress/zlib: add ZLIB PMD support
> 
> Hi Pablo
> 
> >-----Original Message-----
> >From: De Lara Guarch, Pablo [mailto:pablo.de.lara.guarch@intel.com]
> >Sent: 11 July 2018 17:44
> >To: Verma, Shally <Shally.Verma@cavium.com>
> >Cc: dev@dpdk.org; Athreya, Narayana Prasad
> ><NarayanaPrasad.Athreya@cavium.com>; Challa, Mahipal
> ><Mahipal.Challa@cavium.com>; Gupta, Ashish <Ashish.Gupta@cavium.com>;
> >Sahu, Sunila <Sunila.Sahu@cavium.com>
> >Subject: RE: [PATCH v2 1/5] compress/zlib: add ZLIB PMD support
> >
> >External Email
> >
> >And the last comments, sorry for the multiple replies.
> 
> No issues.
> 
> >
> >> -----Original Message-----
> >> From: Shally Verma [mailto:shally.verma@caviumnetworks.com]
> >> Sent: Monday, July 2, 2018 5:57 PM
> >> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> >> Cc: dev@dpdk.org; pathreya@caviumnetworks.com;
> >> mchalla@caviumnetworks.com; Ashish Gupta
> >> <ashish.gupta@caviumnetworks.com>; Sunila Sahu
> >> <sunila.sahu@caviumnetworks.com>
> >> Subject: [PATCH v2 1/5] compress/zlib: add ZLIB PMD support
> >>
> >> From: Ashish Gupta <ashish.gupta@caviumnetworks.com>
> >>
> >> Add sw zlib pmd support in compressdev driver.
> >> Add device probe and remove support.
> >> Add ZLIB build file support.
> >>
> >> Signed-off-by: Sunila Sahu <sunila.sahu@caviumnetworks.com>
> >> Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
> >> Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>
> >
> >...
> >
> >> +++ b/drivers/compress/zlib/zlib_pmd.c
> >
> >...
> >
> >> +static void
> >> +zlib_init_log(void)
> >> +{
> >> +     zlib_logtype_driver = rte_log_register("compress_zlib");
> >
> >The standard for the name of the logtype for PMDs is
> >"pmd.driverType.driverName", so in this case it would be "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..d4c80b1
> >> --- /dev/null
> >> +++ b/drivers/compress/zlib/zlib_pmd_private.h
> >
> >...
> >
> >> +#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)
> >
> >What do you think of having a single macro ZLIB_LOG(level, fmt, args...)?
> >
> I find it simpler to use ZLIB_PMD_INFO/ERR?DEBUG version . So would prefer to
> stick to them.

Ok for me then.

> 
> Thanks for review.
> Shally
>
  

Patch

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 <sunila.sahu@caviumnetworks.com>
+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 <rte_bus_vdev.h>
+#include <rte_common.h>
+#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 <zlib.h>
+#include <rte_compressdev.h>
+#include <rte_compressdev_pmd.h>
+
+#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)