1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Cavium Networks
5 #include <rte_bus_vdev.h>
6 #include <rte_common.h>
8 #include "zlib_pmd_private.h"
11 zlib_create(const char *name,
12 struct rte_vdev_device *vdev,
13 struct rte_compressdev_pmd_init_params *init_params)
15 struct rte_compressdev *dev;
17 dev = rte_compressdev_pmd_create(name, &vdev->device,
18 sizeof(struct zlib_private), init_params);
20 ZLIB_PMD_ERR("driver %s: create failed", init_params->name);
28 zlib_probe(struct rte_vdev_device *vdev)
30 struct rte_compressdev_pmd_init_params init_params = {
35 const char *input_args;
38 name = rte_vdev_device_name(vdev);
43 input_args = rte_vdev_device_args(vdev);
45 retval = rte_compressdev_pmd_parse_input_args(&init_params, input_args);
48 "Failed to parse initialisation arguments[%s]\n",
53 return zlib_create(name, vdev, &init_params);
57 zlib_remove(struct rte_vdev_device *vdev)
59 struct rte_compressdev *compressdev;
62 name = rte_vdev_device_name(vdev);
66 compressdev = rte_compressdev_pmd_get_named_dev(name);
67 if (compressdev == NULL)
70 return rte_compressdev_pmd_destroy(compressdev);
73 static struct rte_vdev_driver zlib_pmd_drv = {
78 RTE_PMD_REGISTER_VDEV(COMPRESSDEV_NAME_ZLIB_PMD, zlib_pmd_drv);
79 RTE_INIT(zlib_init_log);
84 zlib_logtype_driver = rte_log_register("pmd.compress.zlib");
85 if (zlib_logtype_driver >= 0)
86 rte_log_set_level(zlib_logtype_driver, RTE_LOG_INFO);