]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/drivers/bus/fslmc/mc/fsl_dpdmai.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / dpdk / drivers / bus / fslmc / mc / fsl_dpdmai.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2018 NXP
3 */
4
5 #ifndef __FSL_DPDMAI_H
6 #define __FSL_DPDMAI_H
7
8 struct fsl_mc_io;
9
10 /* Data Path DMA Interface API
11 * Contains initialization APIs and runtime control APIs for DPDMAI
12 */
13
14 /* General DPDMAI macros */
15
16 /**
17 * Maximum number of Tx/Rx priorities per DPDMAI object
18 */
19 #define DPDMAI_PRIO_NUM 2
20
21 /**
22 * All queues considered; see dpdmai_set_rx_queue()
23 */
24 #define DPDMAI_ALL_QUEUES (uint8_t)(-1)
25
26 int dpdmai_open(struct fsl_mc_io *mc_io,
27 uint32_t cmd_flags,
28 int dpdmai_id,
29 uint16_t *token);
30
31 int dpdmai_close(struct fsl_mc_io *mc_io,
32 uint32_t cmd_flags,
33 uint16_t token);
34
35 /**
36 * struct dpdmai_cfg - Structure representing DPDMAI configuration
37 * @priorities: Priorities for the DMA hardware processing; valid priorities are
38 * configured with values 1-8; the entry following last valid entry
39 * should be configured with 0
40 */
41 struct dpdmai_cfg {
42 uint8_t num_queues;
43 uint8_t priorities[DPDMAI_PRIO_NUM];
44 };
45
46 int dpdmai_create(struct fsl_mc_io *mc_io,
47 uint16_t dprc_token,
48 uint32_t cmd_flags,
49 const struct dpdmai_cfg *cfg,
50 uint32_t *obj_id);
51
52 int dpdmai_destroy(struct fsl_mc_io *mc_io,
53 uint16_t dprc_token,
54 uint32_t cmd_flags,
55 uint32_t object_id);
56
57 int dpdmai_enable(struct fsl_mc_io *mc_io,
58 uint32_t cmd_flags,
59 uint16_t token);
60
61 int dpdmai_disable(struct fsl_mc_io *mc_io,
62 uint32_t cmd_flags,
63 uint16_t token);
64
65 int dpdmai_is_enabled(struct fsl_mc_io *mc_io,
66 uint32_t cmd_flags,
67 uint16_t token,
68 int *en);
69
70 int dpdmai_reset(struct fsl_mc_io *mc_io,
71 uint32_t cmd_flags,
72 uint16_t token);
73
74 /**
75 * struct dpdmai_attr - Structure representing DPDMAI attributes
76 * @id: DPDMAI object ID
77 * @num_of_priorities: number of priorities
78 */
79 struct dpdmai_attr {
80 int id;
81 uint8_t num_of_priorities;
82 uint8_t num_of_queues;
83 };
84
85 int dpdmai_get_attributes(struct fsl_mc_io *mc_io,
86 uint32_t cmd_flags,
87 uint16_t token,
88 struct dpdmai_attr *attr);
89
90 /**
91 * enum dpdmai_dest - DPDMAI destination types
92 * @DPDMAI_DEST_NONE: Unassigned destination; The queue is set in parked mode
93 * and does not generate FQDAN notifications; user is expected to dequeue
94 * from the queue based on polling or other user-defined method
95 * @DPDMAI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
96 * notifications to the specified DPIO; user is expected to dequeue
97 * from the queue only after notification is received
98 * @DPDMAI_DEST_DPCON: The queue is set in schedule mode and does not generate
99 * FQDAN notifications, but is connected to the specified DPCON object;
100 * user is expected to dequeue from the DPCON channel
101 */
102 enum dpdmai_dest {
103 DPDMAI_DEST_NONE = 0,
104 DPDMAI_DEST_DPIO = 1,
105 DPDMAI_DEST_DPCON = 2
106 };
107
108 /**
109 * struct dpdmai_dest_cfg - Structure representing DPDMAI destination parameters
110 * @dest_type: Destination type
111 * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
112 * @priority: Priority selection within the DPIO or DPCON channel; valid values
113 * are 0-1 or 0-7, depending on the number of priorities in that
114 * channel; not relevant for 'DPDMAI_DEST_NONE' option
115 */
116 struct dpdmai_dest_cfg {
117 enum dpdmai_dest dest_type;
118 int dest_id;
119 uint8_t priority;
120 };
121
122 /* DPDMAI queue modification options */
123
124 /**
125 * Select to modify the user's context associated with the queue
126 */
127 #define DPDMAI_QUEUE_OPT_USER_CTX 0x00000001
128
129 /**
130 * Select to modify the queue's destination
131 */
132 #define DPDMAI_QUEUE_OPT_DEST 0x00000002
133
134 /**
135 * struct dpdmai_rx_queue_cfg - DPDMAI RX queue configuration
136 * @options: Flags representing the suggested modifications to the queue;
137 * Use any combination of 'DPDMAI_QUEUE_OPT_<X>' flags
138 * @user_ctx: User context value provided in the frame descriptor of each
139 * dequeued frame;
140 * valid only if 'DPDMAI_QUEUE_OPT_USER_CTX' is contained in 'options'
141 * @dest_cfg: Queue destination parameters;
142 * valid only if 'DPDMAI_QUEUE_OPT_DEST' is contained in 'options'
143 */
144 struct dpdmai_rx_queue_cfg {
145 uint32_t options;
146 uint64_t user_ctx;
147 struct dpdmai_dest_cfg dest_cfg;
148
149 };
150
151 int dpdmai_set_rx_queue(struct fsl_mc_io *mc_io,
152 uint32_t cmd_flags,
153 uint16_t token,
154 uint8_t queue_idx,
155 uint8_t priority,
156 const struct dpdmai_rx_queue_cfg *cfg);
157
158 /**
159 * struct dpdmai_rx_queue_attr - Structure representing attributes of Rx queues
160 * @user_ctx: User context value provided in the frame descriptor of each
161 * dequeued frame
162 * @dest_cfg: Queue destination configuration
163 * @fqid: Virtual FQID value to be used for dequeue operations
164 */
165 struct dpdmai_rx_queue_attr {
166 uint64_t user_ctx;
167 struct dpdmai_dest_cfg dest_cfg;
168 uint32_t fqid;
169 };
170
171 int dpdmai_get_rx_queue(struct fsl_mc_io *mc_io,
172 uint32_t cmd_flags,
173 uint16_t token,
174 uint8_t queue_idx,
175 uint8_t priority,
176 struct dpdmai_rx_queue_attr *attr);
177
178 /**
179 * struct dpdmai_tx_queue_attr - Structure representing attributes of Tx queues
180 * @fqid: Virtual FQID to be used for sending frames to DMA hardware
181 */
182
183 struct dpdmai_tx_queue_attr {
184 uint32_t fqid;
185 };
186
187 int dpdmai_get_tx_queue(struct fsl_mc_io *mc_io,
188 uint32_t cmd_flags,
189 uint16_t token,
190 uint8_t queue_idx,
191 uint8_t priority,
192 struct dpdmai_tx_queue_attr *attr);
193
194 #endif /* __FSL_DPDMAI_H */