net/bnxt: use HWRM direct for exact match insert and delete
[dpdk.git] / drivers / net / bnxt / tf_core / hwrm_tf.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019 Broadcom
3  * All rights reserved.
4  */
5 #ifndef _HWRM_TF_H_
6 #define _HWRM_TF_H_
7
8 #include "tf_core.h"
9
10 typedef enum tf_type {
11         TF_TYPE_TRUFLOW,
12         TF_TYPE_LAST = TF_TYPE_TRUFLOW,
13 } tf_type_t;
14
15 typedef enum tf_subtype {
16         HWRM_TFT_SESSION_ATTACH = 712,
17         HWRM_TFT_SESSION_HW_RESC_QCAPS = 721,
18         HWRM_TFT_SESSION_HW_RESC_ALLOC = 722,
19         HWRM_TFT_SESSION_HW_RESC_FREE = 723,
20         HWRM_TFT_SESSION_HW_RESC_FLUSH = 724,
21         HWRM_TFT_SESSION_SRAM_RESC_QCAPS = 725,
22         HWRM_TFT_SESSION_SRAM_RESC_ALLOC = 726,
23         HWRM_TFT_SESSION_SRAM_RESC_FREE = 727,
24         HWRM_TFT_SESSION_SRAM_RESC_FLUSH = 728,
25         HWRM_TFT_TBL_SCOPE_CFG = 731,
26         HWRM_TFT_REG_GET = 821,
27         HWRM_TFT_REG_SET = 822,
28         HWRM_TFT_TBL_TYPE_SET = 823,
29         HWRM_TFT_TBL_TYPE_GET = 824,
30         TF_SUBTYPE_LAST = HWRM_TFT_TBL_TYPE_GET,
31 } tf_subtype_t;
32
33 /* Request and Response compile time checking */
34 /* u32_t        tlv_req_value[26]; */
35 #define TF_MAX_REQ_SIZE 104
36 /* u32_t        tlv_resp_value[170]; */
37 #define TF_MAX_RESP_SIZE 680
38
39 /* Use this to allocate/free any kind of
40  * indexes over HWRM and fill the parms pointer
41  */
42 #define TF_BULK_RECV     128
43 #define TF_BULK_SEND      16
44
45 /* EM Key value */
46 #define TF_DEV_DATA_TYPE_TF_EM_RULE_INSERT_KEY_DATA 0x2e30UL
47 /* EM Key value */
48 #define TF_DEV_DATA_TYPE_TF_EM_RULE_DELETE_KEY_DATA 0x2e40UL
49 /* L2 Context DMA Address Type */
50 #define TF_DEV_DATA_TYPE_TF_L2_CTX_DMA_ADDR             0x2fe0UL
51 /* L2 Context Entry */
52 #define TF_DEV_DATA_TYPE_TF_L2_CTX_ENTRY                0x2fe1UL
53 /* Prof tcam DMA Address Type */
54 #define TF_DEV_DATA_TYPE_TF_PROF_TCAM_DMA_ADDR          0x3030UL
55 /* Prof tcam Entry */
56 #define TF_DEV_DATA_TYPE_TF_PROF_TCAM_ENTRY             0x3031UL
57 /* WC DMA Address Type */
58 #define TF_DEV_DATA_TYPE_TF_WC_DMA_ADDR                 0x30d0UL
59 /* WC Entry */
60 #define TF_DEV_DATA_TYPE_TF_WC_ENTRY                    0x30d1UL
61 /* Action Data */
62 #define TF_DEV_DATA_TYPE_TF_ACTION_DATA                 0x3170UL
63 #define TF_DEV_DATA_TYPE_LAST   TF_DEV_DATA_TYPE_TF_ACTION_DATA
64
65 #define TF_BITS2BYTES(x) (((x) + 7) >> 3)
66 #define TF_BITS2BYTES_WORD_ALIGN(x) ((((x) + 31) >> 5) * 4)
67
68 struct tf_session_attach_input;
69 struct tf_session_hw_resc_qcaps_input;
70 struct tf_session_hw_resc_qcaps_output;
71 struct tf_session_hw_resc_alloc_input;
72 struct tf_session_hw_resc_alloc_output;
73 struct tf_session_hw_resc_free_input;
74 struct tf_session_hw_resc_flush_input;
75 struct tf_session_sram_resc_qcaps_input;
76 struct tf_session_sram_resc_qcaps_output;
77 struct tf_session_sram_resc_alloc_input;
78 struct tf_session_sram_resc_alloc_output;
79 struct tf_session_sram_resc_free_input;
80 struct tf_session_sram_resc_flush_input;
81 struct tf_tbl_type_set_input;
82 struct tf_tbl_type_get_input;
83 struct tf_tbl_type_get_output;
84 /* Input params for session attach */
85 typedef struct tf_session_attach_input {
86         /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
87         uint32_t                         fw_session_id;
88         /* Session Name */
89         char                             session_name[TF_SESSION_NAME_MAX];
90 } tf_session_attach_input_t, *ptf_session_attach_input_t;
91
92 /* Input params for session resource HW qcaps */
93 typedef struct tf_session_hw_resc_qcaps_input {
94         /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
95         uint32_t                         fw_session_id;
96         /* flags */
97         uint16_t                         flags;
98         /* When set to 0, indicates the query apply to RX */
99 #define TF_SESSION_HW_RESC_QCAPS_INPUT_FLAGS_DIR_RX       (0x0)
100         /* When set to 1, indicates the query apply to TX */
101 #define TF_SESSION_HW_RESC_QCAPS_INPUT_FLAGS_DIR_TX       (0x1)
102 } tf_session_hw_resc_qcaps_input_t, *ptf_session_hw_resc_qcaps_input_t;
103
104 /* Output params for session resource HW qcaps */
105 typedef struct tf_session_hw_resc_qcaps_output {
106         /* Control Flags */
107         uint32_t                         flags;
108         /* When set to 0, indicates Static partitioning */
109 #define TF_SESSION_HW_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_STATIC    (0x0)
110         /* When set to 1, indicates Strategy 1 */
111 #define TF_SESSION_HW_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_1         (0x1)
112         /* When set to 1, indicates Strategy 2 */
113 #define TF_SESSION_HW_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_2         (0x2)
114         /* When set to 1, indicates Strategy 3 */
115 #define TF_SESSION_HW_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_3         (0x3)
116         /* Unused */
117         uint8_t                   unused[4];
118         /* Minimum guaranteed number of L2 Ctx */
119         uint16_t                         l2_ctx_tcam_entries_min;
120         /* Maximum non-guaranteed number of L2 Ctx */
121         uint16_t                         l2_ctx_tcam_entries_max;
122         /* Minimum guaranteed number of profile functions */
123         uint16_t                         prof_func_min;
124         /* Maximum non-guaranteed number of profile functions */
125         uint16_t                         prof_func_max;
126         /* Minimum guaranteed number of profile TCAM entries */
127         uint16_t                         prof_tcam_entries_min;
128         /* Maximum non-guaranteed number of profile TCAM entries */
129         uint16_t                         prof_tcam_entries_max;
130         /* Minimum guaranteed number of EM profile ID */
131         uint16_t                         em_prof_id_min;
132         /* Maximum non-guaranteed number of EM profile ID */
133         uint16_t                         em_prof_id_max;
134         /* Minimum guaranteed number of EM records entries */
135         uint16_t                         em_record_entries_min;
136         /* Maximum non-guaranteed number of EM record entries */
137         uint16_t                         em_record_entries_max;
138         /* Minimum guaranteed number of WC TCAM profile ID */
139         uint16_t                         wc_tcam_prof_id_min;
140         /* Maximum non-guaranteed number of WC TCAM profile ID */
141         uint16_t                         wc_tcam_prof_id_max;
142         /* Minimum guaranteed number of WC TCAM entries */
143         uint16_t                         wc_tcam_entries_min;
144         /* Maximum non-guaranteed number of WC TCAM entries */
145         uint16_t                         wc_tcam_entries_max;
146         /* Minimum guaranteed number of meter profiles */
147         uint16_t                         meter_profiles_min;
148         /* Maximum non-guaranteed number of meter profiles */
149         uint16_t                         meter_profiles_max;
150         /* Minimum guaranteed number of meter instances */
151         uint16_t                         meter_inst_min;
152         /* Maximum non-guaranteed number of meter instances */
153         uint16_t                         meter_inst_max;
154         /* Minimum guaranteed number of mirrors */
155         uint16_t                         mirrors_min;
156         /* Maximum non-guaranteed number of mirrors */
157         uint16_t                         mirrors_max;
158         /* Minimum guaranteed number of UPAR */
159         uint16_t                         upar_min;
160         /* Maximum non-guaranteed number of UPAR */
161         uint16_t                         upar_max;
162         /* Minimum guaranteed number of SP TCAM entries */
163         uint16_t                         sp_tcam_entries_min;
164         /* Maximum non-guaranteed number of SP TCAM entries */
165         uint16_t                         sp_tcam_entries_max;
166         /* Minimum guaranteed number of L2 Functions */
167         uint16_t                         l2_func_min;
168         /* Maximum non-guaranteed number of L2 Functions */
169         uint16_t                         l2_func_max;
170         /* Minimum guaranteed number of flexible key templates */
171         uint16_t                         flex_key_templ_min;
172         /* Maximum non-guaranteed number of flexible key templates */
173         uint16_t                         flex_key_templ_max;
174         /* Minimum guaranteed number of table Scopes */
175         uint16_t                         tbl_scope_min;
176         /* Maximum non-guaranteed number of table Scopes */
177         uint16_t                         tbl_scope_max;
178         /* Minimum guaranteed number of epoch0 entries */
179         uint16_t                         epoch0_entries_min;
180         /* Maximum non-guaranteed number of epoch0 entries */
181         uint16_t                         epoch0_entries_max;
182         /* Minimum guaranteed number of epoch1 entries */
183         uint16_t                         epoch1_entries_min;
184         /* Maximum non-guaranteed number of epoch1 entries */
185         uint16_t                         epoch1_entries_max;
186         /* Minimum guaranteed number of metadata */
187         uint16_t                         metadata_min;
188         /* Maximum non-guaranteed number of metadata */
189         uint16_t                         metadata_max;
190         /* Minimum guaranteed number of CT states */
191         uint16_t                         ct_state_min;
192         /* Maximum non-guaranteed number of CT states */
193         uint16_t                         ct_state_max;
194         /* Minimum guaranteed number of range profiles */
195         uint16_t                         range_prof_min;
196         /* Maximum non-guaranteed number range profiles */
197         uint16_t                         range_prof_max;
198         /* Minimum guaranteed number of range entries */
199         uint16_t                         range_entries_min;
200         /* Maximum non-guaranteed number of range entries */
201         uint16_t                         range_entries_max;
202         /* Minimum guaranteed number of LAG table entries */
203         uint16_t                         lag_tbl_entries_min;
204         /* Maximum non-guaranteed number of LAG table entries */
205         uint16_t                         lag_tbl_entries_max;
206 } tf_session_hw_resc_qcaps_output_t, *ptf_session_hw_resc_qcaps_output_t;
207
208 /* Input params for session resource HW alloc */
209 typedef struct tf_session_hw_resc_alloc_input {
210         /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
211         uint32_t                         fw_session_id;
212         /* flags */
213         uint16_t                         flags;
214         /* When set to 0, indicates the query apply to RX */
215 #define TF_SESSION_HW_RESC_ALLOC_INPUT_FLAGS_DIR_RX       (0x0)
216         /* When set to 1, indicates the query apply to TX */
217 #define TF_SESSION_HW_RESC_ALLOC_INPUT_FLAGS_DIR_TX       (0x1)
218         /* Unused */
219         uint8_t                   unused[2];
220         /* Number of L2 CTX TCAM entries to be allocated */
221         uint16_t                         num_l2_ctx_tcam_entries;
222         /* Number of profile functions to be allocated */
223         uint16_t                         num_prof_func_entries;
224         /* Number of profile TCAM entries to be allocated */
225         uint16_t                         num_prof_tcam_entries;
226         /* Number of EM profile ids to be allocated */
227         uint16_t                         num_em_prof_id;
228         /* Number of EM records entries to be allocated */
229         uint16_t                         num_em_record_entries;
230         /* Number of WC profiles ids to be allocated */
231         uint16_t                         num_wc_tcam_prof_id;
232         /* Number of WC TCAM entries to be allocated */
233         uint16_t                         num_wc_tcam_entries;
234         /* Number of meter profiles to be allocated */
235         uint16_t                         num_meter_profiles;
236         /* Number of meter instances to be allocated */
237         uint16_t                         num_meter_inst;
238         /* Number of mirrors to be allocated */
239         uint16_t                         num_mirrors;
240         /* Number of UPAR to be allocated */
241         uint16_t                         num_upar;
242         /* Number of SP TCAM entries to be allocated */
243         uint16_t                         num_sp_tcam_entries;
244         /* Number of L2 functions to be allocated */
245         uint16_t                         num_l2_func;
246         /* Number of flexible key templates to be allocated */
247         uint16_t                         num_flex_key_templ;
248         /* Number of table scopes to be allocated */
249         uint16_t                         num_tbl_scope;
250         /* Number of epoch0 entries to be allocated */
251         uint16_t                         num_epoch0_entries;
252         /* Number of epoch1 entries to be allocated */
253         uint16_t                         num_epoch1_entries;
254         /* Number of metadata to be allocated */
255         uint16_t                         num_metadata;
256         /* Number of CT states to be allocated */
257         uint16_t                         num_ct_state;
258         /* Number of range profiles to be allocated */
259         uint16_t                         num_range_prof;
260         /* Number of range Entries to be allocated */
261         uint16_t                         num_range_entries;
262         /* Number of LAG table entries to be allocated */
263         uint16_t                         num_lag_tbl_entries;
264 } tf_session_hw_resc_alloc_input_t, *ptf_session_hw_resc_alloc_input_t;
265
266 /* Output params for session resource HW alloc */
267 typedef struct tf_session_hw_resc_alloc_output {
268         /* Starting index of L2 CTX TCAM entries allocated to the session */
269         uint16_t                         l2_ctx_tcam_entries_start;
270         /* Number of L2 CTX TCAM entries allocated */
271         uint16_t                         l2_ctx_tcam_entries_stride;
272         /* Starting index of profile functions allocated to the session */
273         uint16_t                         prof_func_start;
274         /* Number of profile functions allocated */
275         uint16_t                         prof_func_stride;
276         /* Starting index of profile TCAM entries allocated to the session */
277         uint16_t                         prof_tcam_entries_start;
278         /* Number of profile TCAM entries allocated */
279         uint16_t                         prof_tcam_entries_stride;
280         /* Starting index of EM profile ids allocated to the session */
281         uint16_t                         em_prof_id_start;
282         /* Number of EM profile ids allocated */
283         uint16_t                         em_prof_id_stride;
284         /* Starting index of EM record entries allocated to the session */
285         uint16_t                         em_record_entries_start;
286         /* Number of EM record entries allocated */
287         uint16_t                         em_record_entries_stride;
288         /* Starting index of WC TCAM profiles ids allocated to the session */
289         uint16_t                         wc_tcam_prof_id_start;
290         /* Number of WC TCAM profile ids allocated */
291         uint16_t                         wc_tcam_prof_id_stride;
292         /* Starting index of WC TCAM entries allocated to the session */
293         uint16_t                         wc_tcam_entries_start;
294         /* Number of WC TCAM allocated */
295         uint16_t                         wc_tcam_entries_stride;
296         /* Starting index of meter profiles allocated to the session */
297         uint16_t                         meter_profiles_start;
298         /* Number of meter profiles allocated */
299         uint16_t                         meter_profiles_stride;
300         /* Starting index of meter instance allocated to the session */
301         uint16_t                         meter_inst_start;
302         /* Number of meter instance allocated */
303         uint16_t                         meter_inst_stride;
304         /* Starting index of mirrors allocated to the session */
305         uint16_t                         mirrors_start;
306         /* Number of mirrors allocated */
307         uint16_t                         mirrors_stride;
308         /* Starting index of UPAR allocated to the session */
309         uint16_t                         upar_start;
310         /* Number of UPAR allocated */
311         uint16_t                         upar_stride;
312         /* Starting index of SP TCAM entries allocated to the session */
313         uint16_t                         sp_tcam_entries_start;
314         /* Number of SP TCAM entries allocated */
315         uint16_t                         sp_tcam_entries_stride;
316         /* Starting index of L2 functions allocated to the session */
317         uint16_t                         l2_func_start;
318         /* Number of L2 functions allocated */
319         uint16_t                         l2_func_stride;
320         /* Starting index of flexible key templates allocated to the session */
321         uint16_t                         flex_key_templ_start;
322         /* Number of flexible key templates allocated */
323         uint16_t                         flex_key_templ_stride;
324         /* Starting index of table scopes allocated to the session */
325         uint16_t                         tbl_scope_start;
326         /* Number of table scopes allocated */
327         uint16_t                         tbl_scope_stride;
328         /* Starting index of epoch0 entries allocated to the session */
329         uint16_t                         epoch0_entries_start;
330         /* Number of epoch0 entries allocated */
331         uint16_t                         epoch0_entries_stride;
332         /* Starting index of epoch1 entries allocated to the session */
333         uint16_t                         epoch1_entries_start;
334         /* Number of epoch1 entries allocated */
335         uint16_t                         epoch1_entries_stride;
336         /* Starting index of metadata allocated to the session */
337         uint16_t                         metadata_start;
338         /* Number of metadata allocated */
339         uint16_t                         metadata_stride;
340         /* Starting index of CT states allocated to the session */
341         uint16_t                         ct_state_start;
342         /* Number of CT states allocated */
343         uint16_t                         ct_state_stride;
344         /* Starting index of range profiles allocated to the session */
345         uint16_t                         range_prof_start;
346         /* Number range profiles allocated */
347         uint16_t                         range_prof_stride;
348         /* Starting index of range entries allocated to the session */
349         uint16_t                         range_entries_start;
350         /* Number of range entries allocated */
351         uint16_t                         range_entries_stride;
352         /* Starting index of LAG table entries allocated to the session */
353         uint16_t                         lag_tbl_entries_start;
354         /* Number of LAG table entries allocated */
355         uint16_t                         lag_tbl_entries_stride;
356 } tf_session_hw_resc_alloc_output_t, *ptf_session_hw_resc_alloc_output_t;
357
358 /* Input params for session resource HW free */
359 typedef struct tf_session_hw_resc_free_input {
360         /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
361         uint32_t                         fw_session_id;
362         /* flags */
363         uint16_t                         flags;
364         /* When set to 0, indicates the query apply to RX */
365 #define TF_SESSION_HW_RESC_FREE_INPUT_FLAGS_DIR_RX        (0x0)
366         /* When set to 1, indicates the query apply to TX */
367 #define TF_SESSION_HW_RESC_FREE_INPUT_FLAGS_DIR_TX        (0x1)
368         /* Unused */
369         uint8_t                   unused[2];
370         /* Starting index of L2 CTX TCAM entries allocated to the session */
371         uint16_t                         l2_ctx_tcam_entries_start;
372         /* Number of L2 CTX TCAM entries allocated */
373         uint16_t                         l2_ctx_tcam_entries_stride;
374         /* Starting index of profile functions allocated to the session */
375         uint16_t                         prof_func_start;
376         /* Number of profile functions allocated */
377         uint16_t                         prof_func_stride;
378         /* Starting index of profile TCAM entries allocated to the session */
379         uint16_t                         prof_tcam_entries_start;
380         /* Number of profile TCAM entries allocated */
381         uint16_t                         prof_tcam_entries_stride;
382         /* Starting index of EM profile ids allocated to the session */
383         uint16_t                         em_prof_id_start;
384         /* Number of EM profile ids allocated */
385         uint16_t                         em_prof_id_stride;
386         /* Starting index of EM record entries allocated to the session */
387         uint16_t                         em_record_entries_start;
388         /* Number of EM record entries allocated */
389         uint16_t                         em_record_entries_stride;
390         /* Starting index of WC TCAM profiles ids allocated to the session */
391         uint16_t                         wc_tcam_prof_id_start;
392         /* Number of WC TCAM profile ids allocated */
393         uint16_t                         wc_tcam_prof_id_stride;
394         /* Starting index of WC TCAM entries allocated to the session */
395         uint16_t                         wc_tcam_entries_start;
396         /* Number of WC TCAM allocated */
397         uint16_t                         wc_tcam_entries_stride;
398         /* Starting index of meter profiles allocated to the session */
399         uint16_t                         meter_profiles_start;
400         /* Number of meter profiles allocated */
401         uint16_t                         meter_profiles_stride;
402         /* Starting index of meter instance allocated to the session */
403         uint16_t                         meter_inst_start;
404         /* Number of meter instance allocated */
405         uint16_t                         meter_inst_stride;
406         /* Starting index of mirrors allocated to the session */
407         uint16_t                         mirrors_start;
408         /* Number of mirrors allocated */
409         uint16_t                         mirrors_stride;
410         /* Starting index of UPAR allocated to the session */
411         uint16_t                         upar_start;
412         /* Number of UPAR allocated */
413         uint16_t                         upar_stride;
414         /* Starting index of SP TCAM entries allocated to the session */
415         uint16_t                         sp_tcam_entries_start;
416         /* Number of SP TCAM entries allocated */
417         uint16_t                         sp_tcam_entries_stride;
418         /* Starting index of L2 functions allocated to the session */
419         uint16_t                         l2_func_start;
420         /* Number of L2 functions allocated */
421         uint16_t                         l2_func_stride;
422         /* Starting index of flexible key templates allocated to the session */
423         uint16_t                         flex_key_templ_start;
424         /* Number of flexible key templates allocated */
425         uint16_t                         flex_key_templ_stride;
426         /* Starting index of table scopes allocated to the session */
427         uint16_t                         tbl_scope_start;
428         /* Number of table scopes allocated */
429         uint16_t                         tbl_scope_stride;
430         /* Starting index of epoch0 entries allocated to the session */
431         uint16_t                         epoch0_entries_start;
432         /* Number of epoch0 entries allocated */
433         uint16_t                         epoch0_entries_stride;
434         /* Starting index of epoch1 entries allocated to the session */
435         uint16_t                         epoch1_entries_start;
436         /* Number of epoch1 entries allocated */
437         uint16_t                         epoch1_entries_stride;
438         /* Starting index of metadata allocated to the session */
439         uint16_t                         metadata_start;
440         /* Number of metadata allocated */
441         uint16_t                         metadata_stride;
442         /* Starting index of CT states allocated to the session */
443         uint16_t                         ct_state_start;
444         /* Number of CT states allocated */
445         uint16_t                         ct_state_stride;
446         /* Starting index of range profiles allocated to the session */
447         uint16_t                         range_prof_start;
448         /* Number range profiles allocated */
449         uint16_t                         range_prof_stride;
450         /* Starting index of range entries allocated to the session */
451         uint16_t                         range_entries_start;
452         /* Number of range entries allocated */
453         uint16_t                         range_entries_stride;
454         /* Starting index of LAG table entries allocated to the session */
455         uint16_t                         lag_tbl_entries_start;
456         /* Number of LAG table entries allocated */
457         uint16_t                         lag_tbl_entries_stride;
458 } tf_session_hw_resc_free_input_t, *ptf_session_hw_resc_free_input_t;
459
460 /* Input params for session resource HW flush */
461 typedef struct tf_session_hw_resc_flush_input {
462         /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
463         uint32_t                         fw_session_id;
464         /* flags */
465         uint16_t                         flags;
466         /* When set to 0, indicates the flush apply to RX */
467 #define TF_SESSION_HW_RESC_FLUSH_INPUT_FLAGS_DIR_RX       (0x0)
468         /* When set to 1, indicates the flush apply to TX */
469 #define TF_SESSION_HW_RESC_FLUSH_INPUT_FLAGS_DIR_TX       (0x1)
470         /* Unused */
471         uint8_t                   unused[2];
472         /* Starting index of L2 CTX TCAM entries allocated to the session */
473         uint16_t                         l2_ctx_tcam_entries_start;
474         /* Number of L2 CTX TCAM entries allocated */
475         uint16_t                         l2_ctx_tcam_entries_stride;
476         /* Starting index of profile functions allocated to the session */
477         uint16_t                         prof_func_start;
478         /* Number of profile functions allocated */
479         uint16_t                         prof_func_stride;
480         /* Starting index of profile TCAM entries allocated to the session */
481         uint16_t                         prof_tcam_entries_start;
482         /* Number of profile TCAM entries allocated */
483         uint16_t                         prof_tcam_entries_stride;
484         /* Starting index of EM profile ids allocated to the session */
485         uint16_t                         em_prof_id_start;
486         /* Number of EM profile ids allocated */
487         uint16_t                         em_prof_id_stride;
488         /* Starting index of EM record entries allocated to the session */
489         uint16_t                         em_record_entries_start;
490         /* Number of EM record entries allocated */
491         uint16_t                         em_record_entries_stride;
492         /* Starting index of WC TCAM profiles ids allocated to the session */
493         uint16_t                         wc_tcam_prof_id_start;
494         /* Number of WC TCAM profile ids allocated */
495         uint16_t                         wc_tcam_prof_id_stride;
496         /* Starting index of WC TCAM entries allocated to the session */
497         uint16_t                         wc_tcam_entries_start;
498         /* Number of WC TCAM allocated */
499         uint16_t                         wc_tcam_entries_stride;
500         /* Starting index of meter profiles allocated to the session */
501         uint16_t                         meter_profiles_start;
502         /* Number of meter profiles allocated */
503         uint16_t                         meter_profiles_stride;
504         /* Starting index of meter instance allocated to the session */
505         uint16_t                         meter_inst_start;
506         /* Number of meter instance allocated */
507         uint16_t                         meter_inst_stride;
508         /* Starting index of mirrors allocated to the session */
509         uint16_t                         mirrors_start;
510         /* Number of mirrors allocated */
511         uint16_t                         mirrors_stride;
512         /* Starting index of UPAR allocated to the session */
513         uint16_t                         upar_start;
514         /* Number of UPAR allocated */
515         uint16_t                         upar_stride;
516         /* Starting index of SP TCAM entries allocated to the session */
517         uint16_t                         sp_tcam_entries_start;
518         /* Number of SP TCAM entries allocated */
519         uint16_t                         sp_tcam_entries_stride;
520         /* Starting index of L2 functions allocated to the session */
521         uint16_t                         l2_func_start;
522         /* Number of L2 functions allocated */
523         uint16_t                         l2_func_stride;
524         /* Starting index of flexible key templates allocated to the session */
525         uint16_t                         flex_key_templ_start;
526         /* Number of flexible key templates allocated */
527         uint16_t                         flex_key_templ_stride;
528         /* Starting index of table scopes allocated to the session */
529         uint16_t                         tbl_scope_start;
530         /* Number of table scopes allocated */
531         uint16_t                         tbl_scope_stride;
532         /* Starting index of epoch0 entries allocated to the session */
533         uint16_t                         epoch0_entries_start;
534         /* Number of epoch0 entries allocated */
535         uint16_t                         epoch0_entries_stride;
536         /* Starting index of epoch1 entries allocated to the session */
537         uint16_t                         epoch1_entries_start;
538         /* Number of epoch1 entries allocated */
539         uint16_t                         epoch1_entries_stride;
540         /* Starting index of metadata allocated to the session */
541         uint16_t                         metadata_start;
542         /* Number of metadata allocated */
543         uint16_t                         metadata_stride;
544         /* Starting index of CT states allocated to the session */
545         uint16_t                         ct_state_start;
546         /* Number of CT states allocated */
547         uint16_t                         ct_state_stride;
548         /* Starting index of range profiles allocated to the session */
549         uint16_t                         range_prof_start;
550         /* Number range profiles allocated */
551         uint16_t                         range_prof_stride;
552         /* Starting index of range entries allocated to the session */
553         uint16_t                         range_entries_start;
554         /* Number of range entries allocated */
555         uint16_t                         range_entries_stride;
556         /* Starting index of LAG table entries allocated to the session */
557         uint16_t                         lag_tbl_entries_start;
558         /* Number of LAG table entries allocated */
559         uint16_t                         lag_tbl_entries_stride;
560 } tf_session_hw_resc_flush_input_t, *ptf_session_hw_resc_flush_input_t;
561
562 /* Input params for session resource SRAM qcaps */
563 typedef struct tf_session_sram_resc_qcaps_input {
564         /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
565         uint32_t                         fw_session_id;
566         /* flags */
567         uint16_t                         flags;
568         /* When set to 0, indicates the query apply to RX */
569 #define TF_SESSION_SRAM_RESC_QCAPS_INPUT_FLAGS_DIR_RX     (0x0)
570         /* When set to 1, indicates the query apply to TX */
571 #define TF_SESSION_SRAM_RESC_QCAPS_INPUT_FLAGS_DIR_TX     (0x1)
572 } tf_session_sram_resc_qcaps_input_t, *ptf_session_sram_resc_qcaps_input_t;
573
574 /* Output params for session resource SRAM qcaps */
575 typedef struct tf_session_sram_resc_qcaps_output {
576         /* Flags */
577         uint32_t                         flags;
578         /* When set to 0, indicates Static partitioning */
579 #define TF_SESSION_SRAM_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_STATIC          (0x0)
580         /* When set to 1, indicates Strategy 1 */
581 #define TF_SESSION_SRAM_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_1       (0x1)
582         /* When set to 1, indicates Strategy 2 */
583 #define TF_SESSION_SRAM_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_2       (0x2)
584         /* When set to 1, indicates Strategy 3 */
585 #define TF_SESSION_SRAM_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_3       (0x3)
586         /* Minimum guaranteed number of Full Action */
587         uint16_t                         full_action_min;
588         /* Maximum non-guaranteed number of Full Action */
589         uint16_t                         full_action_max;
590         /* Minimum guaranteed number of MCG */
591         uint16_t                         mcg_min;
592         /* Maximum non-guaranteed number of MCG */
593         uint16_t                         mcg_max;
594         /* Minimum guaranteed number of Encap 8B */
595         uint16_t                         encap_8b_min;
596         /* Maximum non-guaranteed number of Encap 8B */
597         uint16_t                         encap_8b_max;
598         /* Minimum guaranteed number of Encap 16B */
599         uint16_t                         encap_16b_min;
600         /* Maximum non-guaranteed number of Encap 16B */
601         uint16_t                         encap_16b_max;
602         /* Minimum guaranteed number of Encap 64B */
603         uint16_t                         encap_64b_min;
604         /* Maximum non-guaranteed number of Encap 64B */
605         uint16_t                         encap_64b_max;
606         /* Minimum guaranteed number of SP SMAC */
607         uint16_t                         sp_smac_min;
608         /* Maximum non-guaranteed number of SP SMAC */
609         uint16_t                         sp_smac_max;
610         /* Minimum guaranteed number of SP SMAC IPv4 */
611         uint16_t                         sp_smac_ipv4_min;
612         /* Maximum non-guaranteed number of SP SMAC IPv4 */
613         uint16_t                         sp_smac_ipv4_max;
614         /* Minimum guaranteed number of SP SMAC IPv6 */
615         uint16_t                         sp_smac_ipv6_min;
616         /* Maximum non-guaranteed number of SP SMAC IPv6 */
617         uint16_t                         sp_smac_ipv6_max;
618         /* Minimum guaranteed number of Counter 64B */
619         uint16_t                         counter_64b_min;
620         /* Maximum non-guaranteed number of Counter 64B */
621         uint16_t                         counter_64b_max;
622         /* Minimum guaranteed number of NAT SPORT */
623         uint16_t                         nat_sport_min;
624         /* Maximum non-guaranteed number of NAT SPORT */
625         uint16_t                         nat_sport_max;
626         /* Minimum guaranteed number of NAT DPORT */
627         uint16_t                         nat_dport_min;
628         /* Maximum non-guaranteed number of NAT DPORT */
629         uint16_t                         nat_dport_max;
630         /* Minimum guaranteed number of NAT S_IPV4 */
631         uint16_t                         nat_s_ipv4_min;
632         /* Maximum non-guaranteed number of NAT S_IPV4 */
633         uint16_t                         nat_s_ipv4_max;
634         /* Minimum guaranteed number of NAT D_IPV4 */
635         uint16_t                         nat_d_ipv4_min;
636         /* Maximum non-guaranteed number of NAT D_IPV4 */
637         uint16_t                         nat_d_ipv4_max;
638 } tf_session_sram_resc_qcaps_output_t, *ptf_session_sram_resc_qcaps_output_t;
639
640 /* Input params for session resource SRAM alloc */
641 typedef struct tf_session_sram_resc_alloc_input {
642         /* FW Session Id */
643         uint32_t                         fw_session_id;
644         /* flags */
645         uint16_t                         flags;
646         /* When set to 0, indicates the query apply to RX */
647 #define TF_SESSION_SRAM_RESC_ALLOC_INPUT_FLAGS_DIR_RX     (0x0)
648         /* When set to 1, indicates the query apply to TX */
649 #define TF_SESSION_SRAM_RESC_ALLOC_INPUT_FLAGS_DIR_TX     (0x1)
650         /* Unused */
651         uint8_t                   unused[2];
652         /* Number of full action SRAM entries to be allocated */
653         uint16_t                         num_full_action;
654         /* Number of multicast groups to be allocated */
655         uint16_t                         num_mcg;
656         /* Number of Encap 8B entries to be allocated */
657         uint16_t                         num_encap_8b;
658         /* Number of Encap 16B entries to be allocated */
659         uint16_t                         num_encap_16b;
660         /* Number of Encap 64B entries to be allocated */
661         uint16_t                         num_encap_64b;
662         /* Number of SP SMAC entries to be allocated */
663         uint16_t                         num_sp_smac;
664         /* Number of SP SMAC IPv4 entries to be allocated */
665         uint16_t                         num_sp_smac_ipv4;
666         /* Number of SP SMAC IPv6 entries to be allocated */
667         uint16_t                         num_sp_smac_ipv6;
668         /* Number of Counter 64B entries to be allocated */
669         uint16_t                         num_counter_64b;
670         /* Number of NAT source ports to be allocated */
671         uint16_t                         num_nat_sport;
672         /* Number of NAT destination ports to be allocated */
673         uint16_t                         num_nat_dport;
674         /* Number of NAT source iPV4 addresses to be allocated */
675         uint16_t                         num_nat_s_ipv4;
676         /* Number of NAT destination IPV4 addresses to be allocated */
677         uint16_t                         num_nat_d_ipv4;
678 } tf_session_sram_resc_alloc_input_t, *ptf_session_sram_resc_alloc_input_t;
679
680 /* Output params for session resource SRAM alloc */
681 typedef struct tf_session_sram_resc_alloc_output {
682         /* Unused */
683         uint8_t                   unused[2];
684         /* Starting index of full action SRAM entries allocated to the session */
685         uint16_t                         full_action_start;
686         /* Number of full action SRAM entries allocated */
687         uint16_t                         full_action_stride;
688         /* Starting index of multicast groups allocated to this session */
689         uint16_t                         mcg_start;
690         /* Number of multicast groups allocated */
691         uint16_t                         mcg_stride;
692         /* Starting index of encap 8B entries allocated to the session */
693         uint16_t                         encap_8b_start;
694         /* Number of encap 8B entries allocated */
695         uint16_t                         encap_8b_stride;
696         /* Starting index of encap 16B entries allocated to the session */
697         uint16_t                         encap_16b_start;
698         /* Number of encap 16B entries allocated */
699         uint16_t                         encap_16b_stride;
700         /* Starting index of encap 64B entries allocated to the session */
701         uint16_t                         encap_64b_start;
702         /* Number of encap 64B entries allocated */
703         uint16_t                         encap_64b_stride;
704         /* Starting index of SP SMAC entries allocated to the session */
705         uint16_t                         sp_smac_start;
706         /* Number of SP SMAC entries allocated */
707         uint16_t                         sp_smac_stride;
708         /* Starting index of SP SMAC IPv4 entries allocated to the session */
709         uint16_t                         sp_smac_ipv4_start;
710         /* Number of SP SMAC IPv4 entries allocated */
711         uint16_t                         sp_smac_ipv4_stride;
712         /* Starting index of SP SMAC IPv6 entries allocated to the session */
713         uint16_t                         sp_smac_ipv6_start;
714         /* Number of SP SMAC IPv6 entries allocated */
715         uint16_t                         sp_smac_ipv6_stride;
716         /* Starting index of Counter 64B entries allocated to the session */
717         uint16_t                         counter_64b_start;
718         /* Number of Counter 64B entries allocated */
719         uint16_t                         counter_64b_stride;
720         /* Starting index of NAT source ports allocated to the session */
721         uint16_t                         nat_sport_start;
722         /* Number of NAT source ports allocated */
723         uint16_t                         nat_sport_stride;
724         /* Starting index of NAT destination ports allocated to the session */
725         uint16_t                         nat_dport_start;
726         /* Number of NAT destination ports allocated */
727         uint16_t                         nat_dport_stride;
728         /* Starting index of NAT source IPV4 addresses allocated to the session */
729         uint16_t                         nat_s_ipv4_start;
730         /* Number of NAT source IPV4 addresses allocated */
731         uint16_t                         nat_s_ipv4_stride;
732         /*
733          * Starting index of NAT destination IPV4 addresses allocated to the
734          * session
735          */
736         uint16_t                         nat_d_ipv4_start;
737         /* Number of NAT destination IPV4 addresses allocated */
738         uint16_t                         nat_d_ipv4_stride;
739 } tf_session_sram_resc_alloc_output_t, *ptf_session_sram_resc_alloc_output_t;
740
741 /* Input params for session resource SRAM free */
742 typedef struct tf_session_sram_resc_free_input {
743         /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
744         uint32_t                         fw_session_id;
745         /* flags */
746         uint16_t                         flags;
747         /* When set to 0, indicates the query apply to RX */
748 #define TF_SESSION_SRAM_RESC_FREE_INPUT_FLAGS_DIR_RX      (0x0)
749         /* When set to 1, indicates the query apply to TX */
750 #define TF_SESSION_SRAM_RESC_FREE_INPUT_FLAGS_DIR_TX      (0x1)
751         /* Starting index of full action SRAM entries allocated to the session */
752         uint16_t                         full_action_start;
753         /* Number of full action SRAM entries allocated */
754         uint16_t                         full_action_stride;
755         /* Starting index of multicast groups allocated to this session */
756         uint16_t                         mcg_start;
757         /* Number of multicast groups allocated */
758         uint16_t                         mcg_stride;
759         /* Starting index of encap 8B entries allocated to the session */
760         uint16_t                         encap_8b_start;
761         /* Number of encap 8B entries allocated */
762         uint16_t                         encap_8b_stride;
763         /* Starting index of encap 16B entries allocated to the session */
764         uint16_t                         encap_16b_start;
765         /* Number of encap 16B entries allocated */
766         uint16_t                         encap_16b_stride;
767         /* Starting index of encap 64B entries allocated to the session */
768         uint16_t                         encap_64b_start;
769         /* Number of encap 64B entries allocated */
770         uint16_t                         encap_64b_stride;
771         /* Starting index of SP SMAC entries allocated to the session */
772         uint16_t                         sp_smac_start;
773         /* Number of SP SMAC entries allocated */
774         uint16_t                         sp_smac_stride;
775         /* Starting index of SP SMAC IPv4 entries allocated to the session */
776         uint16_t                         sp_smac_ipv4_start;
777         /* Number of SP SMAC IPv4 entries allocated */
778         uint16_t                         sp_smac_ipv4_stride;
779         /* Starting index of SP SMAC IPv6 entries allocated to the session */
780         uint16_t                         sp_smac_ipv6_start;
781         /* Number of SP SMAC IPv6 entries allocated */
782         uint16_t                         sp_smac_ipv6_stride;
783         /* Starting index of Counter 64B entries allocated to the session */
784         uint16_t                         counter_64b_start;
785         /* Number of Counter 64B entries allocated */
786         uint16_t                         counter_64b_stride;
787         /* Starting index of NAT source ports allocated to the session */
788         uint16_t                         nat_sport_start;
789         /* Number of NAT source ports allocated */
790         uint16_t                         nat_sport_stride;
791         /* Starting index of NAT destination ports allocated to the session */
792         uint16_t                         nat_dport_start;
793         /* Number of NAT destination ports allocated */
794         uint16_t                         nat_dport_stride;
795         /* Starting index of NAT source IPV4 addresses allocated to the session */
796         uint16_t                         nat_s_ipv4_start;
797         /* Number of NAT source IPV4 addresses allocated */
798         uint16_t                         nat_s_ipv4_stride;
799         /*
800          * Starting index of NAT destination IPV4 addresses allocated to the
801          * session
802          */
803         uint16_t                         nat_d_ipv4_start;
804         /* Number of NAT destination IPV4 addresses allocated */
805         uint16_t                         nat_d_ipv4_stride;
806 } tf_session_sram_resc_free_input_t, *ptf_session_sram_resc_free_input_t;
807
808 /* Input params for session resource SRAM flush */
809 typedef struct tf_session_sram_resc_flush_input {
810         /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
811         uint32_t                         fw_session_id;
812         /* flags */
813         uint16_t                         flags;
814         /* When set to 0, indicates the flush apply to RX */
815 #define TF_SESSION_SRAM_RESC_FLUSH_INPUT_FLAGS_DIR_RX     (0x0)
816         /* When set to 1, indicates the flush apply to TX */
817 #define TF_SESSION_SRAM_RESC_FLUSH_INPUT_FLAGS_DIR_TX     (0x1)
818         /* Starting index of full action SRAM entries allocated to the session */
819         uint16_t                         full_action_start;
820         /* Number of full action SRAM entries allocated */
821         uint16_t                         full_action_stride;
822         /* Starting index of multicast groups allocated to this session */
823         uint16_t                         mcg_start;
824         /* Number of multicast groups allocated */
825         uint16_t                         mcg_stride;
826         /* Starting index of encap 8B entries allocated to the session */
827         uint16_t                         encap_8b_start;
828         /* Number of encap 8B entries allocated */
829         uint16_t                         encap_8b_stride;
830         /* Starting index of encap 16B entries allocated to the session */
831         uint16_t                         encap_16b_start;
832         /* Number of encap 16B entries allocated */
833         uint16_t                         encap_16b_stride;
834         /* Starting index of encap 64B entries allocated to the session */
835         uint16_t                         encap_64b_start;
836         /* Number of encap 64B entries allocated */
837         uint16_t                         encap_64b_stride;
838         /* Starting index of SP SMAC entries allocated to the session */
839         uint16_t                         sp_smac_start;
840         /* Number of SP SMAC entries allocated */
841         uint16_t                         sp_smac_stride;
842         /* Starting index of SP SMAC IPv4 entries allocated to the session */
843         uint16_t                         sp_smac_ipv4_start;
844         /* Number of SP SMAC IPv4 entries allocated */
845         uint16_t                         sp_smac_ipv4_stride;
846         /* Starting index of SP SMAC IPv6 entries allocated to the session */
847         uint16_t                         sp_smac_ipv6_start;
848         /* Number of SP SMAC IPv6 entries allocated */
849         uint16_t                         sp_smac_ipv6_stride;
850         /* Starting index of Counter 64B entries allocated to the session */
851         uint16_t                         counter_64b_start;
852         /* Number of Counter 64B entries allocated */
853         uint16_t                         counter_64b_stride;
854         /* Starting index of NAT source ports allocated to the session */
855         uint16_t                         nat_sport_start;
856         /* Number of NAT source ports allocated */
857         uint16_t                         nat_sport_stride;
858         /* Starting index of NAT destination ports allocated to the session */
859         uint16_t                         nat_dport_start;
860         /* Number of NAT destination ports allocated */
861         uint16_t                         nat_dport_stride;
862         /* Starting index of NAT source IPV4 addresses allocated to the session */
863         uint16_t                         nat_s_ipv4_start;
864         /* Number of NAT source IPV4 addresses allocated */
865         uint16_t                         nat_s_ipv4_stride;
866         /*
867          * Starting index of NAT destination IPV4 addresses allocated to the
868          * session
869          */
870         uint16_t                         nat_d_ipv4_start;
871         /* Number of NAT destination IPV4 addresses allocated */
872         uint16_t                         nat_d_ipv4_stride;
873 } tf_session_sram_resc_flush_input_t, *ptf_session_sram_resc_flush_input_t;
874
875 /* Input params for table type set */
876 typedef struct tf_tbl_type_set_input {
877         /* Session Id */
878         uint32_t                         fw_session_id;
879         /* flags */
880         uint16_t                         flags;
881         /* When set to 0, indicates the get apply to RX */
882 #define TF_TBL_TYPE_SET_INPUT_FLAGS_DIR_RX                      (0x0)
883         /* When set to 1, indicates the get apply to TX */
884 #define TF_TBL_TYPE_SET_INPUT_FLAGS_DIR_TX                      (0x1)
885         /* Type of the object to set */
886         uint32_t                         type;
887         /* Size of the data to set in bytes */
888         uint16_t                         size;
889         /* Data to set */
890         uint8_t                   data[TF_BULK_SEND];
891         /* Index to set */
892         uint32_t                         index;
893 } tf_tbl_type_set_input_t, *ptf_tbl_type_set_input_t;
894
895 /* Input params for table type get */
896 typedef struct tf_tbl_type_get_input {
897         /* Session Id */
898         uint32_t                         fw_session_id;
899         /* flags */
900         uint16_t                         flags;
901         /* When set to 0, indicates the get apply to RX */
902 #define TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_RX                      (0x0)
903         /* When set to 1, indicates the get apply to TX */
904 #define TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_TX                      (0x1)
905         /* Type of the object to set */
906         uint32_t                         type;
907         /* Index to get */
908         uint32_t                         index;
909 } tf_tbl_type_get_input_t, *ptf_tbl_type_get_input_t;
910
911 /* Output params for table type get */
912 typedef struct tf_tbl_type_get_output {
913         /* Size of the data read in bytes */
914         uint16_t                         size;
915         /* Data read */
916         uint8_t                   data[TF_BULK_RECV];
917 } tf_tbl_type_get_output_t, *ptf_tbl_type_get_output_t;
918
919 #endif /* _HWRM_TF_H_ */