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