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_read_clock)(
struct rte_eth_dev *dev,
326 uint64_t *timestamp);
329 typedef int (*eth_get_reg_t)(
struct rte_eth_dev *dev,
330 struct rte_dev_reg_info *info);
333 typedef int (*eth_get_eeprom_length_t)(
struct rte_eth_dev *dev);
336 typedef int (*eth_get_eeprom_t)(
struct rte_eth_dev *dev,
337 struct rte_dev_eeprom_info *info);
340 typedef int (*eth_set_eeprom_t)(
struct rte_eth_dev *dev,
341 struct rte_dev_eeprom_info *info);
344 typedef int (*eth_get_module_info_t)(
struct rte_eth_dev *dev,
348 typedef int (*eth_get_module_eeprom_t)(
struct rte_eth_dev *dev,
349 struct rte_dev_eeprom_info *info);
352 typedef int (*eth_l2_tunnel_eth_type_conf_t)
356 typedef int (*eth_l2_tunnel_offload_set_t)
357 (
struct rte_eth_dev *dev,
364 typedef int (*eth_filter_ctrl_t)(
struct rte_eth_dev *dev,
370 typedef int (*eth_tm_ops_get_t)(
struct rte_eth_dev *dev,
void *ops);
373 typedef int (*eth_mtr_ops_get_t)(
struct rte_eth_dev *dev,
void *ops);
376 typedef int (*eth_get_dcb_info)(
struct rte_eth_dev *dev,
380 typedef int (*eth_pool_ops_supported_t)(
struct rte_eth_dev *dev,
388 eth_dev_configure_t dev_configure;
389 eth_dev_start_t dev_start;
390 eth_dev_stop_t dev_stop;
391 eth_dev_set_link_up_t dev_set_link_up;
392 eth_dev_set_link_down_t dev_set_link_down;
393 eth_dev_close_t dev_close;
394 eth_dev_reset_t dev_reset;
395 eth_link_update_t link_update;
399 eth_promiscuous_enable_t promiscuous_enable;
400 eth_promiscuous_disable_t promiscuous_disable;
401 eth_allmulticast_enable_t allmulticast_enable;
402 eth_allmulticast_disable_t allmulticast_disable;
403 eth_mac_addr_remove_t mac_addr_remove;
404 eth_mac_addr_add_t mac_addr_add;
405 eth_mac_addr_set_t mac_addr_set;
406 eth_set_mc_addr_list_t set_mc_addr_list;
409 eth_stats_get_t stats_get;
410 eth_stats_reset_t stats_reset;
411 eth_xstats_get_t xstats_get;
412 eth_xstats_reset_t xstats_reset;
413 eth_xstats_get_names_t xstats_get_names;
415 eth_queue_stats_mapping_set_t queue_stats_mapping_set;
418 eth_dev_infos_get_t dev_infos_get;
419 eth_rxq_info_get_t rxq_info_get;
420 eth_txq_info_get_t txq_info_get;
421 eth_fw_version_get_t fw_version_get;
422 eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
425 vlan_filter_set_t vlan_filter_set;
426 vlan_tpid_set_t vlan_tpid_set;
427 vlan_strip_queue_set_t vlan_strip_queue_set;
428 vlan_offload_set_t vlan_offload_set;
429 vlan_pvid_set_t vlan_pvid_set;
431 eth_queue_start_t rx_queue_start;
432 eth_queue_stop_t rx_queue_stop;
433 eth_queue_start_t tx_queue_start;
434 eth_queue_stop_t tx_queue_stop;
435 eth_rx_queue_setup_t rx_queue_setup;
436 eth_queue_release_t rx_queue_release;
437 eth_rx_queue_count_t rx_queue_count;
439 eth_rx_descriptor_done_t rx_descriptor_done;
440 eth_rx_descriptor_status_t rx_descriptor_status;
442 eth_tx_descriptor_status_t tx_descriptor_status;
444 eth_rx_enable_intr_t rx_queue_intr_enable;
445 eth_rx_disable_intr_t rx_queue_intr_disable;
446 eth_tx_queue_setup_t tx_queue_setup;
447 eth_queue_release_t tx_queue_release;
448 eth_tx_done_cleanup_t tx_done_cleanup;
450 eth_dev_led_on_t dev_led_on;
451 eth_dev_led_off_t dev_led_off;
453 flow_ctrl_get_t flow_ctrl_get;
454 flow_ctrl_set_t flow_ctrl_set;
455 priority_flow_ctrl_set_t priority_flow_ctrl_set;
457 eth_uc_hash_table_set_t uc_hash_table_set;
458 eth_uc_all_hash_table_set_t uc_all_hash_table_set;
460 eth_mirror_rule_set_t mirror_rule_set;
461 eth_mirror_rule_reset_t mirror_rule_reset;
463 eth_udp_tunnel_port_add_t udp_tunnel_port_add;
464 eth_udp_tunnel_port_del_t udp_tunnel_port_del;
465 eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
467 eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
470 eth_set_queue_rate_limit_t set_queue_rate_limit;
472 rss_hash_update_t rss_hash_update;
473 rss_hash_conf_get_t rss_hash_conf_get;
474 reta_update_t reta_update;
475 reta_query_t reta_query;
477 eth_get_reg_t get_reg;
478 eth_get_eeprom_length_t get_eeprom_length;
479 eth_get_eeprom_t get_eeprom;
480 eth_set_eeprom_t set_eeprom;
482 eth_get_module_info_t get_module_info;
484 eth_get_module_eeprom_t get_module_eeprom;
487 eth_filter_ctrl_t filter_ctrl;
489 eth_get_dcb_info get_dcb_info;
491 eth_timesync_enable_t timesync_enable;
493 eth_timesync_disable_t timesync_disable;
495 eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
497 eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
499 eth_timesync_adjust_time timesync_adjust_time;
500 eth_timesync_read_time timesync_read_time;
501 eth_timesync_write_time timesync_write_time;
503 eth_read_clock read_clock;
505 eth_xstats_get_by_id_t xstats_get_by_id;
507 eth_xstats_get_names_by_id_t xstats_get_names_by_id;
510 eth_tm_ops_get_t tm_ops_get;
513 eth_mtr_ops_get_t mtr_ops_get;
516 eth_pool_ops_supported_t pool_ops_supported;
525 struct rte_eth_rxtx_callback {
526 struct rte_eth_rxtx_callback *next;
545 eth_rx_burst_t rx_pkt_burst;
546 eth_tx_burst_t tx_pkt_burst;
547 eth_tx_prep_t tx_pkt_prepare;
553 struct rte_eth_dev_data *data;
554 void *process_private;
555 const struct eth_dev_ops *dev_ops;
559 struct rte_eth_dev_cb_list link_intr_cbs;
564 struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
569 struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
574 struct rte_eth_dev_sriov;
575 struct rte_eth_dev_owner;
584 struct rte_eth_dev_data {
585 char name[RTE_ETH_NAME_MAX_LEN];
589 uint16_t nb_rx_queues;
590 uint16_t nb_tx_queues;
592 struct rte_eth_dev_sriov sriov;
602 uint32_t min_rx_buf_size;
605 uint64_t rx_mbuf_alloc_failed;
619 uint8_t promiscuous : 1,
624 uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
626 uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
633 struct rte_eth_dev_owner owner;
634 uint16_t representor_id;
645 extern struct rte_eth_dev rte_eth_devices[];
#define ETH_NUM_RECEIVE_MAC_ADDR
int(* eth_is_removed_t)(struct rte_eth_dev *dev)
uint16_t(* rte_tx_callback_fn)(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param)
#define __rte_cache_aligned
uint16_t(* rte_rx_callback_fn)(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts, void *user_param)