event/dlb2: use new implementation of resource file
[dpdk.git] / drivers / event / dlb2 / dlb2_priv.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016-2020 Intel Corporation
3  */
4
5 #ifndef _DLB2_PRIV_H_
6 #define _DLB2_PRIV_H_
7
8 #include <emmintrin.h>
9 #include <stdbool.h>
10
11 #include <rte_eventdev.h>
12 #include <rte_config.h>
13 #include "dlb2_user.h"
14 #include "dlb2_log.h"
15 #include "rte_pmd_dlb2.h"
16
17 #ifndef RTE_LIBRTE_PMD_DLB2_QUELL_STATS
18 #define DLB2_INC_STAT(_stat, _incr_val) ((_stat) += _incr_val)
19 #else
20 #define DLB2_INC_STAT(_stat, _incr_val)
21 #endif
22
23 #define EVDEV_DLB2_NAME_PMD dlb2_event
24
25 /*  command line arg strings */
26 #define NUMA_NODE_ARG "numa_node"
27 #define DLB2_MAX_NUM_EVENTS "max_num_events"
28 #define DLB2_NUM_DIR_CREDITS "num_dir_credits"
29 #define DEV_ID_ARG "dev_id"
30 #define DLB2_DEFER_SCHED_ARG "defer_sched"
31 #define DLB2_QID_DEPTH_THRESH_ARG "qid_depth_thresh"
32 #define DLB2_COS_ARG "cos"
33
34 /* Begin HW related defines and structs */
35
36 #define DLB2_HW_V2 0
37 #define DLB2_HW_V2_5 1
38 #define DLB2_MAX_NUM_DOMAINS 32
39 #define DLB2_MAX_NUM_VFS 16
40 #define DLB2_MAX_NUM_LDB_QUEUES 32
41 #define DLB2_MAX_NUM_LDB_PORTS 64
42 #define DLB2_MAX_NUM_DIR_PORTS_V2               DLB2_MAX_NUM_DIR_QUEUES_V2
43 #define DLB2_MAX_NUM_DIR_PORTS_V2_5             DLB2_MAX_NUM_DIR_QUEUES_V2_5
44 #define DLB2_MAX_NUM_DIR_PORTS(ver)             (ver == DLB2_HW_V2 ? \
45                                                  DLB2_MAX_NUM_DIR_PORTS_V2 : \
46                                                  DLB2_MAX_NUM_DIR_PORTS_V2_5)
47 #define DLB2_MAX_NUM_DIR_QUEUES_V2              64 /* DIR == directed */
48 #define DLB2_MAX_NUM_DIR_QUEUES_V2_5            96
49 /* When needed for array sizing, the DLB 2.5 macro is used */
50 #define DLB2_MAX_NUM_DIR_QUEUES(ver)            (ver == DLB2_HW_V2 ? \
51                                                  DLB2_MAX_NUM_DIR_QUEUES_V2 : \
52                                                  DLB2_MAX_NUM_DIR_QUEUES_V2_5)
53 #define DLB2_MAX_NUM_FLOWS (64 * 1024)
54 #define DLB2_MAX_NUM_LDB_CREDITS (8 * 1024)
55 #define DLB2_MAX_NUM_DIR_CREDITS(ver)           (ver == DLB2_HW_V2 ? 4096 : 0)
56 #define DLB2_MAX_NUM_CREDITS(ver)               (ver == DLB2_HW_V2 ? \
57                                                  0 : DLB2_MAX_NUM_LDB_CREDITS)
58 #define DLB2_MAX_NUM_LDB_CREDIT_POOLS 64
59 #define DLB2_MAX_NUM_DIR_CREDIT_POOLS 64
60 #define DLB2_MAX_NUM_HIST_LIST_ENTRIES 2048
61 #define DLB2_MAX_NUM_QIDS_PER_LDB_CQ 8
62 #define DLB2_QID_PRIORITIES 8
63 #define DLB2_MAX_DEVICE_PATH 32
64 #define DLB2_MIN_DEQUEUE_TIMEOUT_NS 1
65 /* Note: "- 1" here to support the timeout range check in eventdev_autotest */
66 #define DLB2_MAX_DEQUEUE_TIMEOUT_NS (UINT32_MAX - 1)
67 #define DLB2_SW_CREDIT_BATCH_SZ 32
68 #define DLB2_NUM_SN_GROUPS 2
69 #define DLB2_MAX_LDB_SN_ALLOC 1024
70 #define DLB2_MAX_QUEUE_DEPTH_THRESHOLD 8191
71
72 /* 2048 total hist list entries and 64 total ldb ports, which
73  * makes for 2048/64 == 32 hist list entries per port. However, CQ
74  * depth must be a power of 2 and must also be >= HIST LIST entries.
75  * As a result we just limit the maximum dequeue depth to 32.
76  */
77 #define DLB2_MIN_CQ_DEPTH 1
78 #define DLB2_MAX_CQ_DEPTH 32
79 #define DLB2_MIN_HARDWARE_CQ_DEPTH 8
80 #define DLB2_NUM_HIST_LIST_ENTRIES_PER_LDB_PORT \
81         DLB2_MAX_CQ_DEPTH
82
83 #define DLB2_HW_DEVICE_FROM_PCI_ID(_pdev) \
84         (((_pdev->id.device_id == PCI_DEVICE_ID_INTEL_DLB2_5_PF) ||        \
85           (_pdev->id.device_id == PCI_DEVICE_ID_INTEL_DLB2_5_VF))   ?   \
86                 DLB2_HW_V2_5 : DLB2_HW_V2)
87
88 /*
89  * Static per queue/port provisioning values
90  */
91 #define DLB2_NUM_ATOMIC_INFLIGHTS_PER_QUEUE 64
92
93 #define CQ_BASE(is_dir) ((is_dir) ? DLB2_DIR_CQ_BASE : DLB2_LDB_CQ_BASE)
94 #define CQ_SIZE(is_dir) ((is_dir) ? DLB2_DIR_CQ_MAX_SIZE : \
95                                     DLB2_LDB_CQ_MAX_SIZE)
96 #define PP_BASE(is_dir) ((is_dir) ? DLB2_DIR_PP_BASE : DLB2_LDB_PP_BASE)
97
98 #define DLB2_NUM_QES_PER_CACHE_LINE 4
99
100 #define DLB2_MAX_ENQUEUE_DEPTH 64
101 #define DLB2_MIN_ENQUEUE_DEPTH 4
102
103 #define DLB2_NAME_SIZE 64
104
105 #define DLB2_1K 1024
106 #define DLB2_2K (2 * DLB2_1K)
107 #define DLB2_4K (4 * DLB2_1K)
108 #define DLB2_16K (16 * DLB2_1K)
109 #define DLB2_32K (32 * DLB2_1K)
110 #define DLB2_1MB (DLB2_1K * DLB2_1K)
111 #define DLB2_16MB (16 * DLB2_1MB)
112
113 /* Use the upper 3 bits of the event priority to select the DLB2 priority */
114 #define EV_TO_DLB2_PRIO(x) ((x) >> 5)
115 #define DLB2_TO_EV_PRIO(x) ((x) << 5)
116
117 enum dlb2_hw_ver {
118         DLB2_HW_VER_2,
119         DLB2_HW_VER_2_5,
120 };
121
122 enum dlb2_hw_port_types {
123         DLB2_LDB_PORT,
124         DLB2_DIR_PORT,
125         DLB2_NUM_PORT_TYPES /* Must be last */
126 };
127
128 enum dlb2_hw_queue_types {
129         DLB2_LDB_QUEUE,
130         DLB2_DIR_QUEUE,
131         DLB2_NUM_QUEUE_TYPES /* Must be last */
132 };
133
134 #define DLB2_COMBINED_POOL DLB2_LDB_QUEUE
135
136 #define PORT_TYPE(p) ((p)->is_directed ? DLB2_DIR_PORT : DLB2_LDB_PORT)
137
138 /* Do not change - must match hardware! */
139 enum dlb2_hw_sched_type {
140         DLB2_SCHED_ATOMIC = 0,
141         DLB2_SCHED_UNORDERED,
142         DLB2_SCHED_ORDERED,
143         DLB2_SCHED_DIRECTED,
144         /* DLB2_NUM_HW_SCHED_TYPES must be last */
145         DLB2_NUM_HW_SCHED_TYPES
146 };
147
148 struct dlb2_hw_rsrcs {
149         int32_t nb_events_limit;
150         uint32_t num_queues;            /* Total queues (lb + dir) */
151         uint32_t num_ldb_queues;        /* Number of available ldb queues */
152         uint32_t num_ldb_ports;         /* Number of load balanced ports */
153         uint32_t num_dir_ports;         /* Number of directed ports */
154         union {
155                 struct {
156                         uint32_t num_ldb_credits; /* Number of ldb credits */
157                         uint32_t num_dir_credits; /* Number of dir credits */
158                 };
159                 struct {
160                         uint32_t num_credits; /* Number of combined credits */
161                 };
162         };
163         uint32_t reorder_window_size;   /* Size of reorder window */
164 };
165
166 struct dlb2_hw_resource_info {
167         /**> Max resources that can be provided */
168         struct dlb2_hw_rsrcs hw_rsrc_max;
169         int num_sched_domains;
170         uint32_t socket_id;
171 };
172
173 enum dlb2_enqueue_type {
174         /**>
175          * New : Used to inject a new packet into the QM.
176          */
177         DLB2_ENQ_NEW,
178         /**>
179          * Forward : Enqueues a packet, and
180          *  - if atomic: release any lock it holds in the QM
181          *  - if ordered: release the packet for egress re-ordering
182          */
183         DLB2_ENQ_FWD,
184         /**>
185          * Enqueue Drop : Release an inflight packet. Must be called with
186          * event == NULL. Used to drop a packet.
187          *
188          * Note that all packets dequeued from a load-balanced port must be
189          * released, either with DLB2_ENQ_DROP or DLB2_ENQ_FWD.
190          */
191         DLB2_ENQ_DROP,
192
193         /* marker for array sizing etc. */
194         _DLB2_NB_ENQ_TYPES
195 };
196
197 /* hw-specific format - do not change */
198
199 struct dlb2_event_type {
200         uint8_t major:4;
201         uint8_t unused:4;
202         uint8_t sub;
203 };
204
205 union dlb2_opaque_data {
206         uint16_t opaque_data;
207         struct dlb2_event_type event_type;
208 };
209
210 struct dlb2_msg_info {
211         uint8_t qid;
212         uint8_t sched_type:2;
213         uint8_t priority:3;
214         uint8_t msg_type:3;
215 };
216
217 #define DLB2_NEW_CMD_BYTE 0x08
218 #define DLB2_FWD_CMD_BYTE 0x0A
219 #define DLB2_COMP_CMD_BYTE 0x02
220 #define DLB2_POP_CMD_BYTE 0x01
221 #define DLB2_NOOP_CMD_BYTE 0x00
222
223 /* hw-specific format - do not change */
224 struct dlb2_enqueue_qe {
225         uint64_t data;
226         /* Word 3 */
227         union dlb2_opaque_data u;
228         uint8_t qid;
229         uint8_t sched_type:2;
230         uint8_t priority:3;
231         uint8_t msg_type:3;
232         /* Word 4 */
233         uint16_t lock_id;
234         uint8_t meas_lat:1;
235         uint8_t rsvd1:2;
236         uint8_t no_dec:1;
237         uint8_t cmp_id:4;
238         union {
239                 uint8_t cmd_byte;
240                 struct {
241                         uint8_t cq_token:1;
242                         uint8_t qe_comp:1;
243                         uint8_t qe_frag:1;
244                         uint8_t qe_valid:1;
245                         uint8_t rsvd3:1;
246                         uint8_t error:1;
247                         uint8_t rsvd:2;
248                 };
249         };
250 };
251
252 /* hw-specific format - do not change */
253 struct dlb2_cq_pop_qe {
254         uint64_t data;
255         union dlb2_opaque_data u;
256         uint8_t qid;
257         uint8_t sched_type:2;
258         uint8_t priority:3;
259         uint8_t msg_type:3;
260         uint16_t tokens:10;
261         uint16_t rsvd2:6;
262         uint8_t meas_lat:1;
263         uint8_t rsvd1:2;
264         uint8_t no_dec:1;
265         uint8_t cmp_id:4;
266         union {
267                 uint8_t cmd_byte;
268                 struct {
269                         uint8_t cq_token:1;
270                         uint8_t qe_comp:1;
271                         uint8_t qe_frag:1;
272                         uint8_t qe_valid:1;
273                         uint8_t rsvd3:1;
274                         uint8_t error:1;
275                         uint8_t rsvd:2;
276                 };
277         };
278 };
279
280 /* hw-specific format - do not change */
281 struct dlb2_dequeue_qe {
282         uint64_t data;
283         union dlb2_opaque_data u;
284         uint8_t qid;
285         uint8_t sched_type:2;
286         uint8_t priority:3;
287         uint8_t msg_type:3;
288         uint16_t flow_id:16; /* was pp_id in v1 */
289         uint8_t debug;
290         uint8_t cq_gen:1;
291         uint8_t qid_depth:2; /* 2 bits in v2 */
292         uint8_t rsvd1:2;
293         uint8_t error:1;
294         uint8_t rsvd2:2;
295 };
296
297 union dlb2_port_config {
298         struct dlb2_create_ldb_port_args ldb;
299         struct dlb2_create_dir_port_args dir;
300 };
301
302 enum dlb2_port_state {
303         PORT_CLOSED,
304         PORT_STARTED,
305         PORT_STOPPED
306 };
307
308 enum dlb2_configuration_state {
309         /* The resource has not been configured */
310         DLB2_NOT_CONFIGURED,
311         /* The resource was configured, but the device was stopped */
312         DLB2_PREV_CONFIGURED,
313         /* The resource is currently configured */
314         DLB2_CONFIGURED
315 };
316
317 struct dlb2_port {
318         uint32_t id;
319         bool is_directed;
320         bool gen_bit;
321         uint16_t dir_credits;
322         uint32_t dequeue_depth;
323         enum dlb2_token_pop_mode token_pop_mode;
324         union dlb2_port_config cfg;
325         uint32_t *credit_pool[DLB2_NUM_QUEUE_TYPES]; /* use __atomic builtins */
326         union {
327                 struct {
328                         uint16_t cached_ldb_credits;
329                         uint16_t ldb_credits;
330                         uint16_t cached_dir_credits;
331                 };
332                 struct {
333                         uint16_t cached_credits;
334                         uint16_t credits;
335                 };
336         };
337         bool int_armed;
338         uint16_t owed_tokens;
339         int16_t issued_releases;
340         int16_t token_pop_thresh;
341         int cq_depth;
342         uint16_t cq_idx;
343         uint16_t cq_idx_unmasked;
344         uint16_t cq_depth_mask;
345         uint16_t gen_bit_shift;
346         enum dlb2_port_state state;
347         enum dlb2_configuration_state config_state;
348         int num_mapped_qids;
349         uint8_t *qid_mappings;
350         struct dlb2_enqueue_qe *qe4; /* Cache line's worth of QEs (4) */
351         struct dlb2_enqueue_qe *int_arm_qe;
352         struct dlb2_cq_pop_qe *consume_qe;
353         struct dlb2_eventdev *dlb2; /* back ptr */
354         struct dlb2_eventdev_port *ev_port; /* back ptr */
355 };
356
357 /* Per-process per-port mmio and memory pointers */
358 struct process_local_port_data {
359         uint64_t *pp_addr;
360         struct dlb2_dequeue_qe *cq_base;
361         const struct rte_memzone *mz;
362         bool mmaped;
363 };
364
365 struct dlb2_eventdev;
366
367 struct dlb2_port_low_level_io_functions {
368         void (*pp_enqueue_four)(void *qe4, void *pp_addr);
369 };
370
371 struct dlb2_config {
372         int configured;
373         int reserved;
374         union {
375                 struct {
376                         uint32_t num_ldb_credits;
377                         uint32_t num_dir_credits;
378                 };
379                 struct {
380                         uint32_t num_credits;
381                 };
382         };
383         struct dlb2_create_sched_domain_args resources;
384 };
385
386 enum dlb2_cos {
387         DLB2_COS_DEFAULT = -1,
388         DLB2_COS_0 = 0,
389         DLB2_COS_1,
390         DLB2_COS_2,
391         DLB2_COS_3
392 };
393
394 struct dlb2_hw_dev {
395         struct dlb2_config cfg;
396         struct dlb2_hw_resource_info info;
397         void *pf_dev; /* opaque pointer to PF PMD dev (struct dlb2_dev) */
398         uint32_t domain_id;
399         enum dlb2_cos cos_id;
400         rte_spinlock_t resource_lock; /* for MP support */
401 } __rte_cache_aligned;
402
403 /* End HW related defines and structs */
404
405 /* Begin DLB2 PMD Eventdev related defines and structs */
406
407 #define DLB2_MAX_NUM_QUEUES(ver)                                \
408         (DLB2_MAX_NUM_DIR_QUEUES(ver) + DLB2_MAX_NUM_LDB_QUEUES)
409
410 #define DLB2_MAX_NUM_PORTS(ver) \
411         (DLB2_MAX_NUM_DIR_PORTS(ver) + DLB2_MAX_NUM_LDB_PORTS)
412
413 #define DLB2_MAX_NUM_DIR_QUEUES_V2_5 96
414 #define DLB2_MAX_NUM_DIR_PORTS_V2_5 DLB2_MAX_NUM_DIR_QUEUES_V2_5
415 #define DLB2_MAX_NUM_QUEUES_ALL \
416         (DLB2_MAX_NUM_DIR_QUEUES_V2_5 + DLB2_MAX_NUM_LDB_QUEUES)
417 #define DLB2_MAX_NUM_PORTS_ALL \
418         (DLB2_MAX_NUM_DIR_PORTS_V2_5 + DLB2_MAX_NUM_LDB_PORTS)
419 #define DLB2_MAX_INPUT_QUEUE_DEPTH 256
420
421 /** Structure to hold the queue to port link establishment attributes */
422
423 struct dlb2_event_queue_link {
424         uint8_t queue_id;
425         uint8_t priority;
426         bool mapped;
427         bool valid;
428 };
429
430 struct dlb2_traffic_stats {
431         uint64_t rx_ok;
432         uint64_t rx_drop;
433         uint64_t rx_interrupt_wait;
434         uint64_t rx_umonitor_umwait;
435         uint64_t tx_ok;
436         uint64_t total_polls;
437         uint64_t zero_polls;
438         union {
439                 struct {
440                         uint64_t tx_nospc_ldb_hw_credits;
441                         uint64_t tx_nospc_dir_hw_credits;
442                 };
443                 struct {
444                         uint64_t tx_nospc_hw_credits;
445                 };
446         };
447         uint64_t tx_nospc_inflight_max;
448         uint64_t tx_nospc_new_event_limit;
449         uint64_t tx_nospc_inflight_credits;
450 };
451
452 /* DLB2 HW sets the 2bit qid_depth in rx QEs based on the programmable depth
453  * threshold. The global default value in config/common_base (or rte_config.h)
454  * can be overridden on a per-qid basis using a vdev command line parameter.
455  * 3: depth > threshold
456  * 2: threshold >= depth > 3/4 threshold
457  * 1: 3/4 threshold >= depth > 1/2 threshold
458  * 0: depth <= 1/2 threshold.
459  */
460 #define DLB2_QID_DEPTH_LE50 0
461 #define DLB2_QID_DEPTH_GT50_LE75 1
462 #define DLB2_QID_DEPTH_GT75_LE100 2
463 #define DLB2_QID_DEPTH_GT100 3
464 #define DLB2_NUM_QID_DEPTH_STAT_VALS 4 /* 2 bits */
465
466 struct dlb2_queue_stats {
467         uint64_t enq_ok;
468         uint64_t qid_depth[DLB2_NUM_QID_DEPTH_STAT_VALS];
469 };
470
471 struct dlb2_port_stats {
472         struct dlb2_traffic_stats traffic;
473         uint64_t tx_op_cnt[4]; /* indexed by rte_event.op */
474         uint64_t tx_implicit_rel;
475         uint64_t tx_sched_cnt[DLB2_NUM_HW_SCHED_TYPES];
476         uint64_t tx_invalid;
477         uint64_t rx_sched_cnt[DLB2_NUM_HW_SCHED_TYPES];
478         uint64_t rx_sched_invalid;
479         struct dlb2_queue_stats queue[DLB2_MAX_NUM_QUEUES_ALL];
480 };
481
482 struct dlb2_eventdev_port {
483         struct dlb2_port qm_port; /* hw specific data structure */
484         struct rte_event_port_conf conf; /* user-supplied configuration */
485         uint16_t inflight_credits; /* num credits this port has right now */
486         uint16_t credit_update_quanta;
487         struct dlb2_eventdev *dlb2; /* backlink optimization */
488         struct dlb2_port_stats stats __rte_cache_aligned;
489         struct dlb2_event_queue_link link[DLB2_MAX_NUM_QIDS_PER_LDB_CQ];
490         int num_links;
491         uint32_t id; /* port id */
492         /* num releases yet to be completed on this port.
493          * Only applies to load-balanced ports.
494          */
495         uint16_t outstanding_releases;
496         uint16_t inflight_max; /* app requested max inflights for this port */
497         /* setup_done is set when the event port is setup */
498         bool setup_done;
499         /* enq_configured is set when the qm port is created */
500         bool enq_configured;
501         uint8_t implicit_release; /* release events before dequeueing */
502 }  __rte_cache_aligned;
503
504 struct dlb2_queue {
505         uint32_t num_qid_inflights; /* User config */
506         uint32_t num_atm_inflights; /* User config */
507         enum dlb2_configuration_state config_state;
508         int sched_type; /* LB queue only */
509         uint32_t id;
510         bool is_directed;
511 };
512
513 struct dlb2_eventdev_queue {
514         struct dlb2_queue qm_queue;
515         struct rte_event_queue_conf conf; /* User config */
516         int depth_threshold; /* use default if 0 */
517         uint32_t id;
518         bool setup_done;
519         uint8_t num_links;
520 };
521
522 enum dlb2_run_state {
523         DLB2_RUN_STATE_STOPPED = 0,
524         DLB2_RUN_STATE_STOPPING,
525         DLB2_RUN_STATE_STARTING,
526         DLB2_RUN_STATE_STARTED
527 };
528
529 struct dlb2_eventdev {
530         struct dlb2_eventdev_port ev_ports[DLB2_MAX_NUM_PORTS_ALL];
531         struct dlb2_eventdev_queue ev_queues[DLB2_MAX_NUM_QUEUES_ALL];
532         uint8_t qm_ldb_to_ev_queue_id[DLB2_MAX_NUM_QUEUES_ALL];
533         uint8_t qm_dir_to_ev_queue_id[DLB2_MAX_NUM_QUEUES_ALL];
534         /* store num stats and offset of the stats for each queue */
535         uint16_t xstats_count_per_qid[DLB2_MAX_NUM_QUEUES_ALL];
536         uint16_t xstats_offset_for_qid[DLB2_MAX_NUM_QUEUES_ALL];
537         /* store num stats and offset of the stats for each port */
538         uint16_t xstats_count_per_port[DLB2_MAX_NUM_PORTS_ALL];
539         uint16_t xstats_offset_for_port[DLB2_MAX_NUM_PORTS_ALL];
540         struct dlb2_get_num_resources_args hw_rsrc_query_results;
541         uint32_t xstats_count_mode_queue;
542         struct dlb2_hw_dev qm_instance; /* strictly hw related */
543         uint64_t global_dequeue_wait_ticks;
544         struct dlb2_xstats_entry *xstats;
545         struct rte_eventdev *event_dev; /* backlink to dev */
546         uint32_t xstats_count_mode_dev;
547         uint32_t xstats_count_mode_port;
548         uint32_t xstats_count;
549         uint32_t inflights; /* use __atomic builtins */
550         uint32_t new_event_limit;
551         int max_num_events_override;
552         int num_dir_credits_override;
553         volatile enum dlb2_run_state run_state;
554         uint16_t num_dir_queues; /* total num of evdev dir queues requested */
555         union {
556                 struct {
557                         uint16_t num_dir_credits;
558                         uint16_t num_ldb_credits;
559                 };
560                 struct {
561                         uint16_t num_credits;
562                 };
563         };
564         uint16_t num_queues; /* total queues */
565         uint16_t num_ldb_queues; /* total num of evdev ldb queues requested */
566         uint16_t num_ports; /* total num of evdev ports requested */
567         uint16_t num_ldb_ports; /* total num of ldb ports requested */
568         uint16_t num_dir_ports; /* total num of dir ports requested */
569         bool umwait_allowed;
570         bool global_dequeue_wait; /* Not using per dequeue wait if true */
571         bool defer_sched;
572         enum dlb2_cq_poll_modes poll_mode;
573         uint8_t revision;
574         uint8_t version;
575         bool configured;
576         union {
577                 struct {
578                         uint16_t max_ldb_credits;
579                         uint16_t max_dir_credits;
580                         /* use __atomic builtins */ /* shared hw cred */
581                         uint32_t ldb_credit_pool __rte_cache_aligned;
582                         /* use __atomic builtins */ /* shared hw cred */
583                         uint32_t dir_credit_pool __rte_cache_aligned;
584                 };
585                 struct {
586                         uint16_t max_credits;
587                         /* use __atomic builtins */ /* shared hw cred */
588                         uint32_t credit_pool __rte_cache_aligned;
589                 };
590         };
591 };
592
593 /* used for collecting and passing around the dev args */
594 struct dlb2_qid_depth_thresholds {
595         int val[DLB2_MAX_NUM_QUEUES_ALL];
596 };
597
598 struct dlb2_devargs {
599         int socket_id;
600         int max_num_events;
601         int num_dir_credits_override;
602         int dev_id;
603         int defer_sched;
604         struct dlb2_qid_depth_thresholds qid_depth_thresholds;
605         enum dlb2_cos cos_id;
606 };
607
608 /* End Eventdev related defines and structs */
609
610 /* Forwards for non-inlined functions */
611
612 void dlb2_eventdev_dump(struct rte_eventdev *dev, FILE *f);
613
614 int dlb2_xstats_init(struct dlb2_eventdev *dlb2);
615
616 void dlb2_xstats_uninit(struct dlb2_eventdev *dlb2);
617
618 int dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
619                 enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
620                 const unsigned int ids[], uint64_t values[], unsigned int n);
621
622 int dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
623                 enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
624                 struct rte_event_dev_xstats_name *xstat_names,
625                 unsigned int *ids, unsigned int size);
626
627 uint64_t dlb2_eventdev_xstats_get_by_name(const struct rte_eventdev *dev,
628                                           const char *name, unsigned int *id);
629
630 int dlb2_eventdev_xstats_reset(struct rte_eventdev *dev,
631                 enum rte_event_dev_xstats_mode mode,
632                 int16_t queue_port_id,
633                 const uint32_t ids[],
634                 uint32_t nb_ids);
635
636 int test_dlb2_eventdev(void);
637
638 int dlb2_primary_eventdev_probe(struct rte_eventdev *dev,
639                                 const char *name,
640                                 struct dlb2_devargs *dlb2_args);
641
642 int dlb2_secondary_eventdev_probe(struct rte_eventdev *dev,
643                                   const char *name);
644
645 uint32_t dlb2_get_queue_depth(struct dlb2_eventdev *dlb2,
646                               struct dlb2_eventdev_queue *queue);
647
648 int dlb2_parse_params(const char *params,
649                       const char *name,
650                       struct dlb2_devargs *dlb2_args,
651                       uint8_t version);
652
653 /* Extern globals */
654 extern struct process_local_port_data dlb2_port[][DLB2_NUM_PORT_TYPES];
655
656 #endif  /* _DLB2_PRIV_H_ */