net/bnxt: update RM to support HCAPI only
[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_tcam.h"
15
16 struct tf;
17
18 /* HWRM Direct messages */
19
20 /**
21  * Sends session open request to Firmware
22  *
23  * [in] session
24  *   Pointer to session handle
25  *
26  * [in] ctrl_chan_name
27  *   PCI name of the control channel
28  *
29  * [in/out] fw_session_id
30  *   Pointer to the fw_session_id that is allocated on firmware side
31  *
32  * Returns:
33  *   0 on Success else internal Truflow error
34  */
35 int tf_msg_session_open(struct tf *tfp,
36                         char *ctrl_chan_name,
37                         uint8_t *fw_session_id);
38
39 /**
40  * Sends session close request to Firmware
41  *
42  * [in] session
43  *   Pointer to session handle
44  *
45  * [in] fw_session_id
46  *   Pointer to the fw_session_id that is assigned to the session at
47  *   time of session open
48  *
49  * Returns:
50  *   0 on Success else internal Truflow error
51  */
52 int tf_msg_session_attach(struct tf *tfp,
53                           char *ctrl_channel_name,
54                           uint8_t tf_fw_session_id);
55
56 /**
57  * Sends session close request to Firmware
58  *
59  * [in] session
60  *   Pointer to session handle
61  *
62  * Returns:
63  *   0 on Success else internal Truflow error
64  */
65 int tf_msg_session_close(struct tf *tfp);
66
67 /**
68  * Sends session query config request to TF Firmware
69  *
70  * [in] session
71  *   Pointer to session handle
72  *
73  * Returns:
74  *   0 on Success else internal Truflow error
75  */
76 int tf_msg_session_qcfg(struct tf *tfp);
77
78 /**
79  * Sends session HW resource query capability request to TF Firmware
80  *
81  * [in] tfp
82  *   Pointer to TF handle
83  *
84  * [in] dir
85  *   Receive or Transmit direction
86  *
87  * [in] size
88  *   Number of elements in the query. Should be set to the max
89  *   elements for the device type
90  *
91  * [out] query
92  *   Pointer to an array of query elements
93  *
94  * [out] resv_strategy
95  *   Pointer to the reservation strategy
96  *
97  * Returns:
98  *   0 on Success else internal Truflow error
99  */
100 int tf_msg_session_resc_qcaps(struct tf *tfp,
101                               enum tf_dir dir,
102                               uint16_t size,
103                               struct tf_rm_resc_req_entry *query,
104                               enum tf_rm_resc_resv_strategy *resv_strategy);
105
106 /**
107  * Sends session HW resource allocation request to TF Firmware
108  *
109  * [in] tfp
110  *   Pointer to TF handle
111  *
112  * [in] dir
113  *   Receive or Transmit direction
114  *
115  * [in] size
116  *   Number of elements in the req and resv arrays
117  *
118  * [in] req
119  *   Pointer to an array of request elements
120  *
121  * [in] resv
122  *   Pointer to an array of reserved elements
123  *
124  * Returns:
125  *   0 on Success else internal Truflow error
126  */
127 int tf_msg_session_resc_alloc(struct tf *tfp,
128                               enum tf_dir dir,
129                               uint16_t size,
130                               struct tf_rm_resc_req_entry *request,
131                               struct tf_rm_resc_entry *resv);
132
133 /**
134  * Sends session resource flush request to TF Firmware
135  *
136  * [in] tfp
137  *   Pointer to TF handle
138  *
139  * [in] dir
140  *   Receive or Transmit direction
141  *
142  * [in] size
143  *   Number of elements in the req and resv arrays
144  *
145  * [in] resv
146  *   Pointer to an array of reserved elements that needs to be flushed
147  *
148  * Returns:
149  *   0 on Success else internal Truflow error
150  */
151 int tf_msg_session_resc_flush(struct tf *tfp,
152                               enum tf_dir dir,
153                               uint16_t size,
154                               struct tf_rm_resc_entry *resv);
155 /**
156  * Sends EM internal insert request to Firmware
157  *
158  * [in] tfp
159  *   Pointer to TF handle
160  *
161  * [in] params
162  *   Pointer to em insert parameter list
163  *
164  * [in] rptr_index
165  *   Record ptr index
166  *
167  * [in] rptr_entry
168  *   Record ptr entry
169  *
170  * [in] num_of_entries
171  *   Number of entries to insert
172  *
173  * Returns:
174  *   0 on Success else internal Truflow error
175  */
176 int tf_msg_insert_em_internal_entry(struct tf *tfp,
177                                     struct tf_insert_em_entry_parms *params,
178                                     uint16_t *rptr_index,
179                                     uint8_t *rptr_entry,
180                                     uint8_t *num_of_entries);
181 /**
182  * Sends EM internal delete request to Firmware
183  *
184  * [in] tfp
185  *   Pointer to TF handle
186  *
187  * [in] em_parms
188  *   Pointer to em delete parameters
189  *
190  * Returns:
191  *   0 on Success else internal Truflow error
192  */
193 int tf_msg_delete_em_entry(struct tf *tfp,
194                            struct tf_delete_em_entry_parms *em_parms);
195
196 /**
197  * Sends EM mem register request to Firmware
198  *
199  * [in] tfp
200  *   Pointer to TF handle
201  *
202  * [in] page_lvl
203  *   Page level
204  *
205  * [in] page_size
206  *   Page size
207  *
208  * [in] dma_addr
209  *   DMA Address for the memory page
210  *
211  * [in] ctx_id
212  *   Context id
213  *
214  * Returns:
215  *   0 on Success else internal Truflow error
216  */
217 int tf_msg_em_mem_rgtr(struct tf *tfp,
218                        int page_lvl,
219                        int page_size,
220                        uint64_t dma_addr,
221                        uint16_t *ctx_id);
222
223 /**
224  * Sends EM mem unregister request to Firmware
225  *
226  * [in] tfp
227  *   Pointer to TF handle
228  *
229  * [in] ctx_id
230  *   Context id
231  *
232  * Returns:
233  *   0 on Success else internal Truflow error
234  */
235 int tf_msg_em_mem_unrgtr(struct tf *tfp,
236                          uint16_t *ctx_id);
237
238 /**
239  * Sends EM qcaps request to Firmware
240  *
241  * [in] tfp
242  *   Pointer to TF handle
243  *
244  * [in] dir
245  *   Receive or Transmit direction
246  *
247  * [in] em_caps
248  *   Pointer to EM capabilities
249  *
250  * Returns:
251  *   0 on Success else internal Truflow error
252  */
253 int tf_msg_em_qcaps(struct tf *tfp,
254                     int dir,
255                     struct tf_em_caps *em_caps);
256
257 /**
258  * Sends EM config request to Firmware
259  *
260  * [in] tfp
261  *   Pointer to TF handle
262  *
263  * [in] num_entries
264  *   EM Table, key 0, number of entries to configure
265  *
266  * [in] key0_ctx_id
267  *   EM Table, Key 0 context id
268  *
269  * [in] key1_ctx_id
270  *   EM Table, Key 1 context id
271  *
272  * [in] record_ctx_id
273  *   EM Table, Record context id
274  *
275  * [in] efc_ctx_id
276  *   EM Table, EFC Table context id
277  *
278  * [in] flush_interval
279  *   Flush pending HW cached flows every 1/10th of value set in
280  *   seconds, both idle and active flows are flushed from the HW
281  *   cache. If set to 0, this feature will be disabled.
282  *
283  * [in] dir
284  *   Receive or Transmit direction
285  *
286  * Returns:
287  *   0 on Success else internal Truflow error
288  */
289 int tf_msg_em_cfg(struct tf *tfp,
290                   uint32_t num_entries,
291                   uint16_t key0_ctx_id,
292                   uint16_t key1_ctx_id,
293                   uint16_t record_ctx_id,
294                   uint16_t efc_ctx_id,
295                   uint8_t flush_interval,
296                   int dir);
297
298 /**
299  * Sends EM operation request to Firmware
300  *
301  * [in] tfp
302  *   Pointer to TF handle
303  *
304  * [in] dir
305  *   Receive or Transmit direction
306  *
307  * [in] op
308  *   CFA Operator
309  *
310  * Returns:
311  *   0 on Success else internal Truflow error
312  */
313 int tf_msg_em_op(struct tf *tfp,
314                  int dir,
315                  uint16_t op);
316
317 /**
318  * Sends tcam entry 'set' to the Firmware.
319  *
320  * [in] tfp
321  *   Pointer to session handle
322  *
323  * [in] parms
324  *   Pointer to set parameters
325  *
326  * Returns:
327  *  0 on Success else internal Truflow error
328  */
329 int tf_msg_tcam_entry_set(struct tf *tfp,
330                           struct tf_tcam_set_parms *parms);
331
332 /**
333  * Sends tcam entry 'free' to the Firmware.
334  *
335  * [in] tfp
336  *   Pointer to session handle
337  *
338  * [in] parms
339  *   Pointer to free parameters
340  *
341  * Returns:
342  *  0 on Success else internal Truflow error
343  */
344 int tf_msg_tcam_entry_free(struct tf *tfp,
345                            struct tf_tcam_free_parms *parms);
346
347 /**
348  * Sends Set message of a Table Type element to the firmware.
349  *
350  * [in] tfp
351  *   Pointer to session handle
352  *
353  * [in] dir
354  *   Direction location of the element to set
355  *
356  * [in] hcapi_type
357  *   Type of the object to set
358  *
359  * [in] size
360  *   Size of the data to set
361  *
362  * [in] data
363  *   Data to set
364  *
365  * [in] index
366  *   Index to set
367  *
368  * Returns:
369  *   0 - Success
370  */
371 int tf_msg_set_tbl_entry(struct tf *tfp,
372                          enum tf_dir dir,
373                          uint16_t hcapi_type,
374                          uint16_t size,
375                          uint8_t *data,
376                          uint32_t index);
377
378 /**
379  * Sends get message of a Table Type element to the firmware.
380  *
381  * [in] tfp
382  *   Pointer to session handle
383  *
384  * [in] dir
385  *   Direction location of the element to get
386  *
387  * [in] hcapi_type
388  *   Type of the object to get
389  *
390  * [in] size
391  *   Size of the data read
392  *
393  * [in] data
394  *   Data read
395  *
396  * [in] index
397  *   Index to get
398  *
399  * Returns:
400  *   0 - Success
401  */
402 int tf_msg_get_tbl_entry(struct tf *tfp,
403                          enum tf_dir dir,
404                          uint16_t hcapi_type,
405                          uint16_t size,
406                          uint8_t *data,
407                          uint32_t index);
408
409 /* HWRM Tunneled messages */
410
411 /**
412  * Sends bulk get message of a Table Type element to the firmware.
413  *
414  * [in] tfp
415  *   Pointer to session handle
416  *
417  * [in] parms
418  *   Pointer to table get bulk parameters
419  *
420  * Returns:
421  *  0 on Success else internal Truflow error
422  */
423 int tf_msg_bulk_get_tbl_entry(struct tf *tfp,
424                               enum tf_dir dir,
425                               uint16_t hcapi_type,
426                               uint32_t starting_idx,
427                               uint16_t num_entries,
428                               uint16_t entry_sz_in_bytes,
429                               uint64_t physical_mem_addr);
430
431 #endif  /* _TF_MSG_H_ */