net/bnxt: add dpool allocator for EM allocation
[dpdk.git] / drivers / net / ark / ark_ext.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2015-2018 Atomic Rules LLC
3  */
4
5 #ifndef _ARK_EXT_H_
6 #define _ARK_EXT_H_
7
8 #include <ethdev_driver.h>
9
10 /* The following section lists function prototypes for Arkville's
11  * dynamic PMD extension. User's who create an extension
12  * must include this file and define the necessary and desired
13  * functions. Only 1 function is required for an extension,
14  * rte_pmd_ark_dev_init(); all other functions prototypes in this
15  * section are optional.
16  * See documentation for compiling and use of extensions.
17  */
18
19 /**
20  * Extension prototype, required implementation if extensions are used.
21  * Called during device probe to initialize the user structure
22  * passed to other extension functions.  This is called once for each
23  * port of the device.
24  *
25  * @param dev
26  *   current device.
27  * @param a_bar
28  *   access to PCIe device bar (application bar) and hence access to
29  *   user's portion of FPGA.
30  * @param port_id
31  *   port identifier.
32  * @return user_data
33  *   which will be passed to other extension functions.
34  */
35 void *rte_pmd_ark_dev_init(struct rte_eth_dev *dev, void *a_bar, int port_id);
36
37 /**
38  * Extension prototype, optional implementation.
39  * Called during device uninit.
40  *
41  * @param dev
42  *   current device.
43  * @param user_data
44  *   user argument from dev_init() call.
45  */
46 void rte_pmd_ark_dev_uninit(struct rte_eth_dev *dev, void *user_data);
47
48 /**
49  * Extension prototype, optional implementation.
50  * Called during device probe to change the port count from 1.
51  *
52  * @param dev
53  *   current device.
54  * @param user_data
55  *   user argument from dev_init() call.
56  * @return (0) if successful.
57  */
58 uint8_t dev_get_port_count(struct rte_eth_dev *dev, void *user_data);
59
60 /**
61  * Extension prototype, optional implementation.
62  * Called during rte_eth_dev_configure().
63  *
64  * @param dev
65  *   current device.
66  * @param user_data
67  *   user argument from dev_init() call.
68  * @return (0) if successful.
69  */
70 int rte_pmd_ark_dev_configure(struct rte_eth_dev *dev, void *user_data);
71
72 /**
73  * Extension prototype, optional implementation.
74  * Called during rte_eth_dev_start().
75  *
76  * @param dev
77  *   current device.
78  * @param user_data
79  *   user argument from dev_init() call.
80  * @return (0) if successful.
81  */
82 int rte_pmd_ark_dev_start(struct rte_eth_dev *dev, void *user_data);
83
84 /**
85  * Extension prototype, optional implementation.
86  * Called during  rte_eth_dev_stop().
87  *
88  * @param dev
89  *   current device.
90  * @param user_data
91  *   user argument from dev_init() call.
92  * @return (0) if successful.
93  */
94 void rte_pmd_ark_dev_stop(struct rte_eth_dev *dev, void *user_data);
95
96 /**
97  * Extension prototype, optional implementation.
98  * Called during rte_eth_dev_close().
99  *
100  * @param dev
101  *   current device.
102  * @param user_data
103  *   user argument from dev_init() call.
104  * @return (0) if successful.
105  */
106 void rte_pmd_ark_dev_close(struct rte_eth_dev *dev, void *user_data);
107
108 /**
109  * Extension prototype, optional implementation.
110  * Called during link_update status event.
111  *
112  * @param dev
113  *   current device.
114  * @param wait_to_complete
115  *    argument from update event.
116  * @param user_data
117  *   user argument from dev_init() call.
118  * @return (0) if successful.
119  */
120 int rte_pmd_ark_link_update(struct rte_eth_dev *dev,
121                             int wait_to_complete,
122                             void *user_data);
123
124 /**
125  * Extension prototype, optional implementation.
126  * Called during rte_eth_dev_set_link_up().
127  *
128  * @param dev
129  *   current device.
130  * @param user_data
131  *   user argument from dev_init() call.
132  * @return (0) if successful.
133  */
134 int rte_pmd_ark_dev_set_link_up(struct rte_eth_dev *dev, void *user_data);
135
136 /**
137  * Extension prototype, optional implementation.
138  * Called during rte_eth_dev_set_link_down().
139  *
140  * @param dev
141  *   current device.
142  * @param user_data
143  *   user argument from dev_init() call.
144  * @return (0) if successful.
145  */
146 int rte_pmd_ark_dev_set_link_down(struct rte_eth_dev *dev, void *user_data);
147
148 /**
149  * Extension prototype, optional implementation.
150  * Called during rte_eth_stats_get(); allows updates to the stats
151  * struct in addition Ark's PMD operations.
152  *
153  * @param dev
154  *   current device.
155  * @param stats
156  *   statistics struct already populated by Ark PMD.
157  * @param user_data
158  *   user argument from dev_init() call.
159  * @return (0) if successful.
160  */
161 int rte_pmd_ark_stats_get(struct rte_eth_dev *dev,
162                           struct rte_eth_stats *stats,
163                           void *user_data);
164
165 /**
166  * Extension prototype, optional implementation.
167  * Called during rte_eth_dev_stats_reset().
168  *
169  * @param dev
170  *   current device.
171  * @param user_data
172  *   user argument from dev_init() call.
173  * @return (0) if successful.
174  */
175 void rte_pmd_ark_stats_reset(struct rte_eth_dev *dev, void *user_data);
176
177 /**
178  * Extension prototype, optional implementation.
179  * Called during rte_eth_dev_mac_addr_add().
180  *
181  * @param dev
182  *   current device.
183  * @param macaddr
184  *   The MAC address to add
185  * @param index
186  *   The index into the MAC address array.
187  * @param pool
188  *   VMDq pool index from caller
189  * @param user_data
190  *   user argument from dev_init() call.
191  * @return (0) if successful.
192  */
193 void rte_pmd_ark_mac_addr_add(struct rte_eth_dev *dev,
194                               struct rte_ether_addr *macaddr,
195                               uint32_t index,
196                               uint32_t pool,
197                               void *user_data);
198
199 /**
200  * Extension prototype, optional implementation.
201  * Called during rte_eth_dev_mac_addr_remove().
202  *
203  * @param dev
204  *   current device.
205  * @param index
206  *   The index into the MAC address array.
207  * @param user_data
208  *   user argument from dev_init() call.
209  * @return (0) if successful.
210  */
211 void rte_pmd_ark_mac_addr_remove(struct rte_eth_dev *dev,
212                                  uint32_t index,
213                                  void *user_data);
214
215 /**
216  * Extension prototype, optional implementation.
217  * Called during rte_eth_dev_default_mac_addr_set().
218  *
219  * @param dev
220  *   current device.
221  * @param mac_addr
222  *   The new default MAC address.
223  * @param user_data
224  *   user argument from dev_init() call.
225  * @return (0) if successful.
226  */
227 void rte_pmd_ark_mac_addr_set(struct rte_eth_dev *dev,
228                               struct rte_ether_addr *mac_addr,
229                               void *user_data);
230
231 /**
232  * Extension prototype, optional implementation.
233  * Called during rte_eth_dev_set_mtu().
234  *
235  * @param dev
236  *   current device.
237  * @param size
238  *   The MTU to be applied
239  * @param user_data
240  *   user argument from dev_init() call.
241  * @return (0) if successful.
242  */
243 int rte_pmd_ark_set_mtu(struct rte_eth_dev *dev,
244                         uint16_t size,
245                         void *user_data);
246
247 /**
248  * Extension prototype, optional implementation.
249  * Called during rte_eth_rx_burst() for each packet. This extension
250  * function allows the transfer of meta data from the user's FPGA to
251  * mbuf fields.
252  *
253  * @param mbuf
254  *   The newly received mbuf
255  * @param meta
256  *   The meta data from the user, up to 20 bytes. The
257  *   underlying data in the PMD is of type uint32_t meta[5];
258  * @param user_data
259  *   user argument from dev_init() call.
260  */
261 void rte_pmd_ark_rx_user_meta_hook(struct rte_mbuf *mbuf,
262                                    const uint32_t *meta,
263                                    void *user_data);
264
265 /**
266  * Extension prototype, optional implementation.
267  * Called during rte_eth_tx_burst() for each packet. This extension
268  * function allows the transfer of data from the mbuf to the user's
269  * FPGA.  Up to 20 bytes (5 32-bit words) are transferable
270  *
271  * @param mbuf
272  *   The mbuf about to be transmitted.
273  * @param meta
274  *   The meta data to be populate by this call. The
275  *   underlying in the PMD is of type uint32_t meta[5];
276  * @param meta_cnt
277  *   The count in 32-bit words of the meta data populated, 0 to 5.
278  * @param user_data
279  *   user argument from dev_init() call.
280  */
281 void rte_pmd_ark_tx_user_meta_hook(const struct rte_mbuf *mbuf,
282                                    uint32_t *meta,
283                                    uint8_t *meta_cnt,
284                                    void *user_data);
285
286 #endif