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);
24 dev->dev_ops = rte_zlib_pmd_ops;
30 zlib_probe(struct rte_vdev_device *vdev)
32 struct rte_compressdev_pmd_init_params init_params = {
37 const char *input_args;
40 name = rte_vdev_device_name(vdev);
45 input_args = rte_vdev_device_args(vdev);
47 retval = rte_compressdev_pmd_parse_input_args(&init_params, input_args);
50 "Failed to parse initialisation arguments[%s]\n",
55 return zlib_create(name, vdev, &init_params);
59 zlib_remove(struct rte_vdev_device *vdev)
61 struct rte_compressdev *compressdev;
64 name = rte_vdev_device_name(vdev);
68 compressdev = rte_compressdev_pmd_get_named_dev(name);
69 if (compressdev == NULL)
72 return rte_compressdev_pmd_destroy(compressdev);
75 static struct rte_vdev_driver zlib_pmd_drv = {
80 RTE_PMD_REGISTER_VDEV(COMPRESSDEV_NAME_ZLIB_PMD, zlib_pmd_drv);
81 RTE_INIT(zlib_init_log);
86 zlib_logtype_driver = rte_log_register("pmd.compress.zlib");
87 if (zlib_logtype_driver >= 0)
88 rte_log_set_level(zlib_logtype_driver, RTE_LOG_INFO);