1
2
3
4
5#ifndef _ROC_REE_H_
6#define _ROC_REE_H_
7
8#include "roc_api.h"
9
10#define REE_MAX_LFS 36
11#define REE_MAX_QUEUES_PER_VF 36
12#define REE_MAX_MATCHES_PER_VF 254
13
14#define REE_MAX_PAYLOAD_SIZE (1 << 14)
15
16#define REE_NON_INC_PROG 0
17#define REE_INC_PROG 1
18
19#define REE_MOD_INC(i, l) ((i) == (l - 1) ? (i) = 0 : (i)++)
20
21
22
23
24struct roc_ree_vf {
25 struct plt_pci_device *pci_dev;
26 struct dev *dev;
27
28 uint16_t max_queues;
29
30 uint8_t nb_queues;
31
32 uint16_t max_matches;
33
34 uint16_t lf_msixoff[REE_MAX_LFS];
35
36 uint8_t block_address;
37
38 uint8_t err_intr_registered : 1;
39
40
41#define ROC_REE_MEM_SZ (6 * 1024)
42 uint8_t reserved[ROC_REE_MEM_SZ] __plt_cache_aligned;
43} __plt_cache_aligned;
44
45struct roc_ree_rid {
46 uintptr_t rid;
47
48 uint64_t user_id;
49
50
51};
52
53struct roc_ree_pending_queue {
54 uint64_t pending_count;
55
56 struct roc_ree_rid *rid_queue;
57
58 uint16_t enq_tail;
59
60 uint16_t deq_head;
61
62};
63
64struct roc_ree_qp {
65 uint32_t id;
66
67 uintptr_t base;
68
69 struct roc_ree_pending_queue pend_q;
70
71 rte_iova_t iq_dma_addr;
72
73 uint32_t roc_regexdev_jobid;
74
75 uint32_t write_offset;
76
77};
78
79union roc_ree_inst {
80 uint64_t u[8];
81 struct {
82 uint64_t doneint : 1;
83 uint64_t reserved_1_3 : 3;
84 uint64_t dg : 1;
85 uint64_t reserved_5_7 : 3;
86 uint64_t ooj : 1;
87 uint64_t reserved_9_15 : 7;
88 uint64_t reserved_16_63 : 48;
89 uint64_t inp_ptr_addr : 64;
90 uint64_t inp_ptr_ctl : 64;
91 uint64_t res_ptr_addr : 64;
92 uint64_t wq_ptr : 64;
93 uint64_t tag : 32;
94 uint64_t tt : 2;
95 uint64_t ggrp : 10;
96 uint64_t reserved_364_383 : 20;
97 uint64_t reserved_384_391 : 8;
98 uint64_t ree_job_id : 24;
99 uint64_t ree_job_ctrl : 16;
100 uint64_t ree_job_length : 15;
101 uint64_t reserved_447_447 : 1;
102 uint64_t ree_job_subset_id_0 : 16;
103 uint64_t ree_job_subset_id_1 : 16;
104 uint64_t ree_job_subset_id_2 : 16;
105 uint64_t ree_job_subset_id_3 : 16;
106 } cn98xx;
107};
108
109int __roc_api roc_ree_dev_init(struct roc_ree_vf *vf);
110int __roc_api roc_ree_dev_fini(struct roc_ree_vf *vf);
111int __roc_api roc_ree_queues_attach(struct roc_ree_vf *vf, uint8_t nb_queues);
112int __roc_api roc_ree_queues_detach(struct roc_ree_vf *vf);
113int __roc_api roc_ree_msix_offsets_get(struct roc_ree_vf *vf);
114int __roc_api roc_ree_config_lf(struct roc_ree_vf *vf, uint8_t lf, uint8_t pri,
115 uint32_t size);
116int __roc_api roc_ree_af_reg_read(struct roc_ree_vf *vf, uint64_t reg,
117 uint64_t *val);
118int __roc_api roc_ree_af_reg_write(struct roc_ree_vf *vf, uint64_t reg,
119 uint64_t val);
120int __roc_api roc_ree_rule_db_get(struct roc_ree_vf *vf, char *rule_db,
121 uint32_t rule_db_len, char *rule_dbi,
122 uint32_t rule_dbi_len);
123int __roc_api roc_ree_rule_db_len_get(struct roc_ree_vf *vf,
124 uint32_t *rule_db_len,
125 uint32_t *rule_dbi_len);
126int __roc_api roc_ree_rule_db_prog(struct roc_ree_vf *vf, const char *rule_db,
127 uint32_t rule_db_len, const char *rule_dbi,
128 uint32_t rule_dbi_len);
129uintptr_t __roc_api roc_ree_qp_get_base(struct roc_ree_vf *vf, uint16_t qp_id);
130void __roc_api roc_ree_err_intr_unregister(struct roc_ree_vf *vf);
131int __roc_api roc_ree_err_intr_register(struct roc_ree_vf *vf);
132int __roc_api roc_ree_iq_enable(struct roc_ree_vf *vf,
133 const struct roc_ree_qp *qp, uint8_t pri,
134 uint32_t size_div128);
135void __roc_api roc_ree_iq_disable(struct roc_ree_qp *qp);
136
137#endif
138