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
125 * 0 on Success else internal Truflow error
127 int tf_msg_session_close(struct tf *tfp,
128 uint8_t fw_session_id,
132 * Sends session query config request to TF Firmware
135 * Pointer to session handle
138 * 0 on Success else internal Truflow error
140 int tf_msg_session_qcfg(struct tf *tfp);
143 * Sends session HW resource query capability request to TF Firmware
146 * Pointer to TF handle
149 * Receive or Transmit direction
152 * Number of elements in the query. Should be set to the max
153 * elements for the device type
156 * Pointer to an array of query elements
158 * [out] resv_strategy
159 * Pointer to the reservation strategy
162 * Pointer to the sram profile
165 * 0 on Success else internal Truflow error
167 int tf_msg_session_resc_qcaps(struct tf *tfp,
168 struct tf_dev_info *dev,
171 struct tf_rm_resc_req_entry *query,
172 enum tf_rm_resc_resv_strategy *resv_strategy,
173 uint8_t *sram_profile);
176 * Sends session HW resource allocation request to TF Firmware
179 * Pointer to TF handle
182 * Receive or Transmit direction
185 * Number of elements in the req and resv arrays
188 * Pointer to an array of request elements
191 * Pointer to an array of reserved elements
194 * 0 on Success else internal Truflow error
196 int tf_msg_session_resc_alloc(struct tf *tfp,
197 struct tf_dev_info *dev,
200 struct tf_rm_resc_req_entry *request,
201 struct tf_rm_resc_entry *resv);
204 * Sends session HW resource allocation request to TF Firmware
207 * Pointer to TF handle
210 * Receive or Transmit direction
213 * Number of elements in the req and resv arrays
216 * Pointer to an array of request elements
219 * Pointer to an array of reserved elements
222 * 0 on Success else internal Truflow error
224 int tf_msg_session_resc_info(struct tf *tfp,
225 struct tf_dev_info *dev,
228 struct tf_rm_resc_req_entry *request,
229 struct tf_rm_resc_entry *resv);
232 * Sends session resource flush request to TF Firmware
235 * Pointer to TF handle
238 * Receive or Transmit direction
241 * Number of elements in the req and resv arrays
244 * Pointer to an array of reserved elements that needs to be flushed
247 * 0 on Success else internal Truflow error
249 int tf_msg_session_resc_flush(struct tf *tfp,
252 struct tf_rm_resc_entry *resv);
254 * Sends EM internal insert request to Firmware
257 * Pointer to TF handle
260 * Pointer to em insert parameter list
268 * [in] num_of_entries
269 * Number of entries to insert
272 * 0 on Success else internal Truflow error
274 int tf_msg_insert_em_internal_entry(struct tf *tfp,
275 struct tf_insert_em_entry_parms *params,
276 uint16_t *rptr_index,
278 uint8_t *num_of_entries);
280 * Sends EM hash internal insert request to Firmware
283 * Pointer to TF handle
286 * Pointer to em insert parameter list
292 * Lookup3 hash of key
300 * [in] num_of_entries
301 * Number of entries to insert
304 * 0 on Success else internal Truflow error
307 tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
308 struct tf_insert_em_entry_parms *em_parms,
311 uint16_t *rptr_index,
313 uint8_t *num_of_entries);
315 * Sends EM internal delete request to Firmware
318 * Pointer to TF handle
321 * Pointer to em delete parameters
324 * 0 on Success else internal Truflow error
326 int tf_msg_delete_em_entry(struct tf *tfp,
327 struct tf_delete_em_entry_parms *em_parms);
330 * Sends EM internal move request to Firmware
333 * Pointer to TF handle
336 * Pointer to em move parameters
339 * 0 on Success else internal Truflow error
341 int tf_msg_move_em_entry(struct tf *tfp,
342 struct tf_move_em_entry_parms *em_parms);
345 * Sends Ext EM mem allocation request to Firmware
348 * Pointer to TF handle
351 * memory allocation details
363 * 0 on Success else internal Truflow error
365 int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
366 struct hcapi_cfa_em_table *tbl,
369 uint32_t *page_size);
372 * Sends Ext EM mem allocation request to Firmware
375 * Pointer to TF handle
381 * Pointer to the PBL or PDL depending on number of levels
384 * PBL indirect levels
390 * 0 on Success else internal Truflow error
392 int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
399 * Sends EM mem register request to Firmware
402 * Pointer to TF handle
411 * DMA Address for the memory page
417 * 0 on Success else internal Truflow error
419 int tf_msg_em_mem_rgtr(struct tf *tfp,
426 * Sends EM mem unregister request to Firmware
429 * Pointer to TF handle
435 * 0 on Success else internal Truflow error
437 int tf_msg_em_mem_unrgtr(struct tf *tfp,
441 * Sends EM qcaps request to Firmware
444 * Pointer to TF handle
447 * Receive or Transmit direction
450 * Pointer to EM capabilities
453 * 0 on Success else internal Truflow error
455 int tf_msg_em_qcaps(struct tf *tfp,
457 struct tf_em_caps *em_caps);
460 * Sends EM config request to Firmware
463 * Pointer to TF handle
466 * EM Table, key 0, number of entries to configure
469 * EM Table, Key 0 context id
472 * EM Table, Key 1 context id
475 * EM Table, Record context id
478 * EM Table, EFC Table context id
480 * [in] flush_interval
481 * Flush pending HW cached flows every 1/10th of value set in
482 * seconds, both idle and active flows are flushed from the HW
483 * cache. If set to 0, this feature will be disabled.
486 * Receive or Transmit direction
489 * 0 on Success else internal Truflow error
491 int tf_msg_em_cfg(struct tf *tfp,
492 uint32_t num_entries,
493 uint16_t key0_ctx_id,
494 uint16_t key1_ctx_id,
495 uint16_t record_ctx_id,
497 uint8_t flush_interval,
501 * Sends Ext EM config request to Firmware
504 * Pointer to TF handle
510 * Table scope parameters
515 * [in] flush_interval
516 * Flush pending HW cached flows every 1/10th of value set in
517 * seconds, both idle and active flows are flushed from the HW
518 * cache. If set to 0, this feature will be disabled.
521 * Receive or Transmit direction
524 * 0 on Success else internal Truflow error
526 int tf_msg_ext_em_cfg(struct tf *tfp,
527 struct tf_tbl_scope_cb *tbl_scope_cb,
529 uint8_t flush_interval,
533 * Sends EM operation request to Firmware
536 * Pointer to TF handle
539 * Receive or Transmit direction
545 * 0 on Success else internal Truflow error
547 int tf_msg_em_op(struct tf *tfp,
552 * Sends tcam entry 'set' to the Firmware.
555 * Pointer to session handle
558 * Pointer to set parameters
561 * 0 on Success else internal Truflow error
563 int tf_msg_tcam_entry_set(struct tf *tfp,
564 struct tf_dev_info *dev,
565 struct tf_tcam_set_parms *parms);
568 * Sends tcam entry 'get' to the Firmware.
571 * Pointer to session handle
574 * Pointer to get parameters
577 * 0 on Success else internal Truflow error
579 int tf_msg_tcam_entry_get(struct tf *tfp,
580 struct tf_dev_info *dev,
581 struct tf_tcam_get_parms *parms);
584 * Sends tcam entry 'free' to the Firmware.
587 * Pointer to session handle
590 * Pointer to free parameters
593 * 0 on Success else internal Truflow error
595 int tf_msg_tcam_entry_free(struct tf *tfp,
596 struct tf_dev_info *dev,
597 struct tf_tcam_free_parms *parms);
600 * Sends Set message of a Table Type element to the firmware.
603 * Pointer to session handle
606 * Direction location of the element to set
609 * Type of the object to set
612 * Size of the data to set
623 int tf_msg_set_tbl_entry(struct tf *tfp,
631 * Sends get message of a Table Type element to the firmware.
634 * Pointer to session handle
637 * Direction location of the element to get
640 * Type of the object to get
643 * Size of the data read
654 int tf_msg_get_tbl_entry(struct tf *tfp,
662 /* HWRM Tunneled messages */
665 * Sends global cfg read request to Firmware
668 * Pointer to TF handle
671 * Pointer to read parameters
674 * 0 on Success else internal Truflow error
676 int tf_msg_get_global_cfg(struct tf *tfp,
677 struct tf_global_cfg_parms *params);
680 * Sends global cfg update request to Firmware
683 * Pointer to TF handle
686 * Pointer to write parameters
689 * 0 on Success else internal Truflow error
691 int tf_msg_set_global_cfg(struct tf *tfp,
692 struct tf_global_cfg_parms *params);
695 * Sends bulk get message of a Table Type element to the firmware.
698 * Pointer to session handle
701 * Pointer to table get bulk parameters
704 * 0 on Success else internal Truflow error
706 int tf_msg_bulk_get_tbl_entry(struct tf *tfp,
709 uint32_t starting_idx,
710 uint16_t num_entries,
711 uint16_t entry_sz_in_bytes,
712 uint64_t physical_mem_addr,
716 * Sends Set message of a IF Table Type element to the firmware.
719 * Pointer to session handle
722 * Pointer to IF table set parameters
725 * 0 on Success else internal Truflow error
727 int tf_msg_set_if_tbl_entry(struct tf *tfp,
728 struct tf_if_tbl_set_parms *params);
731 * Sends get message of a IF Table Type element to the firmware.
734 * Pointer to session handle
737 * Pointer to IF table get parameters
740 * 0 on Success else internal Truflow error
742 int tf_msg_get_if_tbl_entry(struct tf *tfp,
743 struct tf_if_tbl_get_parms *params);
746 * Send get version request to the firmware.
749 * Pointer to bnxt handle
752 * Pointer to the associated device
755 * Pointer to the version info parameter
758 * 0 on Success else internal Truflow error
761 tf_msg_get_version(struct bnxt *bp,
762 struct tf_dev_info *dev,
763 struct tf_get_version_parms *parms);
764 #endif /* _TF_MSG_H_ */