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 * 0 on Success else internal Truflow error
164 int tf_msg_session_resc_qcaps(struct tf *tfp,
165 struct tf_dev_info *dev,
168 struct tf_rm_resc_req_entry *query,
169 enum tf_rm_resc_resv_strategy *resv_strategy);
172 * Sends session HW resource allocation request to TF Firmware
175 * Pointer to TF handle
178 * Receive or Transmit direction
181 * Number of elements in the req and resv arrays
184 * Pointer to an array of request elements
187 * Pointer to an array of reserved elements
190 * 0 on Success else internal Truflow error
192 int tf_msg_session_resc_alloc(struct tf *tfp,
193 struct tf_dev_info *dev,
196 struct tf_rm_resc_req_entry *request,
197 struct tf_rm_resc_entry *resv);
200 * Sends session HW resource allocation request to TF Firmware
203 * Pointer to TF handle
206 * Receive or Transmit direction
209 * Number of elements in the req and resv arrays
212 * Pointer to an array of request elements
215 * Pointer to an array of reserved elements
218 * 0 on Success else internal Truflow error
220 int tf_msg_session_resc_info(struct tf *tfp,
221 struct tf_dev_info *dev,
224 struct tf_rm_resc_req_entry *request,
225 struct tf_rm_resc_entry *resv);
228 * Sends session resource flush request to TF Firmware
231 * Pointer to TF handle
234 * Receive or Transmit direction
237 * Number of elements in the req and resv arrays
240 * Pointer to an array of reserved elements that needs to be flushed
243 * 0 on Success else internal Truflow error
245 int tf_msg_session_resc_flush(struct tf *tfp,
248 struct tf_rm_resc_entry *resv);
250 * Sends EM internal insert request to Firmware
253 * Pointer to TF handle
256 * Pointer to em insert parameter list
264 * [in] num_of_entries
265 * Number of entries to insert
268 * 0 on Success else internal Truflow error
270 int tf_msg_insert_em_internal_entry(struct tf *tfp,
271 struct tf_insert_em_entry_parms *params,
272 uint16_t *rptr_index,
274 uint8_t *num_of_entries);
276 * Sends EM hash internal insert request to Firmware
279 * Pointer to TF handle
282 * Pointer to em insert parameter list
288 * Lookup3 hash of key
296 * [in] num_of_entries
297 * Number of entries to insert
300 * 0 on Success else internal Truflow error
303 tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
304 struct tf_insert_em_entry_parms *em_parms,
307 uint16_t *rptr_index,
309 uint8_t *num_of_entries);
311 * Sends EM internal delete request to Firmware
314 * Pointer to TF handle
317 * Pointer to em delete parameters
320 * 0 on Success else internal Truflow error
322 int tf_msg_delete_em_entry(struct tf *tfp,
323 struct tf_delete_em_entry_parms *em_parms);
326 * Sends EM internal move request to Firmware
329 * Pointer to TF handle
332 * Pointer to em move parameters
335 * 0 on Success else internal Truflow error
337 int tf_msg_move_em_entry(struct tf *tfp,
338 struct tf_move_em_entry_parms *em_parms);
341 * Sends Ext EM mem allocation request to Firmware
344 * Pointer to TF handle
347 * memory allocation details
359 * 0 on Success else internal Truflow error
361 int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
362 struct hcapi_cfa_em_table *tbl,
365 uint32_t *page_size);
368 * Sends Ext EM mem allocation request to Firmware
371 * Pointer to TF handle
377 * Pointer to the PBL or PDL depending on number of levels
380 * PBL indirect levels
386 * 0 on Success else internal Truflow error
388 int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
395 * Sends EM mem register request to Firmware
398 * Pointer to TF handle
407 * DMA Address for the memory page
413 * 0 on Success else internal Truflow error
415 int tf_msg_em_mem_rgtr(struct tf *tfp,
422 * Sends EM mem unregister request to Firmware
425 * Pointer to TF handle
431 * 0 on Success else internal Truflow error
433 int tf_msg_em_mem_unrgtr(struct tf *tfp,
437 * Sends EM qcaps request to Firmware
440 * Pointer to TF handle
443 * Receive or Transmit direction
446 * Pointer to EM capabilities
449 * 0 on Success else internal Truflow error
451 int tf_msg_em_qcaps(struct tf *tfp,
453 struct tf_em_caps *em_caps);
456 * Sends EM config request to Firmware
459 * Pointer to TF handle
462 * EM Table, key 0, number of entries to configure
465 * EM Table, Key 0 context id
468 * EM Table, Key 1 context id
471 * EM Table, Record context id
474 * EM Table, EFC Table context id
476 * [in] flush_interval
477 * Flush pending HW cached flows every 1/10th of value set in
478 * seconds, both idle and active flows are flushed from the HW
479 * cache. If set to 0, this feature will be disabled.
482 * Receive or Transmit direction
485 * 0 on Success else internal Truflow error
487 int tf_msg_em_cfg(struct tf *tfp,
488 uint32_t num_entries,
489 uint16_t key0_ctx_id,
490 uint16_t key1_ctx_id,
491 uint16_t record_ctx_id,
493 uint8_t flush_interval,
497 * Sends Ext EM config request to Firmware
500 * Pointer to TF handle
506 * Table scope parameters
511 * [in] flush_interval
512 * Flush pending HW cached flows every 1/10th of value set in
513 * seconds, both idle and active flows are flushed from the HW
514 * cache. If set to 0, this feature will be disabled.
517 * Receive or Transmit direction
520 * 0 on Success else internal Truflow error
522 int tf_msg_ext_em_cfg(struct tf *tfp,
523 struct tf_tbl_scope_cb *tbl_scope_cb,
525 uint8_t flush_interval,
529 * Sends EM operation request to Firmware
532 * Pointer to TF handle
535 * Receive or Transmit direction
541 * 0 on Success else internal Truflow error
543 int tf_msg_em_op(struct tf *tfp,
548 * Sends tcam entry 'set' to the Firmware.
551 * Pointer to session handle
554 * Pointer to set parameters
557 * 0 on Success else internal Truflow error
559 int tf_msg_tcam_entry_set(struct tf *tfp,
560 struct tf_dev_info *dev,
561 struct tf_tcam_set_parms *parms);
564 * Sends tcam entry 'get' to the Firmware.
567 * Pointer to session handle
570 * Pointer to get parameters
573 * 0 on Success else internal Truflow error
575 int tf_msg_tcam_entry_get(struct tf *tfp,
576 struct tf_dev_info *dev,
577 struct tf_tcam_get_parms *parms);
580 * Sends tcam entry 'free' to the Firmware.
583 * Pointer to session handle
586 * Pointer to free parameters
589 * 0 on Success else internal Truflow error
591 int tf_msg_tcam_entry_free(struct tf *tfp,
592 struct tf_dev_info *dev,
593 struct tf_tcam_free_parms *parms);
596 * Sends Set message of a Table Type element to the firmware.
599 * Pointer to session handle
602 * Direction location of the element to set
605 * Type of the object to set
608 * Size of the data to set
619 int tf_msg_set_tbl_entry(struct tf *tfp,
627 * Sends get message of a Table Type element to the firmware.
630 * Pointer to session handle
633 * Direction location of the element to get
636 * Type of the object to get
639 * Size of the data read
650 int tf_msg_get_tbl_entry(struct tf *tfp,
657 /* HWRM Tunneled messages */
660 * Sends global cfg read request to Firmware
663 * Pointer to TF handle
666 * Pointer to read parameters
669 * 0 on Success else internal Truflow error
671 int tf_msg_get_global_cfg(struct tf *tfp,
672 struct tf_global_cfg_parms *params);
675 * Sends global cfg update request to Firmware
678 * Pointer to TF handle
681 * Pointer to write parameters
684 * 0 on Success else internal Truflow error
686 int tf_msg_set_global_cfg(struct tf *tfp,
687 struct tf_global_cfg_parms *params);
690 * Sends bulk get message of a Table Type element to the firmware.
693 * Pointer to session handle
696 * Pointer to table get bulk parameters
699 * 0 on Success else internal Truflow error
701 int tf_msg_bulk_get_tbl_entry(struct tf *tfp,
704 uint32_t starting_idx,
705 uint16_t num_entries,
706 uint16_t entry_sz_in_bytes,
707 uint64_t physical_mem_addr);
710 * Sends Set message of a IF Table Type element to the firmware.
713 * Pointer to session handle
716 * Pointer to IF table set parameters
719 * 0 on Success else internal Truflow error
721 int tf_msg_set_if_tbl_entry(struct tf *tfp,
722 struct tf_if_tbl_set_parms *params);
725 * Sends get message of a IF Table Type element to the firmware.
728 * Pointer to session handle
731 * Pointer to IF table get parameters
734 * 0 on Success else internal Truflow error
736 int tf_msg_get_if_tbl_entry(struct tf *tfp,
737 struct tf_if_tbl_get_parms *params);
739 #endif /* _TF_MSG_H_ */