1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2014-2019 Broadcom
6 #ifndef _ULP_TEMPLATE_STRUCT_H_
7 #define _ULP_TEMPLATE_STRUCT_H_
10 #include "rte_ether.h"
20 /* Number of fields for each protocol */
21 #define BNXT_ULP_PROTO_HDR_SVIF_NUM 1
22 #define BNXT_ULP_PROTO_HDR_ETH_NUM 3
23 #define BNXT_ULP_PROTO_HDR_S_VLAN_NUM 3
24 #define BNXT_ULP_PROTO_HDR_VLAN_NUM 6
25 #define BNXT_ULP_PROTO_HDR_IPV4_NUM 10
26 #define BNXT_ULP_PROTO_HDR_IPV6_NUM 6
27 #define BNXT_ULP_PROTO_HDR_UDP_NUM 4
28 #define BNXT_ULP_PROTO_HDR_TCP_NUM 9
29 #define BNXT_ULP_PROTO_HDR_VXLAN_NUM 4
30 #define BNXT_ULP_PROTO_HDR_MAX 128
32 struct ulp_rte_hdr_bitmap {
36 /* Structure to store the protocol fields */
37 #define RTE_PARSER_FLOW_HDR_FIELD_SIZE 16
38 struct ulp_rte_hdr_field {
39 uint8_t spec[RTE_PARSER_FLOW_HDR_FIELD_SIZE];
40 uint8_t mask[RTE_PARSER_FLOW_HDR_FIELD_SIZE];
44 /* Flow Parser Header Information Structure */
45 struct bnxt_ulp_rte_hdr_info {
46 enum bnxt_ulp_hdr_type hdr_type;
47 /* Flow Parser Protocol Header Function Prototype */
48 int (*proto_hdr_func)(const struct rte_flow_item *item_list,
49 struct ulp_rte_hdr_bitmap *hdr_bitmap,
50 struct ulp_rte_hdr_field *hdr_field,
55 /* Flow Parser Header Information Structure Array defined in template source*/
56 extern struct bnxt_ulp_rte_hdr_info ulp_hdr_info[];
58 struct bnxt_ulp_matcher_field_info {
59 enum bnxt_ulp_fmf_mask mask_opcode;
60 enum bnxt_ulp_fmf_spec spec_opcode;
63 struct ulp_rte_act_bitmap {
68 * Structure to hold the action property details.
69 * It is a array of 128 bytes.
71 struct ulp_rte_act_prop {
72 uint8_t act_details[BNXT_ULP_ACT_PROP_IDX_LAST];
75 /* Flow Matcher structures */
76 struct bnxt_ulp_header_match_info {
77 struct ulp_rte_hdr_bitmap hdr_bitmap;
80 uint32_t class_tmpl_id;
84 /* Flow Matcher templates Structure Array defined in template source*/
85 extern struct bnxt_ulp_header_match_info ulp_ingress_hdr_match_list[];
86 extern struct bnxt_ulp_header_match_info ulp_egress_hdr_match_list[];
88 /* Flow field match Information Structure Array defined in template source*/
89 extern struct bnxt_ulp_matcher_field_info ulp_field_match[];
91 /* Flow Matcher Action structures */
92 struct bnxt_ulp_action_match_info {
93 struct ulp_rte_act_bitmap act_bitmap;
97 /* Flow Matcher templates Structure Array defined in template source */
98 extern struct bnxt_ulp_action_match_info ulp_ingress_act_match_list[];
99 extern struct bnxt_ulp_action_match_info ulp_egress_act_match_list[];
101 /* Device specific parameters */
102 struct bnxt_ulp_device_params {
103 uint8_t description[16];
104 uint32_t global_fid_enable;
105 enum bnxt_ulp_byte_order byte_order;
106 uint8_t encap_byte_swap;
107 uint32_t lfid_entries;
108 uint32_t lfid_entry_size;
109 uint64_t gfid_entries;
110 uint32_t gfid_entry_size;
112 uint32_t num_resources_per_flow;
116 struct bnxt_ulp_mapper_tbl_list_info {
117 uint32_t device_name;
118 uint32_t start_tbl_idx;
122 struct bnxt_ulp_mapper_class_tbl_info {
123 enum bnxt_ulp_resource_func resource_func;
128 uint8_t srch_b4_alloc;
129 uint32_t critical_resource;
131 /* Information for accessing the ulp_key_field_list */
132 uint32_t key_start_idx;
133 uint16_t key_bit_size;
134 uint16_t key_num_fields;
135 /* Size of the blob that holds the key */
136 uint16_t blob_key_bit_size;
138 /* Information for accessing the ulp_class_result_field_list */
139 uint32_t result_start_idx;
140 uint16_t result_bit_size;
141 uint16_t result_num_fields;
143 /* Information for accessing the ulp_ident_list */
144 uint32_t ident_start_idx;
148 enum bnxt_ulp_regfile_index regfile_wr_idx;
151 struct bnxt_ulp_mapper_act_tbl_info {
152 enum bnxt_ulp_resource_func resource_func;
153 enum tf_tbl_type table_type;
155 uint8_t srch_b4_alloc;
156 uint32_t result_start_idx;
157 uint16_t result_bit_size;
158 uint16_t encap_num_fields;
159 uint16_t result_num_fields;
161 enum bnxt_ulp_regfile_index regfile_wr_idx;
164 struct bnxt_ulp_mapper_class_key_field_info {
166 enum bnxt_ulp_mask_opc mask_opcode;
167 enum bnxt_ulp_spec_opc spec_opcode;
168 uint16_t field_bit_size;
169 uint8_t mask_operand[16];
170 uint8_t spec_operand[16];
173 struct bnxt_ulp_mapper_result_field_info {
175 enum bnxt_ulp_result_opc result_opcode;
176 uint16_t field_bit_size;
177 uint8_t result_operand[16];
180 struct bnxt_ulp_mapper_ident_info {
182 uint32_t resource_func;
185 uint16_t ident_bit_size;
186 uint16_t ident_bit_pos;
187 enum bnxt_ulp_regfile_index regfile_wr_idx;
191 * Flow Mapper Static Data Externs:
192 * Access to the below static data should be done through access functions and
193 * directly throughout the code.
197 * The ulp_device_params is indexed by the dev_id.
198 * This table maintains the device specific parameters.
200 extern struct bnxt_ulp_device_params ulp_device_params[];
203 * The ulp_class_tmpl_list and ulp_act_tmpl_list are indexed by the dev_id
204 * and template id (either class or action) returned by the matcher.
205 * The result provides the start index and number of entries in the connected
206 * ulp_class_tbl_list/ulp_act_tbl_list.
208 extern struct bnxt_ulp_mapper_tbl_list_info ulp_class_tmpl_list[];
209 extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_tmpl_list[];
212 * The ulp_class_tbl_list and ulp_act_tbl_list are indexed based on the results
213 * of the template lists. Each entry describes the high level details of the
214 * table entry to include the start index and number of instructions in the
217 extern struct bnxt_ulp_mapper_class_tbl_info ulp_class_tbl_list[];
218 extern struct bnxt_ulp_mapper_act_tbl_info ulp_act_tbl_list[];
221 * The ulp_class_result_field_list provides the instructions for creating result
222 * records such as tcam/em results.
224 extern struct bnxt_ulp_mapper_result_field_info ulp_class_result_field_list[];
227 * The ulp_data_field_list provides the instructions for creating an action
228 * record. It uses the same structure as the result list, but is only used for
232 struct bnxt_ulp_mapper_result_field_info ulp_act_result_field_list[];
235 * The ulp_act_prop_map_table provides the mapping to index and size of action
236 * tcam and em tables.
239 struct bnxt_ulp_mapper_class_key_field_info ulp_class_key_field_list[];
242 * The ulp_ident_list provides the instructions for creating identifiers such
245 extern struct bnxt_ulp_mapper_ident_info ulp_ident_list[];
248 * The ulp_act_prop_map_table provides the mapping to index and size of action
251 extern uint32_t ulp_act_prop_map_table[];
253 #endif /* _ULP_TEMPLATE_STRUCT_H_ */