4 * Copyright (c) 2017 Intel Corporation. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of Intel Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 * @file rte_pmd_i40e.h
39 * i40e PMD specific functions.
41 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
45 #include <rte_ethdev.h>
48 * Response sent back to i40e driver from user app after callback
50 enum rte_pmd_i40e_mb_event_rsp {
51 RTE_PMD_I40E_MB_EVENT_NOOP_ACK, /**< skip mbox request and ACK */
52 RTE_PMD_I40E_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
53 RTE_PMD_I40E_MB_EVENT_PROCEED, /**< proceed with mbox request */
54 RTE_PMD_I40E_MB_EVENT_MAX /**< max value of this enum */
58 * Data sent to the user application when the callback is executed.
60 struct rte_pmd_i40e_mb_event_param {
61 uint16_t vfid; /**< Virtual Function number */
62 uint16_t msg_type; /**< VF to PF message type, see i40e_virtchnl_ops */
63 uint16_t retval; /**< return value */
64 void *msg; /**< pointer to message */
65 uint16_t msglen; /**< length of the message */
69 * Option of package processing.
71 enum rte_pmd_i40e_package_op {
72 RTE_PMD_I40E_PKG_OP_UNDEFINED = 0,
73 RTE_PMD_I40E_PKG_OP_WR_ADD, /**< load package and add to info list */
74 RTE_PMD_I40E_PKG_OP_MAX = 32
77 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
80 * Version for dynamic device personalization.
81 * Version in "major.minor.update.draft" format.
83 struct rte_pmd_i40e_ddp_version {
91 * Profile information in profile info list.
93 struct rte_pmd_i40e_profile_info {
95 struct rte_pmd_i40e_ddp_version version;
98 uint8_t name[RTE_PMD_I40E_DDP_NAME_SIZE];
102 * Profile information list returned from HW.
104 struct rte_pmd_i40e_profile_list {
106 struct rte_pmd_i40e_profile_info p_info[1];
110 * Notify VF when PF link status changes.
113 * The port identifier of the Ethernet device.
117 * - (0) if successful.
118 * - (-ENODEV) if *port* invalid.
119 * - (-EINVAL) if *vf* invalid.
121 int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
124 * Enable/Disable VF MAC anti spoofing.
127 * The port identifier of the Ethernet device.
129 * VF on which to set MAC anti spoofing.
131 * 1 - Enable VFs MAC anti spoofing.
132 * 0 - Disable VFs MAC anti spoofing.
134 * - (0) if successful.
135 * - (-ENODEV) if *port* invalid.
136 * - (-EINVAL) if bad parameter.
138 int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
143 * Enable/Disable VF VLAN anti spoofing.
146 * The port identifier of the Ethernet device.
148 * VF on which to set VLAN anti spoofing.
150 * 1 - Enable VFs VLAN anti spoofing.
151 * 0 - Disable VFs VLAN anti spoofing.
153 * - (0) if successful.
154 * - (-ENODEV) if *port* invalid.
155 * - (-EINVAL) if bad parameter.
157 int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
162 * Enable/Disable TX loopback on all the PF and VFs.
165 * The port identifier of the Ethernet device.
167 * 1 - Enable TX loopback.
168 * 0 - Disable TX loopback.
170 * - (0) if successful.
171 * - (-ENODEV) if *port* invalid.
172 * - (-EINVAL) if bad parameter.
174 int rte_pmd_i40e_set_tx_loopback(uint8_t port,
178 * Enable/Disable VF unicast promiscuous mode.
181 * The port identifier of the Ethernet device.
183 * VF on which to set.
188 * - (0) if successful.
189 * - (-ENODEV) if *port* invalid.
190 * - (-EINVAL) if bad parameter.
192 int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
197 * Enable/Disable VF multicast promiscuous mode.
200 * The port identifier of the Ethernet device.
202 * VF on which to set.
207 * - (0) if successful.
208 * - (-ENODEV) if *port* invalid.
209 * - (-EINVAL) if bad parameter.
211 int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
216 * Set the VF MAC address.
218 * PF should set MAC address before VF initialized, if PF sets the MAC
219 * address after VF initialized, new MAC address won't be effective until
222 * This will remove all existing MAC filters.
225 * The port identifier of the Ethernet device.
231 * - (0) if successful.
232 * - (-ENODEV) if *port* invalid.
233 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
235 int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
236 struct ether_addr *mac_addr);
239 * Enable/Disable vf vlan strip for all queues in a pool
242 * The port identifier of the Ethernet device.
246 * 1 - Enable VF's vlan strip on RX queues.
247 * 0 - Disable VF's vlan strip on RX queues.
250 * - (0) if successful.
251 * - (-ENODEV) if *port* invalid.
252 * - (-EINVAL) if bad parameter.
255 rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
258 * Enable/Disable vf vlan insert
261 * The port identifier of the Ethernet device.
265 * 0 - Disable VF's vlan insert.
266 * n - Enable; n is inserted as the vlan id.
269 * - (0) if successful.
270 * - (-ENODEV) if *port* invalid.
271 * - (-EINVAL) if bad parameter.
273 int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
277 * Enable/Disable vf broadcast mode
280 * The port identifier of the Ethernet device.
284 * 0 - Disable broadcast.
285 * 1 - Enable broadcast.
288 * - (0) if successful.
289 * - (-ENODEV) if *port* invalid.
290 * - (-EINVAL) if bad parameter.
292 int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
296 * Enable/Disable vf vlan tag
299 * The port identifier of the Ethernet device.
303 * 0 - Disable VF's vlan tag.
304 * n - Enable VF's vlan tag.
307 * - (0) if successful.
308 * - (-ENODEV) if *port* invalid.
309 * - (-EINVAL) if bad parameter.
311 int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
314 * Enable/Disable VF VLAN filter
317 * The port identifier of the Ethernet device.
321 * Mask to filter VF's
323 * 0 - Disable VF's VLAN filter.
324 * 1 - Enable VF's VLAN filter.
327 * - (0) if successful.
328 * - (-ENODEV) if *port* invalid.
329 * - (-EINVAL) if bad parameter.
330 * - (-ENOTSUP) not supported by firmware.
332 int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
333 uint64_t vf_mask, uint8_t on);
336 * Get VF's statistics
339 * The port identifier of the Ethernet device.
341 * VF on which to get.
343 * A pointer to a structure of type *rte_eth_stats* to be filled with
344 * the values of device counters for the following set of statistics:
345 * - *ipackets* with the total of successfully received packets.
346 * - *opackets* with the total of successfully transmitted packets.
347 * - *ibytes* with the total of successfully received bytes.
348 * - *obytes* with the total of successfully transmitted bytes.
349 * - *ierrors* with the total of erroneous received packets.
350 * - *oerrors* with the total of failed transmitted packets.
352 * - (0) if successful.
353 * - (-ENODEV) if *port* invalid.
354 * - (-EINVAL) if bad parameter.
357 int rte_pmd_i40e_get_vf_stats(uint8_t port,
359 struct rte_eth_stats *stats);
362 * Clear VF's statistics
365 * The port identifier of the Ethernet device.
367 * VF on which to get.
369 * - (0) if successful.
370 * - (-ENODEV) if *port* invalid.
371 * - (-EINVAL) if bad parameter.
373 int rte_pmd_i40e_reset_vf_stats(uint8_t port,
377 * Set VF's max bandwidth.
379 * Per VF bandwidth limitation and per TC bandwidth limitation cannot
380 * be enabled in parallel. If per TC bandwidth is enabled, this function
384 * The port identifier of the Ethernet device.
388 * Bandwidth for this VF.
390 * - (0) if successful.
391 * - (-ENODEV) if *port* invalid.
392 * - (-EINVAL) if bad parameter.
393 * - (-ENOTSUP) not supported by firmware.
395 int rte_pmd_i40e_set_vf_max_bw(uint8_t port,
400 * Set all the TCs' bandwidth weight on a specific VF.
402 * The bw_weight means the percentage occupied by the TC.
403 * It can be taken as the relative min bandwidth setting.
406 * The port identifier of the Ethernet device.
412 * An array of relative bandwidth weight for all the TCs.
413 * The summary of the bw_weight should be 100.
415 * - (0) if successful.
416 * - (-ENODEV) if *port* invalid.
417 * - (-EINVAL) if bad parameter.
418 * - (-ENOTSUP) not supported by firmware.
420 int rte_pmd_i40e_set_vf_tc_bw_alloc(uint8_t port,
426 * Set a specific TC's max bandwidth on a specific VF.
429 * The port identifier of the Ethernet device.
433 * Number specifying TC.
435 * Max bandwidth for this TC.
437 * - (0) if successful.
438 * - (-ENODEV) if *port* invalid.
439 * - (-EINVAL) if bad parameter.
440 * - (-ENOTSUP) not supported by firmware.
442 int rte_pmd_i40e_set_vf_tc_max_bw(uint8_t port,
448 * Set some TCs to strict priority mode on a physical port.
451 * The port identifier of the Ethernet device.
453 * A bit map for the TCs.
455 * - (0) if successful.
456 * - (-ENODEV) if *port* invalid.
457 * - (-EINVAL) if bad parameter.
458 * - (-ENOTSUP) not supported by firmware.
460 int rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map);
463 * Load/Unload a ddp package
466 * The port identifier of the Ethernet device.
472 * Operation of package processing
474 * - (0) if successful.
475 * - (-ENODEV) if *port* invalid.
476 * - (-EINVAL) if bad parameter.
477 * - (1) if profile exists.
479 int rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,
481 enum rte_pmd_i40e_package_op op);
484 * rte_pmd_i40e_get_ddp_list - Get loaded profile list
488 * buffer for response
492 * - (0) if successful.
493 * - (-ENODEV) if *port* invalid.
494 * - (-EINVAL) if bad parameter.
496 int rte_pmd_i40e_get_ddp_list(uint8_t port, uint8_t *buff, uint32_t size);
498 #endif /* _PMD_I40E_H_ */