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(uint8_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(uint8_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(uint8_t port, uint16_t vf, uint8_t on);
93 * Enable/Disable VF MAC anti spoofing.
96 * The port identifier of the Ethernet device.
98 * VF on which to set MAC anti spoofing.
100 * 1 - Enable VFs MAC anti spoofing.
101 * 0 - Disable VFs MAC anti spoofing.
103 * - (0) if successful.
104 * - (-ENODEV) if *port* invalid.
105 * - (-EINVAL) if bad parameter.
107 int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
110 * Enable/Disable vf vlan insert
113 * The port identifier of the Ethernet device.
117 * 0 - Disable VF's vlan insert.
118 * n - Enable; n is inserted as the vlan id.
121 * - (0) if successful.
122 * - (-ENODEV) if *port* invalid.
123 * - (-EINVAL) if bad parameter.
125 int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf,
129 * Enable/Disable tx loopback
132 * The port identifier of the Ethernet device.
134 * 1 - Enable tx loopback.
135 * 0 - Disable tx loopback.
138 * - (0) if successful.
139 * - (-ENODEV) if *port* invalid.
140 * - (-EINVAL) if bad parameter.
142 int rte_pmd_ixgbe_set_tx_loopback(uint8_t port, uint8_t on);
145 * set all queues drop enable bit
148 * The port identifier of the Ethernet device.
150 * 1 - set the queue drop enable bit for all pools.
151 * 0 - reset the queue drop enable bit for all pools.
154 * - (0) if successful.
155 * - (-ENODEV) if *port* invalid.
156 * - (-EINVAL) if bad parameter.
158 int rte_pmd_ixgbe_set_all_queues_drop_en(uint8_t port, uint8_t on);
161 * set drop enable bit in the VF split rx control register
164 * The port identifier of the Ethernet device.
168 * 1 - set the drop enable bit in the split rx control register.
169 * 0 - reset the drop enable bit in the split rx control register.
172 * - (0) if successful.
173 * - (-ENODEV) if *port* invalid.
174 * - (-EINVAL) if bad parameter.
177 int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on);
180 * Enable/Disable vf vlan strip for all queues in a pool
183 * The port identifier of the Ethernet device.
187 * 1 - Enable VF's vlan strip on RX queues.
188 * 0 - Disable VF's vlan strip on RX queues.
191 * - (0) if successful.
192 * - (-ENOTSUP) if hardware doesn't support this feature.
193 * - (-ENODEV) if *port* invalid.
194 * - (-EINVAL) if bad parameter.
197 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
200 * Enable MACsec offload.
203 * The port identifier of the Ethernet device.
205 * 1 - Enable encryption (encrypt and add integrity signature).
206 * 0 - Disable encryption (only add integrity signature).
208 * 1 - Enable replay protection.
209 * 0 - Disable replay protection.
211 * - (0) if successful.
212 * - (-ENODEV) if *port* invalid.
213 * - (-ENOTSUP) if hardware doesn't support this feature.
215 int rte_pmd_ixgbe_macsec_enable(uint8_t port, uint8_t en, uint8_t rp);
218 * Disable MACsec offload.
221 * The port identifier of the Ethernet device.
223 * - (0) if successful.
224 * - (-ENODEV) if *port* invalid.
225 * - (-ENOTSUP) if hardware doesn't support this feature.
227 int rte_pmd_ixgbe_macsec_disable(uint8_t port);
230 * Configure Tx SC (Secure Connection).
233 * The port identifier of the Ethernet device.
235 * The MAC address on the local side.
237 * - (0) if successful.
238 * - (-ENODEV) if *port* invalid.
239 * - (-ENOTSUP) if hardware doesn't support this feature.
241 int rte_pmd_ixgbe_macsec_config_txsc(uint8_t port, uint8_t *mac);
244 * Configure Rx SC (Secure Connection).
247 * The port identifier of the Ethernet device.
249 * The MAC address on the remote side.
251 * The PI (port identifier) on the remote side.
253 * - (0) if successful.
254 * - (-ENODEV) if *port* invalid.
255 * - (-ENOTSUP) if hardware doesn't support this feature.
257 int rte_pmd_ixgbe_macsec_config_rxsc(uint8_t port, uint8_t *mac, uint16_t pi);
260 * Enable Tx SA (Secure Association).
263 * The port identifier of the Ethernet device.
265 * The SA to be enabled (0 or 1).
267 * The association number on the local side.
269 * The packet number on the local side.
271 * The key on the local side.
273 * - (0) if successful.
274 * - (-ENODEV) if *port* invalid.
275 * - (-ENOTSUP) if hardware doesn't support this feature.
276 * - (-EINVAL) if bad parameter.
278 int rte_pmd_ixgbe_macsec_select_txsa(uint8_t port, uint8_t idx, uint8_t an,
279 uint32_t pn, uint8_t *key);
282 * Enable Rx SA (Secure Association).
285 * The port identifier of the Ethernet device.
287 * The SA to be enabled (0 or 1)
289 * The association number on the remote side.
291 * The packet number on the remote side.
293 * The key on the remote side.
295 * - (0) if successful.
296 * - (-ENODEV) if *port* invalid.
297 * - (-ENOTSUP) if hardware doesn't support this feature.
298 * - (-EINVAL) if bad parameter.
300 int rte_pmd_ixgbe_macsec_select_rxsa(uint8_t port, uint8_t idx, uint8_t an,
301 uint32_t pn, uint8_t *key);
304 * Set RX L2 Filtering mode of a VF of an Ethernet device.
307 * The port identifier of the Ethernet device.
311 * The RX mode mask, which is one or more of accepting Untagged Packets,
312 * packets that match the PFUTA table, Broadcast and Multicast Promiscuous.
313 * ETH_VMDQ_ACCEPT_UNTAG,ETH_VMDQ_ACCEPT_HASH_UC,
314 * ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST will be used
317 * 1 - Enable a VF RX mode.
318 * 0 - Disable a VF RX mode.
320 * - (0) if successful.
321 * - (-ENOTSUP) if hardware doesn't support.
322 * - (-ENODEV) if *port_id* invalid.
323 * - (-EINVAL) if bad parameter.
326 rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mask, uint8_t on);
329 * Enable or disable a VF traffic receive of an Ethernet device.
332 * The port identifier of the Ethernet device.
336 * 1 - Enable a VF traffic receive.
337 * 0 - Disable a VF traffic receive.
339 * - (0) if successful.
340 * - (-ENOTSUP) if hardware doesn't support.
341 * - (-ENODEV) if *port_id* invalid.
342 * - (-EINVAL) if bad parameter.
345 rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on);
348 * Enable or disable a VF traffic transmit of the Ethernet device.
351 * The port identifier of the Ethernet device.
355 * 1 - Enable a VF traffic transmit.
356 * 0 - Disable a VF traffic transmit.
358 * - (0) if successful.
359 * - (-ENODEV) if *port_id* invalid.
360 * - (-ENOTSUP) if hardware doesn't support.
361 * - (-EINVAL) if bad parameter.
364 rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on);
367 * Enable/Disable hardware VF VLAN filtering by an Ethernet device of
368 * received VLAN packets tagged with a given VLAN Tag Identifier.
371 * The port identifier of the Ethernet device.
373 * The VLAN Tag Identifier whose filtering must be enabled or disabled.
375 * Bitmap listing which VFs participate in the VLAN filtering.
377 * 1 - Enable VFs VLAN filtering.
378 * 0 - Disable VFs VLAN filtering.
380 * - (0) if successful.
381 * - (-ENOTSUP) if hardware doesn't support.
382 * - (-ENODEV) if *port_id* invalid.
383 * - (-EINVAL) if bad parameter.
386 rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan, uint64_t vf_mask, uint8_t vlan_on);
389 * Set the rate limitation for a vf on an Ethernet device.
392 * The port identifier of the Ethernet device.
396 * The tx rate allocated from the total link speed for this VF id.
398 * The queue mask which need to set the rate.
400 * - (0) if successful.
401 * - (-ENOTSUP) if hardware doesn't support this feature.
402 * - (-ENODEV) if *port_id* invalid.
403 * - (-EINVAL) if bad parameter.
405 int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf, uint16_t tx_rate, uint64_t q_msk);
408 * Set all the TCs' bandwidth weight.
410 * The bw_weight means the percentage occupied by the TC.
411 * It can be taken as the relative min bandwidth setting.
414 * The port identifier of the Ethernet device.
418 * An array of relative bandwidth weight for all the TCs.
419 * The summary of the bw_weight should be 100.
421 * - (0) if successful.
422 * - (-ENODEV) if *port* invalid.
423 * - (-EINVAL) if bad parameter.
424 * - (-ENOTSUP) not supported by firmware.
426 int rte_pmd_ixgbe_set_tc_bw_alloc(uint8_t port,
432 * Initialize bypass logic. This function needs to be called before
433 * executing any other bypass API.
436 * The port identifier of the Ethernet device.
438 * - (0) if successful.
439 * - (-ENOTSUP) if hardware doesn't support.
440 * - (-EINVAL) if bad parameter.
442 int rte_pmd_ixgbe_bypass_init(uint8_t port);
445 * Return bypass state.
448 * The port identifier of the Ethernet device.
450 * The return bypass state.
455 * - (0) if successful.
456 * - (-ENOTSUP) if hardware doesn't support.
457 * - (-EINVAL) if bad parameter.
459 int rte_pmd_ixgbe_bypass_state_show(uint8_t port, uint32_t *state);
465 * The port identifier of the Ethernet device.
467 * The current bypass state.
472 * - (0) if successful.
473 * - (-ENOTSUP) if hardware doesn't support.
474 * - (-EINVAL) if bad parameter.
476 int rte_pmd_ixgbe_bypass_state_set(uint8_t port, uint32_t *new_state);
479 * Return bypass state when given event occurs.
482 * The port identifier of the Ethernet device.
485 * - (1) Main power on (power button is pushed)
486 * - (2) Auxiliary power on (power supply is being plugged)
487 * - (3) Main power off (system shutdown and power supply is left plugged in)
488 * - (4) Auxiliary power off (power supply is being unplugged)
489 * - (5) Display or set the watchdog timer
491 * The bypass state when given event occurred.
496 * - (0) if successful.
497 * - (-ENOTSUP) if hardware doesn't support.
498 * - (-EINVAL) if bad parameter.
500 int rte_pmd_ixgbe_bypass_event_show(uint8_t port,
505 * Set bypass state when given event occurs.
508 * The port identifier of the Ethernet device.
511 * - (1) Main power on (power button is pushed)
512 * - (2) Auxiliary power on (power supply is being plugged)
513 * - (3) Main power off (system shutdown and power supply is left plugged in)
514 * - (4) Auxiliary power off (power supply is being unplugged)
515 * - (5) Display or set the watchdog timer
517 * The assigned state when given event occurs.
522 * - (0) if successful.
523 * - (-ENOTSUP) if hardware doesn't support.
524 * - (-EINVAL) if bad parameter.
526 int rte_pmd_ixgbe_bypass_event_store(uint8_t port,
531 * Set bypass watchdog timeout count.
534 * The port identifier of the Ethernet device.
536 * The timeout to be set.
537 * - (0) 0 seconds (timer is off)
546 * - (0) if successful.
547 * - (-ENOTSUP) if hardware doesn't support.
548 * - (-EINVAL) if bad parameter.
550 int rte_pmd_ixgbe_bypass_wd_timeout_store(uint8_t port, uint32_t timeout);
553 * Get bypass firmware version.
556 * The port identifier of the Ethernet device.
558 * The firmware version
560 * - (0) if successful.
561 * - (-ENOTSUP) if hardware doesn't support.
562 * - (-EINVAL) if bad parameter.
564 int rte_pmd_ixgbe_bypass_ver_show(uint8_t port, uint32_t *ver);
567 * Return bypass watchdog timeout in seconds
570 * The port identifier of the Ethernet device.
572 * The return watchdog timeout. "0" represents timer expired
573 * - (0) 0 seconds (timer is off)
582 * - (0) if successful.
583 * - (-ENOTSUP) if hardware doesn't support.
584 * - (-EINVAL) if bad parameter.
586 int rte_pmd_ixgbe_bypass_wd_timeout_show(uint8_t port, uint32_t *wd_timeout);
589 * Reset bypass watchdog timer
592 * The port identifier of the Ethernet device.
594 * - (0) if successful.
595 * - (-ENOTSUP) if hardware doesn't support.
596 * - (-EINVAL) if bad parameter.
598 int rte_pmd_ixgbe_bypass_wd_reset(uint8_t port);
602 * Response sent back to ixgbe driver from user app after callback
604 enum rte_pmd_ixgbe_mb_event_rsp {
605 RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK, /**< skip mbox request and ACK */
606 RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
607 RTE_PMD_IXGBE_MB_EVENT_PROCEED, /**< proceed with mbox request */
608 RTE_PMD_IXGBE_MB_EVENT_MAX /**< max value of this enum */
612 * Data sent to the user application when the callback is executed.
614 struct rte_pmd_ixgbe_mb_event_param {
615 uint16_t vfid; /**< Virtual Function number */
616 uint16_t msg_type; /**< VF to PF message type, defined in ixgbe_mbx.h */
617 uint16_t retval; /**< return value */
618 void *msg; /**< pointer to message */
621 RTE_PMD_IXGBE_BYPASS_MODE_NONE,
622 RTE_PMD_IXGBE_BYPASS_MODE_NORMAL,
623 RTE_PMD_IXGBE_BYPASS_MODE_BYPASS,
624 RTE_PMD_IXGBE_BYPASS_MODE_ISOLATE,
625 RTE_PMD_IXGBE_BYPASS_MODE_NUM,
628 #define RTE_PMD_IXGBE_BYPASS_MODE_VALID(x) \
629 ((x) > RTE_PMD_IXGBE_BYPASS_MODE_NONE && \
630 (x) < RTE_PMD_IXGBE_BYPASS_MODE_NUM)
633 RTE_PMD_IXGBE_BYPASS_EVENT_NONE,
634 RTE_PMD_IXGBE_BYPASS_EVENT_START,
635 RTE_PMD_IXGBE_BYPASS_EVENT_OS_ON = RTE_PMD_IXGBE_BYPASS_EVENT_START,
636 RTE_PMD_IXGBE_BYPASS_EVENT_POWER_ON,
637 RTE_PMD_IXGBE_BYPASS_EVENT_OS_OFF,
638 RTE_PMD_IXGBE_BYPASS_EVENT_POWER_OFF,
639 RTE_PMD_IXGBE_BYPASS_EVENT_TIMEOUT,
640 RTE_PMD_IXGBE_BYPASS_EVENT_NUM
643 #define RTE_PMD_IXGBE_BYPASS_EVENT_VALID(x) \
644 ((x) > RTE_PMD_IXGBE_BYPASS_EVENT_NONE && \
645 (x) < RTE_PMD_IXGBE_BYPASS_MODE_NUM)
648 RTE_PMD_IXGBE_BYPASS_TMT_OFF, /* timeout disabled. */
649 RTE_PMD_IXGBE_BYPASS_TMT_1_5_SEC, /* timeout for 1.5 seconds */
650 RTE_PMD_IXGBE_BYPASS_TMT_2_SEC, /* timeout for 2 seconds */
651 RTE_PMD_IXGBE_BYPASS_TMT_3_SEC, /* timeout for 3 seconds */
652 RTE_PMD_IXGBE_BYPASS_TMT_4_SEC, /* timeout for 4 seconds */
653 RTE_PMD_IXGBE_BYPASS_TMT_8_SEC, /* timeout for 8 seconds */
654 RTE_PMD_IXGBE_BYPASS_TMT_16_SEC, /* timeout for 16 seconds */
655 RTE_PMD_IXGBE_BYPASS_TMT_32_SEC, /* timeout for 32 seconds */
656 RTE_PMD_IXGBE_BYPASS_TMT_NUM
659 #define RTE_PMD_IXGBE_BYPASS_TMT_VALID(x) \
660 ((x) == RTE_PMD_IXGBE_BYPASS_TMT_OFF || \
661 ((x) > RTE_PMD_IXGBE_BYPASS_TMT_OFF && \
662 (x) < RTE_PMD_IXGBE_BYPASS_TMT_NUM))
664 #endif /* _PMD_IXGBE_H_ */