net/bnxt: update RM with residual checker
[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 <rte_common.h>
10 #include <hsi_struct_def_dpdk.h>
11
12 #include "tf_tbl.h"
13 #include "tf_rm.h"
14 #include "tf_rm_new.h"
15 #include "tf_tcam.h"
16
17 struct tf;
18
19 /**
20  * Sends session open request to Firmware
21  *
22  * [in] session
23  *   Pointer to session handle
24  *
25  * [in] ctrl_chan_name
26  *   PCI name of the control channel
27  *
28  * [in/out] fw_session_id
29  *   Pointer to the fw_session_id that is allocated on firmware side
30  *
31  * Returns:
32  *
33  */
34 int tf_msg_session_open(struct tf *tfp,
35                         char *ctrl_chan_name,
36                         uint8_t *fw_session_id);
37
38 /**
39  * Sends session close request to Firmware
40  *
41  * [in] session
42  *   Pointer to session handle
43  *
44  * [in] fw_session_id
45  *   Pointer to the fw_session_id that is assigned to the session at
46  *   time of session open
47  *
48  * Returns:
49  *
50  */
51 int tf_msg_session_attach(struct tf *tfp,
52                           char *ctrl_channel_name,
53                           uint8_t tf_fw_session_id);
54
55 /**
56  * Sends session close request to Firmware
57  *
58  * [in] session
59  *   Pointer to session handle
60  *
61  * Returns:
62  *
63  */
64 int tf_msg_session_close(struct tf *tfp);
65
66 /**
67  * Sends session query config request to TF Firmware
68  */
69 int tf_msg_session_qcfg(struct tf *tfp);
70
71 /**
72  * Sends session HW resource query capability request to TF Firmware
73  */
74 int tf_msg_session_hw_resc_qcaps(struct tf *tfp,
75                                  enum tf_dir dir,
76                                  struct tf_rm_hw_query *hw_query);
77
78 /**
79  * Sends session HW resource allocation request to TF Firmware
80  */
81 int tf_msg_session_hw_resc_alloc(struct tf *tfp,
82                                  enum tf_dir dir,
83                                  struct tf_rm_hw_alloc *hw_alloc,
84                                  struct tf_rm_entry *hw_entry);
85
86 /**
87  * Sends session HW resource free request to TF Firmware
88  */
89 int tf_msg_session_hw_resc_free(struct tf *tfp,
90                                 enum tf_dir dir,
91                                 struct tf_rm_entry *hw_entry);
92
93 /**
94  * Sends session HW resource flush request to TF Firmware
95  */
96 int tf_msg_session_hw_resc_flush(struct tf *tfp,
97                                  enum tf_dir dir,
98                                  struct tf_rm_entry *hw_entry);
99
100 /**
101  * Sends session SRAM resource query capability request to TF Firmware
102  */
103 int tf_msg_session_sram_resc_qcaps(struct tf *tfp,
104                                    enum tf_dir dir,
105                                    struct tf_rm_sram_query *sram_query);
106
107 /**
108  * Sends session SRAM resource allocation request to TF Firmware
109  */
110 int tf_msg_session_sram_resc_alloc(struct tf *tfp,
111                                    enum tf_dir dir,
112                                    struct tf_rm_sram_alloc *sram_alloc,
113                                    struct tf_rm_entry *sram_entry);
114
115 /**
116  * Sends session SRAM resource free request to TF Firmware
117  */
118 int tf_msg_session_sram_resc_free(struct tf *tfp,
119                                   enum tf_dir dir,
120                                   struct tf_rm_entry *sram_entry);
121
122 /**
123  * Sends session SRAM resource flush request to TF Firmware
124  */
125 int tf_msg_session_sram_resc_flush(struct tf *tfp,
126                                    enum tf_dir dir,
127                                    struct tf_rm_entry *sram_entry);
128
129 /**
130  * Sends session HW resource query capability request to TF Firmware
131  *
132  * [in] tfp
133  *   Pointer to TF handle
134  *
135  * [in] dir
136  *   Receive or Transmit direction
137  *
138  * [in] size
139  *   Number of elements in the query. Should be set to the max
140  *   elements for the device type
141  *
142  * [out] query
143  *   Pointer to an array of query elements
144  *
145  * [out] resv_strategy
146  *   Pointer to the reservation strategy
147  *
148  * Returns:
149  *   0 on Success else internal Truflow error
150  */
151 int tf_msg_session_resc_qcaps(struct tf *tfp,
152                               enum tf_dir dir,
153                               uint16_t size,
154                               struct tf_rm_resc_req_entry *query,
155                               enum tf_rm_resc_resv_strategy *resv_strategy);
156
157 /**
158  * Sends session HW resource allocation request to TF Firmware
159  *
160  * [in] tfp
161  *   Pointer to TF handle
162  *
163  * [in] dir
164  *   Receive or Transmit direction
165  *
166  * [in] size
167  *   Number of elements in the req and resv arrays
168  *
169  * [in] req
170  *   Pointer to an array of request elements
171  *
172  * [in] resv
173  *   Pointer to an array of reserved elements
174  *
175  * Returns:
176  *   0 on Success else internal Truflow error
177  */
178 int tf_msg_session_resc_alloc(struct tf *tfp,
179                               enum tf_dir dir,
180                               uint16_t size,
181                               struct tf_rm_resc_req_entry *request,
182                               struct tf_rm_resc_entry *resv);
183
184 /**
185  * Sends session resource flush request to TF Firmware
186  */
187 int tf_msg_session_resc_flush(struct tf *tfp,
188                               enum tf_dir dir,
189                               uint16_t size,
190                               struct tf_rm_resc_entry *resv);
191 /**
192  * Sends EM internal insert request to Firmware
193  */
194 int tf_msg_insert_em_internal_entry(struct tf *tfp,
195                                     struct tf_insert_em_entry_parms *params,
196                                     uint16_t *rptr_index,
197                                     uint8_t *rptr_entry,
198                                     uint8_t *num_of_entries);
199 /**
200  * Sends EM internal delete request to Firmware
201  */
202 int tf_msg_delete_em_entry(struct tf *tfp,
203                            struct tf_delete_em_entry_parms *em_parms);
204 /**
205  * Sends EM mem register request to Firmware
206  */
207 int tf_msg_em_mem_rgtr(struct tf *tfp,
208                        int           page_lvl,
209                        int           page_size,
210                        uint64_t      dma_addr,
211                        uint16_t     *ctx_id);
212
213 /**
214  * Sends EM mem unregister request to Firmware
215  */
216 int tf_msg_em_mem_unrgtr(struct tf *tfp,
217                          uint16_t     *ctx_id);
218
219 /**
220  * Sends EM qcaps request to Firmware
221  */
222 int tf_msg_em_qcaps(struct tf *tfp,
223                     int dir,
224                     struct tf_em_caps *em_caps);
225
226 /**
227  * Sends EM config request to Firmware
228  */
229 int tf_msg_em_cfg(struct tf *tfp,
230                   uint32_t      num_entries,
231                   uint16_t      key0_ctx_id,
232                   uint16_t      key1_ctx_id,
233                   uint16_t      record_ctx_id,
234                   uint16_t      efc_ctx_id,
235                   uint8_t       flush_interval,
236                   int           dir);
237
238 /**
239  * Sends EM operation request to Firmware
240  */
241 int tf_msg_em_op(struct tf *tfp,
242                  int        dir,
243                  uint16_t   op);
244
245 /**
246  * Sends tcam entry 'set' to the Firmware.
247  *
248  * [in] tfp
249  *   Pointer to session handle
250  *
251  * [in] parms
252  *   Pointer to set parameters
253  *
254  * Returns:
255  *  0 on Success else internal Truflow error
256  */
257 int tf_msg_tcam_entry_set(struct tf *tfp,
258                           struct tf_tcam_set_parms *parms);
259
260 /**
261  * Sends tcam entry 'free' to the Firmware.
262  *
263  * [in] tfp
264  *   Pointer to session handle
265  *
266  * [in] parms
267  *   Pointer to free parameters
268  *
269  * Returns:
270  *  0 on Success else internal Truflow error
271  */
272 int tf_msg_tcam_entry_free(struct tf *tfp,
273                            struct tf_tcam_free_parms *parms);
274
275 /**
276  * Sends Set message of a Table Type element to the firmware.
277  *
278  * [in] tfp
279  *   Pointer to session handle
280  *
281  * [in] dir
282  *   Direction location of the element to set
283  *
284  * [in] type
285  *   Type of the object to set
286  *
287  * [in] size
288  *   Size of the data to set
289  *
290  * [in] data
291  *   Data to set
292  *
293  * [in] index
294  *   Index to set
295  *
296  * Returns:
297  *   0 - Success
298  */
299 int tf_msg_set_tbl_entry(struct tf *tfp,
300                          enum tf_dir dir,
301                          enum tf_tbl_type type,
302                          uint16_t size,
303                          uint8_t *data,
304                          uint32_t index);
305
306 /**
307  * Sends get message of a Table Type element to the firmware.
308  *
309  * [in] tfp
310  *   Pointer to session handle
311  *
312  * [in] dir
313  *   Direction location of the element to get
314  *
315  * [in] type
316  *   Type of the object to get
317  *
318  * [in] size
319  *   Size of the data read
320  *
321  * [in] data
322  *   Data read
323  *
324  * [in] index
325  *   Index to get
326  *
327  * Returns:
328  *   0 - Success
329  */
330 int tf_msg_get_tbl_entry(struct tf *tfp,
331                          enum tf_dir dir,
332                          enum tf_tbl_type type,
333                          uint16_t size,
334                          uint8_t *data,
335                          uint32_t index);
336
337 /**
338  * Sends bulk get message of a Table Type element to the firmware.
339  *
340  * [in] tfp
341  *   Pointer to session handle
342  *
343  * [in] parms
344  *   Pointer to table get bulk parameters
345  *
346  * Returns:
347  *  0 on Success else internal Truflow error
348  */
349 int tf_msg_bulk_get_tbl_entry(struct tf *tfp,
350                           struct tf_bulk_get_tbl_entry_parms *parms);
351
352 #endif  /* _TF_MSG_H_ */