1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2015-2018 Atomic Rules LLC
8 #include <ethdev_driver.h>
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.
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
28 * access to PCIe device bar (application bar) and hence access to
29 * user's portion of FPGA.
33 * which will be passed to other extension functions.
35 void *rte_pmd_ark_dev_init(struct rte_eth_dev *dev, void *a_bar, int port_id);
38 * Extension prototype, optional implementation.
39 * Called during device uninit.
44 * user argument from dev_init() call.
46 void rte_pmd_ark_dev_uninit(struct rte_eth_dev *dev, void *user_data);
49 * Extension prototype, optional implementation.
50 * Called during device probe to change the port count from 1.
55 * user argument from dev_init() call.
56 * @return (0) if successful.
58 uint8_t dev_get_port_count(struct rte_eth_dev *dev, void *user_data);
61 * Extension prototype, optional implementation.
62 * Called during rte_eth_dev_configure().
67 * user argument from dev_init() call.
68 * @return (0) if successful.
70 int rte_pmd_ark_dev_configure(struct rte_eth_dev *dev, void *user_data);
73 * Extension prototype, optional implementation.
74 * Called during rte_eth_dev_start().
79 * user argument from dev_init() call.
80 * @return (0) if successful.
82 int rte_pmd_ark_dev_start(struct rte_eth_dev *dev, void *user_data);
85 * Extension prototype, optional implementation.
86 * Called during rte_eth_dev_stop().
91 * user argument from dev_init() call.
92 * @return (0) if successful.
94 void rte_pmd_ark_dev_stop(struct rte_eth_dev *dev, void *user_data);
97 * Extension prototype, optional implementation.
98 * Called during rte_eth_dev_close().
103 * user argument from dev_init() call.
104 * @return (0) if successful.
106 void rte_pmd_ark_dev_close(struct rte_eth_dev *dev, void *user_data);
109 * Extension prototype, optional implementation.
110 * Called during link_update status event.
114 * @param wait_to_complete
115 * argument from update event.
117 * user argument from dev_init() call.
118 * @return (0) if successful.
120 int rte_pmd_ark_link_update(struct rte_eth_dev *dev,
121 int wait_to_complete,
125 * Extension prototype, optional implementation.
126 * Called during rte_eth_dev_set_link_up().
131 * user argument from dev_init() call.
132 * @return (0) if successful.
134 int rte_pmd_ark_dev_set_link_up(struct rte_eth_dev *dev, void *user_data);
137 * Extension prototype, optional implementation.
138 * Called during rte_eth_dev_set_link_down().
143 * user argument from dev_init() call.
144 * @return (0) if successful.
146 int rte_pmd_ark_dev_set_link_down(struct rte_eth_dev *dev, void *user_data);
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.
156 * statistics struct already populated by Ark PMD.
158 * user argument from dev_init() call.
159 * @return (0) if successful.
161 int rte_pmd_ark_stats_get(struct rte_eth_dev *dev,
162 struct rte_eth_stats *stats,
166 * Extension prototype, optional implementation.
167 * Called during rte_eth_dev_stats_reset().
172 * user argument from dev_init() call.
173 * @return (0) if successful.
175 void rte_pmd_ark_stats_reset(struct rte_eth_dev *dev, void *user_data);
178 * Extension prototype, optional implementation.
179 * Called during rte_eth_dev_mac_addr_add().
184 * The MAC address to add
186 * The index into the MAC address array.
188 * VMDq pool index from caller
190 * user argument from dev_init() call.
191 * @return (0) if successful.
193 void rte_pmd_ark_mac_addr_add(struct rte_eth_dev *dev,
194 struct rte_ether_addr *macaddr,
200 * Extension prototype, optional implementation.
201 * Called during rte_eth_dev_mac_addr_remove().
206 * The index into the MAC address array.
208 * user argument from dev_init() call.
209 * @return (0) if successful.
211 void rte_pmd_ark_mac_addr_remove(struct rte_eth_dev *dev,
216 * Extension prototype, optional implementation.
217 * Called during rte_eth_dev_default_mac_addr_set().
222 * The new default MAC address.
224 * user argument from dev_init() call.
225 * @return (0) if successful.
227 void rte_pmd_ark_mac_addr_set(struct rte_eth_dev *dev,
228 struct rte_ether_addr *mac_addr,
232 * Extension prototype, optional implementation.
233 * Called during rte_eth_dev_set_mtu().
238 * The MTU to be applied
240 * user argument from dev_init() call.
241 * @return (0) if successful.
243 int rte_pmd_ark_set_mtu(struct rte_eth_dev *dev,
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
254 * The newly received mbuf
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];
259 * user argument from dev_init() call.
261 void rte_pmd_ark_rx_user_meta_hook(struct rte_mbuf *mbuf,
262 const uint32_t *meta,
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
272 * The mbuf about to be transmitted.
274 * The meta data to be populate by this call. The
275 * underlying in the PMD is of type uint32_t meta[5];
277 * The count in 32-bit words of the meta data populated, 0 to 5.
279 * user argument from dev_init() call.
281 void rte_pmd_ark_tx_user_meta_hook(const struct rte_mbuf *mbuf,