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