compressdev: add basic device management
[dpdk.git] / lib / librte_compressdev / rte_compressdev_internal.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017-2018 Intel Corporation
3  */
4
5 #ifndef _RTE_COMPRESSDEV_INTERNAL_H_
6 #define _RTE_COMPRESSDEV_INTERNAL_H_
7
8 /* rte_compressdev_internal.h
9  * This file holds Compressdev private data structures.
10  */
11 #include <rte_log.h>
12
13 #define RTE_COMPRESSDEV_NAME_MAX_LEN    (64)
14 /**< Max length of name of comp PMD */
15
16 /* Logging Macros */
17 extern int compressdev_logtype;
18 #define COMPRESSDEV_LOG(level, fmt, args...) \
19         rte_log(RTE_LOG_ ## level, compressdev_logtype, "%s(): "fmt "\n", \
20                         __func__, ##args)
21
22
23 /** The data structure associated with each comp device. */
24 struct rte_compressdev {
25         struct rte_compressdev_data *data;
26         /**< Pointer to device data */
27         struct rte_compressdev_ops *dev_ops;
28         /**< Functions exported by PMD */
29         uint64_t feature_flags;
30         /**< Supported features */
31         struct rte_device *device;
32         /**< Backing device */
33
34         uint8_t driver_id;
35         /**< comp driver identifier*/
36
37         __extension__
38         uint8_t attached : 1;
39         /**< Flag indicating the device is attached */
40 } __rte_cache_aligned;
41
42 /**
43  *
44  * The data part, with no function pointers, associated with each device.
45  *
46  * This structure is safe to place in shared memory to be common among
47  * different processes in a multi-process configuration.
48  */
49 struct rte_compressdev_data {
50         uint8_t dev_id;
51         /**< Compress device identifier */
52         uint8_t socket_id;
53         /**< Socket identifier where memory is allocated */
54         char name[RTE_COMPRESSDEV_NAME_MAX_LEN];
55         /**< Unique identifier name */
56
57         __extension__
58         uint8_t dev_started : 1;
59         /**< Device state: STARTED(1)/STOPPED(0) */
60
61         void *dev_private;
62         /**< PMD-specific private data */
63 } __rte_cache_aligned;
64 #endif