5 #ifndef _RTE_ETHDEV_CORE_H_
6 #define _RTE_ETHDEV_CORE_H_
20 struct rte_eth_dev_callback;
22 TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
31 typedef int (*eth_dev_configure_t)(
struct rte_eth_dev *dev);
34 typedef int (*eth_dev_start_t)(
struct rte_eth_dev *dev);
37 typedef void (*eth_dev_stop_t)(
struct rte_eth_dev *dev);
40 typedef int (*eth_dev_set_link_up_t)(
struct rte_eth_dev *dev);
43 typedef int (*eth_dev_set_link_down_t)(
struct rte_eth_dev *dev);
46 typedef void (*eth_dev_close_t)(
struct rte_eth_dev *dev);
49 typedef int (*eth_dev_reset_t)(
struct rte_eth_dev *dev);
55 typedef void (*eth_promiscuous_enable_t)(
struct rte_eth_dev *dev);
58 typedef void (*eth_promiscuous_disable_t)(
struct rte_eth_dev *dev);
61 typedef void (*eth_allmulticast_enable_t)(
struct rte_eth_dev *dev);
64 typedef void (*eth_allmulticast_disable_t)(
struct rte_eth_dev *dev);
67 typedef int (*eth_link_update_t)(
struct rte_eth_dev *dev,
68 int wait_to_complete);
71 typedef int (*eth_stats_get_t)(
struct rte_eth_dev *dev,
75 typedef void (*eth_stats_reset_t)(
struct rte_eth_dev *dev);
78 typedef int (*eth_xstats_get_t)(
struct rte_eth_dev *dev,
82 typedef int (*eth_xstats_get_by_id_t)(
struct rte_eth_dev *dev,
88 typedef void (*eth_xstats_reset_t)(
struct rte_eth_dev *dev);
91 typedef int (*eth_xstats_get_names_t)(
struct rte_eth_dev *dev,
95 typedef int (*eth_xstats_get_names_by_id_t)(
struct rte_eth_dev *dev,
100 typedef int (*eth_queue_stats_mapping_set_t)(
struct rte_eth_dev *dev,
106 typedef void (*eth_dev_infos_get_t)(
struct rte_eth_dev *dev,
110 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(
struct rte_eth_dev *dev);
113 typedef int (*eth_queue_start_t)(
struct rte_eth_dev *dev,
117 typedef int (*eth_queue_stop_t)(
struct rte_eth_dev *dev,
121 typedef int (*eth_rx_queue_setup_t)(
struct rte_eth_dev *dev,
122 uint16_t rx_queue_id,
124 unsigned int socket_id,
129 typedef int (*eth_tx_queue_setup_t)(
struct rte_eth_dev *dev,
130 uint16_t tx_queue_id,
132 unsigned int socket_id,
136 typedef int (*eth_rx_enable_intr_t)(
struct rte_eth_dev *dev,
137 uint16_t rx_queue_id);
140 typedef int (*eth_rx_disable_intr_t)(
struct rte_eth_dev *dev,
141 uint16_t rx_queue_id);
144 typedef void (*eth_queue_release_t)(
void *queue);
147 typedef uint32_t (*eth_rx_queue_count_t)(
struct rte_eth_dev *dev,
148 uint16_t rx_queue_id);
151 typedef int (*eth_rx_descriptor_done_t)(
void *rxq, uint16_t offset);
154 typedef int (*eth_rx_descriptor_status_t)(
void *rxq, uint16_t offset);
157 typedef int (*eth_tx_descriptor_status_t)(
void *txq, uint16_t offset);
160 typedef int (*eth_fw_version_get_t)(
struct rte_eth_dev *dev,
161 char *fw_version,
size_t fw_size);
164 typedef int (*eth_tx_done_cleanup_t)(
void *txq, uint32_t free_cnt);
167 typedef void (*eth_rxq_info_get_t)(
struct rte_eth_dev *dev,
170 typedef void (*eth_txq_info_get_t)(
struct rte_eth_dev *dev,
173 typedef int (*mtu_set_t)(
struct rte_eth_dev *dev, uint16_t mtu);
176 typedef int (*vlan_filter_set_t)(
struct rte_eth_dev *dev,
181 typedef int (*vlan_tpid_set_t)(
struct rte_eth_dev *dev,
185 typedef int (*vlan_offload_set_t)(
struct rte_eth_dev *dev,
int mask);
188 typedef int (*vlan_pvid_set_t)(
struct rte_eth_dev *dev,
193 typedef void (*vlan_strip_queue_set_t)(
struct rte_eth_dev *dev,
194 uint16_t rx_queue_id,
198 typedef uint16_t (*eth_rx_burst_t)(
void *rxq,
203 typedef uint16_t (*eth_tx_burst_t)(
void *txq,
208 typedef uint16_t (*eth_tx_prep_t)(
void *txq,
213 typedef int (*flow_ctrl_get_t)(
struct rte_eth_dev *dev,
217 typedef int (*flow_ctrl_set_t)(
struct rte_eth_dev *dev,
221 typedef int (*priority_flow_ctrl_set_t)(
struct rte_eth_dev *dev,
225 typedef int (*reta_update_t)(
struct rte_eth_dev *dev,
230 typedef int (*reta_query_t)(
struct rte_eth_dev *dev,
235 typedef int (*rss_hash_update_t)(
struct rte_eth_dev *dev,
239 typedef int (*rss_hash_conf_get_t)(
struct rte_eth_dev *dev,
243 typedef int (*eth_dev_led_on_t)(
struct rte_eth_dev *dev);
246 typedef int (*eth_dev_led_off_t)(
struct rte_eth_dev *dev);
249 typedef void (*eth_mac_addr_remove_t)(
struct rte_eth_dev *dev, uint32_t index);
252 typedef int (*eth_mac_addr_add_t)(
struct rte_eth_dev *dev,
258 typedef int (*eth_mac_addr_set_t)(
struct rte_eth_dev *dev,
262 typedef int (*eth_uc_hash_table_set_t)(
struct rte_eth_dev *dev,
267 typedef int (*eth_uc_all_hash_table_set_t)(
struct rte_eth_dev *dev,
271 typedef int (*eth_set_queue_rate_limit_t)(
struct rte_eth_dev *dev,
276 typedef int (*eth_mirror_rule_set_t)(
struct rte_eth_dev *dev,
282 typedef int (*eth_mirror_rule_reset_t)(
struct rte_eth_dev *dev,
286 typedef int (*eth_udp_tunnel_port_add_t)(
struct rte_eth_dev *dev,
290 typedef int (*eth_udp_tunnel_port_del_t)(
struct rte_eth_dev *dev,
294 typedef int (*eth_set_mc_addr_list_t)(
struct rte_eth_dev *dev,
296 uint32_t nb_mc_addr);
299 typedef int (*eth_timesync_enable_t)(
struct rte_eth_dev *dev);
302 typedef int (*eth_timesync_disable_t)(
struct rte_eth_dev *dev);
305 typedef int (*eth_timesync_read_rx_timestamp_t)(
struct rte_eth_dev *dev,
306 struct timespec *timestamp,
310 typedef int (*eth_timesync_read_tx_timestamp_t)(
struct rte_eth_dev *dev,
311 struct timespec *timestamp);
314 typedef int (*eth_timesync_adjust_time)(
struct rte_eth_dev *dev, int64_t);
317 typedef int (*eth_timesync_read_time)(
struct rte_eth_dev *dev,
318 struct timespec *timestamp);
321 typedef int (*eth_timesync_write_time)(
struct rte_eth_dev *dev,
322 const struct timespec *timestamp);
325 typedef int (*eth_get_reg_t)(
struct rte_eth_dev *dev,
326 struct rte_dev_reg_info *info);
329 typedef int (*eth_get_eeprom_length_t)(
struct rte_eth_dev *dev);
332 typedef int (*eth_get_eeprom_t)(
struct rte_eth_dev *dev,
333 struct rte_dev_eeprom_info *info);
336 typedef int (*eth_set_eeprom_t)(
struct rte_eth_dev *dev,
337 struct rte_dev_eeprom_info *info);
340 typedef int (*eth_get_module_info_t)(
struct rte_eth_dev *dev,
344 typedef int (*eth_get_module_eeprom_t)(
struct rte_eth_dev *dev,
345 struct rte_dev_eeprom_info *info);
348 typedef int (*eth_l2_tunnel_eth_type_conf_t)
352 typedef int (*eth_l2_tunnel_offload_set_t)
353 (
struct rte_eth_dev *dev,
360 typedef int (*eth_filter_ctrl_t)(
struct rte_eth_dev *dev,
366 typedef int (*eth_tm_ops_get_t)(
struct rte_eth_dev *dev,
void *ops);
369 typedef int (*eth_mtr_ops_get_t)(
struct rte_eth_dev *dev,
void *ops);
372 typedef int (*eth_get_dcb_info)(
struct rte_eth_dev *dev,
376 typedef int (*eth_pool_ops_supported_t)(
struct rte_eth_dev *dev,
384 eth_dev_configure_t dev_configure;
385 eth_dev_start_t dev_start;
386 eth_dev_stop_t dev_stop;
387 eth_dev_set_link_up_t dev_set_link_up;
388 eth_dev_set_link_down_t dev_set_link_down;
389 eth_dev_close_t dev_close;
390 eth_dev_reset_t dev_reset;
391 eth_link_update_t link_update;
395 eth_promiscuous_enable_t promiscuous_enable;
396 eth_promiscuous_disable_t promiscuous_disable;
397 eth_allmulticast_enable_t allmulticast_enable;
398 eth_allmulticast_disable_t allmulticast_disable;
399 eth_mac_addr_remove_t mac_addr_remove;
400 eth_mac_addr_add_t mac_addr_add;
401 eth_mac_addr_set_t mac_addr_set;
402 eth_set_mc_addr_list_t set_mc_addr_list;
405 eth_stats_get_t stats_get;
406 eth_stats_reset_t stats_reset;
407 eth_xstats_get_t xstats_get;
408 eth_xstats_reset_t xstats_reset;
409 eth_xstats_get_names_t xstats_get_names;
411 eth_queue_stats_mapping_set_t queue_stats_mapping_set;
414 eth_dev_infos_get_t dev_infos_get;
415 eth_rxq_info_get_t rxq_info_get;
416 eth_txq_info_get_t txq_info_get;
417 eth_fw_version_get_t fw_version_get;
418 eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
421 vlan_filter_set_t vlan_filter_set;
422 vlan_tpid_set_t vlan_tpid_set;
423 vlan_strip_queue_set_t vlan_strip_queue_set;
424 vlan_offload_set_t vlan_offload_set;
425 vlan_pvid_set_t vlan_pvid_set;
427 eth_queue_start_t rx_queue_start;
428 eth_queue_stop_t rx_queue_stop;
429 eth_queue_start_t tx_queue_start;
430 eth_queue_stop_t tx_queue_stop;
431 eth_rx_queue_setup_t rx_queue_setup;
432 eth_queue_release_t rx_queue_release;
433 eth_rx_queue_count_t rx_queue_count;
435 eth_rx_descriptor_done_t rx_descriptor_done;
436 eth_rx_descriptor_status_t rx_descriptor_status;
438 eth_tx_descriptor_status_t tx_descriptor_status;
440 eth_rx_enable_intr_t rx_queue_intr_enable;
441 eth_rx_disable_intr_t rx_queue_intr_disable;
442 eth_tx_queue_setup_t tx_queue_setup;
443 eth_queue_release_t tx_queue_release;
444 eth_tx_done_cleanup_t tx_done_cleanup;
446 eth_dev_led_on_t dev_led_on;
447 eth_dev_led_off_t dev_led_off;
449 flow_ctrl_get_t flow_ctrl_get;
450 flow_ctrl_set_t flow_ctrl_set;
451 priority_flow_ctrl_set_t priority_flow_ctrl_set;
453 eth_uc_hash_table_set_t uc_hash_table_set;
454 eth_uc_all_hash_table_set_t uc_all_hash_table_set;
456 eth_mirror_rule_set_t mirror_rule_set;
457 eth_mirror_rule_reset_t mirror_rule_reset;
459 eth_udp_tunnel_port_add_t udp_tunnel_port_add;
460 eth_udp_tunnel_port_del_t udp_tunnel_port_del;
461 eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
463 eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
466 eth_set_queue_rate_limit_t set_queue_rate_limit;
468 rss_hash_update_t rss_hash_update;
469 rss_hash_conf_get_t rss_hash_conf_get;
470 reta_update_t reta_update;
471 reta_query_t reta_query;
473 eth_get_reg_t get_reg;
474 eth_get_eeprom_length_t get_eeprom_length;
475 eth_get_eeprom_t get_eeprom;
476 eth_set_eeprom_t set_eeprom;
478 eth_get_module_info_t get_module_info;
480 eth_get_module_eeprom_t get_module_eeprom;
483 eth_filter_ctrl_t filter_ctrl;
485 eth_get_dcb_info get_dcb_info;
487 eth_timesync_enable_t timesync_enable;
489 eth_timesync_disable_t timesync_disable;
491 eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
493 eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
495 eth_timesync_adjust_time timesync_adjust_time;
496 eth_timesync_read_time timesync_read_time;
497 eth_timesync_write_time timesync_write_time;
499 eth_xstats_get_by_id_t xstats_get_by_id;
501 eth_xstats_get_names_by_id_t xstats_get_names_by_id;
504 eth_tm_ops_get_t tm_ops_get;
507 eth_mtr_ops_get_t mtr_ops_get;
510 eth_pool_ops_supported_t pool_ops_supported;
519 struct rte_eth_rxtx_callback {
520 struct rte_eth_rxtx_callback *next;
539 eth_rx_burst_t rx_pkt_burst;
540 eth_tx_burst_t tx_pkt_burst;
541 eth_tx_prep_t tx_pkt_prepare;
542 struct rte_eth_dev_data *data;
543 const struct eth_dev_ops *dev_ops;
547 struct rte_eth_dev_cb_list link_intr_cbs;
552 struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
557 struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
562 struct rte_eth_dev_sriov;
563 struct rte_eth_dev_owner;
572 struct rte_eth_dev_data {
573 char name[RTE_ETH_NAME_MAX_LEN];
577 uint16_t nb_rx_queues;
578 uint16_t nb_tx_queues;
580 struct rte_eth_dev_sriov sriov;
590 uint32_t min_rx_buf_size;
593 uint64_t rx_mbuf_alloc_failed;
601 uint8_t promiscuous : 1,
606 uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
608 uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
615 struct rte_eth_dev_owner owner;
623 extern struct rte_eth_dev rte_eth_devices[];