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 Ext EM mem allocation request to Firmware
322 * Pointer to TF handle
325 * memory allocation details
337 * 0 on Success else internal Truflow error
339 int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
340 struct hcapi_cfa_em_table *tbl,
343 uint32_t *page_size);
346 * Sends Ext EM mem allocation request to Firmware
349 * Pointer to TF handle
355 * Pointer to the PBL or PDL depending on number of levels
358 * PBL indirect levels
364 * 0 on Success else internal Truflow error
366 int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
373 * Sends EM mem register request to Firmware
376 * Pointer to TF handle
385 * DMA Address for the memory page
391 * 0 on Success else internal Truflow error
393 int tf_msg_em_mem_rgtr(struct tf *tfp,
400 * Sends EM mem unregister request to Firmware
403 * Pointer to TF handle
409 * 0 on Success else internal Truflow error
411 int tf_msg_em_mem_unrgtr(struct tf *tfp,
415 * Sends EM qcaps request to Firmware
418 * Pointer to TF handle
421 * Receive or Transmit direction
424 * Pointer to EM capabilities
427 * 0 on Success else internal Truflow error
429 int tf_msg_em_qcaps(struct tf *tfp,
431 struct tf_em_caps *em_caps);
434 * Sends EM config request to Firmware
437 * Pointer to TF handle
440 * EM Table, key 0, number of entries to configure
443 * EM Table, Key 0 context id
446 * EM Table, Key 1 context id
449 * EM Table, Record context id
452 * EM Table, EFC Table context id
454 * [in] flush_interval
455 * Flush pending HW cached flows every 1/10th of value set in
456 * seconds, both idle and active flows are flushed from the HW
457 * cache. If set to 0, this feature will be disabled.
460 * Receive or Transmit direction
463 * 0 on Success else internal Truflow error
465 int tf_msg_em_cfg(struct tf *tfp,
466 uint32_t num_entries,
467 uint16_t key0_ctx_id,
468 uint16_t key1_ctx_id,
469 uint16_t record_ctx_id,
471 uint8_t flush_interval,
475 * Sends Ext EM config request to Firmware
478 * Pointer to TF handle
484 * Table scope parameters
489 * [in] flush_interval
490 * Flush pending HW cached flows every 1/10th of value set in
491 * seconds, both idle and active flows are flushed from the HW
492 * cache. If set to 0, this feature will be disabled.
495 * Receive or Transmit direction
498 * 0 on Success else internal Truflow error
500 int tf_msg_ext_em_cfg(struct tf *tfp,
501 struct tf_tbl_scope_cb *tbl_scope_cb,
503 uint8_t flush_interval,
507 * Sends EM operation request to Firmware
510 * Pointer to TF handle
513 * Receive or Transmit direction
519 * 0 on Success else internal Truflow error
521 int tf_msg_em_op(struct tf *tfp,
526 * Sends tcam entry 'set' to the Firmware.
529 * Pointer to session handle
532 * Pointer to set parameters
535 * 0 on Success else internal Truflow error
537 int tf_msg_tcam_entry_set(struct tf *tfp,
538 struct tf_dev_info *dev,
539 struct tf_tcam_set_parms *parms);
542 * Sends tcam entry 'get' to the Firmware.
545 * Pointer to session handle
548 * Pointer to get parameters
551 * 0 on Success else internal Truflow error
553 int tf_msg_tcam_entry_get(struct tf *tfp,
554 struct tf_dev_info *dev,
555 struct tf_tcam_get_parms *parms);
558 * Sends tcam entry 'free' to the Firmware.
561 * Pointer to session handle
564 * Pointer to free parameters
567 * 0 on Success else internal Truflow error
569 int tf_msg_tcam_entry_free(struct tf *tfp,
570 struct tf_dev_info *dev,
571 struct tf_tcam_free_parms *parms);
574 * Sends Set message of a Table Type element to the firmware.
577 * Pointer to session handle
580 * Direction location of the element to set
583 * Type of the object to set
586 * Size of the data to set
597 int tf_msg_set_tbl_entry(struct tf *tfp,
605 * Sends get message of a Table Type element to the firmware.
608 * Pointer to session handle
611 * Direction location of the element to get
614 * Type of the object to get
617 * Size of the data read
628 int tf_msg_get_tbl_entry(struct tf *tfp,
635 /* HWRM Tunneled messages */
638 * Sends global cfg read request to Firmware
641 * Pointer to TF handle
644 * Pointer to read parameters
647 * 0 on Success else internal Truflow error
649 int tf_msg_get_global_cfg(struct tf *tfp,
650 struct tf_global_cfg_parms *params);
653 * Sends global cfg update request to Firmware
656 * Pointer to TF handle
659 * Pointer to write parameters
662 * 0 on Success else internal Truflow error
664 int tf_msg_set_global_cfg(struct tf *tfp,
665 struct tf_global_cfg_parms *params);
668 * Sends bulk get message of a Table Type element to the firmware.
671 * Pointer to session handle
674 * Pointer to table get bulk parameters
677 * 0 on Success else internal Truflow error
679 int tf_msg_bulk_get_tbl_entry(struct tf *tfp,
682 uint32_t starting_idx,
683 uint16_t num_entries,
684 uint16_t entry_sz_in_bytes,
685 uint64_t physical_mem_addr);
688 * Sends Set message of a IF Table Type element to the firmware.
691 * Pointer to session handle
694 * Pointer to IF table set parameters
697 * 0 on Success else internal Truflow error
699 int tf_msg_set_if_tbl_entry(struct tf *tfp,
700 struct tf_if_tbl_set_parms *params);
703 * Sends get message of a IF Table Type element to the firmware.
706 * Pointer to session handle
709 * Pointer to IF table get parameters
712 * 0 on Success else internal Truflow error
714 int tf_msg_get_if_tbl_entry(struct tf *tfp,
715 struct tf_if_tbl_get_parms *params);
717 #endif /* _TF_MSG_H_ */