net/bnxt: fix number of action records
[dpdk.git] / drivers / net / bnxt / tf_ulp / generic_templates / ulp_template_db_thor_act.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2021 Broadcom
3  * All rights reserved.
4  */
5
6 /* date: Thu May 13 18:15:56 2021 */
7
8 #include "ulp_template_db_enum.h"
9 #include "ulp_template_db_field.h"
10 #include "ulp_template_struct.h"
11 #include "ulp_template_db_tbl.h"
12
13 /* Mapper templates for header act list */
14 struct bnxt_ulp_mapper_tmpl_info ulp_thor_act_tmpl_list[] = {
15         /* act_tid: 1, ingress */
16         [1] = {
17         .device_name = BNXT_ULP_DEVICE_ID_THOR,
18         .num_tbls = 2,
19         .start_tbl_idx = 0,
20         .reject_info = {
21                 .cond_list_opcode = BNXT_ULP_COND_LIST_OPC_OR,
22                 .cond_start_idx = 0,
23                 .cond_nums = 4 }
24         }
25 };
26
27 struct bnxt_ulp_mapper_tbl_info ulp_thor_act_tbl_list[] = {
28         { /* act_tid: 1, , table: int_flow_counter_tbl.0 */
29         .resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
30         .resource_type = TF_TBL_TYPE_ACT_STATS_64,
31         .resource_sub_type =
32                 BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_INT_COUNT,
33         .direction = TF_DIR_RX,
34         .execute_info = {
35                 .cond_true_goto  = 1,
36                 .cond_false_goto = 1,
37                 .cond_list_opcode = BNXT_ULP_COND_LIST_OPC_AND,
38                 .cond_start_idx = 4,
39                 .cond_nums = 1 },
40         .tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_REGFILE,
41         .tbl_operand = BNXT_ULP_RF_IDX_FLOW_CNTR_PTR_0,
42         .fdb_opcode = BNXT_ULP_FDB_OPC_PUSH_FID,
43         .mark_db_opcode = BNXT_ULP_MARK_DB_OPC_NOP,
44         .byte_order = BNXT_ULP_BYTE_ORDER_LE,
45         .result_start_idx = 0,
46         .result_bit_size = 64,
47         .result_num_fields = 1
48         },
49         { /* act_tid: 1, , table: int_full_act_record.0 */
50         .resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
51         .resource_type = TF_TBL_TYPE_FULL_ACT_RECORD,
52         .resource_sub_type =
53                 BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_NORMAL,
54         .direction = TF_DIR_RX,
55         .execute_info = {
56                 .cond_true_goto  = 0,
57                 .cond_false_goto = 0,
58                 .cond_list_opcode = BNXT_ULP_COND_LIST_OPC_TRUE,
59                 .cond_start_idx = 5,
60                 .cond_nums = 0 },
61         .tbl_opcode = BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE,
62         .tbl_operand = BNXT_ULP_RF_IDX_MAIN_ACTION_PTR,
63         .fdb_opcode = BNXT_ULP_FDB_OPC_PUSH_FID,
64         .mark_db_opcode = BNXT_ULP_MARK_DB_OPC_NOP,
65         .byte_order = BNXT_ULP_BYTE_ORDER_LE,
66         .result_start_idx = 1,
67         .result_bit_size = 128,
68         .result_num_fields = 17
69         }
70 };
71
72 struct bnxt_ulp_mapper_cond_info ulp_thor_act_cond_list[] = {
73         /* cond_reject: thor, act_tid: 1 */
74         {
75         .cond_opcode = BNXT_ULP_COND_OPC_ACT_BIT_IS_SET,
76         .cond_operand = BNXT_ULP_ACT_BIT_POP_VLAN
77         },
78         {
79         .cond_opcode = BNXT_ULP_COND_OPC_ACT_BIT_IS_SET,
80         .cond_operand = BNXT_ULP_ACT_BIT_DEC_TTL
81         },
82         {
83         .cond_opcode = BNXT_ULP_COND_OPC_ACT_BIT_IS_SET,
84         .cond_operand = BNXT_ULP_ACT_BIT_VXLAN_DECAP
85         },
86         {
87         .cond_opcode = BNXT_ULP_COND_OPC_ACT_BIT_IS_SET,
88         .cond_operand = BNXT_ULP_ACT_BIT_SHARED_SAMPLE
89         },
90         /* cond_execute: act_tid: 1, int_flow_counter_tbl.0 */
91         {
92         .cond_opcode = BNXT_ULP_COND_OPC_ACT_BIT_IS_SET,
93         .cond_operand = BNXT_ULP_ACT_BIT_COUNT
94         }
95 };
96
97 struct bnxt_ulp_mapper_field_info ulp_thor_act_result_field_list[] = {
98         /* act_tid: 1, , table: int_flow_counter_tbl.0 */
99         {
100         .description = "count",
101         .field_bit_size = 64,
102         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
103         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
104         },
105         /* act_tid: 1, , table: int_full_act_record.0 */
106         {
107         .description = "sp_rec_ptr",
108         .field_bit_size = 16,
109         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
110         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
111         },
112         {
113         .description = "encap_ptr",
114         .field_bit_size = 16,
115         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
116         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
117         },
118         {
119         .description = "mod_rec_ptr",
120         .field_bit_size = 16,
121         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
122         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
123         },
124         {
125         .description = "rsvd1",
126         .field_bit_size = 16,
127         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
128         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
129         },
130         {
131         .description = "rsvd0",
132         .field_bit_size = 8,
133         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
134         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
135         },
136         {
137         .description = "decap_func",
138         .field_bit_size = 5,
139         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
140         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
141         },
142         {
143         .description = "meter",
144         .field_bit_size = 10,
145         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
146         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
147         },
148         {
149         .description = "stats_op",
150         .field_bit_size = 1,
151         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
152         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
153         },
154         {
155         .description = "stats_ptr",
156         .field_bit_size = 16,
157         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
158         .field_src1 = BNXT_ULP_FIELD_SRC_RF,
159         .field_opr1 = {
160         (BNXT_ULP_RF_IDX_FLOW_CNTR_PTR_0 >> 8) & 0xff,
161         BNXT_ULP_RF_IDX_FLOW_CNTR_PTR_0 & 0xff}
162         },
163         {
164         .description = "vnic_or_vport",
165         .field_bit_size = 11,
166         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
167         .field_src1 = BNXT_ULP_FIELD_SRC_ACT_PROP,
168         .field_opr1 = {
169         (BNXT_ULP_ACT_PROP_IDX_VNIC >> 8) & 0xff,
170         BNXT_ULP_ACT_PROP_IDX_VNIC & 0xff}
171         },
172         {
173         .description = "use_default",
174         .field_bit_size = 1,
175         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
176         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
177         },
178         {
179         .description = "mirror",
180         .field_bit_size = 4,
181         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
182         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
183         },
184         {
185         .description = "cond_copy",
186         .field_bit_size = 1,
187         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
188         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
189         },
190         {
191         .description = "vlan_del_rpt",
192         .field_bit_size = 2,
193         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
194         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
195         },
196         {
197         .description = "drop",
198         .field_bit_size = 1,
199         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
200         .field_src1 = BNXT_ULP_FIELD_SRC_ACT_BIT,
201         .field_opr1 = {
202         ((uint64_t)BNXT_ULP_ACT_BIT_DROP >> 56) & 0xff,
203         ((uint64_t)BNXT_ULP_ACT_BIT_DROP >> 48) & 0xff,
204         ((uint64_t)BNXT_ULP_ACT_BIT_DROP >> 40) & 0xff,
205         ((uint64_t)BNXT_ULP_ACT_BIT_DROP >> 32) & 0xff,
206         ((uint64_t)BNXT_ULP_ACT_BIT_DROP >> 24) & 0xff,
207         ((uint64_t)BNXT_ULP_ACT_BIT_DROP >> 16) & 0xff,
208         ((uint64_t)BNXT_ULP_ACT_BIT_DROP >> 8) & 0xff,
209         (uint64_t)BNXT_ULP_ACT_BIT_DROP & 0xff}
210         },
211         {
212         .description = "hit",
213         .field_bit_size = 1,
214         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
215         .field_src1 = BNXT_ULP_FIELD_SRC_ZERO
216         },
217         {
218         .description = "type",
219         .field_bit_size = 3,
220         .field_opc = BNXT_ULP_FIELD_OPC_SRC1,
221         .field_src1 = BNXT_ULP_FIELD_SRC_CONST,
222         .field_opr1 = {
223         1}
224         }
225 };