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