1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2021 Broadcom
9 #include <rte_common.h>
10 #include <hsi_struct_def_dpdk.h>
12 #include "tf_em_common.h"
16 #include "tf_global_cfg.h"
21 /* HWRM Direct messages */
24 * Sends session open request to Firmware
27 * Pointer to bnxt handle
30 * PCI name of the control channel
32 * [in/out] fw_session_id
33 * Pointer to the fw_session_id that is allocated on firmware side
35 * [in/out] fw_session_client_id
36 * Pointer to the fw_session_client_id that is allocated on firmware side
39 * Pointer to the associated device
41 * [out] shared_session_creator
42 * Pointer to the shared_session_creator
45 * 0 on Success else internal Truflow error
47 int tf_msg_session_open(struct bnxt *bp,
49 uint8_t *fw_session_id,
50 uint8_t *fw_session_client_id,
51 struct tf_dev_info *dev,
52 bool *shared_session_creator);
55 * Sends session close request to Firmware
58 * Pointer to session handle
61 * PCI name of the control channel
64 * Pointer to the fw_session_id that is assigned to the session at
65 * time of session open
68 * 0 on Success else internal Truflow error
70 int tf_msg_session_attach(struct tf *tfp,
71 char *ctrl_channel_name,
72 uint8_t tf_fw_session_id);
75 * Sends session client register request to Firmware
78 * Pointer to session handle
81 * PCI name of the control channel
83 * [in/out] fw_session_client_id
84 * Pointer to the fw_session_client_id that is allocated on firmware
88 * 0 on Success else internal Truflow error
90 int tf_msg_session_client_register(struct tf *tfp,
91 struct tf_session *tfs,
92 char *ctrl_channel_name,
93 uint8_t *fw_session_client_id);
96 * Sends session client unregister request to Firmware
99 * Pointer to session handle
101 * [in/out] fw_session_client_id
102 * Pointer to the fw_session_client_id that is allocated on firmware
106 * 0 on Success else internal Truflow error
108 int tf_msg_session_client_unregister(struct tf *tfp,
109 struct tf_session *tfs,
110 uint8_t fw_session_client_id);
113 * Sends session close request to Firmware
116 * Pointer to session handle
119 * 0 on Success else internal Truflow error
121 int tf_msg_session_close(struct tf *tfp,
122 struct tf_session *tfs);
125 * Sends session query config request to TF Firmware
128 * Pointer to session handle
131 * 0 on Success else internal Truflow error
133 int tf_msg_session_qcfg(struct tf *tfp);
136 * Sends session HW resource query capability request to TF Firmware
139 * Pointer to TF handle
142 * Receive or Transmit direction
145 * Number of elements in the query. Should be set to the max
146 * elements for the device type
149 * Pointer to an array of query elements
151 * [out] resv_strategy
152 * Pointer to the reservation strategy
155 * 0 on Success else internal Truflow error
157 int tf_msg_session_resc_qcaps(struct tf *tfp,
158 struct tf_dev_info *dev,
161 struct tf_rm_resc_req_entry *query,
162 enum tf_rm_resc_resv_strategy *resv_strategy);
165 * Sends session HW resource allocation request to TF Firmware
168 * Pointer to TF handle
171 * Receive or Transmit direction
174 * Number of elements in the req and resv arrays
177 * Pointer to an array of request elements
180 * Pointer to an array of reserved elements
183 * 0 on Success else internal Truflow error
185 int tf_msg_session_resc_alloc(struct tf *tfp,
186 struct tf_dev_info *dev,
189 struct tf_rm_resc_req_entry *request,
190 struct tf_rm_resc_entry *resv);
193 * Sends session HW resource allocation request to TF Firmware
196 * Pointer to TF handle
199 * Receive or Transmit direction
202 * Number of elements in the req and resv arrays
205 * Pointer to an array of request elements
208 * Pointer to an array of reserved elements
211 * 0 on Success else internal Truflow error
213 int tf_msg_session_resc_info(struct tf *tfp,
214 struct tf_dev_info *dev,
217 struct tf_rm_resc_req_entry *request,
218 struct tf_rm_resc_entry *resv);
221 * Sends session resource flush request to TF Firmware
224 * Pointer to TF handle
227 * Receive or Transmit direction
230 * Number of elements in the req and resv arrays
233 * Pointer to an array of reserved elements that needs to be flushed
236 * 0 on Success else internal Truflow error
238 int tf_msg_session_resc_flush(struct tf *tfp,
241 struct tf_rm_resc_entry *resv);
243 * Sends EM internal insert request to Firmware
246 * Pointer to TF handle
249 * Pointer to em insert parameter list
257 * [in] num_of_entries
258 * Number of entries to insert
261 * 0 on Success else internal Truflow error
263 int tf_msg_insert_em_internal_entry(struct tf *tfp,
264 struct tf_insert_em_entry_parms *params,
265 uint16_t *rptr_index,
267 uint8_t *num_of_entries);
269 * Sends EM hash internal insert request to Firmware
272 * Pointer to TF handle
275 * Pointer to em insert parameter list
281 * Lookup3 hash of key
289 * [in] num_of_entries
290 * Number of entries to insert
293 * 0 on Success else internal Truflow error
296 tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
297 struct tf_insert_em_entry_parms *em_parms,
300 uint16_t *rptr_index,
302 uint8_t *num_of_entries);
304 * Sends EM internal delete request to Firmware
307 * Pointer to TF handle
310 * Pointer to em delete parameters
313 * 0 on Success else internal Truflow error
315 int tf_msg_delete_em_entry(struct tf *tfp,
316 struct tf_delete_em_entry_parms *em_parms);
319 * Sends EM internal move request to Firmware
322 * Pointer to TF handle
325 * Pointer to em move parameters
328 * 0 on Success else internal Truflow error
330 int tf_msg_move_em_entry(struct tf *tfp,
331 struct tf_move_em_entry_parms *em_parms);
334 * Sends Ext EM mem allocation request to Firmware
337 * Pointer to TF handle
340 * memory allocation details
352 * 0 on Success else internal Truflow error
354 int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
355 struct hcapi_cfa_em_table *tbl,
358 uint32_t *page_size);
361 * Sends Ext EM mem allocation request to Firmware
364 * Pointer to TF handle
370 * Pointer to the PBL or PDL depending on number of levels
373 * PBL indirect levels
379 * 0 on Success else internal Truflow error
381 int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
388 * Sends EM mem register request to Firmware
391 * Pointer to TF handle
400 * DMA Address for the memory page
406 * 0 on Success else internal Truflow error
408 int tf_msg_em_mem_rgtr(struct tf *tfp,
415 * Sends EM mem unregister request to Firmware
418 * Pointer to TF handle
424 * 0 on Success else internal Truflow error
426 int tf_msg_em_mem_unrgtr(struct tf *tfp,
430 * Sends EM qcaps request to Firmware
433 * Pointer to TF handle
436 * Receive or Transmit direction
439 * Pointer to EM capabilities
442 * 0 on Success else internal Truflow error
444 int tf_msg_em_qcaps(struct tf *tfp,
446 struct tf_em_caps *em_caps);
449 * Sends EM config request to Firmware
452 * Pointer to TF handle
455 * EM Table, key 0, number of entries to configure
458 * EM Table, Key 0 context id
461 * EM Table, Key 1 context id
464 * EM Table, Record context id
467 * EM Table, EFC Table context id
469 * [in] flush_interval
470 * Flush pending HW cached flows every 1/10th of value set in
471 * seconds, both idle and active flows are flushed from the HW
472 * cache. If set to 0, this feature will be disabled.
475 * Receive or Transmit direction
478 * 0 on Success else internal Truflow error
480 int tf_msg_em_cfg(struct tf *tfp,
481 uint32_t num_entries,
482 uint16_t key0_ctx_id,
483 uint16_t key1_ctx_id,
484 uint16_t record_ctx_id,
486 uint8_t flush_interval,
490 * Sends Ext EM config request to Firmware
493 * Pointer to TF handle
499 * Table scope parameters
504 * [in] flush_interval
505 * Flush pending HW cached flows every 1/10th of value set in
506 * seconds, both idle and active flows are flushed from the HW
507 * cache. If set to 0, this feature will be disabled.
510 * Receive or Transmit direction
513 * 0 on Success else internal Truflow error
515 int tf_msg_ext_em_cfg(struct tf *tfp,
516 struct tf_tbl_scope_cb *tbl_scope_cb,
518 uint8_t flush_interval,
522 * Sends EM operation request to Firmware
525 * Pointer to TF handle
528 * Receive or Transmit direction
534 * 0 on Success else internal Truflow error
536 int tf_msg_em_op(struct tf *tfp,
541 * Sends tcam entry 'set' to the Firmware.
544 * Pointer to session handle
547 * Pointer to set parameters
550 * 0 on Success else internal Truflow error
552 int tf_msg_tcam_entry_set(struct tf *tfp,
553 struct tf_dev_info *dev,
554 struct tf_tcam_set_parms *parms);
557 * Sends tcam entry 'get' to the Firmware.
560 * Pointer to session handle
563 * Pointer to get parameters
566 * 0 on Success else internal Truflow error
568 int tf_msg_tcam_entry_get(struct tf *tfp,
569 struct tf_dev_info *dev,
570 struct tf_tcam_get_parms *parms);
573 * Sends tcam entry 'free' to the Firmware.
576 * Pointer to session handle
579 * Pointer to free parameters
582 * 0 on Success else internal Truflow error
584 int tf_msg_tcam_entry_free(struct tf *tfp,
585 struct tf_dev_info *dev,
586 struct tf_tcam_free_parms *parms);
589 * Sends Set message of a Table Type element to the firmware.
592 * Pointer to session handle
595 * Direction location of the element to set
598 * Type of the object to set
601 * Size of the data to set
612 int tf_msg_set_tbl_entry(struct tf *tfp,
620 * Sends get message of a Table Type element to the firmware.
623 * Pointer to session handle
626 * Direction location of the element to get
629 * Type of the object to get
632 * Size of the data read
643 int tf_msg_get_tbl_entry(struct tf *tfp,
650 /* HWRM Tunneled messages */
653 * Sends global cfg read request to Firmware
656 * Pointer to TF handle
659 * Pointer to read parameters
662 * 0 on Success else internal Truflow error
664 int tf_msg_get_global_cfg(struct tf *tfp,
665 struct tf_global_cfg_parms *params);
668 * Sends global cfg update request to Firmware
671 * Pointer to TF handle
674 * Pointer to write parameters
677 * 0 on Success else internal Truflow error
679 int tf_msg_set_global_cfg(struct tf *tfp,
680 struct tf_global_cfg_parms *params);
683 * Sends bulk get message of a Table Type element to the firmware.
686 * Pointer to session handle
689 * Pointer to table get bulk parameters
692 * 0 on Success else internal Truflow error
694 int tf_msg_bulk_get_tbl_entry(struct tf *tfp,
697 uint32_t starting_idx,
698 uint16_t num_entries,
699 uint16_t entry_sz_in_bytes,
700 uint64_t physical_mem_addr);
703 * Sends Set message of a IF Table Type element to the firmware.
706 * Pointer to session handle
709 * Pointer to IF table set parameters
712 * 0 on Success else internal Truflow error
714 int tf_msg_set_if_tbl_entry(struct tf *tfp,
715 struct tf_if_tbl_set_parms *params);
718 * Sends get message of a IF Table Type element to the firmware.
721 * Pointer to session handle
724 * Pointer to IF table get parameters
727 * 0 on Success else internal Truflow error
729 int tf_msg_get_if_tbl_entry(struct tf *tfp,
730 struct tf_if_tbl_get_parms *params);
732 #endif /* _TF_MSG_H_ */