b7094c539799b19699fc974e820f38d27a7589d7
[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 ulp_rte_act_bitmap {
33         uint64_t        bits;
34 };
35
36 /*
37  * Structure to hold the action property details.
38  * It is a array of 128 bytes.
39  */
40 struct ulp_rte_act_prop {
41         uint8_t act_details[BNXT_ULP_ACT_PROP_IDX_LAST];
42 };
43
44 /* Device specific parameters */
45 struct bnxt_ulp_device_params {
46         uint8_t                         description[16];
47         uint32_t                        global_fid_enable;
48         enum bnxt_ulp_byte_order        byte_order;
49         uint8_t                         encap_byte_swap;
50         uint32_t                        lfid_entries;
51         uint32_t                        lfid_entry_size;
52         uint64_t                        gfid_entries;
53         uint32_t                        gfid_entry_size;
54         uint64_t                        num_flows;
55         uint32_t                        num_resources_per_flow;
56 };
57
58 /* Flow Mapper */
59 struct bnxt_ulp_mapper_tbl_list_info {
60         uint32_t        device_name;
61         uint32_t        start_tbl_idx;
62         uint32_t        num_tbls;
63 };
64
65 struct bnxt_ulp_mapper_class_tbl_info {
66         enum bnxt_ulp_resource_func     resource_func;
67         uint32_t        table_type;
68         uint8_t         direction;
69         uint8_t         mem;
70         uint32_t        priority;
71         uint8_t         srch_b4_alloc;
72         uint32_t        critical_resource;
73
74         /* Information for accessing the ulp_key_field_list */
75         uint32_t        key_start_idx;
76         uint16_t        key_bit_size;
77         uint16_t        key_num_fields;
78         /* Size of the blob that holds the key */
79         uint16_t        blob_key_bit_size;
80
81         /* Information for accessing the ulp_class_result_field_list */
82         uint32_t        result_start_idx;
83         uint16_t        result_bit_size;
84         uint16_t        result_num_fields;
85
86         /* Information for accessing the ulp_ident_list */
87         uint32_t        ident_start_idx;
88         uint16_t        ident_nums;
89
90         uint8_t         mark_enable;
91         enum bnxt_ulp_regfile_index     regfile_wr_idx;
92 };
93
94 struct bnxt_ulp_mapper_act_tbl_info {
95         enum bnxt_ulp_resource_func     resource_func;
96         enum tf_tbl_type table_type;
97         uint8_t         direction;
98         uint8_t         srch_b4_alloc;
99         uint32_t        result_start_idx;
100         uint16_t        result_bit_size;
101         uint16_t        encap_num_fields;
102         uint16_t        result_num_fields;
103
104         enum bnxt_ulp_regfile_index     regfile_wr_idx;
105 };
106
107 struct bnxt_ulp_mapper_class_key_field_info {
108         uint8_t                 name[64];
109         enum bnxt_ulp_mask_opc  mask_opcode;
110         enum bnxt_ulp_spec_opc  spec_opcode;
111         uint16_t                field_bit_size;
112         uint8_t                 mask_operand[16];
113         uint8_t                 spec_operand[16];
114 };
115
116 struct bnxt_ulp_mapper_result_field_info {
117         uint8_t                         name[64];
118         enum bnxt_ulp_result_opc        result_opcode;
119         uint16_t                        field_bit_size;
120         uint8_t                         result_operand[16];
121 };
122
123 struct bnxt_ulp_mapper_ident_info {
124         uint8_t         name[64];
125         uint32_t        resource_func;
126
127         uint16_t        ident_type;
128         uint16_t        ident_bit_size;
129         uint16_t        ident_bit_pos;
130         enum bnxt_ulp_regfile_index     regfile_wr_idx;
131 };
132
133 /*
134  * Flow Mapper Static Data Externs:
135  * Access to the below static data should be done through access functions and
136  * directly throughout the code.
137  */
138
139 /*
140  * The ulp_device_params is indexed by the dev_id.
141  * This table maintains the device specific parameters.
142  */
143 extern struct bnxt_ulp_device_params ulp_device_params[];
144
145 /*
146  * The ulp_class_tmpl_list and ulp_act_tmpl_list are indexed by the dev_id
147  * and template id (either class or action) returned by the matcher.
148  * The result provides the start index and number of entries in the connected
149  * ulp_class_tbl_list/ulp_act_tbl_list.
150  */
151 extern struct bnxt_ulp_mapper_tbl_list_info     ulp_class_tmpl_list[];
152 extern struct bnxt_ulp_mapper_tbl_list_info     ulp_act_tmpl_list[];
153
154 /*
155  * The ulp_class_tbl_list and ulp_act_tbl_list are indexed based on the results
156  * of the template lists.  Each entry describes the high level details of the
157  * table entry to include the start index and number of instructions in the
158  * field lists.
159  */
160 extern struct bnxt_ulp_mapper_class_tbl_info    ulp_class_tbl_list[];
161 extern struct bnxt_ulp_mapper_act_tbl_info      ulp_act_tbl_list[];
162
163 /*
164  * The ulp_class_result_field_list provides the instructions for creating result
165  * records such as tcam/em results.
166  */
167 extern struct bnxt_ulp_mapper_result_field_info ulp_class_result_field_list[];
168
169 /*
170  * The ulp_data_field_list provides the instructions for creating an action
171  * record.  It uses the same structure as the result list, but is only used for
172  * actions.
173  */
174 extern
175 struct bnxt_ulp_mapper_result_field_info ulp_act_result_field_list[];
176
177 /*
178  * The ulp_act_prop_map_table provides the mapping to index and size of action
179  * tcam and em tables.
180  */
181 extern
182 struct bnxt_ulp_mapper_class_key_field_info     ulp_class_key_field_list[];
183
184 /*
185  * The ulp_ident_list provides the instructions for creating identifiers such
186  * as profile ids.
187  */
188 extern struct bnxt_ulp_mapper_ident_info        ulp_ident_list[];
189
190 /*
191  * The ulp_act_prop_map_table provides the mapping to index and size of action
192  * properties.
193  */
194 extern uint32_t ulp_act_prop_map_table[];
195
196 #endif /* _ULP_TEMPLATE_STRUCT_H_ */