1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
10 #define REE_MAX_LFS 36
11 #define REE_MAX_QUEUES_PER_VF 36
12 #define REE_MAX_MATCHES_PER_VF 254
14 #define REE_MAX_PAYLOAD_SIZE (1 << 14)
16 #define REE_NON_INC_PROG 0
17 #define REE_INC_PROG 1
19 #define REE_MOD_INC(i, l) ((i) == (l - 1) ? (i) = 0 : (i)++)
25 struct plt_pci_device *pci_dev;
29 /**< Max queues supported */
31 /**< Number of regex queues attached */
33 /**< Max matches supported*/
34 uint16_t lf_msixoff[REE_MAX_LFS];
36 uint8_t block_address;
37 /**< REE Block Address */
38 uint8_t err_intr_registered : 1;
39 /**< Are error interrupts registered? */
41 #define ROC_REE_MEM_SZ (6 * 1024)
42 uint8_t reserved[ROC_REE_MEM_SZ] __plt_cache_aligned;
43 } __plt_cache_aligned;
47 /** Request id of a ree operation */
50 /**< IOVA address of the pattern to be matched. */
53 struct roc_ree_pending_queue {
54 uint64_t pending_count;
55 /** Pending requests count */
56 struct roc_ree_rid *rid_queue;
57 /** Array of pending requests */
59 /** Tail of queue to be used for enqueue */
61 /** Head of queue to be used for dequeue */
68 /**< Base address where BAR is mapped */
69 struct roc_ree_pending_queue pend_q;
71 rte_iova_t iq_dma_addr;
72 /**< Instruction queue address */
73 uint32_t roc_regexdev_jobid;
75 uint32_t write_offset;
83 uint64_t reserved_1_3 : 3;
85 uint64_t reserved_5_7 : 3;
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;
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;
109 int __roc_api roc_ree_dev_init(struct roc_ree_vf *vf);
110 int __roc_api roc_ree_dev_fini(struct roc_ree_vf *vf);
111 int __roc_api roc_ree_queues_attach(struct roc_ree_vf *vf, uint8_t nb_queues);
112 int __roc_api roc_ree_queues_detach(struct roc_ree_vf *vf);
113 int __roc_api roc_ree_msix_offsets_get(struct roc_ree_vf *vf);
114 int __roc_api roc_ree_config_lf(struct roc_ree_vf *vf, uint8_t lf, uint8_t pri,
116 int __roc_api roc_ree_af_reg_read(struct roc_ree_vf *vf, uint64_t reg,
118 int __roc_api roc_ree_af_reg_write(struct roc_ree_vf *vf, uint64_t reg,
120 int __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);
123 int __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);
126 int __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);
129 uintptr_t __roc_api roc_ree_qp_get_base(struct roc_ree_vf *vf, uint16_t qp_id);
130 void __roc_api roc_ree_err_intr_unregister(struct roc_ree_vf *vf);
131 int __roc_api roc_ree_err_intr_register(struct roc_ree_vf *vf);
132 int __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);
135 void __roc_api roc_ree_iq_disable(struct roc_ree_qp *qp);
137 #endif /* _ROC_REE_H_ */