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 * ptype mapping table only accept RTE_PTYPE_XXX or "user defined" ptype.
111 * A ptype with MSB set will be regarded as a user defined ptype.
112 * Below macro help to create a user defined ptype.
114 #define RTE_PMD_I40E_PTYPE_USER_DEFINE_MASK 0x80000000
116 struct rte_pmd_i40e_ptype_mapping {
117 uint16_t hw_ptype; /**< hardware defined packet type*/
118 uint32_t sw_ptype; /**< software defined packet type */
122 * Notify VF when PF link status changes.
125 * The port identifier of the Ethernet device.
129 * - (0) if successful.
130 * - (-ENODEV) if *port* invalid.
131 * - (-EINVAL) if *vf* invalid.
133 int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
136 * Enable/Disable VF MAC anti spoofing.
139 * The port identifier of the Ethernet device.
141 * VF on which to set MAC anti spoofing.
143 * 1 - Enable VFs MAC anti spoofing.
144 * 0 - Disable VFs MAC anti spoofing.
146 * - (0) if successful.
147 * - (-ENODEV) if *port* invalid.
148 * - (-EINVAL) if bad parameter.
150 int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
155 * Enable/Disable VF VLAN anti spoofing.
158 * The port identifier of the Ethernet device.
160 * VF on which to set VLAN anti spoofing.
162 * 1 - Enable VFs VLAN anti spoofing.
163 * 0 - Disable VFs VLAN anti spoofing.
165 * - (0) if successful.
166 * - (-ENODEV) if *port* invalid.
167 * - (-EINVAL) if bad parameter.
169 int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
174 * Enable/Disable TX loopback on all the PF and VFs.
177 * The port identifier of the Ethernet device.
179 * 1 - Enable TX loopback.
180 * 0 - Disable TX loopback.
182 * - (0) if successful.
183 * - (-ENODEV) if *port* invalid.
184 * - (-EINVAL) if bad parameter.
186 int rte_pmd_i40e_set_tx_loopback(uint8_t port,
190 * Enable/Disable VF unicast promiscuous mode.
193 * The port identifier of the Ethernet device.
195 * VF on which to set.
200 * - (0) if successful.
201 * - (-ENODEV) if *port* invalid.
202 * - (-EINVAL) if bad parameter.
204 int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
209 * Enable/Disable VF multicast promiscuous mode.
212 * The port identifier of the Ethernet device.
214 * VF on which to set.
219 * - (0) if successful.
220 * - (-ENODEV) if *port* invalid.
221 * - (-EINVAL) if bad parameter.
223 int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
228 * Set the VF MAC address.
230 * PF should set MAC address before VF initialized, if PF sets the MAC
231 * address after VF initialized, new MAC address won't be effective until
234 * This will remove all existing MAC filters.
237 * The port identifier of the Ethernet device.
243 * - (0) if successful.
244 * - (-ENODEV) if *port* invalid.
245 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
247 int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
248 struct ether_addr *mac_addr);
251 * Enable/Disable vf vlan strip for all queues in a pool
254 * The port identifier of the Ethernet device.
258 * 1 - Enable VF's vlan strip on RX queues.
259 * 0 - Disable VF's vlan strip on RX queues.
262 * - (0) if successful.
263 * - (-ENODEV) if *port* invalid.
264 * - (-EINVAL) if bad parameter.
267 rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
270 * Enable/Disable vf vlan insert
273 * The port identifier of the Ethernet device.
277 * 0 - Disable VF's vlan insert.
278 * n - Enable; n is inserted as the vlan id.
281 * - (0) if successful.
282 * - (-ENODEV) if *port* invalid.
283 * - (-EINVAL) if bad parameter.
285 int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
289 * Enable/Disable vf broadcast mode
292 * The port identifier of the Ethernet device.
296 * 0 - Disable broadcast.
297 * 1 - Enable broadcast.
300 * - (0) if successful.
301 * - (-ENODEV) if *port* invalid.
302 * - (-EINVAL) if bad parameter.
304 int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
308 * Enable/Disable vf vlan tag
311 * The port identifier of the Ethernet device.
315 * 0 - Disable VF's vlan tag.
316 * n - Enable VF's vlan tag.
319 * - (0) if successful.
320 * - (-ENODEV) if *port* invalid.
321 * - (-EINVAL) if bad parameter.
323 int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
326 * Enable/Disable VF VLAN filter
329 * The port identifier of the Ethernet device.
333 * Mask to filter VF's
335 * 0 - Disable VF's VLAN filter.
336 * 1 - Enable VF's VLAN filter.
339 * - (0) if successful.
340 * - (-ENODEV) if *port* invalid.
341 * - (-EINVAL) if bad parameter.
342 * - (-ENOTSUP) not supported by firmware.
344 int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
345 uint64_t vf_mask, uint8_t on);
348 * Get VF's statistics
351 * The port identifier of the Ethernet device.
353 * VF on which to get.
355 * A pointer to a structure of type *rte_eth_stats* to be filled with
356 * the values of device counters for the following set of statistics:
357 * - *ipackets* with the total of successfully received packets.
358 * - *opackets* with the total of successfully transmitted packets.
359 * - *ibytes* with the total of successfully received bytes.
360 * - *obytes* with the total of successfully transmitted bytes.
361 * - *ierrors* with the total of erroneous received packets.
362 * - *oerrors* with the total of failed transmitted packets.
364 * - (0) if successful.
365 * - (-ENODEV) if *port* invalid.
366 * - (-EINVAL) if bad parameter.
369 int rte_pmd_i40e_get_vf_stats(uint8_t port,
371 struct rte_eth_stats *stats);
374 * Clear VF's statistics
377 * The port identifier of the Ethernet device.
379 * VF on which to get.
381 * - (0) if successful.
382 * - (-ENODEV) if *port* invalid.
383 * - (-EINVAL) if bad parameter.
385 int rte_pmd_i40e_reset_vf_stats(uint8_t port,
389 * Set VF's max bandwidth.
391 * Per VF bandwidth limitation and per TC bandwidth limitation cannot
392 * be enabled in parallel. If per TC bandwidth is enabled, this function
396 * The port identifier of the Ethernet device.
400 * Bandwidth for this VF.
401 * The value should be an absolute bandwidth in Mbps.
402 * The bandwidth is a L2 bandwidth counting the bytes of ethernet packets.
403 * Not count the bytes added by physical layer.
405 * - (0) if successful.
406 * - (-ENODEV) if *port* invalid.
407 * - (-EINVAL) if bad parameter.
408 * - (-ENOTSUP) not supported by firmware.
410 int rte_pmd_i40e_set_vf_max_bw(uint8_t port,
415 * Set all the TCs' bandwidth weight on a specific VF.
417 * The bw_weight means the percentage occupied by the TC.
418 * It can be taken as the relative min bandwidth setting.
421 * The port identifier of the Ethernet device.
427 * An array of relative bandwidth weight for all the TCs.
428 * The summary of the bw_weight should be 100.
430 * - (0) if successful.
431 * - (-ENODEV) if *port* invalid.
432 * - (-EINVAL) if bad parameter.
433 * - (-ENOTSUP) not supported by firmware.
435 int rte_pmd_i40e_set_vf_tc_bw_alloc(uint8_t port,
441 * Set a specific TC's max bandwidth on a specific VF.
444 * The port identifier of the Ethernet device.
448 * Number specifying TC.
450 * Max bandwidth for this TC.
451 * The value should be an absolute bandwidth in Mbps.
452 * The bandwidth is a L2 bandwidth counting the bytes of ethernet packets.
453 * Not count the bytes added by physical layer.
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_vf_tc_max_bw(uint8_t port,
466 * Set some TCs to strict priority mode on a physical port.
469 * The port identifier of the Ethernet device.
471 * A bit map for the TCs.
473 * - (0) if successful.
474 * - (-ENODEV) if *port* invalid.
475 * - (-EINVAL) if bad parameter.
476 * - (-ENOTSUP) not supported by firmware.
478 int rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map);
481 * Load/Unload a ddp package
484 * The port identifier of the Ethernet device.
490 * Operation of package processing
492 * - (0) if successful.
493 * - (-ENODEV) if *port* invalid.
494 * - (-EINVAL) if bad parameter.
495 * - (1) if profile exists.
497 int rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,
499 enum rte_pmd_i40e_package_op op);
502 * rte_pmd_i40e_get_ddp_list - Get loaded profile list
506 * buffer for response
510 * - (0) if successful.
511 * - (-ENODEV) if *port* invalid.
512 * - (-EINVAL) if bad parameter.
514 int rte_pmd_i40e_get_ddp_list(uint8_t port, uint8_t *buff, uint32_t size);
517 * Update hardware defined ptype to software defined packet type
521 * pointer to port identifier of the device.
522 * @param mapping_items
523 * the base address of the mapping items array.
525 * number of mapping items.
527 * the flag indicate different ptype mapping update method.
528 * -(0) only overwrite referred PTYPE mapping,
529 * keep other PTYPEs mapping unchanged.
530 * -(!0) overwrite referred PTYPE mapping,
531 * set other PTYPEs maps to PTYPE_UNKNOWN.
533 int rte_pmd_i40e_ptype_mapping_update(
535 struct rte_pmd_i40e_ptype_mapping *mapping_items,
540 * Reset hardware defined ptype to software defined ptype
541 * mapping table to default.
544 * pointer to port identifier of the device
546 int rte_pmd_i40e_ptype_mapping_reset(uint8_t port);
549 * Get hardware defined ptype to software defined ptype
553 * pointer to port identifier of the device.
554 * @param mapping_items
555 * the base address of the array to store returned items.
557 * the size of the input array.
559 * the place to store the number of returned items.
561 * -(0) return full mapping table.
562 * -(!0) only return mapping items which packet_type != RTE_PTYPE_UNKNOWN.
564 int rte_pmd_i40e_ptype_mapping_get(
566 struct rte_pmd_i40e_ptype_mapping *mapping_items,
572 * Replace a specific or a group of software defined ptypes
576 * pointer to port identifier of the device
578 * the packet type to be replaced
580 * -(0) target represent a specific software defined ptype.
581 * -(!0) target is a mask to represent a group of software defined ptypes.
583 * the new packet type to overwrite
585 int rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
590 #endif /* _PMD_I40E_H_ */