e28d049909ac2b134141abaf3815f271514b8cce
[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 /* Structure to store the protocol fields */
21 #define RTE_PARSER_FLOW_HDR_FIELD_SIZE          16
22 struct ulp_rte_hdr_field {
23         uint8_t         spec[RTE_PARSER_FLOW_HDR_FIELD_SIZE];
24         uint8_t         mask[RTE_PARSER_FLOW_HDR_FIELD_SIZE];
25         uint32_t        size;
26 };
27
28 struct ulp_rte_act_bitmap {
29         uint64_t        bits;
30 };
31
32 /*
33  * Structure to hold the action property details.
34  * It is a array of 128 bytes.
35  */
36 struct ulp_rte_act_prop {
37         uint8_t act_details[BNXT_ULP_ACT_PROP_IDX_LAST];
38 };
39
40 /* Device specific parameters */
41 struct bnxt_ulp_device_params {
42         uint8_t                         description[16];
43         uint32_t                        global_fid_enable;
44         enum bnxt_ulp_byte_order        byte_order;
45         uint8_t                         encap_byte_swap;
46         uint32_t                        lfid_entries;
47         uint32_t                        lfid_entry_size;
48         uint64_t                        gfid_entries;
49         uint32_t                        gfid_entry_size;
50         uint64_t                        num_flows;
51         uint32_t                        num_resources_per_flow;
52 };
53
54 struct bnxt_ulp_mapper_class_tbl_info {
55         enum bnxt_ulp_resource_func     resource_func;
56         uint32_t        table_type;
57         uint8_t         direction;
58         uint8_t         mem;
59         uint32_t        priority;
60         uint8_t         srch_b4_alloc;
61         uint32_t        critical_resource;
62
63         /* Information for accessing the ulp_key_field_list */
64         uint32_t        key_start_idx;
65         uint16_t        key_bit_size;
66         uint16_t        key_num_fields;
67         /* Size of the blob that holds the key */
68         uint16_t        blob_key_bit_size;
69
70         /* Information for accessing the ulp_class_result_field_list */
71         uint32_t        result_start_idx;
72         uint16_t        result_bit_size;
73         uint16_t        result_num_fields;
74
75         /* Information for accessing the ulp_ident_list */
76         uint32_t        ident_start_idx;
77         uint16_t        ident_nums;
78
79         uint8_t         mark_enable;
80         enum bnxt_ulp_regfile_index     regfile_wr_idx;
81 };
82
83 struct bnxt_ulp_mapper_act_tbl_info {
84         enum bnxt_ulp_resource_func     resource_func;
85         enum tf_tbl_type table_type;
86         uint8_t         direction;
87         uint8_t         srch_b4_alloc;
88         uint32_t        result_start_idx;
89         uint16_t        result_bit_size;
90         uint16_t        encap_num_fields;
91         uint16_t        result_num_fields;
92
93         enum bnxt_ulp_regfile_index     regfile_wr_idx;
94 };
95
96 struct bnxt_ulp_mapper_class_key_field_info {
97         uint8_t                 name[64];
98         enum bnxt_ulp_mask_opc  mask_opcode;
99         enum bnxt_ulp_spec_opc  spec_opcode;
100         uint16_t                field_bit_size;
101         uint8_t                 mask_operand[16];
102         uint8_t                 spec_operand[16];
103 };
104
105 struct bnxt_ulp_mapper_result_field_info {
106         uint8_t                         name[64];
107         enum bnxt_ulp_result_opc        result_opcode;
108         uint16_t                        field_bit_size;
109         uint8_t                         result_operand[16];
110 };
111
112 struct bnxt_ulp_mapper_ident_info {
113         uint8_t         name[64];
114         uint32_t        resource_func;
115
116         uint16_t        ident_type;
117         uint16_t        ident_bit_size;
118         uint16_t        ident_bit_pos;
119         enum bnxt_ulp_regfile_index     regfile_wr_idx;
120 };
121
122 /*
123  * Flow Mapper Static Data Externs:
124  * Access to the below static data should be done through access functions and
125  * directly throughout the code.
126  */
127
128 /*
129  * The ulp_device_params is indexed by the dev_id.
130  * This table maintains the device specific parameters.
131  */
132 extern struct bnxt_ulp_device_params ulp_device_params[];
133
134 /*
135  * The ulp_data_field_list provides the instructions for creating an action
136  * records such as tcam/em results.
137  */
138 extern struct bnxt_ulp_mapper_result_field_info ulp_class_result_field_list[];
139
140 /*
141  * The ulp_data_field_list provides the instructions for creating an action
142  * record.  It uses the same structure as the result list, but is only used for
143  * actions.
144  */
145 extern
146 struct bnxt_ulp_mapper_result_field_info ulp_act_result_field_list[];
147
148 /*
149  * The ulp_act_prop_map_table provides the mapping to index and size of action
150  * tcam and em tables.
151  */
152 extern
153 struct bnxt_ulp_mapper_class_key_field_info     ulp_class_key_field_list[];
154
155 /*
156  * The ulp_ident_list provides the instructions for creating identifiers such
157  * as profile ids.
158  */
159 extern struct bnxt_ulp_mapper_ident_info        ulp_ident_list[];
160
161 /*
162  * The ulp_act_prop_map_table provides the mapping to index and size of action
163  * properties.
164  */
165 extern uint32_t ulp_act_prop_map_table[];
166
167 #endif /* _ULP_TEMPLATE_STRUCT_H_ */