1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016 Intel Corporation
6 * @file rte_pmd_ixgbe.h
7 * ixgbe PMD specific functions.
14 #include <rte_ethdev_driver.h>
17 * Notify VF when PF link status changes.
20 * The port identifier of the Ethernet device.
24 * - (0) if successful.
25 * - (-ENODEV) if *port* invalid.
26 * - (-EINVAL) if *vf* invalid.
28 int rte_pmd_ixgbe_ping_vf(uint16_t port, uint16_t vf);
31 * Set the VF MAC address.
34 * The port identifier of the Ethernet device.
40 * - (0) if successful.
41 * - (-ENODEV) if *port* invalid.
42 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
44 int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf,
45 struct rte_ether_addr *mac_addr);
48 * Enable/Disable VF VLAN anti spoofing.
51 * The port identifier of the Ethernet device.
53 * VF on which to set VLAN anti spoofing.
55 * 1 - Enable VFs VLAN anti spoofing.
56 * 0 - Disable VFs VLAN anti spoofing.
58 * - (0) if successful.
59 * - (-ENODEV) if *port* invalid.
60 * - (-EINVAL) if bad parameter.
62 int rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf,
66 * Enable/Disable VF MAC anti spoofing.
69 * The port identifier of the Ethernet device.
71 * VF on which to set MAC anti spoofing.
73 * 1 - Enable VFs MAC anti spoofing.
74 * 0 - Disable VFs MAC anti spoofing.
76 * - (0) if successful.
77 * - (-ENODEV) if *port* invalid.
78 * - (-EINVAL) if bad parameter.
80 int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
83 * Enable/Disable vf vlan insert
86 * The port identifier of the Ethernet device.
90 * 0 - Disable VF's vlan insert.
91 * n - Enable; n is inserted as the vlan id.
94 * - (0) if successful.
95 * - (-ENODEV) if *port* invalid.
96 * - (-EINVAL) if bad parameter.
98 int rte_pmd_ixgbe_set_vf_vlan_insert(uint16_t port, uint16_t vf,
102 * Enable/Disable tx loopback
105 * The port identifier of the Ethernet device.
107 * 1 - Enable tx loopback.
108 * 0 - Disable tx loopback.
111 * - (0) if successful.
112 * - (-ENODEV) if *port* invalid.
113 * - (-EINVAL) if bad parameter.
115 int rte_pmd_ixgbe_set_tx_loopback(uint16_t port, uint8_t on);
118 * set all queues drop enable bit
121 * The port identifier of the Ethernet device.
123 * 1 - set the queue drop enable bit for all pools.
124 * 0 - reset the queue drop enable bit for all pools.
127 * - (0) if successful.
128 * - (-ENODEV) if *port* invalid.
129 * - (-EINVAL) if bad parameter.
131 int rte_pmd_ixgbe_set_all_queues_drop_en(uint16_t port, uint8_t on);
134 * set drop enable bit in the VF split rx control register
137 * The port identifier of the Ethernet device.
141 * 1 - set the drop enable bit in the split rx control register.
142 * 0 - reset the drop enable bit in the split rx control register.
145 * - (0) if successful.
146 * - (-ENODEV) if *port* invalid.
147 * - (-EINVAL) if bad parameter.
150 int rte_pmd_ixgbe_set_vf_split_drop_en(uint16_t port, uint16_t vf, uint8_t on);
153 * Enable/Disable vf vlan strip for all queues in a pool
156 * The port identifier of the Ethernet device.
160 * 1 - Enable VF's vlan strip on RX queues.
161 * 0 - Disable VF's vlan strip on RX queues.
164 * - (0) if successful.
165 * - (-ENOTSUP) if hardware doesn't support this feature.
166 * - (-ENODEV) if *port* invalid.
167 * - (-EINVAL) if bad parameter.
170 rte_pmd_ixgbe_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
173 * Enable MACsec offload.
176 * The port identifier of the Ethernet device.
178 * 1 - Enable encryption (encrypt and add integrity signature).
179 * 0 - Disable encryption (only add integrity signature).
181 * 1 - Enable replay protection.
182 * 0 - Disable replay protection.
184 * - (0) if successful.
185 * - (-ENODEV) if *port* invalid.
186 * - (-ENOTSUP) if hardware doesn't support this feature.
188 int rte_pmd_ixgbe_macsec_enable(uint16_t port, uint8_t en, uint8_t rp);
191 * Disable MACsec offload.
194 * The port identifier of the Ethernet device.
196 * - (0) if successful.
197 * - (-ENODEV) if *port* invalid.
198 * - (-ENOTSUP) if hardware doesn't support this feature.
200 int rte_pmd_ixgbe_macsec_disable(uint16_t port);
203 * Configure Tx SC (Secure Connection).
206 * The port identifier of the Ethernet device.
208 * The MAC address on the local side.
210 * - (0) if successful.
211 * - (-ENODEV) if *port* invalid.
212 * - (-ENOTSUP) if hardware doesn't support this feature.
214 int rte_pmd_ixgbe_macsec_config_txsc(uint16_t port, uint8_t *mac);
217 * Configure Rx SC (Secure Connection).
220 * The port identifier of the Ethernet device.
222 * The MAC address on the remote side.
224 * The PI (port identifier) on the remote side.
226 * - (0) if successful.
227 * - (-ENODEV) if *port* invalid.
228 * - (-ENOTSUP) if hardware doesn't support this feature.
230 int rte_pmd_ixgbe_macsec_config_rxsc(uint16_t port, uint8_t *mac, uint16_t pi);
233 * Enable Tx SA (Secure Association).
236 * The port identifier of the Ethernet device.
238 * The SA to be enabled (0 or 1).
240 * The association number on the local side.
242 * The packet number on the local side.
244 * The key on the local side.
246 * - (0) if successful.
247 * - (-ENODEV) if *port* invalid.
248 * - (-ENOTSUP) if hardware doesn't support this feature.
249 * - (-EINVAL) if bad parameter.
251 int rte_pmd_ixgbe_macsec_select_txsa(uint16_t port, uint8_t idx, uint8_t an,
252 uint32_t pn, uint8_t *key);
255 * Enable Rx SA (Secure Association).
258 * The port identifier of the Ethernet device.
260 * The SA to be enabled (0 or 1)
262 * The association number on the remote side.
264 * The packet number on the remote side.
266 * The key on the remote side.
268 * - (0) if successful.
269 * - (-ENODEV) if *port* invalid.
270 * - (-ENOTSUP) if hardware doesn't support this feature.
271 * - (-EINVAL) if bad parameter.
273 int rte_pmd_ixgbe_macsec_select_rxsa(uint16_t port, uint8_t idx, uint8_t an,
274 uint32_t pn, uint8_t *key);
277 * Set RX L2 Filtering mode of a VF of an Ethernet device.
280 * The port identifier of the Ethernet device.
284 * The RX mode mask, which is one or more of accepting Untagged Packets,
285 * packets that match the PFUTA table, Broadcast and Multicast Promiscuous.
286 * ETH_VMDQ_ACCEPT_UNTAG,ETH_VMDQ_ACCEPT_HASH_UC,
287 * ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST will be used
290 * 1 - Enable a VF RX mode.
291 * 0 - Disable a VF RX mode.
293 * - (0) if successful.
294 * - (-ENOTSUP) if hardware doesn't support.
295 * - (-ENODEV) if *port_id* invalid.
296 * - (-EINVAL) if bad parameter.
299 rte_pmd_ixgbe_set_vf_rxmode(uint16_t port, uint16_t vf, uint16_t rx_mask,
303 * Enable or disable a VF traffic receive of an Ethernet device.
306 * The port identifier of the Ethernet device.
310 * 1 - Enable a VF traffic receive.
311 * 0 - Disable a VF traffic receive.
313 * - (0) if successful.
314 * - (-ENOTSUP) if hardware doesn't support.
315 * - (-ENODEV) if *port_id* invalid.
316 * - (-EINVAL) if bad parameter.
319 rte_pmd_ixgbe_set_vf_rx(uint16_t port, uint16_t vf, uint8_t on);
322 * Enable or disable a VF traffic transmit of the Ethernet device.
325 * The port identifier of the Ethernet device.
329 * 1 - Enable a VF traffic transmit.
330 * 0 - Disable a VF traffic transmit.
332 * - (0) if successful.
333 * - (-ENODEV) if *port_id* invalid.
334 * - (-ENOTSUP) if hardware doesn't support.
335 * - (-EINVAL) if bad parameter.
338 rte_pmd_ixgbe_set_vf_tx(uint16_t port, uint16_t vf, uint8_t on);
341 * Enable/Disable hardware VF VLAN filtering by an Ethernet device of
342 * received VLAN packets tagged with a given VLAN Tag Identifier.
345 * The port identifier of the Ethernet device.
347 * The VLAN Tag Identifier whose filtering must be enabled or disabled.
349 * Bitmap listing which VFs participate in the VLAN filtering.
351 * 1 - Enable VFs VLAN filtering.
352 * 0 - Disable VFs VLAN filtering.
354 * - (0) if successful.
355 * - (-ENOTSUP) if hardware doesn't support.
356 * - (-ENODEV) if *port_id* invalid.
357 * - (-EINVAL) if bad parameter.
360 rte_pmd_ixgbe_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
361 uint64_t vf_mask, uint8_t vlan_on);
364 * Set the rate limitation for a vf on an Ethernet device.
367 * The port identifier of the Ethernet device.
371 * The tx rate allocated from the total link speed for this VF id.
373 * The queue mask which need to set the rate.
375 * - (0) if successful.
376 * - (-ENOTSUP) if hardware doesn't support this feature.
377 * - (-ENODEV) if *port_id* invalid.
378 * - (-EINVAL) if bad parameter.
380 int rte_pmd_ixgbe_set_vf_rate_limit(uint16_t port, uint16_t vf,
381 uint16_t tx_rate, uint64_t q_msk);
384 * Set all the TCs' bandwidth weight.
386 * The bw_weight means the percentage occupied by the TC.
387 * It can be taken as the relative min bandwidth setting.
390 * The port identifier of the Ethernet device.
394 * An array of relative bandwidth weight for all the TCs.
395 * The summary of the bw_weight should be 100.
397 * - (0) if successful.
398 * - (-ENODEV) if *port* invalid.
399 * - (-EINVAL) if bad parameter.
400 * - (-ENOTSUP) not supported by firmware.
402 int rte_pmd_ixgbe_set_tc_bw_alloc(uint16_t port,
408 * Initialize bypass logic. This function needs to be called before
409 * executing any other bypass API.
412 * The port identifier of the Ethernet device.
414 * - (0) if successful.
415 * - (-ENOTSUP) if hardware doesn't support.
416 * - (-EINVAL) if bad parameter.
418 int rte_pmd_ixgbe_bypass_init(uint16_t port);
421 * Return bypass state.
424 * The port identifier of the Ethernet device.
426 * The return bypass state.
431 * - (0) if successful.
432 * - (-ENOTSUP) if hardware doesn't support.
433 * - (-EINVAL) if bad parameter.
435 int rte_pmd_ixgbe_bypass_state_show(uint16_t port, uint32_t *state);
441 * The port identifier of the Ethernet device.
443 * The current bypass state.
448 * - (0) if successful.
449 * - (-ENOTSUP) if hardware doesn't support.
450 * - (-EINVAL) if bad parameter.
452 int rte_pmd_ixgbe_bypass_state_set(uint16_t port, uint32_t *new_state);
455 * Return bypass state when given event occurs.
458 * The port identifier of the Ethernet device.
461 * - (1) Main power on (power button is pushed)
462 * - (2) Auxiliary power on (power supply is being plugged)
463 * - (3) Main power off (system shutdown and power supply is left plugged in)
464 * - (4) Auxiliary power off (power supply is being unplugged)
465 * - (5) Display or set the watchdog timer
467 * The bypass state when given event occurred.
472 * - (0) if successful.
473 * - (-ENOTSUP) if hardware doesn't support.
474 * - (-EINVAL) if bad parameter.
476 int rte_pmd_ixgbe_bypass_event_show(uint16_t port,
481 * Set bypass state when given event occurs.
484 * The port identifier of the Ethernet device.
487 * - (1) Main power on (power button is pushed)
488 * - (2) Auxiliary power on (power supply is being plugged)
489 * - (3) Main power off (system shutdown and power supply is left plugged in)
490 * - (4) Auxiliary power off (power supply is being unplugged)
491 * - (5) Display or set the watchdog timer
493 * The assigned state when given event occurs.
498 * - (0) if successful.
499 * - (-ENOTSUP) if hardware doesn't support.
500 * - (-EINVAL) if bad parameter.
502 int rte_pmd_ixgbe_bypass_event_store(uint16_t port,
507 * Set bypass watchdog timeout count.
510 * The port identifier of the Ethernet device.
512 * The timeout to be set.
513 * - (0) 0 seconds (timer is off)
522 * - (0) if successful.
523 * - (-ENOTSUP) if hardware doesn't support.
524 * - (-EINVAL) if bad parameter.
526 int rte_pmd_ixgbe_bypass_wd_timeout_store(uint16_t port, uint32_t timeout);
529 * Get bypass firmware version.
532 * The port identifier of the Ethernet device.
534 * The firmware version
536 * - (0) if successful.
537 * - (-ENOTSUP) if hardware doesn't support.
538 * - (-EINVAL) if bad parameter.
540 int rte_pmd_ixgbe_bypass_ver_show(uint16_t port, uint32_t *ver);
543 * Return bypass watchdog timeout in seconds
546 * The port identifier of the Ethernet device.
548 * The return watchdog timeout. "0" represents timer expired
549 * - (0) 0 seconds (timer is off)
558 * - (0) if successful.
559 * - (-ENOTSUP) if hardware doesn't support.
560 * - (-EINVAL) if bad parameter.
562 int rte_pmd_ixgbe_bypass_wd_timeout_show(uint16_t port, uint32_t *wd_timeout);
565 * Reset bypass watchdog timer
568 * The port identifier of the Ethernet device.
570 * - (0) if successful.
571 * - (-ENOTSUP) if hardware doesn't support.
572 * - (-EINVAL) if bad parameter.
574 int rte_pmd_ixgbe_bypass_wd_reset(uint16_t port);
577 * Acquire swfw semaphore lock for MDIO access
580 * The port identifier of the Ethernet device.
582 * - (0) if successful.
583 * - (-ENOTSUP) if hardware doesn't support.
584 * - (-ENODEV) if *port* invalid.
585 * - (IXGBE_ERR_SWFW_SYNC) If sw/fw semaphore acquisition failed
589 rte_pmd_ixgbe_mdio_lock(uint16_t port);
592 * Release swfw semaphore lock used for MDIO access
595 * The port identifier of the Ethernet device.
597 * - (0) if successful.
598 * - (-ENOTSUP) if hardware doesn't support.
599 * - (-ENODEV) if *port* invalid.
603 rte_pmd_ixgbe_mdio_unlock(uint16_t port);
606 * Read PHY register using MDIO without MDIO lock
607 * The lock must be taken separately before calling this
610 * The port identifier of the Ethernet device.
612 * 32 bit PHY Register
614 * Used to define device base address
616 * Pointer for reading PHY register data
618 * - (0) if successful.
619 * - (-ENOTSUP) if hardware doesn't support.
620 * - (-ENODEV) if *port* invalid.
621 * - (IXGBE_ERR_PHY) If PHY read command failed
625 rte_pmd_ixgbe_mdio_unlocked_read(uint16_t port, uint32_t reg_addr,
626 uint32_t dev_type, uint16_t *phy_data);
629 * Write data to PHY register using without MDIO lock
630 * The lock must be taken separately before calling this
634 * The port identifier of the Ethernet device.
636 * 32 bit PHY Register
638 * Used to define device base address
640 * Data to write to PHY register
642 * - (0) if successful.
643 * - (-ENOTSUP) if hardware doesn't support.
644 * - (-ENODEV) if *port* invalid.
645 * - (IXGBE_ERR_PHY) If PHY read command failed
649 rte_pmd_ixgbe_mdio_unlocked_write(uint16_t port, uint32_t reg_addr,
650 uint32_t dev_type, uint16_t phy_data);
653 * Response sent back to ixgbe driver from user app after callback
655 enum rte_pmd_ixgbe_mb_event_rsp {
656 RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK, /**< skip mbox request and ACK */
657 RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
658 RTE_PMD_IXGBE_MB_EVENT_PROCEED, /**< proceed with mbox request */
659 RTE_PMD_IXGBE_MB_EVENT_MAX /**< max value of this enum */
663 * Data sent to the user application when the callback is executed.
665 struct rte_pmd_ixgbe_mb_event_param {
666 uint16_t vfid; /**< Virtual Function number */
667 uint16_t msg_type; /**< VF to PF message type, defined in ixgbe_mbx.h */
668 uint16_t retval; /**< return value */
669 void *msg; /**< pointer to message */
672 RTE_PMD_IXGBE_BYPASS_MODE_NONE,
673 RTE_PMD_IXGBE_BYPASS_MODE_NORMAL,
674 RTE_PMD_IXGBE_BYPASS_MODE_BYPASS,
675 RTE_PMD_IXGBE_BYPASS_MODE_ISOLATE,
676 RTE_PMD_IXGBE_BYPASS_MODE_NUM,
679 #define RTE_PMD_IXGBE_BYPASS_MODE_VALID(x) \
680 ((x) > RTE_PMD_IXGBE_BYPASS_MODE_NONE && \
681 (x) < RTE_PMD_IXGBE_BYPASS_MODE_NUM)
684 RTE_PMD_IXGBE_BYPASS_EVENT_NONE,
685 RTE_PMD_IXGBE_BYPASS_EVENT_START,
686 RTE_PMD_IXGBE_BYPASS_EVENT_OS_ON = RTE_PMD_IXGBE_BYPASS_EVENT_START,
687 RTE_PMD_IXGBE_BYPASS_EVENT_POWER_ON,
688 RTE_PMD_IXGBE_BYPASS_EVENT_OS_OFF,
689 RTE_PMD_IXGBE_BYPASS_EVENT_POWER_OFF,
690 RTE_PMD_IXGBE_BYPASS_EVENT_TIMEOUT,
691 RTE_PMD_IXGBE_BYPASS_EVENT_NUM
694 #define RTE_PMD_IXGBE_BYPASS_EVENT_VALID(x) \
695 ((x) > RTE_PMD_IXGBE_BYPASS_EVENT_NONE && \
696 (x) < RTE_PMD_IXGBE_BYPASS_MODE_NUM)
699 RTE_PMD_IXGBE_BYPASS_TMT_OFF, /* timeout disabled. */
700 RTE_PMD_IXGBE_BYPASS_TMT_1_5_SEC, /* timeout for 1.5 seconds */
701 RTE_PMD_IXGBE_BYPASS_TMT_2_SEC, /* timeout for 2 seconds */
702 RTE_PMD_IXGBE_BYPASS_TMT_3_SEC, /* timeout for 3 seconds */
703 RTE_PMD_IXGBE_BYPASS_TMT_4_SEC, /* timeout for 4 seconds */
704 RTE_PMD_IXGBE_BYPASS_TMT_8_SEC, /* timeout for 8 seconds */
705 RTE_PMD_IXGBE_BYPASS_TMT_16_SEC, /* timeout for 16 seconds */
706 RTE_PMD_IXGBE_BYPASS_TMT_32_SEC, /* timeout for 32 seconds */
707 RTE_PMD_IXGBE_BYPASS_TMT_NUM
710 #define RTE_PMD_IXGBE_BYPASS_TMT_VALID(x) \
711 ((x) == RTE_PMD_IXGBE_BYPASS_TMT_OFF || \
712 ((x) > RTE_PMD_IXGBE_BYPASS_TMT_OFF && \
713 (x) < RTE_PMD_IXGBE_BYPASS_TMT_NUM))
717 * The port identifier of the Ethernet device.
719 * 0 to disable and nonzero to enable 'SBP' bit in FCTRL register
720 * to receive all packets
722 * - (0) if successful.
723 * - (-ENODEV) if *port* invalid.
724 * - (-ENOTSUP) if hardware doesn't support this feature.
728 rte_pmd_ixgbe_upd_fctrl_sbp(uint16_t port, int enable);
729 #endif /* _PMD_IXGBE_H_ */