net/bnxt: support TruFlow core table scope
[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 tcam entry 'set' to the Firmware.
126  *
127  * [in] tfp
128  *   Pointer to session handle
129  *
130  * [in] parms
131  *   Pointer to set parameters
132  *
133  * Returns:
134  *  0 on Success else internal Truflow error
135  */
136 int tf_msg_tcam_entry_set(struct tf *tfp,
137                           struct tf_set_tcam_entry_parms *parms);
138
139 /**
140  * Sends tcam entry 'free' to the Firmware.
141  *
142  * [in] tfp
143  *   Pointer to session handle
144  *
145  * [in] parms
146  *   Pointer to free parameters
147  *
148  * Returns:
149  *  0 on Success else internal Truflow error
150  */
151 int tf_msg_tcam_entry_free(struct tf *tfp,
152                            struct tf_free_tcam_entry_parms *parms);
153
154 /**
155  * Sends Set message of a Table Type element to the firmware.
156  *
157  * [in] tfp
158  *   Pointer to session handle
159  *
160  * [in] dir
161  *   Direction location of the element to set
162  *
163  * [in] type
164  *   Type of the object to set
165  *
166  * [in] size
167  *   Size of the data to set
168  *
169  * [in] data
170  *   Data to set
171  *
172  * [in] index
173  *   Index to set
174  *
175  * Returns:
176  *   0 - Success
177  */
178 int tf_msg_set_tbl_entry(struct tf *tfp,
179                          enum tf_dir dir,
180                          enum tf_tbl_type type,
181                          uint16_t size,
182                          uint8_t *data,
183                          uint32_t index);
184
185 /**
186  * Sends get message of a Table Type element to the firmware.
187  *
188  * [in] tfp
189  *   Pointer to session handle
190  *
191  * [in] dir
192  *   Direction location of the element to get
193  *
194  * [in] type
195  *   Type of the object to get
196  *
197  * [in] size
198  *   Size of the data read
199  *
200  * [in] data
201  *   Data read
202  *
203  * [in] index
204  *   Index to get
205  *
206  * Returns:
207  *   0 - Success
208  */
209 int tf_msg_get_tbl_entry(struct tf *tfp,
210                          enum tf_dir dir,
211                          enum tf_tbl_type type,
212                          uint16_t size,
213                          uint8_t *data,
214                          uint32_t index);
215
216 #endif  /* _TF_MSG_H_ */