5 #ifndef _RTE_ETHDEV_DRIVER_H_ 6 #define _RTE_ETHDEV_DRIVER_H_ 29 struct rte_hairpin_peer_info;
37 typedef int (*eth_dev_configure_t)(
struct rte_eth_dev *dev);
40 typedef int (*eth_dev_start_t)(
struct rte_eth_dev *dev);
43 typedef int (*eth_dev_stop_t)(
struct rte_eth_dev *dev);
46 typedef int (*eth_dev_set_link_up_t)(
struct rte_eth_dev *dev);
49 typedef int (*eth_dev_set_link_down_t)(
struct rte_eth_dev *dev);
52 typedef int (*eth_dev_close_t)(
struct rte_eth_dev *dev);
55 typedef int (*eth_dev_reset_t)(
struct rte_eth_dev *dev);
84 typedef int (*eth_promiscuous_enable_t)(
struct rte_eth_dev *dev);
109 typedef int (*eth_promiscuous_disable_t)(
struct rte_eth_dev *dev);
134 typedef int (*eth_allmulticast_enable_t)(
struct rte_eth_dev *dev);
159 typedef int (*eth_allmulticast_disable_t)(
struct rte_eth_dev *dev);
161 typedef int (*eth_link_update_t)(
struct rte_eth_dev *dev,
162 int wait_to_complete);
165 typedef int (*eth_stats_get_t)(
struct rte_eth_dev *dev,
188 typedef int (*eth_stats_reset_t)(
struct rte_eth_dev *dev);
190 typedef int (*eth_xstats_get_t)(
struct rte_eth_dev *dev,
194 typedef int (*eth_xstats_get_by_id_t)(
struct rte_eth_dev *dev,
219 typedef int (*eth_xstats_reset_t)(
struct rte_eth_dev *dev);
221 typedef int (*eth_xstats_get_names_t)(
struct rte_eth_dev *dev,
225 typedef int (*eth_xstats_get_names_by_id_t)(
struct rte_eth_dev *dev,
230 typedef int (*eth_queue_stats_mapping_set_t)(
struct rte_eth_dev *dev,
236 typedef int (*eth_dev_infos_get_t)(
struct rte_eth_dev *dev,
240 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(
struct rte_eth_dev *dev);
255 typedef int (*eth_dev_ptypes_set_t)(
struct rte_eth_dev *dev,
256 uint32_t ptype_mask);
258 typedef int (*eth_queue_start_t)(
struct rte_eth_dev *dev,
262 typedef int (*eth_queue_stop_t)(
struct rte_eth_dev *dev,
266 typedef int (*eth_rx_queue_setup_t)(
struct rte_eth_dev *dev,
267 uint16_t rx_queue_id,
269 unsigned int socket_id,
274 typedef int (*eth_tx_queue_setup_t)(
struct rte_eth_dev *dev,
275 uint16_t tx_queue_id,
277 unsigned int socket_id,
281 typedef int (*eth_rx_enable_intr_t)(
struct rte_eth_dev *dev,
282 uint16_t rx_queue_id);
285 typedef int (*eth_rx_disable_intr_t)(
struct rte_eth_dev *dev,
286 uint16_t rx_queue_id);
289 typedef void (*eth_queue_release_t)(
void *queue);
292 typedef int (*eth_fw_version_get_t)(
struct rte_eth_dev *dev,
293 char *fw_version,
size_t fw_size);
296 typedef int (*eth_tx_done_cleanup_t)(
void *txq, uint32_t free_cnt);
299 typedef void (*eth_rxq_info_get_t)(
struct rte_eth_dev *dev,
302 typedef void (*eth_txq_info_get_t)(
struct rte_eth_dev *dev,
305 typedef int (*eth_burst_mode_get_t)(
struct rte_eth_dev *dev,
308 typedef int (*mtu_set_t)(
struct rte_eth_dev *dev, uint16_t mtu);
311 typedef int (*vlan_filter_set_t)(
struct rte_eth_dev *dev,
316 typedef int (*vlan_tpid_set_t)(
struct rte_eth_dev *dev,
320 typedef int (*vlan_offload_set_t)(
struct rte_eth_dev *dev,
int mask);
323 typedef int (*vlan_pvid_set_t)(
struct rte_eth_dev *dev,
328 typedef void (*vlan_strip_queue_set_t)(
struct rte_eth_dev *dev,
329 uint16_t rx_queue_id,
333 typedef int (*flow_ctrl_get_t)(
struct rte_eth_dev *dev,
337 typedef int (*flow_ctrl_set_t)(
struct rte_eth_dev *dev,
341 typedef int (*priority_flow_ctrl_set_t)(
struct rte_eth_dev *dev,
345 typedef int (*reta_update_t)(
struct rte_eth_dev *dev,
350 typedef int (*reta_query_t)(
struct rte_eth_dev *dev,
355 typedef int (*rss_hash_update_t)(
struct rte_eth_dev *dev,
359 typedef int (*rss_hash_conf_get_t)(
struct rte_eth_dev *dev,
363 typedef int (*eth_dev_led_on_t)(
struct rte_eth_dev *dev);
366 typedef int (*eth_dev_led_off_t)(
struct rte_eth_dev *dev);
369 typedef void (*eth_mac_addr_remove_t)(
struct rte_eth_dev *dev, uint32_t index);
372 typedef int (*eth_mac_addr_add_t)(
struct rte_eth_dev *dev,
378 typedef int (*eth_mac_addr_set_t)(
struct rte_eth_dev *dev,
382 typedef int (*eth_uc_hash_table_set_t)(
struct rte_eth_dev *dev,
387 typedef int (*eth_uc_all_hash_table_set_t)(
struct rte_eth_dev *dev,
391 typedef int (*eth_set_queue_rate_limit_t)(
struct rte_eth_dev *dev,
396 typedef int (*eth_mirror_rule_set_t)(
struct rte_eth_dev *dev,
402 typedef int (*eth_mirror_rule_reset_t)(
struct rte_eth_dev *dev,
406 typedef int (*eth_udp_tunnel_port_add_t)(
struct rte_eth_dev *dev,
410 typedef int (*eth_udp_tunnel_port_del_t)(
struct rte_eth_dev *dev,
414 typedef int (*eth_set_mc_addr_list_t)(
struct rte_eth_dev *dev,
416 uint32_t nb_mc_addr);
419 typedef int (*eth_timesync_enable_t)(
struct rte_eth_dev *dev);
422 typedef int (*eth_timesync_disable_t)(
struct rte_eth_dev *dev);
425 typedef int (*eth_timesync_read_rx_timestamp_t)(
struct rte_eth_dev *dev,
426 struct timespec *timestamp,
430 typedef int (*eth_timesync_read_tx_timestamp_t)(
struct rte_eth_dev *dev,
431 struct timespec *timestamp);
434 typedef int (*eth_timesync_adjust_time)(
struct rte_eth_dev *dev, int64_t);
437 typedef int (*eth_timesync_read_time)(
struct rte_eth_dev *dev,
438 struct timespec *timestamp);
441 typedef int (*eth_timesync_write_time)(
struct rte_eth_dev *dev,
442 const struct timespec *timestamp);
445 typedef int (*eth_read_clock)(
struct rte_eth_dev *dev,
446 uint64_t *timestamp);
449 typedef int (*eth_get_reg_t)(
struct rte_eth_dev *dev,
450 struct rte_dev_reg_info *info);
453 typedef int (*eth_get_eeprom_length_t)(
struct rte_eth_dev *dev);
456 typedef int (*eth_get_eeprom_t)(
struct rte_eth_dev *dev,
457 struct rte_dev_eeprom_info *info);
460 typedef int (*eth_set_eeprom_t)(
struct rte_eth_dev *dev,
461 struct rte_dev_eeprom_info *info);
464 typedef int (*eth_get_module_info_t)(
struct rte_eth_dev *dev,
468 typedef int (*eth_get_module_eeprom_t)(
struct rte_eth_dev *dev,
469 struct rte_dev_eeprom_info *info);
476 RTE_ETH_FILTER_NONE = 0,
477 RTE_ETH_FILTER_ETHERTYPE,
478 RTE_ETH_FILTER_FLEXIBLE,
480 RTE_ETH_FILTER_NTUPLE,
481 RTE_ETH_FILTER_TUNNEL,
484 RTE_ETH_FILTER_L2_TUNNEL,
485 RTE_ETH_FILTER_GENERIC,
495 typedef int (*eth_filter_ctrl_t)(
struct rte_eth_dev *dev,
501 typedef int (*eth_tm_ops_get_t)(
struct rte_eth_dev *dev,
void *ops);
504 typedef int (*eth_mtr_ops_get_t)(
struct rte_eth_dev *dev,
void *ops);
507 typedef int (*eth_get_dcb_info)(
struct rte_eth_dev *dev,
511 typedef int (*eth_pool_ops_supported_t)(
struct rte_eth_dev *dev,
532 typedef int (*eth_hairpin_cap_get_t)(
struct rte_eth_dev *dev,
560 typedef int (*eth_rx_hairpin_queue_setup_t)
561 (
struct rte_eth_dev *dev, uint16_t rx_queue_id,
590 typedef int (*eth_tx_hairpin_queue_setup_t)
591 (
struct rte_eth_dev *dev, uint16_t tx_queue_id,
623 typedef int (*eth_fec_get_capability_t)(
struct rte_eth_dev *dev,
624 struct rte_eth_fec_capa *speed_fec_capa,
unsigned int num);
648 typedef int (*eth_fec_get_t)(
struct rte_eth_dev *dev,
674 typedef int (*eth_fec_set_t)(
struct rte_eth_dev *dev, uint32_t fec_capa);
703 typedef int (*hairpin_get_peer_ports_t)(
struct rte_eth_dev *dev,
704 uint16_t *peer_ports,
size_t len,
728 typedef int (*eth_hairpin_bind_t)(
struct rte_eth_dev *dev,
752 typedef int (*eth_hairpin_unbind_t)(
struct rte_eth_dev *dev,
755 typedef int (*eth_hairpin_queue_peer_update_t)
756 (
struct rte_eth_dev *dev, uint16_t peer_queue,
757 struct rte_hairpin_peer_info *current_info,
758 struct rte_hairpin_peer_info *peer_info, uint32_t direction);
761 typedef int (*eth_hairpin_queue_peer_bind_t)
762 (
struct rte_eth_dev *dev, uint16_t cur_queue,
763 struct rte_hairpin_peer_info *peer_info, uint32_t direction);
766 typedef int (*eth_hairpin_queue_peer_unbind_t)
767 (
struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction);
774 eth_dev_configure_t dev_configure;
775 eth_dev_start_t dev_start;
776 eth_dev_stop_t dev_stop;
777 eth_dev_set_link_up_t dev_set_link_up;
778 eth_dev_set_link_down_t dev_set_link_down;
779 eth_dev_close_t dev_close;
780 eth_dev_reset_t dev_reset;
781 eth_link_update_t link_update;
785 eth_promiscuous_enable_t promiscuous_enable;
786 eth_promiscuous_disable_t promiscuous_disable;
787 eth_allmulticast_enable_t allmulticast_enable;
788 eth_allmulticast_disable_t allmulticast_disable;
789 eth_mac_addr_remove_t mac_addr_remove;
790 eth_mac_addr_add_t mac_addr_add;
791 eth_mac_addr_set_t mac_addr_set;
792 eth_set_mc_addr_list_t set_mc_addr_list;
795 eth_stats_get_t stats_get;
796 eth_stats_reset_t stats_reset;
797 eth_xstats_get_t xstats_get;
798 eth_xstats_reset_t xstats_reset;
799 eth_xstats_get_names_t xstats_get_names;
801 eth_queue_stats_mapping_set_t queue_stats_mapping_set;
804 eth_dev_infos_get_t dev_infos_get;
805 eth_rxq_info_get_t rxq_info_get;
806 eth_txq_info_get_t txq_info_get;
807 eth_burst_mode_get_t rx_burst_mode_get;
808 eth_burst_mode_get_t tx_burst_mode_get;
809 eth_fw_version_get_t fw_version_get;
810 eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
812 eth_dev_ptypes_set_t dev_ptypes_set;
815 vlan_filter_set_t vlan_filter_set;
816 vlan_tpid_set_t vlan_tpid_set;
817 vlan_strip_queue_set_t vlan_strip_queue_set;
818 vlan_offload_set_t vlan_offload_set;
819 vlan_pvid_set_t vlan_pvid_set;
821 eth_queue_start_t rx_queue_start;
822 eth_queue_stop_t rx_queue_stop;
823 eth_queue_start_t tx_queue_start;
824 eth_queue_stop_t tx_queue_stop;
825 eth_rx_queue_setup_t rx_queue_setup;
826 eth_queue_release_t rx_queue_release;
828 eth_rx_enable_intr_t rx_queue_intr_enable;
829 eth_rx_disable_intr_t rx_queue_intr_disable;
830 eth_tx_queue_setup_t tx_queue_setup;
831 eth_queue_release_t tx_queue_release;
832 eth_tx_done_cleanup_t tx_done_cleanup;
834 eth_dev_led_on_t dev_led_on;
835 eth_dev_led_off_t dev_led_off;
837 flow_ctrl_get_t flow_ctrl_get;
838 flow_ctrl_set_t flow_ctrl_set;
839 priority_flow_ctrl_set_t priority_flow_ctrl_set;
841 eth_uc_hash_table_set_t uc_hash_table_set;
842 eth_uc_all_hash_table_set_t uc_all_hash_table_set;
844 eth_mirror_rule_set_t mirror_rule_set;
845 eth_mirror_rule_reset_t mirror_rule_reset;
847 eth_udp_tunnel_port_add_t udp_tunnel_port_add;
848 eth_udp_tunnel_port_del_t udp_tunnel_port_del;
850 eth_set_queue_rate_limit_t set_queue_rate_limit;
852 rss_hash_update_t rss_hash_update;
853 rss_hash_conf_get_t rss_hash_conf_get;
854 reta_update_t reta_update;
855 reta_query_t reta_query;
857 eth_get_reg_t get_reg;
858 eth_get_eeprom_length_t get_eeprom_length;
859 eth_get_eeprom_t get_eeprom;
860 eth_set_eeprom_t set_eeprom;
862 eth_get_module_info_t get_module_info;
864 eth_get_module_eeprom_t get_module_eeprom;
867 eth_filter_ctrl_t filter_ctrl;
869 eth_get_dcb_info get_dcb_info;
871 eth_timesync_enable_t timesync_enable;
873 eth_timesync_disable_t timesync_disable;
875 eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
877 eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
879 eth_timesync_adjust_time timesync_adjust_time;
880 eth_timesync_read_time timesync_read_time;
881 eth_timesync_write_time timesync_write_time;
883 eth_read_clock read_clock;
885 eth_xstats_get_by_id_t xstats_get_by_id;
887 eth_xstats_get_names_by_id_t xstats_get_names_by_id;
890 eth_tm_ops_get_t tm_ops_get;
893 eth_mtr_ops_get_t mtr_ops_get;
896 eth_pool_ops_supported_t pool_ops_supported;
899 eth_hairpin_cap_get_t hairpin_cap_get;
901 eth_rx_hairpin_queue_setup_t rx_hairpin_queue_setup;
903 eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup;
906 eth_fec_get_capability_t fec_get_capability;
908 eth_fec_get_t fec_get;
910 eth_fec_set_t fec_set;
912 hairpin_get_peer_ports_t hairpin_get_peer_ports;
914 eth_hairpin_bind_t hairpin_bind;
916 eth_hairpin_unbind_t hairpin_unbind;
918 eth_hairpin_queue_peer_update_t hairpin_queue_peer_update;
920 eth_hairpin_queue_peer_bind_t hairpin_queue_peer_bind;
922 eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind;
939 int rte_eth_dev_is_rx_hairpin_queue(
struct rte_eth_dev *dev, uint16_t queue_id);
954 int rte_eth_dev_is_tx_hairpin_queue(
struct rte_eth_dev *dev, uint16_t queue_id);
966 struct rte_eth_dev *rte_eth_dev_allocated(
const char *name);
978 struct rte_eth_dev *rte_eth_dev_allocate(
const char *name);
992 struct rte_eth_dev *rte_eth_dev_attach_secondary(
const char *name);
1011 int rte_eth_dev_release_port(
struct rte_eth_dev *eth_dev);
1025 void rte_eth_dev_internal_reset(
struct rte_eth_dev *dev);
1045 int rte_eth_dev_callback_process(
struct rte_eth_dev *dev,
1061 void rte_eth_dev_probing_finish(
struct rte_eth_dev *dev);
1085 uint16_t queue_id,
size_t size,
1086 unsigned align,
int socket_id);
1121 rte_eth_linkstatus_set(
struct rte_eth_dev *dev,
1124 uint64_t *dev_link = (uint64_t *)&(dev->data->dev_link);
1132 orig.val64 = __atomic_exchange_n(dev_link, *(
const uint64_t *)new_link,
1135 return (orig.link.link_status == new_link->link_status) ? -1 : 0;
1148 rte_eth_linkstatus_get(
const struct rte_eth_dev *dev,
1151 uint64_t *src = (uint64_t *)&(dev->data->dev_link);
1152 uint64_t *dst = (uint64_t *)link;
1156 *dst = __atomic_load_n(src, __ATOMIC_SEQ_CST);
1195 uint16_t ports[RTE_MAX_ETHPORTS];
1199 uint16_t representor_ports[RTE_MAX_ETHPORTS];
1221 typedef int (*ethdev_init_t)(
struct rte_eth_dev *ethdev,
void *init_params);
1222 typedef int (*ethdev_bus_specific_init)(
struct rte_eth_dev *ethdev,
1223 void *bus_specific_init_params);
1249 size_t priv_data_size,
1250 ethdev_bus_specific_init bus_specific_init,
void *bus_init_params,
1251 ethdev_init_t ethdev_init,
void *init_params);
1254 typedef int (*ethdev_uninit_t)(
struct rte_eth_dev *ethdev);
1295 rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,
1296 struct rte_hairpin_peer_info *cur_info,
1297 struct rte_hairpin_peer_info *peer_info,
1298 uint32_t direction);
1322 rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
1323 struct rte_hairpin_peer_info *peer_info,
1324 uint32_t direction);
1342 rte_eth_dev_get_by_name(
const char *name);
1364 rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
1365 uint32_t direction);
1376 #define RTE_ETHTYPE_FLAGS_MAC 0x0001 1377 #define RTE_ETHTYPE_FLAGS_DROP 0x0002 1383 struct rte_eth_ethertype_filter { 1403 #define ETH_TUNNEL_FILTER_OMAC 0x01 1404 #define ETH_TUNNEL_FILTER_OIP 0x02 1405 #define ETH_TUNNEL_FILTER_TENID 0x04 1406 #define ETH_TUNNEL_FILTER_IMAC 0x08 1407 #define ETH_TUNNEL_FILTER_IVLAN 0x10 1408 #define ETH_TUNNEL_FILTER_IIP 0x20 1410 #define RTE_TUNNEL_FILTER_IMAC_IVLAN (ETH_TUNNEL_FILTER_IMAC | \ 1411 ETH_TUNNEL_FILTER_IVLAN) 1412 #define RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID (ETH_TUNNEL_FILTER_IMAC | \ 1413 ETH_TUNNEL_FILTER_IVLAN | \ 1414 ETH_TUNNEL_FILTER_TENID) 1415 #define RTE_TUNNEL_FILTER_IMAC_TENID (ETH_TUNNEL_FILTER_IMAC | \ 1416 ETH_TUNNEL_FILTER_TENID) 1417 #define RTE_TUNNEL_FILTER_OMAC_TENID_IMAC (ETH_TUNNEL_FILTER_OMAC | \ 1418 ETH_TUNNEL_FILTER_TENID | \ 1419 ETH_TUNNEL_FILTER_IMAC) 1444 uint32_t ipv6_addr[4];
__rte_internal int rte_eth_switch_domain_free(uint16_t domain_id)
uint16_t nb_representor_ports
__rte_internal int rte_eth_dev_create(struct rte_device *device, const char *name, size_t priv_data_size, ethdev_bus_specific_init bus_specific_init, void *bus_init_params, ethdev_init_t ethdev_init, void *init_params)
__rte_internal int rte_eth_switch_domain_alloc(uint16_t *domain_id)
#define RTE_BUILD_BUG_ON(condition)
__rte_internal const struct rte_memzone * rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name, uint16_t queue_id, size_t size, unsigned align, int socket_id)
__rte_internal int rte_eth_devargs_parse(const char *devargs, struct rte_eth_devargs *eth_devargs)
__rte_internal int rte_eth_dma_zone_free(const struct rte_eth_dev *eth_dev, const char *name, uint16_t queue_id)
int(* eth_is_removed_t)(struct rte_eth_dev *dev)
__rte_internal int rte_eth_dev_destroy(struct rte_eth_dev *ethdev, ethdev_uninit_t ethdev_uninit)