aboutsummaryrefslogtreecommitdiffstats
path: root/lib/librte_compressdev/rte_compressdev_internal.h
blob: 22ceac66e2c9e33a3a549a6c69567de30207b1be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2017-2018 Intel Corporation
 */

#ifndef _RTE_COMPRESSDEV_INTERNAL_H_
#define _RTE_COMPRESSDEV_INTERNAL_H_

/* rte_compressdev_internal.h
 * This file holds Compressdev private data structures.
 */
#include <rte_log.h>

#include "rte_comp.h"

#define RTE_COMPRESSDEV_NAME_MAX_LEN	(64)
/**< Max length of name of comp PMD */

/* Logging Macros */
extern int compressdev_logtype;
#define COMPRESSDEV_LOG(level, fmt, args...) \
	rte_log(RTE_LOG_ ## level, compressdev_logtype, "%s(): "fmt "\n", \
			__func__, ##args)

/**
 * Dequeue processed packets from queue pair of a device.
 *
 * @param qp
 *   The queue pair from which to retrieve
 *   processed operations.
 * @param ops
 *   The address of an array of pointers to
 *   *rte_comp_op* structures that must be
 *   large enough to store *nb_ops* pointers in it
 * @param nb_ops
 *   The maximum number of operations to dequeue
 * @return
 *   - The number of operations actually dequeued, which is the number
 *   of pointers to *rte_comp_op* structures effectively supplied to the
 *   *ops* array.
 */
typedef uint16_t (*compressdev_dequeue_pkt_burst_t)(void *qp,
		struct rte_comp_op **ops, uint16_t nb_ops);

/**
 * Enqueue a burst of operations for processing.
 *
 * @param qp
 *   The queue pair on which operations
 *   are to be enqueued for processing
 * @param ops
 *   The address of an array of *nb_ops* pointers
 *   to *rte_comp_op* structures which contain
 *   the operations to be processed
 * @param nb_ops
 *   The number of operations to process
 * @return
 *   The number of operations actually enqueued on the device. The return
 *   value can be less than the value of the *nb_ops* parameter when the
 *   comp devices queue is full or if invalid parameters are specified in
 *   a *rte_comp_op*.
 */

typedef uint16_t (*compressdev_enqueue_pkt_burst_t)(void *qp,
		struct rte_comp_op **ops, uint16_t nb_ops);

/** The data structure associated with each comp device. */
struct rte_compressdev {
	compressdev_dequeue_pkt_burst_t dequeue_burst;
	/**< Pointer to PMD receive function */
	compressdev_enqueue_pkt_burst_t enqueue_burst;
	/**< Pointer to PMD transmit function */

	struct rte_compressdev_data *data;
	/**< Pointer to device data */
	struct rte_compressdev_ops *dev_ops;
	/**< Functions exported by PMD */
	uint64_t feature_flags;
	/**< Supported features */
	struct rte_device *device;
	/**< Backing device */

	__extension__
	uint8_t attached : 1;
	/**< Flag indicating the device is attached */
} __rte_cache_aligned;

/**
 *
 * The data part, with no function pointers, associated with each device.
 *
 * This structure is safe to place in shared memory to be common among
 * different processes in a multi-process configuration.
 */
struct rte_compressdev_data {
	uint8_t dev_id;
	/**< Compress device identifier */
	uint8_t socket_id;
	/**< Socket identifier where memory is allocated */
	char name[RTE_COMPRESSDEV_NAME_MAX_LEN];
	/**< Unique identifier name */

	__extension__
	uint8_t dev_started : 1;
	/**< Device state: STARTED(1)/STOPPED(0) */

	void **queue_pairs;
	/**< Array of pointers to queue pairs. */
	uint16_t nb_queue_pairs;
	/**< Number of device queue pairs */

	void *dev_private;
	/**< PMD-specific private data */
} __rte_cache_aligned;
#endif