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>
15 #include "tf_global_cfg.h"
19 /* HWRM Direct messages */
22 * Sends session open request to Firmware
25 * Pointer to session handle
28 * PCI name of the control channel
30 * [in/out] fw_session_id
31 * Pointer to the fw_session_id that is allocated on firmware side
34 * 0 on Success else internal Truflow error
36 int tf_msg_session_open(struct tf *tfp,
38 uint8_t *fw_session_id,
39 uint8_t *fw_session_client_id,
40 struct tf_dev_info *dev);
43 * Sends session close request to Firmware
46 * Pointer to session handle
49 * PCI name of the control channel
52 * Pointer to the fw_session_id that is assigned to the session at
53 * time of session open
56 * 0 on Success else internal Truflow error
58 int tf_msg_session_attach(struct tf *tfp,
59 char *ctrl_channel_name,
60 uint8_t tf_fw_session_id);
63 * Sends session client register request to Firmware
66 * Pointer to session handle
69 * PCI name of the control channel
71 * [in/out] fw_session_client_id
72 * Pointer to the fw_session_client_id that is allocated on firmware
76 * 0 on Success else internal Truflow error
78 int tf_msg_session_client_register(struct tf *tfp,
79 struct tf_session *tfs,
80 char *ctrl_channel_name,
81 uint8_t *fw_session_client_id);
84 * Sends session client unregister request to Firmware
87 * Pointer to session handle
89 * [in/out] fw_session_client_id
90 * Pointer to the fw_session_client_id that is allocated on firmware
94 * 0 on Success else internal Truflow error
96 int tf_msg_session_client_unregister(struct tf *tfp,
97 struct tf_session *tfs,
98 uint8_t fw_session_client_id);
101 * Sends session close request to Firmware
104 * Pointer to session handle
107 * 0 on Success else internal Truflow error
109 int tf_msg_session_close(struct tf *tfp,
110 struct tf_session *tfs);
113 * Sends session query config request to TF Firmware
116 * Pointer to session handle
119 * 0 on Success else internal Truflow error
121 int tf_msg_session_qcfg(struct tf *tfp);
124 * Sends session HW resource query capability request to TF Firmware
127 * Pointer to TF handle
130 * Receive or Transmit direction
133 * Number of elements in the query. Should be set to the max
134 * elements for the device type
137 * Pointer to an array of query elements
139 * [out] resv_strategy
140 * Pointer to the reservation strategy
143 * 0 on Success else internal Truflow error
145 int tf_msg_session_resc_qcaps(struct tf *tfp,
146 struct tf_dev_info *dev,
149 struct tf_rm_resc_req_entry *query,
150 enum tf_rm_resc_resv_strategy *resv_strategy);
153 * Sends session HW resource allocation request to TF Firmware
156 * Pointer to TF handle
159 * Receive or Transmit direction
162 * Number of elements in the req and resv arrays
165 * Pointer to an array of request elements
168 * Pointer to an array of reserved elements
171 * 0 on Success else internal Truflow error
173 int tf_msg_session_resc_alloc(struct tf *tfp,
174 struct tf_dev_info *dev,
177 struct tf_rm_resc_req_entry *request,
178 struct tf_rm_resc_entry *resv);
181 * Sends session resource flush request to TF Firmware
184 * Pointer to TF handle
187 * Receive or Transmit direction
190 * Number of elements in the req and resv arrays
193 * Pointer to an array of reserved elements that needs to be flushed
196 * 0 on Success else internal Truflow error
198 int tf_msg_session_resc_flush(struct tf *tfp,
201 struct tf_rm_resc_entry *resv);
203 * Sends EM internal insert request to Firmware
206 * Pointer to TF handle
209 * Pointer to em insert parameter list
217 * [in] num_of_entries
218 * Number of entries to insert
221 * 0 on Success else internal Truflow error
223 int tf_msg_insert_em_internal_entry(struct tf *tfp,
224 struct tf_insert_em_entry_parms *params,
225 uint16_t *rptr_index,
227 uint8_t *num_of_entries);
229 * Sends EM hash internal insert request to Firmware
232 * Pointer to TF handle
235 * Pointer to em insert parameter list
241 * Lookup3 hash of key
249 * [in] num_of_entries
250 * Number of entries to insert
253 * 0 on Success else internal Truflow error
256 tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
257 struct tf_insert_em_entry_parms *em_parms,
260 uint16_t *rptr_index,
262 uint8_t *num_of_entries);
264 * Sends EM internal delete request to Firmware
267 * Pointer to TF handle
270 * Pointer to em delete parameters
273 * 0 on Success else internal Truflow error
275 int tf_msg_delete_em_entry(struct tf *tfp,
276 struct tf_delete_em_entry_parms *em_parms);
279 * Sends EM mem register request to Firmware
282 * Pointer to TF handle
291 * DMA Address for the memory page
297 * 0 on Success else internal Truflow error
299 int tf_msg_em_mem_rgtr(struct tf *tfp,
306 * Sends EM mem unregister request to Firmware
309 * Pointer to TF handle
315 * 0 on Success else internal Truflow error
317 int tf_msg_em_mem_unrgtr(struct tf *tfp,
321 * Sends EM qcaps request to Firmware
324 * Pointer to TF handle
327 * Receive or Transmit direction
330 * Pointer to EM capabilities
333 * 0 on Success else internal Truflow error
335 int tf_msg_em_qcaps(struct tf *tfp,
337 struct tf_em_caps *em_caps);
340 * Sends EM config request to Firmware
343 * Pointer to TF handle
346 * EM Table, key 0, number of entries to configure
349 * EM Table, Key 0 context id
352 * EM Table, Key 1 context id
355 * EM Table, Record context id
358 * EM Table, EFC Table context id
360 * [in] flush_interval
361 * Flush pending HW cached flows every 1/10th of value set in
362 * seconds, both idle and active flows are flushed from the HW
363 * cache. If set to 0, this feature will be disabled.
366 * Receive or Transmit direction
369 * 0 on Success else internal Truflow error
371 int tf_msg_em_cfg(struct tf *tfp,
372 uint32_t num_entries,
373 uint16_t key0_ctx_id,
374 uint16_t key1_ctx_id,
375 uint16_t record_ctx_id,
377 uint8_t flush_interval,
381 * Sends EM operation request to Firmware
384 * Pointer to TF handle
387 * Receive or Transmit direction
393 * 0 on Success else internal Truflow error
395 int tf_msg_em_op(struct tf *tfp,
400 * Sends tcam entry 'set' to the Firmware.
403 * Pointer to session handle
406 * Pointer to set parameters
409 * 0 on Success else internal Truflow error
411 int tf_msg_tcam_entry_set(struct tf *tfp,
412 struct tf_dev_info *dev,
413 struct tf_tcam_set_parms *parms);
416 * Sends tcam entry 'get' to the Firmware.
419 * Pointer to session handle
422 * Pointer to get parameters
425 * 0 on Success else internal Truflow error
427 int tf_msg_tcam_entry_get(struct tf *tfp,
428 struct tf_dev_info *dev,
429 struct tf_tcam_get_parms *parms);
432 * Sends tcam entry 'free' to the Firmware.
435 * Pointer to session handle
438 * Pointer to free parameters
441 * 0 on Success else internal Truflow error
443 int tf_msg_tcam_entry_free(struct tf *tfp,
444 struct tf_dev_info *dev,
445 struct tf_tcam_free_parms *parms);
448 * Sends Set message of a Table Type element to the firmware.
451 * Pointer to session handle
454 * Direction location of the element to set
457 * Type of the object to set
460 * Size of the data to set
471 int tf_msg_set_tbl_entry(struct tf *tfp,
479 * Sends get message of a Table Type element to the firmware.
482 * Pointer to session handle
485 * Direction location of the element to get
488 * Type of the object to get
491 * Size of the data read
502 int tf_msg_get_tbl_entry(struct tf *tfp,
509 /* HWRM Tunneled messages */
512 * Sends global cfg read request to Firmware
515 * Pointer to TF handle
518 * Pointer to read parameters
521 * 0 on Success else internal Truflow error
523 int tf_msg_get_global_cfg(struct tf *tfp,
524 struct tf_global_cfg_parms *params);
527 * Sends global cfg update request to Firmware
530 * Pointer to TF handle
533 * Pointer to write parameters
536 * 0 on Success else internal Truflow error
538 int tf_msg_set_global_cfg(struct tf *tfp,
539 struct tf_global_cfg_parms *params);
542 * Sends bulk get message of a Table Type element to the firmware.
545 * Pointer to session handle
548 * Pointer to table get bulk parameters
551 * 0 on Success else internal Truflow error
553 int tf_msg_bulk_get_tbl_entry(struct tf *tfp,
556 uint32_t starting_idx,
557 uint16_t num_entries,
558 uint16_t entry_sz_in_bytes,
559 uint64_t physical_mem_addr);
562 * Sends Set message of a IF Table Type element to the firmware.
565 * Pointer to session handle
568 * Pointer to IF table set parameters
571 * 0 on Success else internal Truflow error
573 int tf_msg_set_if_tbl_entry(struct tf *tfp,
574 struct tf_if_tbl_set_parms *params);
577 * Sends get message of a IF Table Type element to the firmware.
580 * Pointer to session handle
583 * Pointer to IF table get parameters
586 * 0 on Success else internal Truflow error
588 int tf_msg_get_if_tbl_entry(struct tf *tfp,
589 struct tf_if_tbl_get_parms *params);
591 #endif /* _TF_MSG_H_ */