dd06fb12f05d01b0ac6956e1244bc4f055682070
[dpdk.git] / drivers / net / bnxt / tf_ulp / ulp_template_struct.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2019 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _ULP_TEMPLATE_STRUCT_H_
7 #define _ULP_TEMPLATE_STRUCT_H_
8
9 #include <stdint.h>
10 #include "rte_ether.h"
11 #include "rte_icmp.h"
12 #include "rte_ip.h"
13 #include "rte_tcp.h"
14 #include "rte_udp.h"
15 #include "rte_esp.h"
16 #include "rte_sctp.h"
17 #include "rte_flow.h"
18 #include "tf_core.h"
19
20 struct ulp_rte_hdr_bitmap {
21         uint64_t        bits;
22 };
23
24 /* Structure to store the protocol fields */
25 #define RTE_PARSER_FLOW_HDR_FIELD_SIZE          16
26 struct ulp_rte_hdr_field {
27         uint8_t         spec[RTE_PARSER_FLOW_HDR_FIELD_SIZE];
28         uint8_t         mask[RTE_PARSER_FLOW_HDR_FIELD_SIZE];
29         uint32_t        size;
30 };
31
32 struct bnxt_ulp_matcher_field_info {
33         enum bnxt_ulp_fmf_mask  mask_opcode;
34         enum bnxt_ulp_fmf_spec  spec_opcode;
35 };
36
37 struct ulp_rte_act_bitmap {
38         uint64_t        bits;
39 };
40
41 /*
42  * Structure to hold the action property details.
43  * It is a array of 128 bytes.
44  */
45 struct ulp_rte_act_prop {
46         uint8_t act_details[BNXT_ULP_ACT_PROP_IDX_LAST];
47 };
48
49 /* Flow Matcher structures */
50 struct bnxt_ulp_header_match_info {
51         struct ulp_rte_hdr_bitmap               hdr_bitmap;
52         uint32_t                                start_idx;
53         uint32_t                                num_entries;
54         uint32_t                                class_tmpl_id;
55         uint32_t                                act_vnic;
56 };
57
58 /* Flow Matcher templates Structure Array defined in template source*/
59 extern struct bnxt_ulp_header_match_info  ulp_ingress_hdr_match_list[];
60 extern struct bnxt_ulp_header_match_info  ulp_egress_hdr_match_list[];
61
62 /* Flow field match Information Structure Array defined in template source*/
63 extern struct bnxt_ulp_matcher_field_info       ulp_field_match[];
64
65 /* Device specific parameters */
66 struct bnxt_ulp_device_params {
67         uint8_t                         description[16];
68         uint32_t                        global_fid_enable;
69         enum bnxt_ulp_byte_order        byte_order;
70         uint8_t                         encap_byte_swap;
71         uint32_t                        lfid_entries;
72         uint32_t                        lfid_entry_size;
73         uint64_t                        gfid_entries;
74         uint32_t                        gfid_entry_size;
75         uint64_t                        num_flows;
76         uint32_t                        num_resources_per_flow;
77 };
78
79 /* Flow Mapper */
80 struct bnxt_ulp_mapper_tbl_list_info {
81         uint32_t        device_name;
82         uint32_t        start_tbl_idx;
83         uint32_t        num_tbls;
84 };
85
86 struct bnxt_ulp_mapper_class_tbl_info {
87         enum bnxt_ulp_resource_func     resource_func;
88         uint32_t        table_type;
89         uint8_t         direction;
90         uint8_t         mem;
91         uint32_t        priority;
92         uint8_t         srch_b4_alloc;
93         uint32_t        critical_resource;
94
95         /* Information for accessing the ulp_key_field_list */
96         uint32_t        key_start_idx;
97         uint16_t        key_bit_size;
98         uint16_t        key_num_fields;
99         /* Size of the blob that holds the key */
100         uint16_t        blob_key_bit_size;
101
102         /* Information for accessing the ulp_class_result_field_list */
103         uint32_t        result_start_idx;
104         uint16_t        result_bit_size;
105         uint16_t        result_num_fields;
106
107         /* Information for accessing the ulp_ident_list */
108         uint32_t        ident_start_idx;
109         uint16_t        ident_nums;
110
111         uint8_t         mark_enable;
112         enum bnxt_ulp_regfile_index     regfile_wr_idx;
113 };
114
115 struct bnxt_ulp_mapper_act_tbl_info {
116         enum bnxt_ulp_resource_func     resource_func;
117         enum tf_tbl_type table_type;
118         uint8_t         direction;
119         uint8_t         srch_b4_alloc;
120         uint32_t        result_start_idx;
121         uint16_t        result_bit_size;
122         uint16_t        encap_num_fields;
123         uint16_t        result_num_fields;
124
125         enum bnxt_ulp_regfile_index     regfile_wr_idx;
126 };
127
128 struct bnxt_ulp_mapper_class_key_field_info {
129         uint8_t                 name[64];
130         enum bnxt_ulp_mask_opc  mask_opcode;
131         enum bnxt_ulp_spec_opc  spec_opcode;
132         uint16_t                field_bit_size;
133         uint8_t                 mask_operand[16];
134         uint8_t                 spec_operand[16];
135 };
136
137 struct bnxt_ulp_mapper_result_field_info {
138         uint8_t                         name[64];
139         enum bnxt_ulp_result_opc        result_opcode;
140         uint16_t                        field_bit_size;
141         uint8_t                         result_operand[16];
142 };
143
144 struct bnxt_ulp_mapper_ident_info {
145         uint8_t         name[64];
146         uint32_t        resource_func;
147
148         uint16_t        ident_type;
149         uint16_t        ident_bit_size;
150         uint16_t        ident_bit_pos;
151         enum bnxt_ulp_regfile_index     regfile_wr_idx;
152 };
153
154 /*
155  * Flow Mapper Static Data Externs:
156  * Access to the below static data should be done through access functions and
157  * directly throughout the code.
158  */
159
160 /*
161  * The ulp_device_params is indexed by the dev_id.
162  * This table maintains the device specific parameters.
163  */
164 extern struct bnxt_ulp_device_params ulp_device_params[];
165
166 /*
167  * The ulp_class_tmpl_list and ulp_act_tmpl_list are indexed by the dev_id
168  * and template id (either class or action) returned by the matcher.
169  * The result provides the start index and number of entries in the connected
170  * ulp_class_tbl_list/ulp_act_tbl_list.
171  */
172 extern struct bnxt_ulp_mapper_tbl_list_info     ulp_class_tmpl_list[];
173 extern struct bnxt_ulp_mapper_tbl_list_info     ulp_act_tmpl_list[];
174
175 /*
176  * The ulp_class_tbl_list and ulp_act_tbl_list are indexed based on the results
177  * of the template lists.  Each entry describes the high level details of the
178  * table entry to include the start index and number of instructions in the
179  * field lists.
180  */
181 extern struct bnxt_ulp_mapper_class_tbl_info    ulp_class_tbl_list[];
182 extern struct bnxt_ulp_mapper_act_tbl_info      ulp_act_tbl_list[];
183
184 /*
185  * The ulp_class_result_field_list provides the instructions for creating result
186  * records such as tcam/em results.
187  */
188 extern struct bnxt_ulp_mapper_result_field_info ulp_class_result_field_list[];
189
190 /*
191  * The ulp_data_field_list provides the instructions for creating an action
192  * record.  It uses the same structure as the result list, but is only used for
193  * actions.
194  */
195 extern
196 struct bnxt_ulp_mapper_result_field_info ulp_act_result_field_list[];
197
198 /*
199  * The ulp_act_prop_map_table provides the mapping to index and size of action
200  * tcam and em tables.
201  */
202 extern
203 struct bnxt_ulp_mapper_class_key_field_info     ulp_class_key_field_list[];
204
205 /*
206  * The ulp_ident_list provides the instructions for creating identifiers such
207  * as profile ids.
208  */
209 extern struct bnxt_ulp_mapper_ident_info        ulp_ident_list[];
210
211 /*
212  * The ulp_act_prop_map_table provides the mapping to index and size of action
213  * properties.
214  */
215 extern uint32_t ulp_act_prop_map_table[];
216
217 #endif /* _ULP_TEMPLATE_STRUCT_H_ */