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 struct tf_em_internal_delete_output;
90 /* Input params for session attach */
91 typedef struct tf_session_attach_input {
92 /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
93 uint32_t fw_session_id;
95 char session_name[TF_SESSION_NAME_MAX];
96 } tf_session_attach_input_t, *ptf_session_attach_input_t;
98 /* Input params for session resource HW qcaps */
99 typedef struct tf_session_hw_resc_qcaps_input {
100 /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
101 uint32_t fw_session_id;
104 /* When set to 0, indicates the query apply to RX */
105 #define TF_SESSION_HW_RESC_QCAPS_INPUT_FLAGS_DIR_RX (0x0)
106 /* When set to 1, indicates the query apply to TX */
107 #define TF_SESSION_HW_RESC_QCAPS_INPUT_FLAGS_DIR_TX (0x1)
108 } tf_session_hw_resc_qcaps_input_t, *ptf_session_hw_resc_qcaps_input_t;
110 /* Output params for session resource HW qcaps */
111 typedef struct tf_session_hw_resc_qcaps_output {
114 /* When set to 0, indicates Static partitioning */
115 #define TF_SESSION_HW_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_STATIC (0x0)
116 /* When set to 1, indicates Strategy 1 */
117 #define TF_SESSION_HW_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_1 (0x1)
118 /* When set to 1, indicates Strategy 2 */
119 #define TF_SESSION_HW_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_2 (0x2)
120 /* When set to 1, indicates Strategy 3 */
121 #define TF_SESSION_HW_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_3 (0x3)
124 /* Minimum guaranteed number of L2 Ctx */
125 uint16_t l2_ctx_tcam_entries_min;
126 /* Maximum non-guaranteed number of L2 Ctx */
127 uint16_t l2_ctx_tcam_entries_max;
128 /* Minimum guaranteed number of profile functions */
129 uint16_t prof_func_min;
130 /* Maximum non-guaranteed number of profile functions */
131 uint16_t prof_func_max;
132 /* Minimum guaranteed number of profile TCAM entries */
133 uint16_t prof_tcam_entries_min;
134 /* Maximum non-guaranteed number of profile TCAM entries */
135 uint16_t prof_tcam_entries_max;
136 /* Minimum guaranteed number of EM profile ID */
137 uint16_t em_prof_id_min;
138 /* Maximum non-guaranteed number of EM profile ID */
139 uint16_t em_prof_id_max;
140 /* Minimum guaranteed number of EM records entries */
141 uint16_t em_record_entries_min;
142 /* Maximum non-guaranteed number of EM record entries */
143 uint16_t em_record_entries_max;
144 /* Minimum guaranteed number of WC TCAM profile ID */
145 uint16_t wc_tcam_prof_id_min;
146 /* Maximum non-guaranteed number of WC TCAM profile ID */
147 uint16_t wc_tcam_prof_id_max;
148 /* Minimum guaranteed number of WC TCAM entries */
149 uint16_t wc_tcam_entries_min;
150 /* Maximum non-guaranteed number of WC TCAM entries */
151 uint16_t wc_tcam_entries_max;
152 /* Minimum guaranteed number of meter profiles */
153 uint16_t meter_profiles_min;
154 /* Maximum non-guaranteed number of meter profiles */
155 uint16_t meter_profiles_max;
156 /* Minimum guaranteed number of meter instances */
157 uint16_t meter_inst_min;
158 /* Maximum non-guaranteed number of meter instances */
159 uint16_t meter_inst_max;
160 /* Minimum guaranteed number of mirrors */
161 uint16_t mirrors_min;
162 /* Maximum non-guaranteed number of mirrors */
163 uint16_t mirrors_max;
164 /* Minimum guaranteed number of UPAR */
166 /* Maximum non-guaranteed number of UPAR */
168 /* Minimum guaranteed number of SP TCAM entries */
169 uint16_t sp_tcam_entries_min;
170 /* Maximum non-guaranteed number of SP TCAM entries */
171 uint16_t sp_tcam_entries_max;
172 /* Minimum guaranteed number of L2 Functions */
173 uint16_t l2_func_min;
174 /* Maximum non-guaranteed number of L2 Functions */
175 uint16_t l2_func_max;
176 /* Minimum guaranteed number of flexible key templates */
177 uint16_t flex_key_templ_min;
178 /* Maximum non-guaranteed number of flexible key templates */
179 uint16_t flex_key_templ_max;
180 /* Minimum guaranteed number of table Scopes */
181 uint16_t tbl_scope_min;
182 /* Maximum non-guaranteed number of table Scopes */
183 uint16_t tbl_scope_max;
184 /* Minimum guaranteed number of epoch0 entries */
185 uint16_t epoch0_entries_min;
186 /* Maximum non-guaranteed number of epoch0 entries */
187 uint16_t epoch0_entries_max;
188 /* Minimum guaranteed number of epoch1 entries */
189 uint16_t epoch1_entries_min;
190 /* Maximum non-guaranteed number of epoch1 entries */
191 uint16_t epoch1_entries_max;
192 /* Minimum guaranteed number of metadata */
193 uint16_t metadata_min;
194 /* Maximum non-guaranteed number of metadata */
195 uint16_t metadata_max;
196 /* Minimum guaranteed number of CT states */
197 uint16_t ct_state_min;
198 /* Maximum non-guaranteed number of CT states */
199 uint16_t ct_state_max;
200 /* Minimum guaranteed number of range profiles */
201 uint16_t range_prof_min;
202 /* Maximum non-guaranteed number range profiles */
203 uint16_t range_prof_max;
204 /* Minimum guaranteed number of range entries */
205 uint16_t range_entries_min;
206 /* Maximum non-guaranteed number of range entries */
207 uint16_t range_entries_max;
208 /* Minimum guaranteed number of LAG table entries */
209 uint16_t lag_tbl_entries_min;
210 /* Maximum non-guaranteed number of LAG table entries */
211 uint16_t lag_tbl_entries_max;
212 } tf_session_hw_resc_qcaps_output_t, *ptf_session_hw_resc_qcaps_output_t;
214 /* Input params for session resource HW alloc */
215 typedef struct tf_session_hw_resc_alloc_input {
216 /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
217 uint32_t fw_session_id;
220 /* When set to 0, indicates the query apply to RX */
221 #define TF_SESSION_HW_RESC_ALLOC_INPUT_FLAGS_DIR_RX (0x0)
222 /* When set to 1, indicates the query apply to TX */
223 #define TF_SESSION_HW_RESC_ALLOC_INPUT_FLAGS_DIR_TX (0x1)
226 /* Number of L2 CTX TCAM entries to be allocated */
227 uint16_t num_l2_ctx_tcam_entries;
228 /* Number of profile functions to be allocated */
229 uint16_t num_prof_func_entries;
230 /* Number of profile TCAM entries to be allocated */
231 uint16_t num_prof_tcam_entries;
232 /* Number of EM profile ids to be allocated */
233 uint16_t num_em_prof_id;
234 /* Number of EM records entries to be allocated */
235 uint16_t num_em_record_entries;
236 /* Number of WC profiles ids to be allocated */
237 uint16_t num_wc_tcam_prof_id;
238 /* Number of WC TCAM entries to be allocated */
239 uint16_t num_wc_tcam_entries;
240 /* Number of meter profiles to be allocated */
241 uint16_t num_meter_profiles;
242 /* Number of meter instances to be allocated */
243 uint16_t num_meter_inst;
244 /* Number of mirrors to be allocated */
245 uint16_t num_mirrors;
246 /* Number of UPAR to be allocated */
248 /* Number of SP TCAM entries to be allocated */
249 uint16_t num_sp_tcam_entries;
250 /* Number of L2 functions to be allocated */
251 uint16_t num_l2_func;
252 /* Number of flexible key templates to be allocated */
253 uint16_t num_flex_key_templ;
254 /* Number of table scopes to be allocated */
255 uint16_t num_tbl_scope;
256 /* Number of epoch0 entries to be allocated */
257 uint16_t num_epoch0_entries;
258 /* Number of epoch1 entries to be allocated */
259 uint16_t num_epoch1_entries;
260 /* Number of metadata to be allocated */
261 uint16_t num_metadata;
262 /* Number of CT states to be allocated */
263 uint16_t num_ct_state;
264 /* Number of range profiles to be allocated */
265 uint16_t num_range_prof;
266 /* Number of range Entries to be allocated */
267 uint16_t num_range_entries;
268 /* Number of LAG table entries to be allocated */
269 uint16_t num_lag_tbl_entries;
270 } tf_session_hw_resc_alloc_input_t, *ptf_session_hw_resc_alloc_input_t;
272 /* Output params for session resource HW alloc */
273 typedef struct tf_session_hw_resc_alloc_output {
274 /* Starting index of L2 CTX TCAM entries allocated to the session */
275 uint16_t l2_ctx_tcam_entries_start;
276 /* Number of L2 CTX TCAM entries allocated */
277 uint16_t l2_ctx_tcam_entries_stride;
278 /* Starting index of profile functions allocated to the session */
279 uint16_t prof_func_start;
280 /* Number of profile functions allocated */
281 uint16_t prof_func_stride;
282 /* Starting index of profile TCAM entries allocated to the session */
283 uint16_t prof_tcam_entries_start;
284 /* Number of profile TCAM entries allocated */
285 uint16_t prof_tcam_entries_stride;
286 /* Starting index of EM profile ids allocated to the session */
287 uint16_t em_prof_id_start;
288 /* Number of EM profile ids allocated */
289 uint16_t em_prof_id_stride;
290 /* Starting index of EM record entries allocated to the session */
291 uint16_t em_record_entries_start;
292 /* Number of EM record entries allocated */
293 uint16_t em_record_entries_stride;
294 /* Starting index of WC TCAM profiles ids allocated to the session */
295 uint16_t wc_tcam_prof_id_start;
296 /* Number of WC TCAM profile ids allocated */
297 uint16_t wc_tcam_prof_id_stride;
298 /* Starting index of WC TCAM entries allocated to the session */
299 uint16_t wc_tcam_entries_start;
300 /* Number of WC TCAM allocated */
301 uint16_t wc_tcam_entries_stride;
302 /* Starting index of meter profiles allocated to the session */
303 uint16_t meter_profiles_start;
304 /* Number of meter profiles allocated */
305 uint16_t meter_profiles_stride;
306 /* Starting index of meter instance allocated to the session */
307 uint16_t meter_inst_start;
308 /* Number of meter instance allocated */
309 uint16_t meter_inst_stride;
310 /* Starting index of mirrors allocated to the session */
311 uint16_t mirrors_start;
312 /* Number of mirrors allocated */
313 uint16_t mirrors_stride;
314 /* Starting index of UPAR allocated to the session */
316 /* Number of UPAR allocated */
317 uint16_t upar_stride;
318 /* Starting index of SP TCAM entries allocated to the session */
319 uint16_t sp_tcam_entries_start;
320 /* Number of SP TCAM entries allocated */
321 uint16_t sp_tcam_entries_stride;
322 /* Starting index of L2 functions allocated to the session */
323 uint16_t l2_func_start;
324 /* Number of L2 functions allocated */
325 uint16_t l2_func_stride;
326 /* Starting index of flexible key templates allocated to the session */
327 uint16_t flex_key_templ_start;
328 /* Number of flexible key templates allocated */
329 uint16_t flex_key_templ_stride;
330 /* Starting index of table scopes allocated to the session */
331 uint16_t tbl_scope_start;
332 /* Number of table scopes allocated */
333 uint16_t tbl_scope_stride;
334 /* Starting index of epoch0 entries allocated to the session */
335 uint16_t epoch0_entries_start;
336 /* Number of epoch0 entries allocated */
337 uint16_t epoch0_entries_stride;
338 /* Starting index of epoch1 entries allocated to the session */
339 uint16_t epoch1_entries_start;
340 /* Number of epoch1 entries allocated */
341 uint16_t epoch1_entries_stride;
342 /* Starting index of metadata allocated to the session */
343 uint16_t metadata_start;
344 /* Number of metadata allocated */
345 uint16_t metadata_stride;
346 /* Starting index of CT states allocated to the session */
347 uint16_t ct_state_start;
348 /* Number of CT states allocated */
349 uint16_t ct_state_stride;
350 /* Starting index of range profiles allocated to the session */
351 uint16_t range_prof_start;
352 /* Number range profiles allocated */
353 uint16_t range_prof_stride;
354 /* Starting index of range entries allocated to the session */
355 uint16_t range_entries_start;
356 /* Number of range entries allocated */
357 uint16_t range_entries_stride;
358 /* Starting index of LAG table entries allocated to the session */
359 uint16_t lag_tbl_entries_start;
360 /* Number of LAG table entries allocated */
361 uint16_t lag_tbl_entries_stride;
362 } tf_session_hw_resc_alloc_output_t, *ptf_session_hw_resc_alloc_output_t;
364 /* Input params for session resource HW free */
365 typedef struct tf_session_hw_resc_free_input {
366 /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
367 uint32_t fw_session_id;
370 /* When set to 0, indicates the query apply to RX */
371 #define TF_SESSION_HW_RESC_FREE_INPUT_FLAGS_DIR_RX (0x0)
372 /* When set to 1, indicates the query apply to TX */
373 #define TF_SESSION_HW_RESC_FREE_INPUT_FLAGS_DIR_TX (0x1)
376 /* Starting index of L2 CTX TCAM entries allocated to the session */
377 uint16_t l2_ctx_tcam_entries_start;
378 /* Number of L2 CTX TCAM entries allocated */
379 uint16_t l2_ctx_tcam_entries_stride;
380 /* Starting index of profile functions allocated to the session */
381 uint16_t prof_func_start;
382 /* Number of profile functions allocated */
383 uint16_t prof_func_stride;
384 /* Starting index of profile TCAM entries allocated to the session */
385 uint16_t prof_tcam_entries_start;
386 /* Number of profile TCAM entries allocated */
387 uint16_t prof_tcam_entries_stride;
388 /* Starting index of EM profile ids allocated to the session */
389 uint16_t em_prof_id_start;
390 /* Number of EM profile ids allocated */
391 uint16_t em_prof_id_stride;
392 /* Starting index of EM record entries allocated to the session */
393 uint16_t em_record_entries_start;
394 /* Number of EM record entries allocated */
395 uint16_t em_record_entries_stride;
396 /* Starting index of WC TCAM profiles ids allocated to the session */
397 uint16_t wc_tcam_prof_id_start;
398 /* Number of WC TCAM profile ids allocated */
399 uint16_t wc_tcam_prof_id_stride;
400 /* Starting index of WC TCAM entries allocated to the session */
401 uint16_t wc_tcam_entries_start;
402 /* Number of WC TCAM allocated */
403 uint16_t wc_tcam_entries_stride;
404 /* Starting index of meter profiles allocated to the session */
405 uint16_t meter_profiles_start;
406 /* Number of meter profiles allocated */
407 uint16_t meter_profiles_stride;
408 /* Starting index of meter instance allocated to the session */
409 uint16_t meter_inst_start;
410 /* Number of meter instance allocated */
411 uint16_t meter_inst_stride;
412 /* Starting index of mirrors allocated to the session */
413 uint16_t mirrors_start;
414 /* Number of mirrors allocated */
415 uint16_t mirrors_stride;
416 /* Starting index of UPAR allocated to the session */
418 /* Number of UPAR allocated */
419 uint16_t upar_stride;
420 /* Starting index of SP TCAM entries allocated to the session */
421 uint16_t sp_tcam_entries_start;
422 /* Number of SP TCAM entries allocated */
423 uint16_t sp_tcam_entries_stride;
424 /* Starting index of L2 functions allocated to the session */
425 uint16_t l2_func_start;
426 /* Number of L2 functions allocated */
427 uint16_t l2_func_stride;
428 /* Starting index of flexible key templates allocated to the session */
429 uint16_t flex_key_templ_start;
430 /* Number of flexible key templates allocated */
431 uint16_t flex_key_templ_stride;
432 /* Starting index of table scopes allocated to the session */
433 uint16_t tbl_scope_start;
434 /* Number of table scopes allocated */
435 uint16_t tbl_scope_stride;
436 /* Starting index of epoch0 entries allocated to the session */
437 uint16_t epoch0_entries_start;
438 /* Number of epoch0 entries allocated */
439 uint16_t epoch0_entries_stride;
440 /* Starting index of epoch1 entries allocated to the session */
441 uint16_t epoch1_entries_start;
442 /* Number of epoch1 entries allocated */
443 uint16_t epoch1_entries_stride;
444 /* Starting index of metadata allocated to the session */
445 uint16_t metadata_start;
446 /* Number of metadata allocated */
447 uint16_t metadata_stride;
448 /* Starting index of CT states allocated to the session */
449 uint16_t ct_state_start;
450 /* Number of CT states allocated */
451 uint16_t ct_state_stride;
452 /* Starting index of range profiles allocated to the session */
453 uint16_t range_prof_start;
454 /* Number range profiles allocated */
455 uint16_t range_prof_stride;
456 /* Starting index of range entries allocated to the session */
457 uint16_t range_entries_start;
458 /* Number of range entries allocated */
459 uint16_t range_entries_stride;
460 /* Starting index of LAG table entries allocated to the session */
461 uint16_t lag_tbl_entries_start;
462 /* Number of LAG table entries allocated */
463 uint16_t lag_tbl_entries_stride;
464 } tf_session_hw_resc_free_input_t, *ptf_session_hw_resc_free_input_t;
466 /* Input params for session resource HW flush */
467 typedef struct tf_session_hw_resc_flush_input {
468 /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
469 uint32_t fw_session_id;
472 /* When set to 0, indicates the flush apply to RX */
473 #define TF_SESSION_HW_RESC_FLUSH_INPUT_FLAGS_DIR_RX (0x0)
474 /* When set to 1, indicates the flush apply to TX */
475 #define TF_SESSION_HW_RESC_FLUSH_INPUT_FLAGS_DIR_TX (0x1)
478 /* Starting index of L2 CTX TCAM entries allocated to the session */
479 uint16_t l2_ctx_tcam_entries_start;
480 /* Number of L2 CTX TCAM entries allocated */
481 uint16_t l2_ctx_tcam_entries_stride;
482 /* Starting index of profile functions allocated to the session */
483 uint16_t prof_func_start;
484 /* Number of profile functions allocated */
485 uint16_t prof_func_stride;
486 /* Starting index of profile TCAM entries allocated to the session */
487 uint16_t prof_tcam_entries_start;
488 /* Number of profile TCAM entries allocated */
489 uint16_t prof_tcam_entries_stride;
490 /* Starting index of EM profile ids allocated to the session */
491 uint16_t em_prof_id_start;
492 /* Number of EM profile ids allocated */
493 uint16_t em_prof_id_stride;
494 /* Starting index of EM record entries allocated to the session */
495 uint16_t em_record_entries_start;
496 /* Number of EM record entries allocated */
497 uint16_t em_record_entries_stride;
498 /* Starting index of WC TCAM profiles ids allocated to the session */
499 uint16_t wc_tcam_prof_id_start;
500 /* Number of WC TCAM profile ids allocated */
501 uint16_t wc_tcam_prof_id_stride;
502 /* Starting index of WC TCAM entries allocated to the session */
503 uint16_t wc_tcam_entries_start;
504 /* Number of WC TCAM allocated */
505 uint16_t wc_tcam_entries_stride;
506 /* Starting index of meter profiles allocated to the session */
507 uint16_t meter_profiles_start;
508 /* Number of meter profiles allocated */
509 uint16_t meter_profiles_stride;
510 /* Starting index of meter instance allocated to the session */
511 uint16_t meter_inst_start;
512 /* Number of meter instance allocated */
513 uint16_t meter_inst_stride;
514 /* Starting index of mirrors allocated to the session */
515 uint16_t mirrors_start;
516 /* Number of mirrors allocated */
517 uint16_t mirrors_stride;
518 /* Starting index of UPAR allocated to the session */
520 /* Number of UPAR allocated */
521 uint16_t upar_stride;
522 /* Starting index of SP TCAM entries allocated to the session */
523 uint16_t sp_tcam_entries_start;
524 /* Number of SP TCAM entries allocated */
525 uint16_t sp_tcam_entries_stride;
526 /* Starting index of L2 functions allocated to the session */
527 uint16_t l2_func_start;
528 /* Number of L2 functions allocated */
529 uint16_t l2_func_stride;
530 /* Starting index of flexible key templates allocated to the session */
531 uint16_t flex_key_templ_start;
532 /* Number of flexible key templates allocated */
533 uint16_t flex_key_templ_stride;
534 /* Starting index of table scopes allocated to the session */
535 uint16_t tbl_scope_start;
536 /* Number of table scopes allocated */
537 uint16_t tbl_scope_stride;
538 /* Starting index of epoch0 entries allocated to the session */
539 uint16_t epoch0_entries_start;
540 /* Number of epoch0 entries allocated */
541 uint16_t epoch0_entries_stride;
542 /* Starting index of epoch1 entries allocated to the session */
543 uint16_t epoch1_entries_start;
544 /* Number of epoch1 entries allocated */
545 uint16_t epoch1_entries_stride;
546 /* Starting index of metadata allocated to the session */
547 uint16_t metadata_start;
548 /* Number of metadata allocated */
549 uint16_t metadata_stride;
550 /* Starting index of CT states allocated to the session */
551 uint16_t ct_state_start;
552 /* Number of CT states allocated */
553 uint16_t ct_state_stride;
554 /* Starting index of range profiles allocated to the session */
555 uint16_t range_prof_start;
556 /* Number range profiles allocated */
557 uint16_t range_prof_stride;
558 /* Starting index of range entries allocated to the session */
559 uint16_t range_entries_start;
560 /* Number of range entries allocated */
561 uint16_t range_entries_stride;
562 /* Starting index of LAG table entries allocated to the session */
563 uint16_t lag_tbl_entries_start;
564 /* Number of LAG table entries allocated */
565 uint16_t lag_tbl_entries_stride;
566 } tf_session_hw_resc_flush_input_t, *ptf_session_hw_resc_flush_input_t;
568 /* Input params for session resource SRAM qcaps */
569 typedef struct tf_session_sram_resc_qcaps_input {
570 /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
571 uint32_t fw_session_id;
574 /* When set to 0, indicates the query apply to RX */
575 #define TF_SESSION_SRAM_RESC_QCAPS_INPUT_FLAGS_DIR_RX (0x0)
576 /* When set to 1, indicates the query apply to TX */
577 #define TF_SESSION_SRAM_RESC_QCAPS_INPUT_FLAGS_DIR_TX (0x1)
578 } tf_session_sram_resc_qcaps_input_t, *ptf_session_sram_resc_qcaps_input_t;
580 /* Output params for session resource SRAM qcaps */
581 typedef struct tf_session_sram_resc_qcaps_output {
584 /* When set to 0, indicates Static partitioning */
585 #define TF_SESSION_SRAM_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_STATIC (0x0)
586 /* When set to 1, indicates Strategy 1 */
587 #define TF_SESSION_SRAM_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_1 (0x1)
588 /* When set to 1, indicates Strategy 2 */
589 #define TF_SESSION_SRAM_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_2 (0x2)
590 /* When set to 1, indicates Strategy 3 */
591 #define TF_SESSION_SRAM_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_3 (0x3)
592 /* Minimum guaranteed number of Full Action */
593 uint16_t full_action_min;
594 /* Maximum non-guaranteed number of Full Action */
595 uint16_t full_action_max;
596 /* Minimum guaranteed number of MCG */
598 /* Maximum non-guaranteed number of MCG */
600 /* Minimum guaranteed number of Encap 8B */
601 uint16_t encap_8b_min;
602 /* Maximum non-guaranteed number of Encap 8B */
603 uint16_t encap_8b_max;
604 /* Minimum guaranteed number of Encap 16B */
605 uint16_t encap_16b_min;
606 /* Maximum non-guaranteed number of Encap 16B */
607 uint16_t encap_16b_max;
608 /* Minimum guaranteed number of Encap 64B */
609 uint16_t encap_64b_min;
610 /* Maximum non-guaranteed number of Encap 64B */
611 uint16_t encap_64b_max;
612 /* Minimum guaranteed number of SP SMAC */
613 uint16_t sp_smac_min;
614 /* Maximum non-guaranteed number of SP SMAC */
615 uint16_t sp_smac_max;
616 /* Minimum guaranteed number of SP SMAC IPv4 */
617 uint16_t sp_smac_ipv4_min;
618 /* Maximum non-guaranteed number of SP SMAC IPv4 */
619 uint16_t sp_smac_ipv4_max;
620 /* Minimum guaranteed number of SP SMAC IPv6 */
621 uint16_t sp_smac_ipv6_min;
622 /* Maximum non-guaranteed number of SP SMAC IPv6 */
623 uint16_t sp_smac_ipv6_max;
624 /* Minimum guaranteed number of Counter 64B */
625 uint16_t counter_64b_min;
626 /* Maximum non-guaranteed number of Counter 64B */
627 uint16_t counter_64b_max;
628 /* Minimum guaranteed number of NAT SPORT */
629 uint16_t nat_sport_min;
630 /* Maximum non-guaranteed number of NAT SPORT */
631 uint16_t nat_sport_max;
632 /* Minimum guaranteed number of NAT DPORT */
633 uint16_t nat_dport_min;
634 /* Maximum non-guaranteed number of NAT DPORT */
635 uint16_t nat_dport_max;
636 /* Minimum guaranteed number of NAT S_IPV4 */
637 uint16_t nat_s_ipv4_min;
638 /* Maximum non-guaranteed number of NAT S_IPV4 */
639 uint16_t nat_s_ipv4_max;
640 /* Minimum guaranteed number of NAT D_IPV4 */
641 uint16_t nat_d_ipv4_min;
642 /* Maximum non-guaranteed number of NAT D_IPV4 */
643 uint16_t nat_d_ipv4_max;
644 } tf_session_sram_resc_qcaps_output_t, *ptf_session_sram_resc_qcaps_output_t;
646 /* Input params for session resource SRAM alloc */
647 typedef struct tf_session_sram_resc_alloc_input {
649 uint32_t fw_session_id;
652 /* When set to 0, indicates the query apply to RX */
653 #define TF_SESSION_SRAM_RESC_ALLOC_INPUT_FLAGS_DIR_RX (0x0)
654 /* When set to 1, indicates the query apply to TX */
655 #define TF_SESSION_SRAM_RESC_ALLOC_INPUT_FLAGS_DIR_TX (0x1)
658 /* Number of full action SRAM entries to be allocated */
659 uint16_t num_full_action;
660 /* Number of multicast groups to be allocated */
662 /* Number of Encap 8B entries to be allocated */
663 uint16_t num_encap_8b;
664 /* Number of Encap 16B entries to be allocated */
665 uint16_t num_encap_16b;
666 /* Number of Encap 64B entries to be allocated */
667 uint16_t num_encap_64b;
668 /* Number of SP SMAC entries to be allocated */
669 uint16_t num_sp_smac;
670 /* Number of SP SMAC IPv4 entries to be allocated */
671 uint16_t num_sp_smac_ipv4;
672 /* Number of SP SMAC IPv6 entries to be allocated */
673 uint16_t num_sp_smac_ipv6;
674 /* Number of Counter 64B entries to be allocated */
675 uint16_t num_counter_64b;
676 /* Number of NAT source ports to be allocated */
677 uint16_t num_nat_sport;
678 /* Number of NAT destination ports to be allocated */
679 uint16_t num_nat_dport;
680 /* Number of NAT source iPV4 addresses to be allocated */
681 uint16_t num_nat_s_ipv4;
682 /* Number of NAT destination IPV4 addresses to be allocated */
683 uint16_t num_nat_d_ipv4;
684 } tf_session_sram_resc_alloc_input_t, *ptf_session_sram_resc_alloc_input_t;
686 /* Output params for session resource SRAM alloc */
687 typedef struct tf_session_sram_resc_alloc_output {
690 /* Starting index of full action SRAM entries allocated to the session */
691 uint16_t full_action_start;
692 /* Number of full action SRAM entries allocated */
693 uint16_t full_action_stride;
694 /* Starting index of multicast groups allocated to this session */
696 /* Number of multicast groups allocated */
698 /* Starting index of encap 8B entries allocated to the session */
699 uint16_t encap_8b_start;
700 /* Number of encap 8B entries allocated */
701 uint16_t encap_8b_stride;
702 /* Starting index of encap 16B entries allocated to the session */
703 uint16_t encap_16b_start;
704 /* Number of encap 16B entries allocated */
705 uint16_t encap_16b_stride;
706 /* Starting index of encap 64B entries allocated to the session */
707 uint16_t encap_64b_start;
708 /* Number of encap 64B entries allocated */
709 uint16_t encap_64b_stride;
710 /* Starting index of SP SMAC entries allocated to the session */
711 uint16_t sp_smac_start;
712 /* Number of SP SMAC entries allocated */
713 uint16_t sp_smac_stride;
714 /* Starting index of SP SMAC IPv4 entries allocated to the session */
715 uint16_t sp_smac_ipv4_start;
716 /* Number of SP SMAC IPv4 entries allocated */
717 uint16_t sp_smac_ipv4_stride;
718 /* Starting index of SP SMAC IPv6 entries allocated to the session */
719 uint16_t sp_smac_ipv6_start;
720 /* Number of SP SMAC IPv6 entries allocated */
721 uint16_t sp_smac_ipv6_stride;
722 /* Starting index of Counter 64B entries allocated to the session */
723 uint16_t counter_64b_start;
724 /* Number of Counter 64B entries allocated */
725 uint16_t counter_64b_stride;
726 /* Starting index of NAT source ports allocated to the session */
727 uint16_t nat_sport_start;
728 /* Number of NAT source ports allocated */
729 uint16_t nat_sport_stride;
730 /* Starting index of NAT destination ports allocated to the session */
731 uint16_t nat_dport_start;
732 /* Number of NAT destination ports allocated */
733 uint16_t nat_dport_stride;
734 /* Starting index of NAT source IPV4 addresses allocated to the session */
735 uint16_t nat_s_ipv4_start;
736 /* Number of NAT source IPV4 addresses allocated */
737 uint16_t nat_s_ipv4_stride;
739 * Starting index of NAT destination IPV4 addresses allocated to the
742 uint16_t nat_d_ipv4_start;
743 /* Number of NAT destination IPV4 addresses allocated */
744 uint16_t nat_d_ipv4_stride;
745 } tf_session_sram_resc_alloc_output_t, *ptf_session_sram_resc_alloc_output_t;
747 /* Input params for session resource SRAM free */
748 typedef struct tf_session_sram_resc_free_input {
749 /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
750 uint32_t fw_session_id;
753 /* When set to 0, indicates the query apply to RX */
754 #define TF_SESSION_SRAM_RESC_FREE_INPUT_FLAGS_DIR_RX (0x0)
755 /* When set to 1, indicates the query apply to TX */
756 #define TF_SESSION_SRAM_RESC_FREE_INPUT_FLAGS_DIR_TX (0x1)
757 /* Starting index of full action SRAM entries allocated to the session */
758 uint16_t full_action_start;
759 /* Number of full action SRAM entries allocated */
760 uint16_t full_action_stride;
761 /* Starting index of multicast groups allocated to this session */
763 /* Number of multicast groups allocated */
765 /* Starting index of encap 8B entries allocated to the session */
766 uint16_t encap_8b_start;
767 /* Number of encap 8B entries allocated */
768 uint16_t encap_8b_stride;
769 /* Starting index of encap 16B entries allocated to the session */
770 uint16_t encap_16b_start;
771 /* Number of encap 16B entries allocated */
772 uint16_t encap_16b_stride;
773 /* Starting index of encap 64B entries allocated to the session */
774 uint16_t encap_64b_start;
775 /* Number of encap 64B entries allocated */
776 uint16_t encap_64b_stride;
777 /* Starting index of SP SMAC entries allocated to the session */
778 uint16_t sp_smac_start;
779 /* Number of SP SMAC entries allocated */
780 uint16_t sp_smac_stride;
781 /* Starting index of SP SMAC IPv4 entries allocated to the session */
782 uint16_t sp_smac_ipv4_start;
783 /* Number of SP SMAC IPv4 entries allocated */
784 uint16_t sp_smac_ipv4_stride;
785 /* Starting index of SP SMAC IPv6 entries allocated to the session */
786 uint16_t sp_smac_ipv6_start;
787 /* Number of SP SMAC IPv6 entries allocated */
788 uint16_t sp_smac_ipv6_stride;
789 /* Starting index of Counter 64B entries allocated to the session */
790 uint16_t counter_64b_start;
791 /* Number of Counter 64B entries allocated */
792 uint16_t counter_64b_stride;
793 /* Starting index of NAT source ports allocated to the session */
794 uint16_t nat_sport_start;
795 /* Number of NAT source ports allocated */
796 uint16_t nat_sport_stride;
797 /* Starting index of NAT destination ports allocated to the session */
798 uint16_t nat_dport_start;
799 /* Number of NAT destination ports allocated */
800 uint16_t nat_dport_stride;
801 /* Starting index of NAT source IPV4 addresses allocated to the session */
802 uint16_t nat_s_ipv4_start;
803 /* Number of NAT source IPV4 addresses allocated */
804 uint16_t nat_s_ipv4_stride;
806 * Starting index of NAT destination IPV4 addresses allocated to the
809 uint16_t nat_d_ipv4_start;
810 /* Number of NAT destination IPV4 addresses allocated */
811 uint16_t nat_d_ipv4_stride;
812 } tf_session_sram_resc_free_input_t, *ptf_session_sram_resc_free_input_t;
814 /* Input params for session resource SRAM flush */
815 typedef struct tf_session_sram_resc_flush_input {
816 /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
817 uint32_t fw_session_id;
820 /* When set to 0, indicates the flush apply to RX */
821 #define TF_SESSION_SRAM_RESC_FLUSH_INPUT_FLAGS_DIR_RX (0x0)
822 /* When set to 1, indicates the flush apply to TX */
823 #define TF_SESSION_SRAM_RESC_FLUSH_INPUT_FLAGS_DIR_TX (0x1)
824 /* Starting index of full action SRAM entries allocated to the session */
825 uint16_t full_action_start;
826 /* Number of full action SRAM entries allocated */
827 uint16_t full_action_stride;
828 /* Starting index of multicast groups allocated to this session */
830 /* Number of multicast groups allocated */
832 /* Starting index of encap 8B entries allocated to the session */
833 uint16_t encap_8b_start;
834 /* Number of encap 8B entries allocated */
835 uint16_t encap_8b_stride;
836 /* Starting index of encap 16B entries allocated to the session */
837 uint16_t encap_16b_start;
838 /* Number of encap 16B entries allocated */
839 uint16_t encap_16b_stride;
840 /* Starting index of encap 64B entries allocated to the session */
841 uint16_t encap_64b_start;
842 /* Number of encap 64B entries allocated */
843 uint16_t encap_64b_stride;
844 /* Starting index of SP SMAC entries allocated to the session */
845 uint16_t sp_smac_start;
846 /* Number of SP SMAC entries allocated */
847 uint16_t sp_smac_stride;
848 /* Starting index of SP SMAC IPv4 entries allocated to the session */
849 uint16_t sp_smac_ipv4_start;
850 /* Number of SP SMAC IPv4 entries allocated */
851 uint16_t sp_smac_ipv4_stride;
852 /* Starting index of SP SMAC IPv6 entries allocated to the session */
853 uint16_t sp_smac_ipv6_start;
854 /* Number of SP SMAC IPv6 entries allocated */
855 uint16_t sp_smac_ipv6_stride;
856 /* Starting index of Counter 64B entries allocated to the session */
857 uint16_t counter_64b_start;
858 /* Number of Counter 64B entries allocated */
859 uint16_t counter_64b_stride;
860 /* Starting index of NAT source ports allocated to the session */
861 uint16_t nat_sport_start;
862 /* Number of NAT source ports allocated */
863 uint16_t nat_sport_stride;
864 /* Starting index of NAT destination ports allocated to the session */
865 uint16_t nat_dport_start;
866 /* Number of NAT destination ports allocated */
867 uint16_t nat_dport_stride;
868 /* Starting index of NAT source IPV4 addresses allocated to the session */
869 uint16_t nat_s_ipv4_start;
870 /* Number of NAT source IPV4 addresses allocated */
871 uint16_t nat_s_ipv4_stride;
873 * Starting index of NAT destination IPV4 addresses allocated to the
876 uint16_t nat_d_ipv4_start;
877 /* Number of NAT destination IPV4 addresses allocated */
878 uint16_t nat_d_ipv4_stride;
879 } tf_session_sram_resc_flush_input_t, *ptf_session_sram_resc_flush_input_t;
881 /* Input params for table type set */
882 typedef struct tf_tbl_type_set_input {
884 uint32_t fw_session_id;
887 /* When set to 0, indicates the get apply to RX */
888 #define TF_TBL_TYPE_SET_INPUT_FLAGS_DIR_RX (0x0)
889 /* When set to 1, indicates the get apply to TX */
890 #define TF_TBL_TYPE_SET_INPUT_FLAGS_DIR_TX (0x1)
891 /* Type of the object to set */
893 /* Size of the data to set in bytes */
896 uint8_t data[TF_BULK_SEND];
899 } tf_tbl_type_set_input_t, *ptf_tbl_type_set_input_t;
901 /* Input params for table type get */
902 typedef struct tf_tbl_type_get_input {
904 uint32_t fw_session_id;
907 /* When set to 0, indicates the get apply to RX */
908 #define TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_RX (0x0)
909 /* When set to 1, indicates the get apply to TX */
910 #define TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_TX (0x1)
911 /* Type of the object to set */
915 } tf_tbl_type_get_input_t, *ptf_tbl_type_get_input_t;
917 /* Output params for table type get */
918 typedef struct tf_tbl_type_get_output {
919 /* Size of the data read in bytes */
922 uint8_t data[TF_BULK_RECV];
923 } tf_tbl_type_get_output_t, *ptf_tbl_type_get_output_t;
925 /* Input params for EM internal rule insert */
926 typedef struct tf_em_internal_insert_input {
927 /* Firmware Session Id */
928 uint32_t fw_session_id;
931 /* When set to 0, indicates the get apply to RX */
932 #define TF_EM_INTERNAL_INSERT_INPUT_FLAGS_DIR_RX (0x0)
933 /* When set to 1, indicates the get apply to TX */
934 #define TF_EM_INTERNAL_INSERT_INPUT_FLAGS_DIR_TX (0x1)
937 /* index to action */
939 /* index of em record */
940 uint32_t em_record_idx;
943 /* number of bits in em_key */
944 uint16_t em_key_bitlen;
945 } tf_em_internal_insert_input_t, *ptf_em_internal_insert_input_t;
947 /* Output params for EM internal rule insert */
948 typedef struct tf_em_internal_insert_output {
949 /* EM record pointer index */
951 /* EM record offset 0~3 */
953 /* Number of word entries consumed by the key */
954 uint8_t num_of_entries;
955 } tf_em_internal_insert_output_t, *ptf_em_internal_insert_output_t;
957 /* Input params for EM INTERNAL rule delete */
958 typedef struct tf_em_internal_delete_input {
960 uint32_t tf_session_id;
963 /* When set to 0, indicates the get apply to RX */
964 #define TF_EM_INTERNAL_DELETE_INPUT_FLAGS_DIR_RX (0x0)
965 /* When set to 1, indicates the get apply to TX */
966 #define TF_EM_INTERNAL_DELETE_INPUT_FLAGS_DIR_TX (0x1)
967 /* EM internal flow hanndle */
968 uint64_t flow_handle;
971 /* number of bits in em_key */
972 uint16_t em_key_bitlen;
973 } tf_em_internal_delete_input_t, *ptf_em_internal_delete_input_t;
975 /* Input params for EM INTERNAL rule delete */
976 typedef struct tf_em_internal_delete_output {
977 /* Original stack allocation index */
979 } tf_em_internal_delete_output_t, *ptf_em_internal_delete_output_t;
981 #endif /* _HWRM_TF_H_ */