baseband/acc100: add queue configuration
[dpdk.git] / drivers / baseband / acc100 / rte_acc100_pmd.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4
5 #ifndef _RTE_ACC100_PMD_H_
6 #define _RTE_ACC100_PMD_H_
7
8 #include "acc100_pf_enum.h"
9 #include "acc100_vf_enum.h"
10 #include "rte_acc100_cfg.h"
11
12 /* Helper macro for logging */
13 #define rte_bbdev_log(level, fmt, ...) \
14         rte_log(RTE_LOG_ ## level, acc100_logtype, fmt "\n", \
15                 ##__VA_ARGS__)
16
17 #ifdef RTE_LIBRTE_BBDEV_DEBUG
18 #define rte_bbdev_log_debug(fmt, ...) \
19                 rte_bbdev_log(DEBUG, "acc100_pmd: " fmt, \
20                 ##__VA_ARGS__)
21 #else
22 #define rte_bbdev_log_debug(fmt, ...)
23 #endif
24
25 /* ACC100 PF and VF driver names */
26 #define ACC100PF_DRIVER_NAME           intel_acc100_pf
27 #define ACC100VF_DRIVER_NAME           intel_acc100_vf
28
29 /* ACC100 PCI vendor & device IDs */
30 #define RTE_ACC100_VENDOR_ID           (0x8086)
31 #define RTE_ACC100_PF_DEVICE_ID        (0x0d5c)
32 #define RTE_ACC100_VF_DEVICE_ID        (0x0d5d)
33
34 /* Define as 1 to use only a single FEC engine */
35 #ifndef RTE_ACC100_SINGLE_FEC
36 #define RTE_ACC100_SINGLE_FEC 0
37 #endif
38
39 /* Values used in filling in descriptors */
40 #define ACC100_DMA_DESC_TYPE           2
41 #define ACC100_DMA_CODE_BLK_MODE       0
42 #define ACC100_DMA_BLKID_FCW           1
43 #define ACC100_DMA_BLKID_IN            2
44 #define ACC100_DMA_BLKID_OUT_ENC       1
45 #define ACC100_DMA_BLKID_OUT_HARD      1
46 #define ACC100_DMA_BLKID_OUT_SOFT      2
47 #define ACC100_DMA_BLKID_OUT_HARQ      3
48 #define ACC100_DMA_BLKID_IN_HARQ       3
49
50 /* Values used in filling in decode FCWs */
51 #define ACC100_FCW_TD_VER              1
52 #define ACC100_FCW_TD_EXT_COLD_REG_EN  1
53 #define ACC100_FCW_TD_AUTOMAP          0x0f
54 #define ACC100_FCW_TD_RVIDX_0          2
55 #define ACC100_FCW_TD_RVIDX_1          26
56 #define ACC100_FCW_TD_RVIDX_2          50
57 #define ACC100_FCW_TD_RVIDX_3          74
58
59 /* Values used in writing to the registers */
60 #define ACC100_REG_IRQ_EN_ALL          0x1FF83FF  /* Enable all interrupts */
61
62 /* ACC100 Specific Dimensioning */
63 #define ACC100_SIZE_64MBYTE            (64*1024*1024)
64 /* Number of elements in an Info Ring */
65 #define ACC100_INFO_RING_NUM_ENTRIES   1024
66 /* Number of elements in HARQ layout memory */
67 #define ACC100_HARQ_LAYOUT             (64*1024*1024)
68 /* Assume offset for HARQ in memory */
69 #define ACC100_HARQ_OFFSET             (32*1024)
70 /* Mask used to calculate an index in an Info Ring array (not a byte offset) */
71 #define ACC100_INFO_RING_MASK          (ACC100_INFO_RING_NUM_ENTRIES-1)
72 /* Number of Virtual Functions ACC100 supports */
73 #define ACC100_NUM_VFS                  16
74 #define ACC100_NUM_QGRPS                8
75 #define ACC100_NUM_QGRPS_PER_WORD       8
76 #define ACC100_NUM_AQS                  16
77 #define MAX_ENQ_BATCH_SIZE              255
78 /* All ACC100 Registers alignment are 32bits = 4B */
79 #define ACC100_BYTES_IN_WORD                 4
80 #define ACC100_MAX_E_MBUF                64000
81
82 #define ACC100_GRP_ID_SHIFT    10 /* Queue Index Hierarchy */
83 #define ACC100_VF_ID_SHIFT     4  /* Queue Index Hierarchy */
84 #define ACC100_VF_OFFSET_QOS   16 /* offset in Memory specific to QoS Mon */
85 #define ACC100_TMPL_PRI_0      0x03020100
86 #define ACC100_TMPL_PRI_1      0x07060504
87 #define ACC100_TMPL_PRI_2      0x0b0a0908
88 #define ACC100_TMPL_PRI_3      0x0f0e0d0c
89 #define ACC100_QUEUE_ENABLE    0x80000000  /* Bit to mark Queue as Enabled */
90 #define ACC100_WORDS_IN_ARAM_SIZE (128 * 1024 / 4)
91
92 #define ACC100_NUM_TMPL       32
93 /* Mapping of signals for the available engines */
94 #define ACC100_SIG_UL_5G      0
95 #define ACC100_SIG_UL_5G_LAST 7
96 #define ACC100_SIG_DL_5G      13
97 #define ACC100_SIG_DL_5G_LAST 15
98 #define ACC100_SIG_UL_4G      16
99 #define ACC100_SIG_UL_4G_LAST 21
100 #define ACC100_SIG_DL_4G      27
101 #define ACC100_SIG_DL_4G_LAST 31
102 #define ACC100_NUM_ACCS       5
103 #define ACC100_ACCMAP_0       0
104 #define ACC100_ACCMAP_1       2
105 #define ACC100_ACCMAP_2       1
106 #define ACC100_ACCMAP_3       3
107 #define ACC100_ACCMAP_4       4
108 #define ACC100_PF_VAL         2
109
110 /* max number of iterations to allocate memory block for all rings */
111 #define ACC100_SW_RING_MEM_ALLOC_ATTEMPTS 5
112 #define ACC100_MAX_QUEUE_DEPTH            1024
113 #define ACC100_DMA_MAX_NUM_POINTERS       14
114 #define ACC100_DMA_DESC_PADDING           8
115 #define ACC100_FCW_PADDING                12
116 #define ACC100_DESC_FCW_OFFSET            192
117 #define ACC100_DESC_SIZE                  256
118 #define ACC100_DESC_OFFSET                (ACC100_DESC_SIZE / 64)
119 #define ACC100_FCW_TE_BLEN                32
120 #define ACC100_FCW_TD_BLEN                24
121 #define ACC100_FCW_LE_BLEN                32
122 #define ACC100_FCW_LD_BLEN                36
123
124 #define ACC100_FCW_VER         2
125 #define ACC100_MUX_5GDL_DESC   6
126 #define ACC100_CMP_ENC_SIZE    20
127 #define ACC100_CMP_DEC_SIZE    24
128 #define ACC100_ENC_OFFSET     (32)
129 #define ACC100_DEC_OFFSET     (80)
130 #define ACC100_EXT_MEM /* Default option with memory external to CPU */
131 #define ACC100_HARQ_OFFSET_THRESHOLD 1024
132
133 /* Constants from K0 computation from 3GPP 38.212 Table 5.4.2.1-2 */
134 #define ACC100_N_ZC_1 66 /* N = 66 Zc for BG 1 */
135 #define ACC100_N_ZC_2 50 /* N = 50 Zc for BG 2 */
136 #define ACC100_K0_1_1 17 /* K0 fraction numerator for rv 1 and BG 1 */
137 #define ACC100_K0_1_2 13 /* K0 fraction numerator for rv 1 and BG 2 */
138 #define ACC100_K0_2_1 33 /* K0 fraction numerator for rv 2 and BG 1 */
139 #define ACC100_K0_2_2 25 /* K0 fraction numerator for rv 2 and BG 2 */
140 #define ACC100_K0_3_1 56 /* K0 fraction numerator for rv 3 and BG 1 */
141 #define ACC100_K0_3_2 43 /* K0 fraction numerator for rv 3 and BG 2 */
142
143 /* ACC100 Configuration */
144 #define ACC100_DDR_ECC_ENABLE
145 #define ACC100_CFG_DMA_ERROR    0x3D7
146 #define ACC100_CFG_AXI_CACHE    0x11
147 #define ACC100_CFG_QMGR_HI_P    0x0F0F
148 #define ACC100_CFG_PCI_AXI      0xC003
149 #define ACC100_CFG_PCI_BRIDGE   0x40006033
150 #define ACC100_ENGINE_OFFSET    0x1000
151 #define ACC100_RESET_HI         0x20100
152 #define ACC100_RESET_LO         0x20000
153 #define ACC100_RESET_HARD       0x1FF
154 #define ACC100_ENGINES_MAX      9
155 #define ACC100_LONG_WAIT        1000
156
157 /* ACC100 DMA Descriptor triplet */
158 struct acc100_dma_triplet {
159         uint64_t address;
160         uint32_t blen:20,
161                 res0:4,
162                 last:1,
163                 dma_ext:1,
164                 res1:2,
165                 blkid:4;
166 } __rte_packed;
167
168 /* ACC100 DMA Response Descriptor */
169 union acc100_dma_rsp_desc {
170         uint32_t val;
171         struct {
172                 uint32_t crc_status:1,
173                         synd_ok:1,
174                         dma_err:1,
175                         neg_stop:1,
176                         fcw_err:1,
177                         output_err:1,
178                         input_err:1,
179                         timestampEn:1,
180                         iterCountFrac:8,
181                         iter_cnt:8,
182                         rsrvd3:6,
183                         sdone:1,
184                         fdone:1;
185                 uint32_t add_info_0;
186                 uint32_t add_info_1;
187         };
188 };
189
190
191 /* ACC100 Queue Manager Enqueue PCI Register */
192 union acc100_enqueue_reg_fmt {
193         uint32_t val;
194         struct {
195                 uint32_t num_elem:8,
196                         addr_offset:3,
197                         rsrvd:1,
198                         req_elem_addr:20;
199         };
200 };
201
202 /* FEC 4G Uplink Frame Control Word */
203 struct __rte_packed acc100_fcw_td {
204         uint8_t fcw_ver:4,
205                 num_maps:4; /* Unused */
206         uint8_t filler:6, /* Unused */
207                 rsrvd0:1,
208                 bypass_sb_deint:1;
209         uint16_t k_pos;
210         uint16_t k_neg; /* Unused */
211         uint8_t c_neg; /* Unused */
212         uint8_t c; /* Unused */
213         uint32_t ea; /* Unused */
214         uint32_t eb; /* Unused */
215         uint8_t cab; /* Unused */
216         uint8_t k0_start_col; /* Unused */
217         uint8_t rsrvd1;
218         uint8_t code_block_mode:1, /* Unused */
219                 turbo_crc_type:1,
220                 rsrvd2:3,
221                 bypass_teq:1, /* Unused */
222                 soft_output_en:1, /* Unused */
223                 ext_td_cold_reg_en:1;
224         union { /* External Cold register */
225                 uint32_t ext_td_cold_reg;
226                 struct {
227                         uint32_t min_iter:4, /* Unused */
228                                 max_iter:4,
229                                 ext_scale:5, /* Unused */
230                                 rsrvd3:3,
231                                 early_stop_en:1, /* Unused */
232                                 sw_soft_out_dis:1, /* Unused */
233                                 sw_et_cont:1, /* Unused */
234                                 sw_soft_out_saturation:1, /* Unused */
235                                 half_iter_on:1, /* Unused */
236                                 raw_decoder_input_on:1, /* Unused */
237                                 rsrvd4:10;
238                 };
239         };
240 };
241
242 /* FEC 5GNR Uplink Frame Control Word */
243 struct __rte_packed acc100_fcw_ld {
244         uint32_t FCWversion:4,
245                 qm:4,
246                 nfiller:11,
247                 BG:1,
248                 Zc:9,
249                 res0:1,
250                 synd_precoder:1,
251                 synd_post:1;
252         uint32_t ncb:16,
253                 k0:16;
254         uint32_t rm_e:24,
255                 hcin_en:1,
256                 hcout_en:1,
257                 crc_select:1,
258                 bypass_dec:1,
259                 bypass_intlv:1,
260                 so_en:1,
261                 so_bypass_rm:1,
262                 so_bypass_intlv:1;
263         uint32_t hcin_offset:16,
264                 hcin_size0:16;
265         uint32_t hcin_size1:16,
266                 hcin_decomp_mode:3,
267                 llr_pack_mode:1,
268                 hcout_comp_mode:3,
269                 res2:1,
270                 dec_convllr:4,
271                 hcout_convllr:4;
272         uint32_t itmax:7,
273                 itstop:1,
274                 so_it:7,
275                 res3:1,
276                 hcout_offset:16;
277         uint32_t hcout_size0:16,
278                 hcout_size1:16;
279         uint32_t gain_i:8,
280                 gain_h:8,
281                 negstop_th:16;
282         uint32_t negstop_it:7,
283                 negstop_en:1,
284                 res4:24;
285 };
286
287 /* FEC 4G Downlink Frame Control Word */
288 struct __rte_packed acc100_fcw_te {
289         uint16_t k_neg;
290         uint16_t k_pos;
291         uint8_t c_neg;
292         uint8_t c;
293         uint8_t filler;
294         uint8_t cab;
295         uint32_t ea:17,
296                 rsrvd0:15;
297         uint32_t eb:17,
298                 rsrvd1:15;
299         uint16_t ncb_neg;
300         uint16_t ncb_pos;
301         uint8_t rv_idx0:2,
302                 rsrvd2:2,
303                 rv_idx1:2,
304                 rsrvd3:2;
305         uint8_t bypass_rv_idx0:1,
306                 bypass_rv_idx1:1,
307                 bypass_rm:1,
308                 rsrvd4:5;
309         uint8_t rsrvd5:1,
310                 rsrvd6:3,
311                 code_block_crc:1,
312                 rsrvd7:3;
313         uint8_t code_block_mode:1,
314                 rsrvd8:7;
315         uint64_t rsrvd9;
316 };
317
318 /* FEC 5GNR Downlink Frame Control Word */
319 struct __rte_packed acc100_fcw_le {
320         uint32_t FCWversion:4,
321                 qm:4,
322                 nfiller:11,
323                 BG:1,
324                 Zc:9,
325                 res0:3;
326         uint32_t ncb:16,
327                 k0:16;
328         uint32_t rm_e:24,
329                 res1:2,
330                 crc_select:1,
331                 res2:1,
332                 bypass_intlv:1,
333                 res3:3;
334         uint32_t res4_a:12,
335                 mcb_count:3,
336                 res4_b:17;
337         uint32_t res5;
338         uint32_t res6;
339         uint32_t res7;
340         uint32_t res8;
341 };
342
343 /* ACC100 DMA Request Descriptor */
344 struct __rte_packed acc100_dma_req_desc {
345         union {
346                 struct{
347                         uint32_t type:4,
348                                 rsrvd0:26,
349                                 sdone:1,
350                                 fdone:1;
351                         uint32_t rsrvd1;
352                         uint32_t rsrvd2;
353                         uint32_t pass_param:8,
354                                 sdone_enable:1,
355                                 irq_enable:1,
356                                 timeStampEn:1,
357                                 res0:5,
358                                 numCBs:4,
359                                 res1:4,
360                                 m2dlen:4,
361                                 d2mlen:4;
362                 };
363                 struct{
364                         uint32_t word0;
365                         uint32_t word1;
366                         uint32_t word2;
367                         uint32_t word3;
368                 };
369         };
370         struct acc100_dma_triplet data_ptrs[ACC100_DMA_MAX_NUM_POINTERS];
371
372         /* Virtual addresses used to retrieve SW context info */
373         union {
374                 void *op_addr;
375                 uint64_t pad1;  /* pad to 64 bits */
376         };
377         /*
378          * Stores additional information needed for driver processing:
379          * - last_desc_in_batch - flag used to mark last descriptor (CB)
380          *                        in batch
381          * - cbs_in_tb - stores information about total number of Code Blocks
382          *               in currently processed Transport Block
383          */
384         union {
385                 struct {
386                         union {
387                                 struct acc100_fcw_ld fcw_ld;
388                                 struct acc100_fcw_td fcw_td;
389                                 struct acc100_fcw_le fcw_le;
390                                 struct acc100_fcw_te fcw_te;
391                                 uint32_t pad2[ACC100_FCW_PADDING];
392                         };
393                         uint32_t last_desc_in_batch :8,
394                                 cbs_in_tb:8,
395                                 pad4 : 16;
396                 };
397                 uint64_t pad3[ACC100_DMA_DESC_PADDING]; /* pad to 64 bits */
398         };
399 };
400
401 /* ACC100 DMA Descriptor */
402 union acc100_dma_desc {
403         struct acc100_dma_req_desc req;
404         union acc100_dma_rsp_desc rsp;
405 };
406
407
408 /* Union describing Info Ring entry */
409 union acc100_harq_layout_data {
410         uint32_t val;
411         struct {
412                 uint16_t offset;
413                 uint16_t size0;
414         };
415 } __rte_packed;
416
417
418 /* Union describing Info Ring entry */
419 union acc100_info_ring_data {
420         uint32_t val;
421         struct {
422                 union {
423                         uint16_t detailed_info;
424                         struct {
425                                 uint16_t aq_id: 4;
426                                 uint16_t qg_id: 4;
427                                 uint16_t vf_id: 6;
428                                 uint16_t reserved: 2;
429                         };
430                 };
431                 uint16_t int_nb: 7;
432                 uint16_t msi_0: 1;
433                 uint16_t vf2pf: 6;
434                 uint16_t loop: 1;
435                 uint16_t valid: 1;
436         };
437 } __rte_packed;
438
439 struct acc100_registry_addr {
440         unsigned int dma_ring_dl5g_hi;
441         unsigned int dma_ring_dl5g_lo;
442         unsigned int dma_ring_ul5g_hi;
443         unsigned int dma_ring_ul5g_lo;
444         unsigned int dma_ring_dl4g_hi;
445         unsigned int dma_ring_dl4g_lo;
446         unsigned int dma_ring_ul4g_hi;
447         unsigned int dma_ring_ul4g_lo;
448         unsigned int ring_size;
449         unsigned int info_ring_hi;
450         unsigned int info_ring_lo;
451         unsigned int info_ring_en;
452         unsigned int info_ring_ptr;
453         unsigned int tail_ptrs_dl5g_hi;
454         unsigned int tail_ptrs_dl5g_lo;
455         unsigned int tail_ptrs_ul5g_hi;
456         unsigned int tail_ptrs_ul5g_lo;
457         unsigned int tail_ptrs_dl4g_hi;
458         unsigned int tail_ptrs_dl4g_lo;
459         unsigned int tail_ptrs_ul4g_hi;
460         unsigned int tail_ptrs_ul4g_lo;
461         unsigned int depth_log0_offset;
462         unsigned int depth_log1_offset;
463         unsigned int qman_group_func;
464         unsigned int ddr_range;
465 };
466
467 /* Structure holding registry addresses for PF */
468 static const struct acc100_registry_addr pf_reg_addr = {
469         .dma_ring_dl5g_hi = HWPfDmaFec5GdlDescBaseHiRegVf,
470         .dma_ring_dl5g_lo = HWPfDmaFec5GdlDescBaseLoRegVf,
471         .dma_ring_ul5g_hi = HWPfDmaFec5GulDescBaseHiRegVf,
472         .dma_ring_ul5g_lo = HWPfDmaFec5GulDescBaseLoRegVf,
473         .dma_ring_dl4g_hi = HWPfDmaFec4GdlDescBaseHiRegVf,
474         .dma_ring_dl4g_lo = HWPfDmaFec4GdlDescBaseLoRegVf,
475         .dma_ring_ul4g_hi = HWPfDmaFec4GulDescBaseHiRegVf,
476         .dma_ring_ul4g_lo = HWPfDmaFec4GulDescBaseLoRegVf,
477         .ring_size = HWPfQmgrRingSizeVf,
478         .info_ring_hi = HWPfHiInfoRingBaseHiRegPf,
479         .info_ring_lo = HWPfHiInfoRingBaseLoRegPf,
480         .info_ring_en = HWPfHiInfoRingIntWrEnRegPf,
481         .info_ring_ptr = HWPfHiInfoRingPointerRegPf,
482         .tail_ptrs_dl5g_hi = HWPfDmaFec5GdlRespPtrHiRegVf,
483         .tail_ptrs_dl5g_lo = HWPfDmaFec5GdlRespPtrLoRegVf,
484         .tail_ptrs_ul5g_hi = HWPfDmaFec5GulRespPtrHiRegVf,
485         .tail_ptrs_ul5g_lo = HWPfDmaFec5GulRespPtrLoRegVf,
486         .tail_ptrs_dl4g_hi = HWPfDmaFec4GdlRespPtrHiRegVf,
487         .tail_ptrs_dl4g_lo = HWPfDmaFec4GdlRespPtrLoRegVf,
488         .tail_ptrs_ul4g_hi = HWPfDmaFec4GulRespPtrHiRegVf,
489         .tail_ptrs_ul4g_lo = HWPfDmaFec4GulRespPtrLoRegVf,
490         .depth_log0_offset = HWPfQmgrGrpDepthLog20Vf,
491         .depth_log1_offset = HWPfQmgrGrpDepthLog21Vf,
492         .qman_group_func = HWPfQmgrGrpFunction0,
493         .ddr_range = HWPfDmaVfDdrBaseRw,
494 };
495
496 /* Structure holding registry addresses for VF */
497 static const struct acc100_registry_addr vf_reg_addr = {
498         .dma_ring_dl5g_hi = HWVfDmaFec5GdlDescBaseHiRegVf,
499         .dma_ring_dl5g_lo = HWVfDmaFec5GdlDescBaseLoRegVf,
500         .dma_ring_ul5g_hi = HWVfDmaFec5GulDescBaseHiRegVf,
501         .dma_ring_ul5g_lo = HWVfDmaFec5GulDescBaseLoRegVf,
502         .dma_ring_dl4g_hi = HWVfDmaFec4GdlDescBaseHiRegVf,
503         .dma_ring_dl4g_lo = HWVfDmaFec4GdlDescBaseLoRegVf,
504         .dma_ring_ul4g_hi = HWVfDmaFec4GulDescBaseHiRegVf,
505         .dma_ring_ul4g_lo = HWVfDmaFec4GulDescBaseLoRegVf,
506         .ring_size = HWVfQmgrRingSizeVf,
507         .info_ring_hi = HWVfHiInfoRingBaseHiVf,
508         .info_ring_lo = HWVfHiInfoRingBaseLoVf,
509         .info_ring_en = HWVfHiInfoRingIntWrEnVf,
510         .info_ring_ptr = HWVfHiInfoRingPointerVf,
511         .tail_ptrs_dl5g_hi = HWVfDmaFec5GdlRespPtrHiRegVf,
512         .tail_ptrs_dl5g_lo = HWVfDmaFec5GdlRespPtrLoRegVf,
513         .tail_ptrs_ul5g_hi = HWVfDmaFec5GulRespPtrHiRegVf,
514         .tail_ptrs_ul5g_lo = HWVfDmaFec5GulRespPtrLoRegVf,
515         .tail_ptrs_dl4g_hi = HWVfDmaFec4GdlRespPtrHiRegVf,
516         .tail_ptrs_dl4g_lo = HWVfDmaFec4GdlRespPtrLoRegVf,
517         .tail_ptrs_ul4g_hi = HWVfDmaFec4GulRespPtrHiRegVf,
518         .tail_ptrs_ul4g_lo = HWVfDmaFec4GulRespPtrLoRegVf,
519         .depth_log0_offset = HWVfQmgrGrpDepthLog20Vf,
520         .depth_log1_offset = HWVfQmgrGrpDepthLog21Vf,
521         .qman_group_func = HWVfQmgrGrpFunction0Vf,
522         .ddr_range = HWVfDmaDdrBaseRangeRoVf,
523 };
524
525 /* Structure associated with each queue. */
526 struct __rte_cache_aligned acc100_queue {
527         union acc100_dma_desc *ring_addr;  /* Virtual address of sw ring */
528         rte_iova_t ring_addr_iova;  /* IOVA address of software ring */
529         uint32_t sw_ring_head;  /* software ring head */
530         uint32_t sw_ring_tail;  /* software ring tail */
531         /* software ring size (descriptors, not bytes) */
532         uint32_t sw_ring_depth;
533         /* mask used to wrap enqueued descriptors on the sw ring */
534         uint32_t sw_ring_wrap_mask;
535         /* MMIO register used to enqueue descriptors */
536         void *mmio_reg_enqueue;
537         uint8_t vf_id;  /* VF ID (max = 63) */
538         uint8_t qgrp_id;  /* Queue Group ID */
539         uint16_t aq_id;  /* Atomic Queue ID */
540         uint16_t aq_depth;  /* Depth of atomic queue */
541         uint32_t aq_enqueued;  /* Count how many "batches" have been enqueued */
542         uint32_t aq_dequeued;  /* Count how many "batches" have been dequeued */
543         uint32_t irq_enable;  /* Enable ops dequeue interrupts if set to 1 */
544         struct rte_mempool *fcw_mempool;  /* FCW mempool */
545         enum rte_bbdev_op_type op_type;  /* Type of this Queue: TE or TD */
546         /* Internal Buffers for loopback input */
547         uint8_t *lb_in;
548         uint8_t *lb_out;
549         rte_iova_t lb_in_addr_iova;
550         rte_iova_t lb_out_addr_iova;
551         struct acc100_device *d;
552 };
553
554 /* Private data structure for each ACC100 device */
555 struct acc100_device {
556         void *mmio_base;  /**< Base address of MMIO registers (BAR0) */
557         void *sw_rings_base;  /* Base addr of un-aligned memory for sw rings */
558         void *sw_rings;  /* 64MBs of 64MB aligned memory for sw rings */
559         rte_iova_t sw_rings_iova;  /* IOVA address of sw_rings */
560         /* Virtual address of the info memory routed to the this function under
561          * operation, whether it is PF or VF.
562          */
563         union acc100_harq_layout_data *harq_layout;
564         uint32_t sw_ring_size;
565         uint32_t ddr_size; /* Size in kB */
566         uint32_t *tail_ptrs; /* Base address of response tail pointer buffer */
567         rte_iova_t tail_ptr_iova; /* IOVA address of tail pointers */
568         /* Max number of entries available for each queue in device, depending
569          * on how many queues are enabled with configure()
570          */
571         uint32_t sw_ring_max_depth;
572         struct rte_acc100_conf acc100_conf; /* ACC100 Initial configuration */
573         /* Bitmap capturing which Queues have already been assigned */
574         uint16_t q_assigned_bit_map[ACC100_NUM_QGRPS];
575         bool pf_device; /**< True if this is a PF ACC100 device */
576         bool configured; /**< True if this ACC100 device is configured */
577 };
578
579 #endif /* _RTE_ACC100_PMD_H_ */