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