net/bnxt: support bulk table get and mirror
[dpdk.git] / drivers / net / bnxt / tf_core / tf_msg.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2020 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _TF_MSG_H_
7 #define _TF_MSG_H_
8
9 #include "tf_tbl.h"
10 #include "tf_rm.h"
11
12 struct tf;
13
14 /**
15  * Sends session open request to Firmware
16  *
17  * [in] session
18  *   Pointer to session handle
19  *
20  * [in] ctrl_chan_name
21  *   PCI name of the control channel
22  *
23  * [in/out] fw_session_id
24  *   Pointer to the fw_session_id that is allocated on firmware side
25  *
26  * Returns:
27  *
28  */
29 int tf_msg_session_open(struct tf *tfp,
30                         char *ctrl_chan_name,
31                         uint8_t *fw_session_id);
32
33 /**
34  * Sends session close request to Firmware
35  *
36  * [in] session
37  *   Pointer to session handle
38  *
39  * [in] fw_session_id
40  *   Pointer to the fw_session_id that is assigned to the session at
41  *   time of session open
42  *
43  * Returns:
44  *
45  */
46 int tf_msg_session_attach(struct tf *tfp,
47                           char *ctrl_channel_name,
48                           uint8_t tf_fw_session_id);
49
50 /**
51  * Sends session close request to Firmware
52  *
53  * [in] session
54  *   Pointer to session handle
55  *
56  * Returns:
57  *
58  */
59 int tf_msg_session_close(struct tf *tfp);
60
61 /**
62  * Sends session query config request to TF Firmware
63  */
64 int tf_msg_session_qcfg(struct tf *tfp);
65
66 /**
67  * Sends session HW resource query capability request to TF Firmware
68  */
69 int tf_msg_session_hw_resc_qcaps(struct tf *tfp,
70                                  enum tf_dir dir,
71                                  struct tf_rm_hw_query *hw_query);
72
73 /**
74  * Sends session HW resource allocation request to TF Firmware
75  */
76 int tf_msg_session_hw_resc_alloc(struct tf *tfp,
77                                  enum tf_dir dir,
78                                  struct tf_rm_hw_alloc *hw_alloc,
79                                  struct tf_rm_entry *hw_entry);
80
81 /**
82  * Sends session HW resource free request to TF Firmware
83  */
84 int tf_msg_session_hw_resc_free(struct tf *tfp,
85                                 enum tf_dir dir,
86                                 struct tf_rm_entry *hw_entry);
87
88 /**
89  * Sends session HW resource flush request to TF Firmware
90  */
91 int tf_msg_session_hw_resc_flush(struct tf *tfp,
92                                  enum tf_dir dir,
93                                  struct tf_rm_entry *hw_entry);
94
95 /**
96  * Sends session SRAM resource query capability request to TF Firmware
97  */
98 int tf_msg_session_sram_resc_qcaps(struct tf *tfp,
99                                    enum tf_dir dir,
100                                    struct tf_rm_sram_query *sram_query);
101
102 /**
103  * Sends session SRAM resource allocation request to TF Firmware
104  */
105 int tf_msg_session_sram_resc_alloc(struct tf *tfp,
106                                    enum tf_dir dir,
107                                    struct tf_rm_sram_alloc *sram_alloc,
108                                    struct tf_rm_entry *sram_entry);
109
110 /**
111  * Sends session SRAM resource free request to TF Firmware
112  */
113 int tf_msg_session_sram_resc_free(struct tf *tfp,
114                                   enum tf_dir dir,
115                                   struct tf_rm_entry *sram_entry);
116
117 /**
118  * Sends session SRAM resource flush request to TF Firmware
119  */
120 int tf_msg_session_sram_resc_flush(struct tf *tfp,
121                                    enum tf_dir dir,
122                                    struct tf_rm_entry *sram_entry);
123
124 /**
125  * Sends EM internal insert request to Firmware
126  */
127 int tf_msg_insert_em_internal_entry(struct tf *tfp,
128                                     struct tf_insert_em_entry_parms *params,
129                                     uint16_t *rptr_index,
130                                     uint8_t *rptr_entry,
131                                     uint8_t *num_of_entries);
132 /**
133  * Sends EM internal delete request to Firmware
134  */
135 int tf_msg_delete_em_entry(struct tf *tfp,
136                            struct tf_delete_em_entry_parms *em_parms);
137 /**
138  * Sends EM mem register request to Firmware
139  */
140 int tf_msg_em_mem_rgtr(struct tf *tfp,
141                        int           page_lvl,
142                        int           page_size,
143                        uint64_t      dma_addr,
144                        uint16_t     *ctx_id);
145
146 /**
147  * Sends EM mem unregister request to Firmware
148  */
149 int tf_msg_em_mem_unrgtr(struct tf *tfp,
150                          uint16_t     *ctx_id);
151
152 /**
153  * Sends EM qcaps request to Firmware
154  */
155 int tf_msg_em_qcaps(struct tf *tfp,
156                     int dir,
157                     struct tf_em_caps *em_caps);
158
159 /**
160  * Sends EM config request to Firmware
161  */
162 int tf_msg_em_cfg(struct tf *tfp,
163                   uint32_t      num_entries,
164                   uint16_t      key0_ctx_id,
165                   uint16_t      key1_ctx_id,
166                   uint16_t      record_ctx_id,
167                   uint16_t      efc_ctx_id,
168                   uint8_t       flush_interval,
169                   int           dir);
170
171 /**
172  * Sends EM operation request to Firmware
173  */
174 int tf_msg_em_op(struct tf *tfp,
175                  int        dir,
176                  uint16_t   op);
177
178 /**
179  * Sends tcam entry 'set' to the Firmware.
180  *
181  * [in] tfp
182  *   Pointer to session handle
183  *
184  * [in] parms
185  *   Pointer to set parameters
186  *
187  * Returns:
188  *  0 on Success else internal Truflow error
189  */
190 int tf_msg_tcam_entry_set(struct tf *tfp,
191                           struct tf_set_tcam_entry_parms *parms);
192
193 /**
194  * Sends tcam entry 'free' to the Firmware.
195  *
196  * [in] tfp
197  *   Pointer to session handle
198  *
199  * [in] parms
200  *   Pointer to free parameters
201  *
202  * Returns:
203  *  0 on Success else internal Truflow error
204  */
205 int tf_msg_tcam_entry_free(struct tf *tfp,
206                            struct tf_free_tcam_entry_parms *parms);
207
208 /**
209  * Sends Set message of a Table Type element to the firmware.
210  *
211  * [in] tfp
212  *   Pointer to session handle
213  *
214  * [in] dir
215  *   Direction location of the element to set
216  *
217  * [in] type
218  *   Type of the object to set
219  *
220  * [in] size
221  *   Size of the data to set
222  *
223  * [in] data
224  *   Data to set
225  *
226  * [in] index
227  *   Index to set
228  *
229  * Returns:
230  *   0 - Success
231  */
232 int tf_msg_set_tbl_entry(struct tf *tfp,
233                          enum tf_dir dir,
234                          enum tf_tbl_type type,
235                          uint16_t size,
236                          uint8_t *data,
237                          uint32_t index);
238
239 /**
240  * Sends get message of a Table Type element to the firmware.
241  *
242  * [in] tfp
243  *   Pointer to session handle
244  *
245  * [in] dir
246  *   Direction location of the element to get
247  *
248  * [in] type
249  *   Type of the object to get
250  *
251  * [in] size
252  *   Size of the data read
253  *
254  * [in] data
255  *   Data read
256  *
257  * [in] index
258  *   Index to get
259  *
260  * Returns:
261  *   0 - Success
262  */
263 int tf_msg_get_tbl_entry(struct tf *tfp,
264                          enum tf_dir dir,
265                          enum tf_tbl_type type,
266                          uint16_t size,
267                          uint8_t *data,
268                          uint32_t index);
269
270 /**
271  * Sends bulk get message of a Table Type element to the firmware.
272  *
273  * [in] tfp
274  *   Pointer to session handle
275  *
276  * [in] parms
277  *   Pointer to table get bulk parameters
278  *
279  * Returns:
280  *  0 on Success else internal Truflow error
281  */
282 int tf_msg_get_bulk_tbl_entry(struct tf *tfp,
283                           struct tf_get_bulk_tbl_entry_parms *parms);
284
285 #endif  /* _TF_MSG_H_ */