4 * Copyright (c) 2016 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.
34 * @file rte_pmd_ixgbe.h
35 * ixgbe PMD specific functions.
42 #include <rte_ethdev.h>
45 * Notify VF when PF link status changes.
48 * The port identifier of the Ethernet device.
52 * - (0) if successful.
53 * - (-ENODEV) if *port* invalid.
54 * - (-EINVAL) if *vf* invalid.
56 int rte_pmd_ixgbe_ping_vf(uint16_t port, uint16_t vf);
59 * Set the VF MAC address.
62 * The port identifier of the Ethernet device.
68 * - (0) if successful.
69 * - (-ENODEV) if *port* invalid.
70 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
72 int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf,
73 struct ether_addr *mac_addr);
76 * Enable/Disable VF VLAN anti spoofing.
79 * The port identifier of the Ethernet device.
81 * VF on which to set VLAN anti spoofing.
83 * 1 - Enable VFs VLAN anti spoofing.
84 * 0 - Disable VFs VLAN anti spoofing.
86 * - (0) if successful.
87 * - (-ENODEV) if *port* invalid.
88 * - (-EINVAL) if bad parameter.
90 int rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf,
94 * Enable/Disable VF MAC anti spoofing.
97 * The port identifier of the Ethernet device.
99 * VF on which to set MAC anti spoofing.
101 * 1 - Enable VFs MAC anti spoofing.
102 * 0 - Disable VFs MAC anti spoofing.
104 * - (0) if successful.
105 * - (-ENODEV) if *port* invalid.
106 * - (-EINVAL) if bad parameter.
108 int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
111 * Enable/Disable vf vlan insert
114 * The port identifier of the Ethernet device.
118 * 0 - Disable VF's vlan insert.
119 * n - Enable; n is inserted as the vlan id.
122 * - (0) if successful.
123 * - (-ENODEV) if *port* invalid.
124 * - (-EINVAL) if bad parameter.
126 int rte_pmd_ixgbe_set_vf_vlan_insert(uint16_t port, uint16_t vf,
130 * Enable/Disable tx loopback
133 * The port identifier of the Ethernet device.
135 * 1 - Enable tx loopback.
136 * 0 - Disable tx loopback.
139 * - (0) if successful.
140 * - (-ENODEV) if *port* invalid.
141 * - (-EINVAL) if bad parameter.
143 int rte_pmd_ixgbe_set_tx_loopback(uint16_t port, uint8_t on);
146 * set all queues drop enable bit
149 * The port identifier of the Ethernet device.
151 * 1 - set the queue drop enable bit for all pools.
152 * 0 - reset the queue drop enable bit for all pools.
155 * - (0) if successful.
156 * - (-ENODEV) if *port* invalid.
157 * - (-EINVAL) if bad parameter.
159 int rte_pmd_ixgbe_set_all_queues_drop_en(uint16_t port, uint8_t on);
162 * set drop enable bit in the VF split rx control register
165 * The port identifier of the Ethernet device.
169 * 1 - set the drop enable bit in the split rx control register.
170 * 0 - reset the drop enable bit in the split rx control register.
173 * - (0) if successful.
174 * - (-ENODEV) if *port* invalid.
175 * - (-EINVAL) if bad parameter.
178 int rte_pmd_ixgbe_set_vf_split_drop_en(uint16_t port, uint16_t vf, uint8_t on);
181 * Enable/Disable vf vlan strip for all queues in a pool
184 * The port identifier of the Ethernet device.
188 * 1 - Enable VF's vlan strip on RX queues.
189 * 0 - Disable VF's vlan strip on RX queues.
192 * - (0) if successful.
193 * - (-ENOTSUP) if hardware doesn't support this feature.
194 * - (-ENODEV) if *port* invalid.
195 * - (-EINVAL) if bad parameter.
198 rte_pmd_ixgbe_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
201 * Enable MACsec offload.
204 * The port identifier of the Ethernet device.
206 * 1 - Enable encryption (encrypt and add integrity signature).
207 * 0 - Disable encryption (only add integrity signature).
209 * 1 - Enable replay protection.
210 * 0 - Disable replay protection.
212 * - (0) if successful.
213 * - (-ENODEV) if *port* invalid.
214 * - (-ENOTSUP) if hardware doesn't support this feature.
216 int rte_pmd_ixgbe_macsec_enable(uint16_t port, uint8_t en, uint8_t rp);
219 * Disable MACsec offload.
222 * The port identifier of the Ethernet device.
224 * - (0) if successful.
225 * - (-ENODEV) if *port* invalid.
226 * - (-ENOTSUP) if hardware doesn't support this feature.
228 int rte_pmd_ixgbe_macsec_disable(uint16_t port);
231 * Configure Tx SC (Secure Connection).
234 * The port identifier of the Ethernet device.
236 * The MAC address on the local side.
238 * - (0) if successful.
239 * - (-ENODEV) if *port* invalid.
240 * - (-ENOTSUP) if hardware doesn't support this feature.
242 int rte_pmd_ixgbe_macsec_config_txsc(uint16_t port, uint8_t *mac);
245 * Configure Rx SC (Secure Connection).
248 * The port identifier of the Ethernet device.
250 * The MAC address on the remote side.
252 * The PI (port identifier) on the remote side.
254 * - (0) if successful.
255 * - (-ENODEV) if *port* invalid.
256 * - (-ENOTSUP) if hardware doesn't support this feature.
258 int rte_pmd_ixgbe_macsec_config_rxsc(uint16_t port, uint8_t *mac, uint16_t pi);
261 * Enable Tx SA (Secure Association).
264 * The port identifier of the Ethernet device.
266 * The SA to be enabled (0 or 1).
268 * The association number on the local side.
270 * The packet number on the local side.
272 * The key on the local side.
274 * - (0) if successful.
275 * - (-ENODEV) if *port* invalid.
276 * - (-ENOTSUP) if hardware doesn't support this feature.
277 * - (-EINVAL) if bad parameter.
279 int rte_pmd_ixgbe_macsec_select_txsa(uint16_t port, uint8_t idx, uint8_t an,
280 uint32_t pn, uint8_t *key);
283 * Enable Rx SA (Secure Association).
286 * The port identifier of the Ethernet device.
288 * The SA to be enabled (0 or 1)
290 * The association number on the remote side.
292 * The packet number on the remote side.
294 * The key on the remote side.
296 * - (0) if successful.
297 * - (-ENODEV) if *port* invalid.
298 * - (-ENOTSUP) if hardware doesn't support this feature.
299 * - (-EINVAL) if bad parameter.
301 int rte_pmd_ixgbe_macsec_select_rxsa(uint16_t port, uint8_t idx, uint8_t an,
302 uint32_t pn, uint8_t *key);
305 * Set RX L2 Filtering mode of a VF of an Ethernet device.
308 * The port identifier of the Ethernet device.
312 * The RX mode mask, which is one or more of accepting Untagged Packets,
313 * packets that match the PFUTA table, Broadcast and Multicast Promiscuous.
314 * ETH_VMDQ_ACCEPT_UNTAG,ETH_VMDQ_ACCEPT_HASH_UC,
315 * ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST will be used
318 * 1 - Enable a VF RX mode.
319 * 0 - Disable a VF RX mode.
321 * - (0) if successful.
322 * - (-ENOTSUP) if hardware doesn't support.
323 * - (-ENODEV) if *port_id* invalid.
324 * - (-EINVAL) if bad parameter.
327 rte_pmd_ixgbe_set_vf_rxmode(uint16_t port, uint16_t vf, uint16_t rx_mask,
331 * Enable or disable a VF traffic receive of an Ethernet device.
334 * The port identifier of the Ethernet device.
338 * 1 - Enable a VF traffic receive.
339 * 0 - Disable a VF traffic receive.
341 * - (0) if successful.
342 * - (-ENOTSUP) if hardware doesn't support.
343 * - (-ENODEV) if *port_id* invalid.
344 * - (-EINVAL) if bad parameter.
347 rte_pmd_ixgbe_set_vf_rx(uint16_t port, uint16_t vf, uint8_t on);
350 * Enable or disable a VF traffic transmit of the Ethernet device.
353 * The port identifier of the Ethernet device.
357 * 1 - Enable a VF traffic transmit.
358 * 0 - Disable a VF traffic transmit.
360 * - (0) if successful.
361 * - (-ENODEV) if *port_id* invalid.
362 * - (-ENOTSUP) if hardware doesn't support.
363 * - (-EINVAL) if bad parameter.
366 rte_pmd_ixgbe_set_vf_tx(uint16_t port, uint16_t vf, uint8_t on);
369 * Enable/Disable hardware VF VLAN filtering by an Ethernet device of
370 * received VLAN packets tagged with a given VLAN Tag Identifier.
373 * The port identifier of the Ethernet device.
375 * The VLAN Tag Identifier whose filtering must be enabled or disabled.
377 * Bitmap listing which VFs participate in the VLAN filtering.
379 * 1 - Enable VFs VLAN filtering.
380 * 0 - Disable VFs VLAN filtering.
382 * - (0) if successful.
383 * - (-ENOTSUP) if hardware doesn't support.
384 * - (-ENODEV) if *port_id* invalid.
385 * - (-EINVAL) if bad parameter.
388 rte_pmd_ixgbe_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
389 uint64_t vf_mask, uint8_t vlan_on);
392 * Set the rate limitation for a vf on an Ethernet device.
395 * The port identifier of the Ethernet device.
399 * The tx rate allocated from the total link speed for this VF id.
401 * The queue mask which need to set the rate.
403 * - (0) if successful.
404 * - (-ENOTSUP) if hardware doesn't support this feature.
405 * - (-ENODEV) if *port_id* invalid.
406 * - (-EINVAL) if bad parameter.
408 int rte_pmd_ixgbe_set_vf_rate_limit(uint16_t port, uint16_t vf,
409 uint16_t tx_rate, uint64_t q_msk);
412 * Set all the TCs' bandwidth weight.
414 * The bw_weight means the percentage occupied by the TC.
415 * It can be taken as the relative min bandwidth setting.
418 * The port identifier of the Ethernet device.
422 * An array of relative bandwidth weight for all the TCs.
423 * The summary of the bw_weight should be 100.
425 * - (0) if successful.
426 * - (-ENODEV) if *port* invalid.
427 * - (-EINVAL) if bad parameter.
428 * - (-ENOTSUP) not supported by firmware.
430 int rte_pmd_ixgbe_set_tc_bw_alloc(uint16_t port,
436 * Initialize bypass logic. This function needs to be called before
437 * executing any other bypass API.
440 * The port identifier of the Ethernet device.
442 * - (0) if successful.
443 * - (-ENOTSUP) if hardware doesn't support.
444 * - (-EINVAL) if bad parameter.
446 int rte_pmd_ixgbe_bypass_init(uint16_t port);
449 * Return bypass state.
452 * The port identifier of the Ethernet device.
454 * The return bypass state.
459 * - (0) if successful.
460 * - (-ENOTSUP) if hardware doesn't support.
461 * - (-EINVAL) if bad parameter.
463 int rte_pmd_ixgbe_bypass_state_show(uint16_t port, uint32_t *state);
469 * The port identifier of the Ethernet device.
471 * The current bypass state.
476 * - (0) if successful.
477 * - (-ENOTSUP) if hardware doesn't support.
478 * - (-EINVAL) if bad parameter.
480 int rte_pmd_ixgbe_bypass_state_set(uint16_t port, uint32_t *new_state);
483 * Return bypass state when given event occurs.
486 * The port identifier of the Ethernet device.
489 * - (1) Main power on (power button is pushed)
490 * - (2) Auxiliary power on (power supply is being plugged)
491 * - (3) Main power off (system shutdown and power supply is left plugged in)
492 * - (4) Auxiliary power off (power supply is being unplugged)
493 * - (5) Display or set the watchdog timer
495 * The bypass state when given event occurred.
500 * - (0) if successful.
501 * - (-ENOTSUP) if hardware doesn't support.
502 * - (-EINVAL) if bad parameter.
504 int rte_pmd_ixgbe_bypass_event_show(uint16_t port,
509 * Set bypass state when given event occurs.
512 * The port identifier of the Ethernet device.
515 * - (1) Main power on (power button is pushed)
516 * - (2) Auxiliary power on (power supply is being plugged)
517 * - (3) Main power off (system shutdown and power supply is left plugged in)
518 * - (4) Auxiliary power off (power supply is being unplugged)
519 * - (5) Display or set the watchdog timer
521 * The assigned state when given event occurs.
526 * - (0) if successful.
527 * - (-ENOTSUP) if hardware doesn't support.
528 * - (-EINVAL) if bad parameter.
530 int rte_pmd_ixgbe_bypass_event_store(uint16_t port,
535 * Set bypass watchdog timeout count.
538 * The port identifier of the Ethernet device.
540 * The timeout to be set.
541 * - (0) 0 seconds (timer is off)
550 * - (0) if successful.
551 * - (-ENOTSUP) if hardware doesn't support.
552 * - (-EINVAL) if bad parameter.
554 int rte_pmd_ixgbe_bypass_wd_timeout_store(uint16_t port, uint32_t timeout);
557 * Get bypass firmware version.
560 * The port identifier of the Ethernet device.
562 * The firmware version
564 * - (0) if successful.
565 * - (-ENOTSUP) if hardware doesn't support.
566 * - (-EINVAL) if bad parameter.
568 int rte_pmd_ixgbe_bypass_ver_show(uint16_t port, uint32_t *ver);
571 * Return bypass watchdog timeout in seconds
574 * The port identifier of the Ethernet device.
576 * The return watchdog timeout. "0" represents timer expired
577 * - (0) 0 seconds (timer is off)
586 * - (0) if successful.
587 * - (-ENOTSUP) if hardware doesn't support.
588 * - (-EINVAL) if bad parameter.
590 int rte_pmd_ixgbe_bypass_wd_timeout_show(uint16_t port, uint32_t *wd_timeout);
593 * Reset bypass watchdog timer
596 * The port identifier of the Ethernet device.
598 * - (0) if successful.
599 * - (-ENOTSUP) if hardware doesn't support.
600 * - (-EINVAL) if bad parameter.
602 int rte_pmd_ixgbe_bypass_wd_reset(uint16_t port);
606 * Response sent back to ixgbe driver from user app after callback
608 enum rte_pmd_ixgbe_mb_event_rsp {
609 RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK, /**< skip mbox request and ACK */
610 RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
611 RTE_PMD_IXGBE_MB_EVENT_PROCEED, /**< proceed with mbox request */
612 RTE_PMD_IXGBE_MB_EVENT_MAX /**< max value of this enum */
616 * Data sent to the user application when the callback is executed.
618 struct rte_pmd_ixgbe_mb_event_param {
619 uint16_t vfid; /**< Virtual Function number */
620 uint16_t msg_type; /**< VF to PF message type, defined in ixgbe_mbx.h */
621 uint16_t retval; /**< return value */
622 void *msg; /**< pointer to message */
625 RTE_PMD_IXGBE_BYPASS_MODE_NONE,
626 RTE_PMD_IXGBE_BYPASS_MODE_NORMAL,
627 RTE_PMD_IXGBE_BYPASS_MODE_BYPASS,
628 RTE_PMD_IXGBE_BYPASS_MODE_ISOLATE,
629 RTE_PMD_IXGBE_BYPASS_MODE_NUM,
632 #define RTE_PMD_IXGBE_BYPASS_MODE_VALID(x) \
633 ((x) > RTE_PMD_IXGBE_BYPASS_MODE_NONE && \
634 (x) < RTE_PMD_IXGBE_BYPASS_MODE_NUM)
637 RTE_PMD_IXGBE_BYPASS_EVENT_NONE,
638 RTE_PMD_IXGBE_BYPASS_EVENT_START,
639 RTE_PMD_IXGBE_BYPASS_EVENT_OS_ON = RTE_PMD_IXGBE_BYPASS_EVENT_START,
640 RTE_PMD_IXGBE_BYPASS_EVENT_POWER_ON,
641 RTE_PMD_IXGBE_BYPASS_EVENT_OS_OFF,
642 RTE_PMD_IXGBE_BYPASS_EVENT_POWER_OFF,
643 RTE_PMD_IXGBE_BYPASS_EVENT_TIMEOUT,
644 RTE_PMD_IXGBE_BYPASS_EVENT_NUM
647 #define RTE_PMD_IXGBE_BYPASS_EVENT_VALID(x) \
648 ((x) > RTE_PMD_IXGBE_BYPASS_EVENT_NONE && \
649 (x) < RTE_PMD_IXGBE_BYPASS_MODE_NUM)
652 RTE_PMD_IXGBE_BYPASS_TMT_OFF, /* timeout disabled. */
653 RTE_PMD_IXGBE_BYPASS_TMT_1_5_SEC, /* timeout for 1.5 seconds */
654 RTE_PMD_IXGBE_BYPASS_TMT_2_SEC, /* timeout for 2 seconds */
655 RTE_PMD_IXGBE_BYPASS_TMT_3_SEC, /* timeout for 3 seconds */
656 RTE_PMD_IXGBE_BYPASS_TMT_4_SEC, /* timeout for 4 seconds */
657 RTE_PMD_IXGBE_BYPASS_TMT_8_SEC, /* timeout for 8 seconds */
658 RTE_PMD_IXGBE_BYPASS_TMT_16_SEC, /* timeout for 16 seconds */
659 RTE_PMD_IXGBE_BYPASS_TMT_32_SEC, /* timeout for 32 seconds */
660 RTE_PMD_IXGBE_BYPASS_TMT_NUM
663 #define RTE_PMD_IXGBE_BYPASS_TMT_VALID(x) \
664 ((x) == RTE_PMD_IXGBE_BYPASS_TMT_OFF || \
665 ((x) > RTE_PMD_IXGBE_BYPASS_TMT_OFF && \
666 (x) < RTE_PMD_IXGBE_BYPASS_TMT_NUM))
668 #endif /* _PMD_IXGBE_H_ */