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_compat.h>
15 #include <rte_ethdev.h>
16 #include <rte_ether.h>
19 * Notify VF when PF link status changes.
22 * The port identifier of the Ethernet device.
26 * - (0) if successful.
27 * - (-ENODEV) if *port* invalid.
28 * - (-EINVAL) if *vf* invalid.
30 int rte_pmd_ixgbe_ping_vf(uint16_t port, uint16_t vf);
33 * Set the VF MAC address.
36 * The port identifier of the Ethernet device.
42 * - (0) if successful.
43 * - (-ENODEV) if *port* invalid.
44 * - (-EINVAL) if *vf* or *mac_addr* is invalid.
46 int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf,
47 struct rte_ether_addr *mac_addr);
50 * Enable/Disable VF VLAN anti spoofing.
53 * The port identifier of the Ethernet device.
55 * VF on which to set VLAN anti spoofing.
57 * 1 - Enable VFs VLAN anti spoofing.
58 * 0 - Disable VFs VLAN anti spoofing.
60 * - (0) if successful.
61 * - (-ENODEV) if *port* invalid.
62 * - (-EINVAL) if bad parameter.
64 int rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf,
68 * Enable/Disable VF MAC anti spoofing.
71 * The port identifier of the Ethernet device.
73 * VF on which to set MAC anti spoofing.
75 * 1 - Enable VFs MAC anti spoofing.
76 * 0 - Disable VFs MAC anti spoofing.
78 * - (0) if successful.
79 * - (-ENODEV) if *port* invalid.
80 * - (-EINVAL) if bad parameter.
82 int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
85 * Enable/Disable vf vlan insert
88 * The port identifier of the Ethernet device.
92 * 0 - Disable VF's vlan insert.
93 * n - Enable; n is inserted as the vlan id.
96 * - (0) if successful.
97 * - (-ENODEV) if *port* invalid.
98 * - (-EINVAL) if bad parameter.
100 int rte_pmd_ixgbe_set_vf_vlan_insert(uint16_t port, uint16_t vf,
104 * Enable/Disable tx loopback
107 * The port identifier of the Ethernet device.
109 * 1 - Enable tx loopback.
110 * 0 - Disable tx loopback.
113 * - (0) if successful.
114 * - (-ENODEV) if *port* invalid.
115 * - (-EINVAL) if bad parameter.
117 int rte_pmd_ixgbe_set_tx_loopback(uint16_t port, uint8_t on);
120 * set all queues drop enable bit
123 * The port identifier of the Ethernet device.
125 * 1 - set the queue drop enable bit for all pools.
126 * 0 - reset the queue drop enable bit for all pools.
129 * - (0) if successful.
130 * - (-ENODEV) if *port* invalid.
131 * - (-EINVAL) if bad parameter.
133 int rte_pmd_ixgbe_set_all_queues_drop_en(uint16_t port, uint8_t on);
136 * set drop enable bit in the VF split rx control register
139 * The port identifier of the Ethernet device.
143 * 1 - set the drop enable bit in the split rx control register.
144 * 0 - reset the drop enable bit in the split rx control register.
147 * - (0) if successful.
148 * - (-ENODEV) if *port* invalid.
149 * - (-EINVAL) if bad parameter.
152 int rte_pmd_ixgbe_set_vf_split_drop_en(uint16_t port, uint16_t vf, uint8_t on);
155 * Enable/Disable vf vlan strip for all queues in a pool
158 * The port identifier of the Ethernet device.
162 * 1 - Enable VF's vlan strip on RX queues.
163 * 0 - Disable VF's vlan strip on RX queues.
166 * - (0) if successful.
167 * - (-ENOTSUP) if hardware doesn't support this feature.
168 * - (-ENODEV) if *port* invalid.
169 * - (-EINVAL) if bad parameter.
172 rte_pmd_ixgbe_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
175 * Enable MACsec offload.
178 * The port identifier of the Ethernet device.
180 * 1 - Enable encryption (encrypt and add integrity signature).
181 * 0 - Disable encryption (only add integrity signature).
183 * 1 - Enable replay protection.
184 * 0 - Disable replay protection.
186 * - (0) if successful.
187 * - (-ENODEV) if *port* invalid.
188 * - (-ENOTSUP) if hardware doesn't support this feature.
190 int rte_pmd_ixgbe_macsec_enable(uint16_t port, uint8_t en, uint8_t rp);
193 * Disable MACsec offload.
196 * The port identifier of the Ethernet device.
198 * - (0) if successful.
199 * - (-ENODEV) if *port* invalid.
200 * - (-ENOTSUP) if hardware doesn't support this feature.
202 int rte_pmd_ixgbe_macsec_disable(uint16_t port);
205 * Configure Tx SC (Secure Connection).
208 * The port identifier of the Ethernet device.
210 * The MAC address on the local side.
212 * - (0) if successful.
213 * - (-ENODEV) if *port* invalid.
214 * - (-ENOTSUP) if hardware doesn't support this feature.
216 int rte_pmd_ixgbe_macsec_config_txsc(uint16_t port, uint8_t *mac);
219 * Configure Rx SC (Secure Connection).
222 * The port identifier of the Ethernet device.
224 * The MAC address on the remote side.
226 * The PI (port identifier) on the remote side.
228 * - (0) if successful.
229 * - (-ENODEV) if *port* invalid.
230 * - (-ENOTSUP) if hardware doesn't support this feature.
232 int rte_pmd_ixgbe_macsec_config_rxsc(uint16_t port, uint8_t *mac, uint16_t pi);
235 * Enable Tx SA (Secure Association).
238 * The port identifier of the Ethernet device.
240 * The SA to be enabled (0 or 1).
242 * The association number on the local side.
244 * The packet number on the local side.
246 * The key on the local side.
248 * - (0) if successful.
249 * - (-ENODEV) if *port* invalid.
250 * - (-ENOTSUP) if hardware doesn't support this feature.
251 * - (-EINVAL) if bad parameter.
253 int rte_pmd_ixgbe_macsec_select_txsa(uint16_t port, uint8_t idx, uint8_t an,
254 uint32_t pn, uint8_t *key);
257 * Enable Rx SA (Secure Association).
260 * The port identifier of the Ethernet device.
262 * The SA to be enabled (0 or 1)
264 * The association number on the remote side.
266 * The packet number on the remote side.
268 * The key on the remote side.
270 * - (0) if successful.
271 * - (-ENODEV) if *port* invalid.
272 * - (-ENOTSUP) if hardware doesn't support this feature.
273 * - (-EINVAL) if bad parameter.
275 int rte_pmd_ixgbe_macsec_select_rxsa(uint16_t port, uint8_t idx, uint8_t an,
276 uint32_t pn, uint8_t *key);
279 * Set RX L2 Filtering mode of a VF of an Ethernet device.
282 * The port identifier of the Ethernet device.
286 * The RX mode mask, which is one or more of accepting Untagged Packets,
287 * packets that match the PFUTA table, Broadcast and Multicast Promiscuous.
288 * ETH_VMDQ_ACCEPT_UNTAG,ETH_VMDQ_ACCEPT_HASH_UC,
289 * ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST will be used
292 * 1 - Enable a VF RX mode.
293 * 0 - Disable a VF RX mode.
295 * - (0) if successful.
296 * - (-ENOTSUP) if hardware doesn't support.
297 * - (-ENODEV) if *port_id* invalid.
298 * - (-EINVAL) if bad parameter.
301 rte_pmd_ixgbe_set_vf_rxmode(uint16_t port, uint16_t vf, uint16_t rx_mask,
305 * Enable or disable a VF traffic receive of an Ethernet device.
308 * The port identifier of the Ethernet device.
312 * 1 - Enable a VF traffic receive.
313 * 0 - Disable a VF traffic receive.
315 * - (0) if successful.
316 * - (-ENOTSUP) if hardware doesn't support.
317 * - (-ENODEV) if *port_id* invalid.
318 * - (-EINVAL) if bad parameter.
321 rte_pmd_ixgbe_set_vf_rx(uint16_t port, uint16_t vf, uint8_t on);
324 * Enable or disable a VF traffic transmit of the Ethernet device.
327 * The port identifier of the Ethernet device.
331 * 1 - Enable a VF traffic transmit.
332 * 0 - Disable a VF traffic transmit.
334 * - (0) if successful.
335 * - (-ENODEV) if *port_id* invalid.
336 * - (-ENOTSUP) if hardware doesn't support.
337 * - (-EINVAL) if bad parameter.
340 rte_pmd_ixgbe_set_vf_tx(uint16_t port, uint16_t vf, uint8_t on);
343 * Enable/Disable hardware VF VLAN filtering by an Ethernet device of
344 * received VLAN packets tagged with a given VLAN Tag Identifier.
347 * The port identifier of the Ethernet device.
349 * The VLAN Tag Identifier whose filtering must be enabled or disabled.
351 * Bitmap listing which VFs participate in the VLAN filtering.
353 * 1 - Enable VFs VLAN filtering.
354 * 0 - Disable VFs VLAN filtering.
356 * - (0) if successful.
357 * - (-ENOTSUP) if hardware doesn't support.
358 * - (-ENODEV) if *port_id* invalid.
359 * - (-EINVAL) if bad parameter.
362 rte_pmd_ixgbe_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
363 uint64_t vf_mask, uint8_t vlan_on);
366 * Set the rate limitation for a vf on an Ethernet device.
369 * The port identifier of the Ethernet device.
373 * The tx rate allocated from the total link speed for this VF id.
375 * The queue mask which need to set the rate.
377 * - (0) if successful.
378 * - (-ENOTSUP) if hardware doesn't support this feature.
379 * - (-ENODEV) if *port_id* invalid.
380 * - (-EINVAL) if bad parameter.
382 int rte_pmd_ixgbe_set_vf_rate_limit(uint16_t port, uint16_t vf,
383 uint16_t tx_rate, uint64_t q_msk);
386 * Set all the TCs' bandwidth weight.
388 * The bw_weight means the percentage occupied by the TC.
389 * It can be taken as the relative min bandwidth setting.
392 * The port identifier of the Ethernet device.
396 * An array of relative bandwidth weight for all the TCs.
397 * The summary of the bw_weight should be 100.
399 * - (0) if successful.
400 * - (-ENODEV) if *port* invalid.
401 * - (-EINVAL) if bad parameter.
402 * - (-ENOTSUP) not supported by firmware.
404 int rte_pmd_ixgbe_set_tc_bw_alloc(uint16_t port,
410 * Initialize bypass logic. This function needs to be called before
411 * executing any other bypass API.
414 * The port identifier of the Ethernet device.
416 * - (0) if successful.
417 * - (-ENOTSUP) if hardware doesn't support.
418 * - (-EINVAL) if bad parameter.
420 int rte_pmd_ixgbe_bypass_init(uint16_t port);
423 * Return bypass state.
426 * The port identifier of the Ethernet device.
428 * The return bypass state.
433 * - (0) if successful.
434 * - (-ENOTSUP) if hardware doesn't support.
435 * - (-EINVAL) if bad parameter.
437 int rte_pmd_ixgbe_bypass_state_show(uint16_t port, uint32_t *state);
443 * The port identifier of the Ethernet device.
445 * The current bypass state.
450 * - (0) if successful.
451 * - (-ENOTSUP) if hardware doesn't support.
452 * - (-EINVAL) if bad parameter.
454 int rte_pmd_ixgbe_bypass_state_set(uint16_t port, uint32_t *new_state);
457 * Return bypass state when given event occurs.
460 * The port identifier of the Ethernet device.
463 * - (1) Main power on (power button is pushed)
464 * - (2) Auxiliary power on (power supply is being plugged)
465 * - (3) Main power off (system shutdown and power supply is left plugged in)
466 * - (4) Auxiliary power off (power supply is being unplugged)
467 * - (5) Display or set the watchdog timer
469 * The bypass state when given event occurred.
474 * - (0) if successful.
475 * - (-ENOTSUP) if hardware doesn't support.
476 * - (-EINVAL) if bad parameter.
478 int rte_pmd_ixgbe_bypass_event_show(uint16_t port,
483 * Set 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 assigned state when given event occurs.
500 * - (0) if successful.
501 * - (-ENOTSUP) if hardware doesn't support.
502 * - (-EINVAL) if bad parameter.
504 int rte_pmd_ixgbe_bypass_event_store(uint16_t port,
509 * Set bypass watchdog timeout count.
512 * The port identifier of the Ethernet device.
514 * The timeout to be set.
515 * - (0) 0 seconds (timer is off)
524 * - (0) if successful.
525 * - (-ENOTSUP) if hardware doesn't support.
526 * - (-EINVAL) if bad parameter.
528 int rte_pmd_ixgbe_bypass_wd_timeout_store(uint16_t port, uint32_t timeout);
531 * Get bypass firmware version.
534 * The port identifier of the Ethernet device.
536 * The firmware version
538 * - (0) if successful.
539 * - (-ENOTSUP) if hardware doesn't support.
540 * - (-EINVAL) if bad parameter.
542 int rte_pmd_ixgbe_bypass_ver_show(uint16_t port, uint32_t *ver);
545 * Return bypass watchdog timeout in seconds
548 * The port identifier of the Ethernet device.
550 * The return watchdog timeout. "0" represents timer expired
551 * - (0) 0 seconds (timer is off)
560 * - (0) if successful.
561 * - (-ENOTSUP) if hardware doesn't support.
562 * - (-EINVAL) if bad parameter.
564 int rte_pmd_ixgbe_bypass_wd_timeout_show(uint16_t port, uint32_t *wd_timeout);
567 * Reset bypass watchdog timer
570 * The port identifier of the Ethernet device.
572 * - (0) if successful.
573 * - (-ENOTSUP) if hardware doesn't support.
574 * - (-EINVAL) if bad parameter.
576 int rte_pmd_ixgbe_bypass_wd_reset(uint16_t port);
579 * Acquire swfw semaphore lock for MDIO access
582 * The port identifier of the Ethernet device.
584 * - (0) if successful.
585 * - (-ENOTSUP) if hardware doesn't support.
586 * - (-ENODEV) if *port* invalid.
587 * - (IXGBE_ERR_SWFW_SYNC) If sw/fw semaphore acquisition failed
591 rte_pmd_ixgbe_mdio_lock(uint16_t port);
594 * Release swfw semaphore lock used for MDIO access
597 * The port identifier of the Ethernet device.
599 * - (0) if successful.
600 * - (-ENOTSUP) if hardware doesn't support.
601 * - (-ENODEV) if *port* invalid.
605 rte_pmd_ixgbe_mdio_unlock(uint16_t port);
608 * Read PHY register using MDIO without MDIO lock
609 * The lock must be taken separately before calling this
612 * The port identifier of the Ethernet device.
614 * 32 bit PHY Register
616 * Used to define device base address
618 * Pointer for reading PHY register data
620 * - (0) if successful.
621 * - (-ENOTSUP) if hardware doesn't support.
622 * - (-ENODEV) if *port* invalid.
623 * - (IXGBE_ERR_PHY) If PHY read command failed
627 rte_pmd_ixgbe_mdio_unlocked_read(uint16_t port, uint32_t reg_addr,
628 uint32_t dev_type, uint16_t *phy_data);
631 * Write data to PHY register using without MDIO lock
632 * The lock must be taken separately before calling this
636 * The port identifier of the Ethernet device.
638 * 32 bit PHY Register
640 * Used to define device base address
642 * Data to write to PHY register
644 * - (0) if successful.
645 * - (-ENOTSUP) if hardware doesn't support.
646 * - (-ENODEV) if *port* invalid.
647 * - (IXGBE_ERR_PHY) If PHY read command failed
651 rte_pmd_ixgbe_mdio_unlocked_write(uint16_t port, uint32_t reg_addr,
652 uint32_t dev_type, uint16_t phy_data);
655 * Response sent back to ixgbe driver from user app after callback
657 enum rte_pmd_ixgbe_mb_event_rsp {
658 RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK, /**< skip mbox request and ACK */
659 RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
660 RTE_PMD_IXGBE_MB_EVENT_PROCEED, /**< proceed with mbox request */
661 RTE_PMD_IXGBE_MB_EVENT_MAX /**< max value of this enum */
665 * Data sent to the user application when the callback is executed.
667 struct rte_pmd_ixgbe_mb_event_param {
668 uint16_t vfid; /**< Virtual Function number */
669 uint16_t msg_type; /**< VF to PF message type, defined in ixgbe_mbx.h */
670 uint16_t retval; /**< return value */
671 void *msg; /**< pointer to message */
674 RTE_PMD_IXGBE_BYPASS_MODE_NONE,
675 RTE_PMD_IXGBE_BYPASS_MODE_NORMAL,
676 RTE_PMD_IXGBE_BYPASS_MODE_BYPASS,
677 RTE_PMD_IXGBE_BYPASS_MODE_ISOLATE,
678 RTE_PMD_IXGBE_BYPASS_MODE_NUM,
681 #define RTE_PMD_IXGBE_BYPASS_MODE_VALID(x) \
682 ((x) > RTE_PMD_IXGBE_BYPASS_MODE_NONE && \
683 (x) < RTE_PMD_IXGBE_BYPASS_MODE_NUM)
686 RTE_PMD_IXGBE_BYPASS_EVENT_NONE,
687 RTE_PMD_IXGBE_BYPASS_EVENT_START,
688 RTE_PMD_IXGBE_BYPASS_EVENT_OS_ON = RTE_PMD_IXGBE_BYPASS_EVENT_START,
689 RTE_PMD_IXGBE_BYPASS_EVENT_POWER_ON,
690 RTE_PMD_IXGBE_BYPASS_EVENT_OS_OFF,
691 RTE_PMD_IXGBE_BYPASS_EVENT_POWER_OFF,
692 RTE_PMD_IXGBE_BYPASS_EVENT_TIMEOUT,
693 RTE_PMD_IXGBE_BYPASS_EVENT_NUM
696 #define RTE_PMD_IXGBE_BYPASS_EVENT_VALID(x) \
697 ((x) > RTE_PMD_IXGBE_BYPASS_EVENT_NONE && \
698 (x) < RTE_PMD_IXGBE_BYPASS_MODE_NUM)
701 RTE_PMD_IXGBE_BYPASS_TMT_OFF, /* timeout disabled. */
702 RTE_PMD_IXGBE_BYPASS_TMT_1_5_SEC, /* timeout for 1.5 seconds */
703 RTE_PMD_IXGBE_BYPASS_TMT_2_SEC, /* timeout for 2 seconds */
704 RTE_PMD_IXGBE_BYPASS_TMT_3_SEC, /* timeout for 3 seconds */
705 RTE_PMD_IXGBE_BYPASS_TMT_4_SEC, /* timeout for 4 seconds */
706 RTE_PMD_IXGBE_BYPASS_TMT_8_SEC, /* timeout for 8 seconds */
707 RTE_PMD_IXGBE_BYPASS_TMT_16_SEC, /* timeout for 16 seconds */
708 RTE_PMD_IXGBE_BYPASS_TMT_32_SEC, /* timeout for 32 seconds */
709 RTE_PMD_IXGBE_BYPASS_TMT_NUM
712 #define RTE_PMD_IXGBE_BYPASS_TMT_VALID(x) \
713 ((x) == RTE_PMD_IXGBE_BYPASS_TMT_OFF || \
714 ((x) > RTE_PMD_IXGBE_BYPASS_TMT_OFF && \
715 (x) < RTE_PMD_IXGBE_BYPASS_TMT_NUM))
719 * The port identifier of the Ethernet device.
721 * 0 to disable and nonzero to enable 'SBP' bit in FCTRL register
722 * to receive all packets
724 * - (0) if successful.
725 * - (-ENODEV) if *port* invalid.
726 * - (-ENOTSUP) if hardware doesn't support this feature.
730 rte_pmd_ixgbe_upd_fctrl_sbp(uint16_t port, int enable);
736 * The port identifier of the Ethernet device.
738 * The fdir info of the port
740 * - (0) if successful.
741 * - (-ENODEV) if *port* invalid.
742 * - (-ENOTSUP) if operation not supported.
746 rte_pmd_ixgbe_get_fdir_info(uint16_t port, struct rte_eth_fdir_info *fdir_info);
749 * Get port fdir status
752 * The port identifier of the Ethernet device.
754 * The fdir status of the port
756 * - (0) if successful.
757 * - (-ENODEV) if *port* invalid.
758 * - (-ENOTSUP) if operation not supported.
762 rte_pmd_ixgbe_get_fdir_stats(uint16_t port,
763 struct rte_eth_fdir_stats *fdir_stats);
764 #endif /* _PMD_IXGBE_H_ */