199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2017 Intel Corporation 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef _RTE_ETHDEV_DRIVER_H_ 699a2dd95SBruce Richardson #define _RTE_ETHDEV_DRIVER_H_ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson /** 999a2dd95SBruce Richardson * @file 1099a2dd95SBruce Richardson * 1199a2dd95SBruce Richardson * RTE Ethernet Device PMD API 1299a2dd95SBruce Richardson * 1399a2dd95SBruce Richardson * These APIs for the use from Ethernet drivers, user applications shouldn't 1499a2dd95SBruce Richardson * use them. 1599a2dd95SBruce Richardson * 1699a2dd95SBruce Richardson */ 1799a2dd95SBruce Richardson 1899a2dd95SBruce Richardson #include <rte_ethdev.h> 1999a2dd95SBruce Richardson 2099a2dd95SBruce Richardson /**< @internal Declaration of the hairpin peer queue information structure. */ 2199a2dd95SBruce Richardson struct rte_hairpin_peer_info; 2299a2dd95SBruce Richardson 2399a2dd95SBruce Richardson /* 2499a2dd95SBruce Richardson * Definitions of all functions exported by an Ethernet driver through the 2599a2dd95SBruce Richardson * generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev* 2699a2dd95SBruce Richardson * structure associated with an Ethernet device. 2799a2dd95SBruce Richardson */ 2899a2dd95SBruce Richardson 2999a2dd95SBruce Richardson typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev); 3099a2dd95SBruce Richardson /**< @internal Ethernet device configuration. */ 3199a2dd95SBruce Richardson 3299a2dd95SBruce Richardson typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev); 3399a2dd95SBruce Richardson /**< @internal Function used to start a configured Ethernet device. */ 3499a2dd95SBruce Richardson 3599a2dd95SBruce Richardson typedef int (*eth_dev_stop_t)(struct rte_eth_dev *dev); 3699a2dd95SBruce Richardson /**< @internal Function used to stop a configured Ethernet device. */ 3799a2dd95SBruce Richardson 3899a2dd95SBruce Richardson typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev); 3999a2dd95SBruce Richardson /**< @internal Function used to link up a configured Ethernet device. */ 4099a2dd95SBruce Richardson 4199a2dd95SBruce Richardson typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev); 4299a2dd95SBruce Richardson /**< @internal Function used to link down a configured Ethernet device. */ 4399a2dd95SBruce Richardson 4499a2dd95SBruce Richardson typedef int (*eth_dev_close_t)(struct rte_eth_dev *dev); 4599a2dd95SBruce Richardson /**< @internal Function used to close a configured Ethernet device. */ 4699a2dd95SBruce Richardson 4799a2dd95SBruce Richardson typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev); 4899a2dd95SBruce Richardson /** <@internal Function used to reset a configured Ethernet device. */ 4999a2dd95SBruce Richardson 5099a2dd95SBruce Richardson typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev); 5199a2dd95SBruce Richardson /**< @internal Function used to detect an Ethernet device removal. */ 5299a2dd95SBruce Richardson 5399a2dd95SBruce Richardson /** 5499a2dd95SBruce Richardson * @internal 5599a2dd95SBruce Richardson * Function used to enable the Rx promiscuous mode of an Ethernet device. 5699a2dd95SBruce Richardson * 5799a2dd95SBruce Richardson * @param dev 5899a2dd95SBruce Richardson * ethdev handle of port. 5999a2dd95SBruce Richardson * 6099a2dd95SBruce Richardson * @return 6199a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 6299a2dd95SBruce Richardson * 6399a2dd95SBruce Richardson * @retval 0 6499a2dd95SBruce Richardson * Success, promiscuous mode is enabled. 6599a2dd95SBruce Richardson * @retval -ENOTSUP 6699a2dd95SBruce Richardson * Promiscuous mode is not supported. 6799a2dd95SBruce Richardson * @retval -ENODEV 6899a2dd95SBruce Richardson * Device is gone. 6999a2dd95SBruce Richardson * @retval -E_RTE_SECONDARY 7099a2dd95SBruce Richardson * Function was called from a secondary process instance and not supported. 7199a2dd95SBruce Richardson * @retval -ETIMEDOUT 7299a2dd95SBruce Richardson * Attempt to enable promiscuos mode failed because of timeout. 7399a2dd95SBruce Richardson * @retval -EAGAIN 7499a2dd95SBruce Richardson * Failed to enable promiscuous mode. 7599a2dd95SBruce Richardson */ 7699a2dd95SBruce Richardson typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev); 7799a2dd95SBruce Richardson 7899a2dd95SBruce Richardson /** 7999a2dd95SBruce Richardson * @internal 8099a2dd95SBruce Richardson * Function used to disable the Rx promiscuous mode of an Ethernet device. 8199a2dd95SBruce Richardson * 8299a2dd95SBruce Richardson * @param dev 8399a2dd95SBruce Richardson * ethdev handle of port. 8499a2dd95SBruce Richardson * 8599a2dd95SBruce Richardson * @return 8699a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 8799a2dd95SBruce Richardson * 8899a2dd95SBruce Richardson * @retval 0 8999a2dd95SBruce Richardson * Success, promiscuous mode is disabled. 9099a2dd95SBruce Richardson * @retval -ENOTSUP 9199a2dd95SBruce Richardson * Promiscuous mode disabling is not supported. 9299a2dd95SBruce Richardson * @retval -ENODEV 9399a2dd95SBruce Richardson * Device is gone. 9499a2dd95SBruce Richardson * @retval -E_RTE_SECONDARY 9599a2dd95SBruce Richardson * Function was called from a secondary process instance and not supported. 9699a2dd95SBruce Richardson * @retval -ETIMEDOUT 9799a2dd95SBruce Richardson * Attempt to disable promiscuos mode failed because of timeout. 9899a2dd95SBruce Richardson * @retval -EAGAIN 9999a2dd95SBruce Richardson * Failed to disable promiscuous mode. 10099a2dd95SBruce Richardson */ 10199a2dd95SBruce Richardson typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev); 10299a2dd95SBruce Richardson 10399a2dd95SBruce Richardson /** 10499a2dd95SBruce Richardson * @internal 10599a2dd95SBruce Richardson * Enable the receipt of all multicast packets by an Ethernet device. 10699a2dd95SBruce Richardson * 10799a2dd95SBruce Richardson * @param dev 10899a2dd95SBruce Richardson * ethdev handle of port. 10999a2dd95SBruce Richardson * 11099a2dd95SBruce Richardson * @return 11199a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 11299a2dd95SBruce Richardson * 11399a2dd95SBruce Richardson * @retval 0 11499a2dd95SBruce Richardson * Success, all-multicast mode is enabled. 11599a2dd95SBruce Richardson * @retval -ENOTSUP 11699a2dd95SBruce Richardson * All-multicast mode is not supported. 11799a2dd95SBruce Richardson * @retval -ENODEV 11899a2dd95SBruce Richardson * Device is gone. 11999a2dd95SBruce Richardson * @retval -E_RTE_SECONDARY 12099a2dd95SBruce Richardson * Function was called from a secondary process instance and not supported. 12199a2dd95SBruce Richardson * @retval -ETIMEDOUT 12299a2dd95SBruce Richardson * Attempt to enable all-multicast mode failed because of timeout. 12399a2dd95SBruce Richardson * @retval -EAGAIN 12499a2dd95SBruce Richardson * Failed to enable all-multicast mode. 12599a2dd95SBruce Richardson */ 12699a2dd95SBruce Richardson typedef int (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev); 12799a2dd95SBruce Richardson 12899a2dd95SBruce Richardson /** 12999a2dd95SBruce Richardson * @internal 13099a2dd95SBruce Richardson * Disable the receipt of all multicast packets by an Ethernet device. 13199a2dd95SBruce Richardson * 13299a2dd95SBruce Richardson * @param dev 13399a2dd95SBruce Richardson * ethdev handle of port. 13499a2dd95SBruce Richardson * 13599a2dd95SBruce Richardson * @return 13699a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 13799a2dd95SBruce Richardson * 13899a2dd95SBruce Richardson * @retval 0 13999a2dd95SBruce Richardson * Success, all-multicast mode is disabled. 14099a2dd95SBruce Richardson * @retval -ENOTSUP 14199a2dd95SBruce Richardson * All-multicast mode disabling is not supported. 14299a2dd95SBruce Richardson * @retval -ENODEV 14399a2dd95SBruce Richardson * Device is gone. 14499a2dd95SBruce Richardson * @retval -E_RTE_SECONDARY 14599a2dd95SBruce Richardson * Function was called from a secondary process instance and not supported. 14699a2dd95SBruce Richardson * @retval -ETIMEDOUT 14799a2dd95SBruce Richardson * Attempt to disable all-multicast mode failed because of timeout. 14899a2dd95SBruce Richardson * @retval -EAGAIN 14999a2dd95SBruce Richardson * Failed to disable all-multicast mode. 15099a2dd95SBruce Richardson */ 15199a2dd95SBruce Richardson typedef int (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev); 15299a2dd95SBruce Richardson 15399a2dd95SBruce Richardson typedef int (*eth_link_update_t)(struct rte_eth_dev *dev, 15499a2dd95SBruce Richardson int wait_to_complete); 15599a2dd95SBruce Richardson /**< @internal Get link speed, duplex mode and state (up/down) of an Ethernet device. */ 15699a2dd95SBruce Richardson 15799a2dd95SBruce Richardson typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev, 15899a2dd95SBruce Richardson struct rte_eth_stats *igb_stats); 15999a2dd95SBruce Richardson /**< @internal Get global I/O statistics of an Ethernet device. */ 16099a2dd95SBruce Richardson 16199a2dd95SBruce Richardson /** 16299a2dd95SBruce Richardson * @internal 16399a2dd95SBruce Richardson * Reset global I/O statistics of an Ethernet device to 0. 16499a2dd95SBruce Richardson * 16599a2dd95SBruce Richardson * @param dev 16699a2dd95SBruce Richardson * ethdev handle of port. 16799a2dd95SBruce Richardson * 16899a2dd95SBruce Richardson * @return 16999a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 17099a2dd95SBruce Richardson * 17199a2dd95SBruce Richardson * @retval 0 17299a2dd95SBruce Richardson * Success, statistics has been reset. 17399a2dd95SBruce Richardson * @retval -ENOTSUP 17499a2dd95SBruce Richardson * Resetting statistics is not supported. 17599a2dd95SBruce Richardson * @retval -EINVAL 17699a2dd95SBruce Richardson * Resetting statistics is not valid. 17799a2dd95SBruce Richardson * @retval -ENOMEM 17899a2dd95SBruce Richardson * Not enough memory to get the stats. 17999a2dd95SBruce Richardson */ 18099a2dd95SBruce Richardson typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev); 18199a2dd95SBruce Richardson 18299a2dd95SBruce Richardson typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev, 18399a2dd95SBruce Richardson struct rte_eth_xstat *stats, unsigned int n); 18499a2dd95SBruce Richardson /**< @internal Get extended stats of an Ethernet device. */ 18599a2dd95SBruce Richardson 186*71b5e430SIvan Ilchenko /** 187*71b5e430SIvan Ilchenko * @internal 188*71b5e430SIvan Ilchenko * Get extended stats of an Ethernet device. 189*71b5e430SIvan Ilchenko * 190*71b5e430SIvan Ilchenko * @param dev 191*71b5e430SIvan Ilchenko * ethdev handle of port. 192*71b5e430SIvan Ilchenko * @param ids 193*71b5e430SIvan Ilchenko * IDs array to retrieve specific statistics. Must not be NULL. 194*71b5e430SIvan Ilchenko * @param values 195*71b5e430SIvan Ilchenko * A pointer to a table to be filled with device statistics values. 196*71b5e430SIvan Ilchenko * Must not be NULL. 197*71b5e430SIvan Ilchenko * @param n 198*71b5e430SIvan Ilchenko * Element count in @p ids and @p values. 199*71b5e430SIvan Ilchenko * 200*71b5e430SIvan Ilchenko * @return 201*71b5e430SIvan Ilchenko * - A number of filled in stats. 202*71b5e430SIvan Ilchenko * - A negative value on error. 203*71b5e430SIvan Ilchenko */ 20499a2dd95SBruce Richardson typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev, 20599a2dd95SBruce Richardson const uint64_t *ids, 20699a2dd95SBruce Richardson uint64_t *values, 20799a2dd95SBruce Richardson unsigned int n); 20899a2dd95SBruce Richardson 20999a2dd95SBruce Richardson /** 21099a2dd95SBruce Richardson * @internal 21199a2dd95SBruce Richardson * Reset extended stats of an Ethernet device. 21299a2dd95SBruce Richardson * 21399a2dd95SBruce Richardson * @param dev 21499a2dd95SBruce Richardson * ethdev handle of port. 21599a2dd95SBruce Richardson * 21699a2dd95SBruce Richardson * @return 21799a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 21899a2dd95SBruce Richardson * 21999a2dd95SBruce Richardson * @retval 0 22099a2dd95SBruce Richardson * Success, statistics has been reset. 22199a2dd95SBruce Richardson * @retval -ENOTSUP 22299a2dd95SBruce Richardson * Resetting statistics is not supported. 22399a2dd95SBruce Richardson * @retval -EINVAL 22499a2dd95SBruce Richardson * Resetting statistics is not valid. 22599a2dd95SBruce Richardson * @retval -ENOMEM 22699a2dd95SBruce Richardson * Not enough memory to get the stats. 22799a2dd95SBruce Richardson */ 22899a2dd95SBruce Richardson typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev); 22999a2dd95SBruce Richardson 23099a2dd95SBruce Richardson typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev, 23199a2dd95SBruce Richardson struct rte_eth_xstat_name *xstats_names, unsigned int size); 23299a2dd95SBruce Richardson /**< @internal Get names of extended stats of an Ethernet device. */ 23399a2dd95SBruce Richardson 234*71b5e430SIvan Ilchenko /** 235*71b5e430SIvan Ilchenko * @internal 236*71b5e430SIvan Ilchenko * Get names of extended stats of an Ethernet device. 237*71b5e430SIvan Ilchenko * 238*71b5e430SIvan Ilchenko * @param dev 239*71b5e430SIvan Ilchenko * ethdev handle of port. 240*71b5e430SIvan Ilchenko * @param xstats_names 241*71b5e430SIvan Ilchenko * An rte_eth_xstat_name array of at least @p size elements to be filled. 242*71b5e430SIvan Ilchenko * Must not be NULL. 243*71b5e430SIvan Ilchenko * @param ids 244*71b5e430SIvan Ilchenko * IDs array to retrieve specific statistics. Must not be NULL. 245*71b5e430SIvan Ilchenko * @param size 246*71b5e430SIvan Ilchenko * Element count in @p ids and @p xstats_names. 247*71b5e430SIvan Ilchenko * 248*71b5e430SIvan Ilchenko * @return 249*71b5e430SIvan Ilchenko * - A number of filled in stats. 250*71b5e430SIvan Ilchenko * - A negative value on error. 251*71b5e430SIvan Ilchenko */ 25299a2dd95SBruce Richardson typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev, 25399a2dd95SBruce Richardson struct rte_eth_xstat_name *xstats_names, const uint64_t *ids, 25499a2dd95SBruce Richardson unsigned int size); 25599a2dd95SBruce Richardson 25699a2dd95SBruce Richardson typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev, 25799a2dd95SBruce Richardson uint16_t queue_id, 25899a2dd95SBruce Richardson uint8_t stat_idx, 25999a2dd95SBruce Richardson uint8_t is_rx); 26099a2dd95SBruce Richardson /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */ 26199a2dd95SBruce Richardson 26299a2dd95SBruce Richardson typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev, 26399a2dd95SBruce Richardson struct rte_eth_dev_info *dev_info); 26499a2dd95SBruce Richardson /**< @internal Get specific information of an Ethernet device. */ 26599a2dd95SBruce Richardson 26699a2dd95SBruce Richardson typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev); 26799a2dd95SBruce Richardson /**< @internal Get supported ptypes of an Ethernet device. */ 26899a2dd95SBruce Richardson 26999a2dd95SBruce Richardson /** 27099a2dd95SBruce Richardson * @internal 27199a2dd95SBruce Richardson * Inform Ethernet device about reduced range of packet types to handle. 27299a2dd95SBruce Richardson * 27399a2dd95SBruce Richardson * @param dev 27499a2dd95SBruce Richardson * The Ethernet device identifier. 27599a2dd95SBruce Richardson * @param ptype_mask 27699a2dd95SBruce Richardson * The ptype family that application is interested in should be bitwise OR of 27799a2dd95SBruce Richardson * RTE_PTYPE_*_MASK or 0. 27899a2dd95SBruce Richardson * @return 27999a2dd95SBruce Richardson * - (0) if Success. 28099a2dd95SBruce Richardson */ 28199a2dd95SBruce Richardson typedef int (*eth_dev_ptypes_set_t)(struct rte_eth_dev *dev, 28299a2dd95SBruce Richardson uint32_t ptype_mask); 28399a2dd95SBruce Richardson 28499a2dd95SBruce Richardson typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev, 28599a2dd95SBruce Richardson uint16_t queue_id); 28699a2dd95SBruce Richardson /**< @internal Start rx and tx of a queue of an Ethernet device. */ 28799a2dd95SBruce Richardson 28899a2dd95SBruce Richardson typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev, 28999a2dd95SBruce Richardson uint16_t queue_id); 29099a2dd95SBruce Richardson /**< @internal Stop rx and tx of a queue of an Ethernet device. */ 29199a2dd95SBruce Richardson 29299a2dd95SBruce Richardson typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev, 29399a2dd95SBruce Richardson uint16_t rx_queue_id, 29499a2dd95SBruce Richardson uint16_t nb_rx_desc, 29599a2dd95SBruce Richardson unsigned int socket_id, 29699a2dd95SBruce Richardson const struct rte_eth_rxconf *rx_conf, 29799a2dd95SBruce Richardson struct rte_mempool *mb_pool); 29899a2dd95SBruce Richardson /**< @internal Set up a receive queue of an Ethernet device. */ 29999a2dd95SBruce Richardson 30099a2dd95SBruce Richardson typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev, 30199a2dd95SBruce Richardson uint16_t tx_queue_id, 30299a2dd95SBruce Richardson uint16_t nb_tx_desc, 30399a2dd95SBruce Richardson unsigned int socket_id, 30499a2dd95SBruce Richardson const struct rte_eth_txconf *tx_conf); 30599a2dd95SBruce Richardson /**< @internal Setup a transmit queue of an Ethernet device. */ 30699a2dd95SBruce Richardson 30799a2dd95SBruce Richardson typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev, 30899a2dd95SBruce Richardson uint16_t rx_queue_id); 30999a2dd95SBruce Richardson /**< @internal Enable interrupt of a receive queue of an Ethernet device. */ 31099a2dd95SBruce Richardson 31199a2dd95SBruce Richardson typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev, 31299a2dd95SBruce Richardson uint16_t rx_queue_id); 31399a2dd95SBruce Richardson /**< @internal Disable interrupt of a receive queue of an Ethernet device. */ 31499a2dd95SBruce Richardson 31599a2dd95SBruce Richardson typedef void (*eth_queue_release_t)(void *queue); 31699a2dd95SBruce Richardson /**< @internal Release memory resources allocated by given RX/TX queue. */ 31799a2dd95SBruce Richardson 31899a2dd95SBruce Richardson typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev, 31999a2dd95SBruce Richardson char *fw_version, size_t fw_size); 32099a2dd95SBruce Richardson /**< @internal Get firmware information of an Ethernet device. */ 32199a2dd95SBruce Richardson 32299a2dd95SBruce Richardson typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt); 32399a2dd95SBruce Richardson /**< @internal Force mbufs to be from TX ring. */ 32499a2dd95SBruce Richardson 32599a2dd95SBruce Richardson typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev, 32699a2dd95SBruce Richardson uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo); 32799a2dd95SBruce Richardson 32899a2dd95SBruce Richardson typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev, 32999a2dd95SBruce Richardson uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo); 33099a2dd95SBruce Richardson 33199a2dd95SBruce Richardson typedef int (*eth_burst_mode_get_t)(struct rte_eth_dev *dev, 33299a2dd95SBruce Richardson uint16_t queue_id, struct rte_eth_burst_mode *mode); 33399a2dd95SBruce Richardson 33499a2dd95SBruce Richardson typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu); 33599a2dd95SBruce Richardson /**< @internal Set MTU. */ 33699a2dd95SBruce Richardson 33799a2dd95SBruce Richardson typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev, 33899a2dd95SBruce Richardson uint16_t vlan_id, 33999a2dd95SBruce Richardson int on); 34099a2dd95SBruce Richardson /**< @internal filtering of a VLAN Tag Identifier by an Ethernet device. */ 34199a2dd95SBruce Richardson 34299a2dd95SBruce Richardson typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev, 34399a2dd95SBruce Richardson enum rte_vlan_type type, uint16_t tpid); 34499a2dd95SBruce Richardson /**< @internal set the outer/inner VLAN-TPID by an Ethernet device. */ 34599a2dd95SBruce Richardson 34699a2dd95SBruce Richardson typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask); 34799a2dd95SBruce Richardson /**< @internal set VLAN offload function by an Ethernet device. */ 34899a2dd95SBruce Richardson 34999a2dd95SBruce Richardson typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev, 35099a2dd95SBruce Richardson uint16_t vlan_id, 35199a2dd95SBruce Richardson int on); 35299a2dd95SBruce Richardson /**< @internal set port based TX VLAN insertion by an Ethernet device. */ 35399a2dd95SBruce Richardson 35499a2dd95SBruce Richardson typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev, 35599a2dd95SBruce Richardson uint16_t rx_queue_id, 35699a2dd95SBruce Richardson int on); 35799a2dd95SBruce Richardson /**< @internal VLAN stripping enable/disable by an queue of Ethernet device. */ 35899a2dd95SBruce Richardson 35999a2dd95SBruce Richardson typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev, 36099a2dd95SBruce Richardson struct rte_eth_fc_conf *fc_conf); 36199a2dd95SBruce Richardson /**< @internal Get current flow control parameter on an Ethernet device */ 36299a2dd95SBruce Richardson 36399a2dd95SBruce Richardson typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev, 36499a2dd95SBruce Richardson struct rte_eth_fc_conf *fc_conf); 36599a2dd95SBruce Richardson /**< @internal Setup flow control parameter on an Ethernet device */ 36699a2dd95SBruce Richardson 36799a2dd95SBruce Richardson typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev, 36899a2dd95SBruce Richardson struct rte_eth_pfc_conf *pfc_conf); 36999a2dd95SBruce Richardson /**< @internal Setup priority flow control parameter on an Ethernet device */ 37099a2dd95SBruce Richardson 37199a2dd95SBruce Richardson typedef int (*reta_update_t)(struct rte_eth_dev *dev, 37299a2dd95SBruce Richardson struct rte_eth_rss_reta_entry64 *reta_conf, 37399a2dd95SBruce Richardson uint16_t reta_size); 37499a2dd95SBruce Richardson /**< @internal Update RSS redirection table on an Ethernet device */ 37599a2dd95SBruce Richardson 37699a2dd95SBruce Richardson typedef int (*reta_query_t)(struct rte_eth_dev *dev, 37799a2dd95SBruce Richardson struct rte_eth_rss_reta_entry64 *reta_conf, 37899a2dd95SBruce Richardson uint16_t reta_size); 37999a2dd95SBruce Richardson /**< @internal Query RSS redirection table on an Ethernet device */ 38099a2dd95SBruce Richardson 38199a2dd95SBruce Richardson typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev, 38299a2dd95SBruce Richardson struct rte_eth_rss_conf *rss_conf); 38399a2dd95SBruce Richardson /**< @internal Update RSS hash configuration of an Ethernet device */ 38499a2dd95SBruce Richardson 38599a2dd95SBruce Richardson typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev, 38699a2dd95SBruce Richardson struct rte_eth_rss_conf *rss_conf); 38799a2dd95SBruce Richardson /**< @internal Get current RSS hash configuration of an Ethernet device */ 38899a2dd95SBruce Richardson 38999a2dd95SBruce Richardson typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev); 39099a2dd95SBruce Richardson /**< @internal Turn on SW controllable LED on an Ethernet device */ 39199a2dd95SBruce Richardson 39299a2dd95SBruce Richardson typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev); 39399a2dd95SBruce Richardson /**< @internal Turn off SW controllable LED on an Ethernet device */ 39499a2dd95SBruce Richardson 39599a2dd95SBruce Richardson typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index); 39699a2dd95SBruce Richardson /**< @internal Remove MAC address from receive address register */ 39799a2dd95SBruce Richardson 39899a2dd95SBruce Richardson typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev, 39999a2dd95SBruce Richardson struct rte_ether_addr *mac_addr, 40099a2dd95SBruce Richardson uint32_t index, 40199a2dd95SBruce Richardson uint32_t vmdq); 40299a2dd95SBruce Richardson /**< @internal Set a MAC address into Receive Address Register */ 40399a2dd95SBruce Richardson 40499a2dd95SBruce Richardson typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev, 40599a2dd95SBruce Richardson struct rte_ether_addr *mac_addr); 40699a2dd95SBruce Richardson /**< @internal Set a MAC address into Receive Address Register */ 40799a2dd95SBruce Richardson 40899a2dd95SBruce Richardson typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev, 40999a2dd95SBruce Richardson struct rte_ether_addr *mac_addr, 41099a2dd95SBruce Richardson uint8_t on); 41199a2dd95SBruce Richardson /**< @internal Set a Unicast Hash bitmap */ 41299a2dd95SBruce Richardson 41399a2dd95SBruce Richardson typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev, 41499a2dd95SBruce Richardson uint8_t on); 41599a2dd95SBruce Richardson /**< @internal Set all Unicast Hash bitmap */ 41699a2dd95SBruce Richardson 41799a2dd95SBruce Richardson typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev, 41899a2dd95SBruce Richardson uint16_t queue_idx, 41999a2dd95SBruce Richardson uint16_t tx_rate); 42099a2dd95SBruce Richardson /**< @internal Set queue TX rate */ 42199a2dd95SBruce Richardson 42299a2dd95SBruce Richardson typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev, 42399a2dd95SBruce Richardson struct rte_eth_mirror_conf *mirror_conf, 42499a2dd95SBruce Richardson uint8_t rule_id, 42599a2dd95SBruce Richardson uint8_t on); 42699a2dd95SBruce Richardson /**< @internal Add a traffic mirroring rule on an Ethernet device */ 42799a2dd95SBruce Richardson 42899a2dd95SBruce Richardson typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev, 42999a2dd95SBruce Richardson uint8_t rule_id); 43099a2dd95SBruce Richardson /**< @internal Remove a traffic mirroring rule on an Ethernet device */ 43199a2dd95SBruce Richardson 43299a2dd95SBruce Richardson typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, 43399a2dd95SBruce Richardson struct rte_eth_udp_tunnel *tunnel_udp); 43499a2dd95SBruce Richardson /**< @internal Add tunneling UDP port */ 43599a2dd95SBruce Richardson 43699a2dd95SBruce Richardson typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, 43799a2dd95SBruce Richardson struct rte_eth_udp_tunnel *tunnel_udp); 43899a2dd95SBruce Richardson /**< @internal Delete tunneling UDP port */ 43999a2dd95SBruce Richardson 44099a2dd95SBruce Richardson typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev, 44199a2dd95SBruce Richardson struct rte_ether_addr *mc_addr_set, 44299a2dd95SBruce Richardson uint32_t nb_mc_addr); 44399a2dd95SBruce Richardson /**< @internal set the list of multicast addresses on an Ethernet device */ 44499a2dd95SBruce Richardson 44599a2dd95SBruce Richardson typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev); 44699a2dd95SBruce Richardson /**< @internal Function used to enable IEEE1588/802.1AS timestamping. */ 44799a2dd95SBruce Richardson 44899a2dd95SBruce Richardson typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev); 44999a2dd95SBruce Richardson /**< @internal Function used to disable IEEE1588/802.1AS timestamping. */ 45099a2dd95SBruce Richardson 45199a2dd95SBruce Richardson typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev, 45299a2dd95SBruce Richardson struct timespec *timestamp, 45399a2dd95SBruce Richardson uint32_t flags); 45499a2dd95SBruce Richardson /**< @internal Function used to read an RX IEEE1588/802.1AS timestamp. */ 45599a2dd95SBruce Richardson 45699a2dd95SBruce Richardson typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev, 45799a2dd95SBruce Richardson struct timespec *timestamp); 45899a2dd95SBruce Richardson /**< @internal Function used to read a TX IEEE1588/802.1AS timestamp. */ 45999a2dd95SBruce Richardson 46099a2dd95SBruce Richardson typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t); 46199a2dd95SBruce Richardson /**< @internal Function used to adjust the device clock */ 46299a2dd95SBruce Richardson 46399a2dd95SBruce Richardson typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev, 46499a2dd95SBruce Richardson struct timespec *timestamp); 46599a2dd95SBruce Richardson /**< @internal Function used to get time from the device clock. */ 46699a2dd95SBruce Richardson 46799a2dd95SBruce Richardson typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev, 46899a2dd95SBruce Richardson const struct timespec *timestamp); 46999a2dd95SBruce Richardson /**< @internal Function used to get time from the device clock */ 47099a2dd95SBruce Richardson 47199a2dd95SBruce Richardson typedef int (*eth_read_clock)(struct rte_eth_dev *dev, 47299a2dd95SBruce Richardson uint64_t *timestamp); 47399a2dd95SBruce Richardson /**< @internal Function used to get the current value of the device clock. */ 47499a2dd95SBruce Richardson 47599a2dd95SBruce Richardson typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev, 47699a2dd95SBruce Richardson struct rte_dev_reg_info *info); 47799a2dd95SBruce Richardson /**< @internal Retrieve registers */ 47899a2dd95SBruce Richardson 47999a2dd95SBruce Richardson typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev); 48099a2dd95SBruce Richardson /**< @internal Retrieve eeprom size */ 48199a2dd95SBruce Richardson 48299a2dd95SBruce Richardson typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev, 48399a2dd95SBruce Richardson struct rte_dev_eeprom_info *info); 48499a2dd95SBruce Richardson /**< @internal Retrieve eeprom data */ 48599a2dd95SBruce Richardson 48699a2dd95SBruce Richardson typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, 48799a2dd95SBruce Richardson struct rte_dev_eeprom_info *info); 48899a2dd95SBruce Richardson /**< @internal Program eeprom data */ 48999a2dd95SBruce Richardson 49099a2dd95SBruce Richardson typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev, 49199a2dd95SBruce Richardson struct rte_eth_dev_module_info *modinfo); 49299a2dd95SBruce Richardson /**< @internal Retrieve type and size of plugin module eeprom */ 49399a2dd95SBruce Richardson 49499a2dd95SBruce Richardson typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev, 49599a2dd95SBruce Richardson struct rte_dev_eeprom_info *info); 49699a2dd95SBruce Richardson /**< @internal Retrieve plugin module eeprom data */ 49799a2dd95SBruce Richardson 49899a2dd95SBruce Richardson struct rte_flow_ops; 49999a2dd95SBruce Richardson /** 50099a2dd95SBruce Richardson * @internal 50199a2dd95SBruce Richardson * Get flow operations. 50299a2dd95SBruce Richardson * 50399a2dd95SBruce Richardson * If the flow API is not supported for the specified device, 50499a2dd95SBruce Richardson * the driver can return NULL. 50599a2dd95SBruce Richardson */ 50699a2dd95SBruce Richardson typedef int (*eth_flow_ops_get_t)(struct rte_eth_dev *dev, 50799a2dd95SBruce Richardson const struct rte_flow_ops **ops); 50899a2dd95SBruce Richardson 50999a2dd95SBruce Richardson typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops); 51099a2dd95SBruce Richardson /**< @internal Get Traffic Management (TM) operations on an Ethernet device */ 51199a2dd95SBruce Richardson 51299a2dd95SBruce Richardson typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops); 51399a2dd95SBruce Richardson /**< @internal Get Traffic Metering and Policing (MTR) operations */ 51499a2dd95SBruce Richardson 51599a2dd95SBruce Richardson typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev, 51699a2dd95SBruce Richardson struct rte_eth_dcb_info *dcb_info); 51799a2dd95SBruce Richardson /**< @internal Get dcb information on an Ethernet device */ 51899a2dd95SBruce Richardson 51999a2dd95SBruce Richardson typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev, 52099a2dd95SBruce Richardson const char *pool); 52199a2dd95SBruce Richardson /**< @internal Test if a port supports specific mempool ops */ 52299a2dd95SBruce Richardson 52399a2dd95SBruce Richardson /** 52499a2dd95SBruce Richardson * @internal 52599a2dd95SBruce Richardson * Get the hairpin capabilities. 52699a2dd95SBruce Richardson * 52799a2dd95SBruce Richardson * @param dev 52899a2dd95SBruce Richardson * ethdev handle of port. 52999a2dd95SBruce Richardson * @param cap 53099a2dd95SBruce Richardson * returns the hairpin capabilities from the device. 53199a2dd95SBruce Richardson * 53299a2dd95SBruce Richardson * @return 53399a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 53499a2dd95SBruce Richardson * 53599a2dd95SBruce Richardson * @retval 0 53699a2dd95SBruce Richardson * Success, hairpin is supported. 53799a2dd95SBruce Richardson * @retval -ENOTSUP 53899a2dd95SBruce Richardson * Hairpin is not supported. 53999a2dd95SBruce Richardson */ 54099a2dd95SBruce Richardson typedef int (*eth_hairpin_cap_get_t)(struct rte_eth_dev *dev, 54199a2dd95SBruce Richardson struct rte_eth_hairpin_cap *cap); 54299a2dd95SBruce Richardson 54399a2dd95SBruce Richardson /** 54499a2dd95SBruce Richardson * @internal 54599a2dd95SBruce Richardson * Setup RX hairpin queue. 54699a2dd95SBruce Richardson * 54799a2dd95SBruce Richardson * @param dev 54899a2dd95SBruce Richardson * ethdev handle of port. 54999a2dd95SBruce Richardson * @param rx_queue_id 55099a2dd95SBruce Richardson * the selected RX queue index. 55199a2dd95SBruce Richardson * @param nb_rx_desc 55299a2dd95SBruce Richardson * the requested number of descriptors for this queue. 0 - use PMD default. 55399a2dd95SBruce Richardson * @param conf 55499a2dd95SBruce Richardson * the RX hairpin configuration structure. 55599a2dd95SBruce Richardson * 55699a2dd95SBruce Richardson * @return 55799a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 55899a2dd95SBruce Richardson * 55999a2dd95SBruce Richardson * @retval 0 56099a2dd95SBruce Richardson * Success, hairpin is supported. 56199a2dd95SBruce Richardson * @retval -ENOTSUP 56299a2dd95SBruce Richardson * Hairpin is not supported. 56399a2dd95SBruce Richardson * @retval -EINVAL 56499a2dd95SBruce Richardson * One of the parameters is invalid. 56599a2dd95SBruce Richardson * @retval -ENOMEM 56699a2dd95SBruce Richardson * Unable to allocate resources. 56799a2dd95SBruce Richardson */ 56899a2dd95SBruce Richardson typedef int (*eth_rx_hairpin_queue_setup_t) 56999a2dd95SBruce Richardson (struct rte_eth_dev *dev, uint16_t rx_queue_id, 57099a2dd95SBruce Richardson uint16_t nb_rx_desc, 57199a2dd95SBruce Richardson const struct rte_eth_hairpin_conf *conf); 57299a2dd95SBruce Richardson 57399a2dd95SBruce Richardson /** 57499a2dd95SBruce Richardson * @internal 57599a2dd95SBruce Richardson * Setup TX hairpin queue. 57699a2dd95SBruce Richardson * 57799a2dd95SBruce Richardson * @param dev 57899a2dd95SBruce Richardson * ethdev handle of port. 57999a2dd95SBruce Richardson * @param tx_queue_id 58099a2dd95SBruce Richardson * the selected TX queue index. 58199a2dd95SBruce Richardson * @param nb_tx_desc 58299a2dd95SBruce Richardson * the requested number of descriptors for this queue. 0 - use PMD default. 58399a2dd95SBruce Richardson * @param conf 58499a2dd95SBruce Richardson * the TX hairpin configuration structure. 58599a2dd95SBruce Richardson * 58699a2dd95SBruce Richardson * @return 58799a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 58899a2dd95SBruce Richardson * 58999a2dd95SBruce Richardson * @retval 0 59099a2dd95SBruce Richardson * Success, hairpin is supported. 59199a2dd95SBruce Richardson * @retval -ENOTSUP 59299a2dd95SBruce Richardson * Hairpin is not supported. 59399a2dd95SBruce Richardson * @retval -EINVAL 59499a2dd95SBruce Richardson * One of the parameters is invalid. 59599a2dd95SBruce Richardson * @retval -ENOMEM 59699a2dd95SBruce Richardson * Unable to allocate resources. 59799a2dd95SBruce Richardson */ 59899a2dd95SBruce Richardson typedef int (*eth_tx_hairpin_queue_setup_t) 59999a2dd95SBruce Richardson (struct rte_eth_dev *dev, uint16_t tx_queue_id, 60099a2dd95SBruce Richardson uint16_t nb_tx_desc, 60199a2dd95SBruce Richardson const struct rte_eth_hairpin_conf *hairpin_conf); 60299a2dd95SBruce Richardson 60399a2dd95SBruce Richardson /** 60499a2dd95SBruce Richardson * @internal 60599a2dd95SBruce Richardson * Get Forward Error Correction(FEC) capability. 60699a2dd95SBruce Richardson * 60799a2dd95SBruce Richardson * @param dev 60899a2dd95SBruce Richardson * ethdev handle of port. 60999a2dd95SBruce Richardson * @param speed_fec_capa 61099a2dd95SBruce Richardson * speed_fec_capa is out only with per-speed capabilities. 61199a2dd95SBruce Richardson * @param num 61299a2dd95SBruce Richardson * a number of elements in an speed_fec_capa array. 61399a2dd95SBruce Richardson * 61499a2dd95SBruce Richardson * @return 61599a2dd95SBruce Richardson * Negative errno value on error, positive value on success. 61699a2dd95SBruce Richardson * 61799a2dd95SBruce Richardson * @retval positive value 61899a2dd95SBruce Richardson * A non-negative value lower or equal to num: success. The return value 61999a2dd95SBruce Richardson * is the number of entries filled in the fec capa array. 62099a2dd95SBruce Richardson * A non-negative value higher than num: error, the given fec capa array 62199a2dd95SBruce Richardson * is too small. The return value corresponds to the num that should 62299a2dd95SBruce Richardson * be given to succeed. The entries in the fec capa array are not valid 62399a2dd95SBruce Richardson * and shall not be used by the caller. 62499a2dd95SBruce Richardson * @retval -ENOTSUP 62599a2dd95SBruce Richardson * Operation is not supported. 62699a2dd95SBruce Richardson * @retval -EIO 62799a2dd95SBruce Richardson * Device is removed. 62899a2dd95SBruce Richardson * @retval -EINVAL 62999a2dd95SBruce Richardson * *num* or *speed_fec_capa* invalid. 63099a2dd95SBruce Richardson */ 63199a2dd95SBruce Richardson typedef int (*eth_fec_get_capability_t)(struct rte_eth_dev *dev, 63299a2dd95SBruce Richardson struct rte_eth_fec_capa *speed_fec_capa, unsigned int num); 63399a2dd95SBruce Richardson 63499a2dd95SBruce Richardson /** 63599a2dd95SBruce Richardson * @internal 63699a2dd95SBruce Richardson * Get Forward Error Correction(FEC) mode. 63799a2dd95SBruce Richardson * 63899a2dd95SBruce Richardson * @param dev 63999a2dd95SBruce Richardson * ethdev handle of port. 64099a2dd95SBruce Richardson * @param fec_capa 64199a2dd95SBruce Richardson * a bitmask of enabled FEC modes. If AUTO bit is set, other 64299a2dd95SBruce Richardson * bits specify FEC modes which may be negotiated. If AUTO 64399a2dd95SBruce Richardson * bit is clear, specify FEC modes to be used (only one valid 64499a2dd95SBruce Richardson * mode per speed may be set). 64599a2dd95SBruce Richardson * 64699a2dd95SBruce Richardson * @return 64799a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 64899a2dd95SBruce Richardson * 64999a2dd95SBruce Richardson * @retval 0 65099a2dd95SBruce Richardson * Success, get FEC success. 65199a2dd95SBruce Richardson * @retval -ENOTSUP 65299a2dd95SBruce Richardson * Operation is not supported. 65399a2dd95SBruce Richardson * @retval -EIO 65499a2dd95SBruce Richardson * Device is removed. 65599a2dd95SBruce Richardson */ 65699a2dd95SBruce Richardson typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev, 65799a2dd95SBruce Richardson uint32_t *fec_capa); 65899a2dd95SBruce Richardson 65999a2dd95SBruce Richardson /** 66099a2dd95SBruce Richardson * @internal 66199a2dd95SBruce Richardson * Set Forward Error Correction(FEC) mode. 66299a2dd95SBruce Richardson * 66399a2dd95SBruce Richardson * @param dev 66499a2dd95SBruce Richardson * ethdev handle of port. 66599a2dd95SBruce Richardson * @param fec_capa 66699a2dd95SBruce Richardson * bitmask of allowed FEC modes. It must be only one 66799a2dd95SBruce Richardson * if AUTO is disabled. If AUTO is enabled, other 66899a2dd95SBruce Richardson * bits specify FEC modes which may be negotiated. 66999a2dd95SBruce Richardson * 67099a2dd95SBruce Richardson * @return 67199a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 67299a2dd95SBruce Richardson * 67399a2dd95SBruce Richardson * @retval 0 67499a2dd95SBruce Richardson * Success, set FEC success. 67599a2dd95SBruce Richardson * @retval -ENOTSUP 67699a2dd95SBruce Richardson * Operation is not supported. 67799a2dd95SBruce Richardson * @retval -EINVAL 67899a2dd95SBruce Richardson * Unsupported FEC mode requested. 67999a2dd95SBruce Richardson * @retval -EIO 68099a2dd95SBruce Richardson * Device is removed. 68199a2dd95SBruce Richardson */ 68299a2dd95SBruce Richardson typedef int (*eth_fec_set_t)(struct rte_eth_dev *dev, uint32_t fec_capa); 68399a2dd95SBruce Richardson 68499a2dd95SBruce Richardson /** 68599a2dd95SBruce Richardson * @internal 68699a2dd95SBruce Richardson * Get all hairpin Tx/Rx peer ports of the current device, if any. 68799a2dd95SBruce Richardson * 68899a2dd95SBruce Richardson * @param dev 68999a2dd95SBruce Richardson * ethdev handle of port. 69099a2dd95SBruce Richardson * @param peer_ports 69199a2dd95SBruce Richardson * array to save the ports list. 69299a2dd95SBruce Richardson * @param len 69399a2dd95SBruce Richardson * array length. 69499a2dd95SBruce Richardson * @param direction 69599a2dd95SBruce Richardson * value to decide the current to peer direction 69699a2dd95SBruce Richardson * positive - used as Tx to get all peer Rx ports. 69799a2dd95SBruce Richardson * zero - used as Rx to get all peer Tx ports. 69899a2dd95SBruce Richardson * 69999a2dd95SBruce Richardson * @return 70099a2dd95SBruce Richardson * Negative errno value on error, 0 or positive on success. 70199a2dd95SBruce Richardson * 70299a2dd95SBruce Richardson * @retval 0 70399a2dd95SBruce Richardson * Success, no peer ports. 70499a2dd95SBruce Richardson * @retval >0 70599a2dd95SBruce Richardson * Actual number of the peer ports. 70699a2dd95SBruce Richardson * @retval -ENOTSUP 70799a2dd95SBruce Richardson * Get peer ports API is not supported. 70899a2dd95SBruce Richardson * @retval -EINVAL 70999a2dd95SBruce Richardson * One of the parameters is invalid. 71099a2dd95SBruce Richardson */ 71199a2dd95SBruce Richardson typedef int (*hairpin_get_peer_ports_t)(struct rte_eth_dev *dev, 71299a2dd95SBruce Richardson uint16_t *peer_ports, size_t len, 71399a2dd95SBruce Richardson uint32_t direction); 71499a2dd95SBruce Richardson 71599a2dd95SBruce Richardson /** 71699a2dd95SBruce Richardson * @internal 71799a2dd95SBruce Richardson * Bind all hairpin Tx queues of one port to the Rx queues of the peer port. 71899a2dd95SBruce Richardson * 71999a2dd95SBruce Richardson * @param dev 72099a2dd95SBruce Richardson * ethdev handle of port. 72199a2dd95SBruce Richardson * @param rx_port 72299a2dd95SBruce Richardson * the peer Rx port. 72399a2dd95SBruce Richardson * 72499a2dd95SBruce Richardson * @return 72599a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 72699a2dd95SBruce Richardson * 72799a2dd95SBruce Richardson * @retval 0 72899a2dd95SBruce Richardson * Success, bind successfully. 72999a2dd95SBruce Richardson * @retval -ENOTSUP 73099a2dd95SBruce Richardson * Bind API is not supported. 73199a2dd95SBruce Richardson * @retval -EINVAL 73299a2dd95SBruce Richardson * One of the parameters is invalid. 73399a2dd95SBruce Richardson * @retval -EBUSY 73499a2dd95SBruce Richardson * Device is not started. 73599a2dd95SBruce Richardson */ 73699a2dd95SBruce Richardson typedef int (*eth_hairpin_bind_t)(struct rte_eth_dev *dev, 73799a2dd95SBruce Richardson uint16_t rx_port); 73899a2dd95SBruce Richardson 73999a2dd95SBruce Richardson /** 74099a2dd95SBruce Richardson * @internal 74199a2dd95SBruce Richardson * Unbind all hairpin Tx queues of one port from the Rx queues of the peer port. 74299a2dd95SBruce Richardson * 74399a2dd95SBruce Richardson * @param dev 74499a2dd95SBruce Richardson * ethdev handle of port. 74599a2dd95SBruce Richardson * @param rx_port 74699a2dd95SBruce Richardson * the peer Rx port. 74799a2dd95SBruce Richardson * 74899a2dd95SBruce Richardson * @return 74999a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 75099a2dd95SBruce Richardson * 75199a2dd95SBruce Richardson * @retval 0 75299a2dd95SBruce Richardson * Success, unbind successfully. 75399a2dd95SBruce Richardson * @retval -ENOTSUP 75499a2dd95SBruce Richardson * Bind API is not supported. 75599a2dd95SBruce Richardson * @retval -EINVAL 75699a2dd95SBruce Richardson * One of the parameters is invalid. 75799a2dd95SBruce Richardson * @retval -EBUSY 75899a2dd95SBruce Richardson * Device is already stopped. 75999a2dd95SBruce Richardson */ 76099a2dd95SBruce Richardson typedef int (*eth_hairpin_unbind_t)(struct rte_eth_dev *dev, 76199a2dd95SBruce Richardson uint16_t rx_port); 76299a2dd95SBruce Richardson 76399a2dd95SBruce Richardson typedef int (*eth_hairpin_queue_peer_update_t) 76499a2dd95SBruce Richardson (struct rte_eth_dev *dev, uint16_t peer_queue, 76599a2dd95SBruce Richardson struct rte_hairpin_peer_info *current_info, 76699a2dd95SBruce Richardson struct rte_hairpin_peer_info *peer_info, uint32_t direction); 76799a2dd95SBruce Richardson /**< @internal Update and fetch peer queue information. */ 76899a2dd95SBruce Richardson 76999a2dd95SBruce Richardson typedef int (*eth_hairpin_queue_peer_bind_t) 77099a2dd95SBruce Richardson (struct rte_eth_dev *dev, uint16_t cur_queue, 77199a2dd95SBruce Richardson struct rte_hairpin_peer_info *peer_info, uint32_t direction); 77299a2dd95SBruce Richardson /**< @internal Bind peer queue to the current queue with fetched information. */ 77399a2dd95SBruce Richardson 77499a2dd95SBruce Richardson typedef int (*eth_hairpin_queue_peer_unbind_t) 77599a2dd95SBruce Richardson (struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction); 77699a2dd95SBruce Richardson /**< @internal Unbind peer queue from the current queue. */ 77799a2dd95SBruce Richardson 77899a2dd95SBruce Richardson /** 77999a2dd95SBruce Richardson * @internal 78099a2dd95SBruce Richardson * Get address of memory location whose contents will change whenever there is 78199a2dd95SBruce Richardson * new data to be received on an Rx queue. 78299a2dd95SBruce Richardson * 78399a2dd95SBruce Richardson * @param rxq 78499a2dd95SBruce Richardson * Ethdev queue pointer. 78599a2dd95SBruce Richardson * @param pmc 78699a2dd95SBruce Richardson * The pointer to power-optimized monitoring condition structure. 78799a2dd95SBruce Richardson * @return 78899a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 78999a2dd95SBruce Richardson * 79099a2dd95SBruce Richardson * @retval 0 79199a2dd95SBruce Richardson * Success 79299a2dd95SBruce Richardson * @retval -EINVAL 79399a2dd95SBruce Richardson * Invalid parameters 79499a2dd95SBruce Richardson */ 79599a2dd95SBruce Richardson typedef int (*eth_get_monitor_addr_t)(void *rxq, 79699a2dd95SBruce Richardson struct rte_power_monitor_cond *pmc); 79799a2dd95SBruce Richardson 79899a2dd95SBruce Richardson /** 79999a2dd95SBruce Richardson * @internal 80099a2dd95SBruce Richardson * Get representor info to be able to calculate the unique representor ID. 80199a2dd95SBruce Richardson * 80299a2dd95SBruce Richardson * Caller should pass NULL as pointer of info to get number of entries, 80399a2dd95SBruce Richardson * allocate info buffer according to returned entry number, then call 80499a2dd95SBruce Richardson * again with buffer to get real info. 80599a2dd95SBruce Richardson * 80699a2dd95SBruce Richardson * To calculate the representor ID, caller should iterate each entry, 80799a2dd95SBruce Richardson * match controller index, pf index, vf or sf start index and range, 80899a2dd95SBruce Richardson * then calculate representor ID from offset to vf/sf start index. 80999a2dd95SBruce Richardson * @see rte_eth_representor_id_get. 81099a2dd95SBruce Richardson * 81199a2dd95SBruce Richardson * @param dev 81299a2dd95SBruce Richardson * Ethdev handle of port. 81399a2dd95SBruce Richardson * @param [out] info 81499a2dd95SBruce Richardson * Pointer to memory to save device representor info. 81599a2dd95SBruce Richardson * @return 81699a2dd95SBruce Richardson * Negative errno value on error, number of info entries otherwise. 81799a2dd95SBruce Richardson */ 81899a2dd95SBruce Richardson 81999a2dd95SBruce Richardson typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev, 82099a2dd95SBruce Richardson struct rte_eth_representor_info *info); 82199a2dd95SBruce Richardson 82299a2dd95SBruce Richardson /** 82399a2dd95SBruce Richardson * @internal A structure containing the functions exported by an Ethernet driver. 82499a2dd95SBruce Richardson */ 82599a2dd95SBruce Richardson struct eth_dev_ops { 82699a2dd95SBruce Richardson eth_dev_configure_t dev_configure; /**< Configure device. */ 82799a2dd95SBruce Richardson eth_dev_start_t dev_start; /**< Start device. */ 82899a2dd95SBruce Richardson eth_dev_stop_t dev_stop; /**< Stop device. */ 82999a2dd95SBruce Richardson eth_dev_set_link_up_t dev_set_link_up; /**< Device link up. */ 83099a2dd95SBruce Richardson eth_dev_set_link_down_t dev_set_link_down; /**< Device link down. */ 83199a2dd95SBruce Richardson eth_dev_close_t dev_close; /**< Close device. */ 83299a2dd95SBruce Richardson eth_dev_reset_t dev_reset; /**< Reset device. */ 83399a2dd95SBruce Richardson eth_link_update_t link_update; /**< Get device link state. */ 83499a2dd95SBruce Richardson eth_is_removed_t is_removed; 83599a2dd95SBruce Richardson /**< Check if the device was physically removed. */ 83699a2dd95SBruce Richardson 83799a2dd95SBruce Richardson eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON. */ 83899a2dd95SBruce Richardson eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF. */ 83999a2dd95SBruce Richardson eth_allmulticast_enable_t allmulticast_enable;/**< RX multicast ON. */ 84099a2dd95SBruce Richardson eth_allmulticast_disable_t allmulticast_disable;/**< RX multicast OFF. */ 84199a2dd95SBruce Richardson eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address. */ 84299a2dd95SBruce Richardson eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address. */ 84399a2dd95SBruce Richardson eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address. */ 84499a2dd95SBruce Richardson eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs. */ 84599a2dd95SBruce Richardson mtu_set_t mtu_set; /**< Set MTU. */ 84699a2dd95SBruce Richardson 84799a2dd95SBruce Richardson eth_stats_get_t stats_get; /**< Get generic device statistics. */ 84899a2dd95SBruce Richardson eth_stats_reset_t stats_reset; /**< Reset generic device statistics. */ 84999a2dd95SBruce Richardson eth_xstats_get_t xstats_get; /**< Get extended device statistics. */ 85099a2dd95SBruce Richardson eth_xstats_reset_t xstats_reset; /**< Reset extended device statistics. */ 85199a2dd95SBruce Richardson eth_xstats_get_names_t xstats_get_names; 85299a2dd95SBruce Richardson /**< Get names of extended statistics. */ 85399a2dd95SBruce Richardson eth_queue_stats_mapping_set_t queue_stats_mapping_set; 85499a2dd95SBruce Richardson /**< Configure per queue stat counter mapping. */ 85599a2dd95SBruce Richardson 85699a2dd95SBruce Richardson eth_dev_infos_get_t dev_infos_get; /**< Get device info. */ 85799a2dd95SBruce Richardson eth_rxq_info_get_t rxq_info_get; /**< retrieve RX queue information. */ 85899a2dd95SBruce Richardson eth_txq_info_get_t txq_info_get; /**< retrieve TX queue information. */ 85999a2dd95SBruce Richardson eth_burst_mode_get_t rx_burst_mode_get; /**< Get RX burst mode */ 86099a2dd95SBruce Richardson eth_burst_mode_get_t tx_burst_mode_get; /**< Get TX burst mode */ 86199a2dd95SBruce Richardson eth_fw_version_get_t fw_version_get; /**< Get firmware version. */ 86299a2dd95SBruce Richardson eth_dev_supported_ptypes_get_t dev_supported_ptypes_get; 86399a2dd95SBruce Richardson /**< Get packet types supported and identified by device. */ 86499a2dd95SBruce Richardson eth_dev_ptypes_set_t dev_ptypes_set; 86599a2dd95SBruce Richardson /**< Inform Ethernet device about reduced range of packet types to handle. */ 86699a2dd95SBruce Richardson 86799a2dd95SBruce Richardson vlan_filter_set_t vlan_filter_set; /**< Filter VLAN Setup. */ 86899a2dd95SBruce Richardson vlan_tpid_set_t vlan_tpid_set; /**< Outer/Inner VLAN TPID Setup. */ 86999a2dd95SBruce Richardson vlan_strip_queue_set_t vlan_strip_queue_set; /**< VLAN Stripping on queue. */ 87099a2dd95SBruce Richardson vlan_offload_set_t vlan_offload_set; /**< Set VLAN Offload. */ 87199a2dd95SBruce Richardson vlan_pvid_set_t vlan_pvid_set; /**< Set port based TX VLAN insertion. */ 87299a2dd95SBruce Richardson 87399a2dd95SBruce Richardson eth_queue_start_t rx_queue_start;/**< Start RX for a queue. */ 87499a2dd95SBruce Richardson eth_queue_stop_t rx_queue_stop; /**< Stop RX for a queue. */ 87599a2dd95SBruce Richardson eth_queue_start_t tx_queue_start;/**< Start TX for a queue. */ 87699a2dd95SBruce Richardson eth_queue_stop_t tx_queue_stop; /**< Stop TX for a queue. */ 87799a2dd95SBruce Richardson eth_rx_queue_setup_t rx_queue_setup;/**< Set up device RX queue. */ 87899a2dd95SBruce Richardson eth_queue_release_t rx_queue_release; /**< Release RX queue. */ 87999a2dd95SBruce Richardson 88099a2dd95SBruce Richardson eth_rx_enable_intr_t rx_queue_intr_enable; /**< Enable Rx queue interrupt. */ 88199a2dd95SBruce Richardson eth_rx_disable_intr_t rx_queue_intr_disable; /**< Disable Rx queue interrupt. */ 88299a2dd95SBruce Richardson eth_tx_queue_setup_t tx_queue_setup;/**< Set up device TX queue. */ 88399a2dd95SBruce Richardson eth_queue_release_t tx_queue_release; /**< Release TX queue. */ 88499a2dd95SBruce Richardson eth_tx_done_cleanup_t tx_done_cleanup;/**< Free tx ring mbufs */ 88599a2dd95SBruce Richardson 88699a2dd95SBruce Richardson eth_dev_led_on_t dev_led_on; /**< Turn on LED. */ 88799a2dd95SBruce Richardson eth_dev_led_off_t dev_led_off; /**< Turn off LED. */ 88899a2dd95SBruce Richardson 88999a2dd95SBruce Richardson flow_ctrl_get_t flow_ctrl_get; /**< Get flow control. */ 89099a2dd95SBruce Richardson flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control. */ 89199a2dd95SBruce Richardson priority_flow_ctrl_set_t priority_flow_ctrl_set; /**< Setup priority flow control. */ 89299a2dd95SBruce Richardson 89399a2dd95SBruce Richardson eth_uc_hash_table_set_t uc_hash_table_set; /**< Set Unicast Table Array. */ 89499a2dd95SBruce Richardson eth_uc_all_hash_table_set_t uc_all_hash_table_set; /**< Set Unicast hash bitmap. */ 89599a2dd95SBruce Richardson 89699a2dd95SBruce Richardson eth_mirror_rule_set_t mirror_rule_set; /**< Add a traffic mirror rule. */ 89799a2dd95SBruce Richardson eth_mirror_rule_reset_t mirror_rule_reset; /**< reset a traffic mirror rule. */ 89899a2dd95SBruce Richardson 89999a2dd95SBruce Richardson eth_udp_tunnel_port_add_t udp_tunnel_port_add; /** Add UDP tunnel port. */ 90099a2dd95SBruce Richardson eth_udp_tunnel_port_del_t udp_tunnel_port_del; /** Del UDP tunnel port. */ 90199a2dd95SBruce Richardson 90299a2dd95SBruce Richardson eth_set_queue_rate_limit_t set_queue_rate_limit; /**< Set queue rate limit. */ 90399a2dd95SBruce Richardson 90499a2dd95SBruce Richardson rss_hash_update_t rss_hash_update; /** Configure RSS hash protocols. */ 90599a2dd95SBruce Richardson rss_hash_conf_get_t rss_hash_conf_get; /** Get current RSS hash configuration. */ 90699a2dd95SBruce Richardson reta_update_t reta_update; /** Update redirection table. */ 90799a2dd95SBruce Richardson reta_query_t reta_query; /** Query redirection table. */ 90899a2dd95SBruce Richardson 90999a2dd95SBruce Richardson eth_get_reg_t get_reg; /**< Get registers. */ 91099a2dd95SBruce Richardson eth_get_eeprom_length_t get_eeprom_length; /**< Get eeprom length. */ 91199a2dd95SBruce Richardson eth_get_eeprom_t get_eeprom; /**< Get eeprom data. */ 91299a2dd95SBruce Richardson eth_set_eeprom_t set_eeprom; /**< Set eeprom. */ 91399a2dd95SBruce Richardson 91499a2dd95SBruce Richardson eth_get_module_info_t get_module_info; 91599a2dd95SBruce Richardson /** Get plugin module eeprom attribute. */ 91699a2dd95SBruce Richardson eth_get_module_eeprom_t get_module_eeprom; 91799a2dd95SBruce Richardson /** Get plugin module eeprom data. */ 91899a2dd95SBruce Richardson 91999a2dd95SBruce Richardson eth_flow_ops_get_t flow_ops_get; /**< Get flow operations. */ 92099a2dd95SBruce Richardson 92199a2dd95SBruce Richardson eth_get_dcb_info get_dcb_info; /** Get DCB information. */ 92299a2dd95SBruce Richardson 92399a2dd95SBruce Richardson eth_timesync_enable_t timesync_enable; 92499a2dd95SBruce Richardson /** Turn IEEE1588/802.1AS timestamping on. */ 92599a2dd95SBruce Richardson eth_timesync_disable_t timesync_disable; 92699a2dd95SBruce Richardson /** Turn IEEE1588/802.1AS timestamping off. */ 92799a2dd95SBruce Richardson eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp; 92899a2dd95SBruce Richardson /** Read the IEEE1588/802.1AS RX timestamp. */ 92999a2dd95SBruce Richardson eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp; 93099a2dd95SBruce Richardson /** Read the IEEE1588/802.1AS TX timestamp. */ 93199a2dd95SBruce Richardson eth_timesync_adjust_time timesync_adjust_time; /** Adjust the device clock. */ 93299a2dd95SBruce Richardson eth_timesync_read_time timesync_read_time; /** Get the device clock time. */ 93399a2dd95SBruce Richardson eth_timesync_write_time timesync_write_time; /** Set the device clock time. */ 93499a2dd95SBruce Richardson 93599a2dd95SBruce Richardson eth_read_clock read_clock; 93699a2dd95SBruce Richardson 93799a2dd95SBruce Richardson eth_xstats_get_by_id_t xstats_get_by_id; 93899a2dd95SBruce Richardson /**< Get extended device statistic values by ID. */ 93999a2dd95SBruce Richardson eth_xstats_get_names_by_id_t xstats_get_names_by_id; 94099a2dd95SBruce Richardson /**< Get name of extended device statistics by ID. */ 94199a2dd95SBruce Richardson 94299a2dd95SBruce Richardson eth_tm_ops_get_t tm_ops_get; 94399a2dd95SBruce Richardson /**< Get Traffic Management (TM) operations. */ 94499a2dd95SBruce Richardson 94599a2dd95SBruce Richardson eth_mtr_ops_get_t mtr_ops_get; 94699a2dd95SBruce Richardson /**< Get Traffic Metering and Policing (MTR) operations. */ 94799a2dd95SBruce Richardson 94899a2dd95SBruce Richardson eth_pool_ops_supported_t pool_ops_supported; 94999a2dd95SBruce Richardson /**< Test if a port supports specific mempool ops */ 95099a2dd95SBruce Richardson 95199a2dd95SBruce Richardson eth_hairpin_cap_get_t hairpin_cap_get; 95299a2dd95SBruce Richardson /**< Returns the hairpin capabilities. */ 95399a2dd95SBruce Richardson eth_rx_hairpin_queue_setup_t rx_hairpin_queue_setup; 95499a2dd95SBruce Richardson /**< Set up device RX hairpin queue. */ 95599a2dd95SBruce Richardson eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup; 95699a2dd95SBruce Richardson /**< Set up device TX hairpin queue. */ 95799a2dd95SBruce Richardson 95899a2dd95SBruce Richardson eth_fec_get_capability_t fec_get_capability; 95999a2dd95SBruce Richardson /**< Get Forward Error Correction(FEC) capability. */ 96099a2dd95SBruce Richardson eth_fec_get_t fec_get; 96199a2dd95SBruce Richardson /**< Get Forward Error Correction(FEC) mode. */ 96299a2dd95SBruce Richardson eth_fec_set_t fec_set; 96399a2dd95SBruce Richardson /**< Set Forward Error Correction(FEC) mode. */ 96499a2dd95SBruce Richardson hairpin_get_peer_ports_t hairpin_get_peer_ports; 96599a2dd95SBruce Richardson /**< Get hairpin peer ports list. */ 96699a2dd95SBruce Richardson eth_hairpin_bind_t hairpin_bind; 96799a2dd95SBruce Richardson /**< Bind all hairpin Tx queues of device to the peer port Rx queues. */ 96899a2dd95SBruce Richardson eth_hairpin_unbind_t hairpin_unbind; 96999a2dd95SBruce Richardson /**< Unbind all hairpin Tx queues from the peer port Rx queues. */ 97099a2dd95SBruce Richardson eth_hairpin_queue_peer_update_t hairpin_queue_peer_update; 97199a2dd95SBruce Richardson /**< Pass the current queue info and get the peer queue info. */ 97299a2dd95SBruce Richardson eth_hairpin_queue_peer_bind_t hairpin_queue_peer_bind; 97399a2dd95SBruce Richardson /**< Set up the connection between the pair of hairpin queues. */ 97499a2dd95SBruce Richardson eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind; 97599a2dd95SBruce Richardson /**< Disconnect the hairpin queues of a pair from each other. */ 97699a2dd95SBruce Richardson 97799a2dd95SBruce Richardson eth_get_monitor_addr_t get_monitor_addr; 97899a2dd95SBruce Richardson /**< Get power monitoring condition for Rx queue. */ 97999a2dd95SBruce Richardson 98099a2dd95SBruce Richardson eth_representor_info_get_t representor_info_get; 98199a2dd95SBruce Richardson /**< Get representor info. */ 98299a2dd95SBruce Richardson }; 98399a2dd95SBruce Richardson 98499a2dd95SBruce Richardson /** 98599a2dd95SBruce Richardson * @internal 98699a2dd95SBruce Richardson * Check if the selected Rx queue is hairpin queue. 98799a2dd95SBruce Richardson * 98899a2dd95SBruce Richardson * @param dev 98999a2dd95SBruce Richardson * Pointer to the selected device. 99099a2dd95SBruce Richardson * @param queue_id 99199a2dd95SBruce Richardson * The selected queue. 99299a2dd95SBruce Richardson * 99399a2dd95SBruce Richardson * @return 99499a2dd95SBruce Richardson * - (1) if the queue is hairpin queue, 0 otherwise. 99599a2dd95SBruce Richardson */ 99699a2dd95SBruce Richardson __rte_internal 99799a2dd95SBruce Richardson int rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id); 99899a2dd95SBruce Richardson 99999a2dd95SBruce Richardson /** 100099a2dd95SBruce Richardson * @internal 100199a2dd95SBruce Richardson * Check if the selected Tx queue is hairpin queue. 100299a2dd95SBruce Richardson * 100399a2dd95SBruce Richardson * @param dev 100499a2dd95SBruce Richardson * Pointer to the selected device. 100599a2dd95SBruce Richardson * @param queue_id 100699a2dd95SBruce Richardson * The selected queue. 100799a2dd95SBruce Richardson * 100899a2dd95SBruce Richardson * @return 100999a2dd95SBruce Richardson * - (1) if the queue is hairpin queue, 0 otherwise. 101099a2dd95SBruce Richardson */ 101199a2dd95SBruce Richardson __rte_internal 101299a2dd95SBruce Richardson int rte_eth_dev_is_tx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id); 101399a2dd95SBruce Richardson 101499a2dd95SBruce Richardson /** 101599a2dd95SBruce Richardson * @internal 101699a2dd95SBruce Richardson * Returns a ethdev slot specified by the unique identifier name. 101799a2dd95SBruce Richardson * 101899a2dd95SBruce Richardson * @param name 101999a2dd95SBruce Richardson * The pointer to the Unique identifier name for each Ethernet device 102099a2dd95SBruce Richardson * @return 102199a2dd95SBruce Richardson * - The pointer to the ethdev slot, on success. NULL on error 102299a2dd95SBruce Richardson */ 102399a2dd95SBruce Richardson __rte_internal 102499a2dd95SBruce Richardson struct rte_eth_dev *rte_eth_dev_allocated(const char *name); 102599a2dd95SBruce Richardson 102699a2dd95SBruce Richardson /** 102799a2dd95SBruce Richardson * @internal 102899a2dd95SBruce Richardson * Allocates a new ethdev slot for an ethernet device and returns the pointer 102999a2dd95SBruce Richardson * to that slot for the driver to use. 103099a2dd95SBruce Richardson * 103199a2dd95SBruce Richardson * @param name Unique identifier name for each Ethernet device 103299a2dd95SBruce Richardson * @return 103399a2dd95SBruce Richardson * - Slot in the rte_dev_devices array for a new device; 103499a2dd95SBruce Richardson */ 103599a2dd95SBruce Richardson __rte_internal 103699a2dd95SBruce Richardson struct rte_eth_dev *rte_eth_dev_allocate(const char *name); 103799a2dd95SBruce Richardson 103899a2dd95SBruce Richardson /** 103999a2dd95SBruce Richardson * @internal 104099a2dd95SBruce Richardson * Attach to the ethdev already initialized by the primary 104199a2dd95SBruce Richardson * process. 104299a2dd95SBruce Richardson * 104399a2dd95SBruce Richardson * @param name Ethernet device's name. 104499a2dd95SBruce Richardson * @return 104599a2dd95SBruce Richardson * - Success: Slot in the rte_dev_devices array for attached 104699a2dd95SBruce Richardson * device. 104799a2dd95SBruce Richardson * - Error: Null pointer. 104899a2dd95SBruce Richardson */ 104999a2dd95SBruce Richardson __rte_internal 105099a2dd95SBruce Richardson struct rte_eth_dev *rte_eth_dev_attach_secondary(const char *name); 105199a2dd95SBruce Richardson 105299a2dd95SBruce Richardson /** 105399a2dd95SBruce Richardson * @internal 105499a2dd95SBruce Richardson * Notify RTE_ETH_EVENT_DESTROY and release the specified ethdev port. 105599a2dd95SBruce Richardson * 105699a2dd95SBruce Richardson * The following PMD-managed data fields will be freed: 105799a2dd95SBruce Richardson * - dev_private 105899a2dd95SBruce Richardson * - mac_addrs 105999a2dd95SBruce Richardson * - hash_mac_addrs 106099a2dd95SBruce Richardson * If one of these fields should not be freed, 106199a2dd95SBruce Richardson * it must be reset to NULL by the PMD, typically in dev_close method. 106299a2dd95SBruce Richardson * 106399a2dd95SBruce Richardson * @param eth_dev 106499a2dd95SBruce Richardson * Device to be detached. 106599a2dd95SBruce Richardson * @return 106699a2dd95SBruce Richardson * - 0 on success, negative on error 106799a2dd95SBruce Richardson */ 106899a2dd95SBruce Richardson __rte_internal 106999a2dd95SBruce Richardson int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev); 107099a2dd95SBruce Richardson 107199a2dd95SBruce Richardson /** 107299a2dd95SBruce Richardson * @internal 107399a2dd95SBruce Richardson * Release device queues and clear its configuration to force the user 107499a2dd95SBruce Richardson * application to reconfigure it. It is for internal use only. 107599a2dd95SBruce Richardson * 107699a2dd95SBruce Richardson * @param dev 107799a2dd95SBruce Richardson * Pointer to struct rte_eth_dev. 107899a2dd95SBruce Richardson * 107999a2dd95SBruce Richardson * @return 108099a2dd95SBruce Richardson * void 108199a2dd95SBruce Richardson */ 108299a2dd95SBruce Richardson __rte_internal 108399a2dd95SBruce Richardson void rte_eth_dev_internal_reset(struct rte_eth_dev *dev); 108499a2dd95SBruce Richardson 108599a2dd95SBruce Richardson /** 108699a2dd95SBruce Richardson * @internal Executes all the user application registered callbacks for 108799a2dd95SBruce Richardson * the specific device. It is for DPDK internal user only. User 108899a2dd95SBruce Richardson * application should not call it directly. 108999a2dd95SBruce Richardson * 109099a2dd95SBruce Richardson * @param dev 109199a2dd95SBruce Richardson * Pointer to struct rte_eth_dev. 109299a2dd95SBruce Richardson * @param event 109399a2dd95SBruce Richardson * Eth device interrupt event type. 109499a2dd95SBruce Richardson * @param ret_param 109599a2dd95SBruce Richardson * To pass data back to user application. 109699a2dd95SBruce Richardson * This allows the user application to decide if a particular function 109799a2dd95SBruce Richardson * is permitted or not. 109899a2dd95SBruce Richardson * 109999a2dd95SBruce Richardson * @return 110099a2dd95SBruce Richardson * int 110199a2dd95SBruce Richardson */ 110299a2dd95SBruce Richardson __rte_internal 110399a2dd95SBruce Richardson int rte_eth_dev_callback_process(struct rte_eth_dev *dev, 110499a2dd95SBruce Richardson enum rte_eth_event_type event, void *ret_param); 110599a2dd95SBruce Richardson 110699a2dd95SBruce Richardson /** 110799a2dd95SBruce Richardson * @internal 110899a2dd95SBruce Richardson * This is the last step of device probing. 110999a2dd95SBruce Richardson * It must be called after a port is allocated and initialized successfully. 111099a2dd95SBruce Richardson * 111199a2dd95SBruce Richardson * The notification RTE_ETH_EVENT_NEW is sent to other entities 111299a2dd95SBruce Richardson * (libraries and applications). 111399a2dd95SBruce Richardson * The state is set as RTE_ETH_DEV_ATTACHED. 111499a2dd95SBruce Richardson * 111599a2dd95SBruce Richardson * @param dev 111699a2dd95SBruce Richardson * New ethdev port. 111799a2dd95SBruce Richardson */ 111899a2dd95SBruce Richardson __rte_internal 111999a2dd95SBruce Richardson void rte_eth_dev_probing_finish(struct rte_eth_dev *dev); 112099a2dd95SBruce Richardson 112199a2dd95SBruce Richardson /** 112299a2dd95SBruce Richardson * Create memzone for HW rings. 112399a2dd95SBruce Richardson * malloc can't be used as the physical address is needed. 112499a2dd95SBruce Richardson * If the memzone is already created, then this function returns a ptr 112599a2dd95SBruce Richardson * to the old one. 112699a2dd95SBruce Richardson * 112799a2dd95SBruce Richardson * @param eth_dev 112899a2dd95SBruce Richardson * The *eth_dev* pointer is the address of the *rte_eth_dev* structure 112999a2dd95SBruce Richardson * @param name 113099a2dd95SBruce Richardson * The name of the memory zone 113199a2dd95SBruce Richardson * @param queue_id 113299a2dd95SBruce Richardson * The index of the queue to add to name 113399a2dd95SBruce Richardson * @param size 113499a2dd95SBruce Richardson * The sizeof of the memory area 113599a2dd95SBruce Richardson * @param align 113699a2dd95SBruce Richardson * Alignment for resulting memzone. Must be a power of 2. 113799a2dd95SBruce Richardson * @param socket_id 113899a2dd95SBruce Richardson * The *socket_id* argument is the socket identifier in case of NUMA. 113999a2dd95SBruce Richardson */ 114099a2dd95SBruce Richardson __rte_internal 114199a2dd95SBruce Richardson const struct rte_memzone * 114299a2dd95SBruce Richardson rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name, 114399a2dd95SBruce Richardson uint16_t queue_id, size_t size, 114499a2dd95SBruce Richardson unsigned align, int socket_id); 114599a2dd95SBruce Richardson 114699a2dd95SBruce Richardson /** 114799a2dd95SBruce Richardson * Free previously allocated memzone for HW rings. 114899a2dd95SBruce Richardson * 114999a2dd95SBruce Richardson * @param eth_dev 115099a2dd95SBruce Richardson * The *eth_dev* pointer is the address of the *rte_eth_dev* structure 115199a2dd95SBruce Richardson * @param name 115299a2dd95SBruce Richardson * The name of the memory zone 115399a2dd95SBruce Richardson * @param queue_id 115499a2dd95SBruce Richardson * The index of the queue to add to name 115599a2dd95SBruce Richardson * @return 115699a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 115799a2dd95SBruce Richardson */ 115899a2dd95SBruce Richardson __rte_internal 115999a2dd95SBruce Richardson int 116099a2dd95SBruce Richardson rte_eth_dma_zone_free(const struct rte_eth_dev *eth_dev, const char *name, 116199a2dd95SBruce Richardson uint16_t queue_id); 116299a2dd95SBruce Richardson 116399a2dd95SBruce Richardson /** 116499a2dd95SBruce Richardson * @internal 116599a2dd95SBruce Richardson * Atomically set the link status for the specific device. 116699a2dd95SBruce Richardson * It is for use by DPDK device driver use only. 116799a2dd95SBruce Richardson * User applications should not call it 116899a2dd95SBruce Richardson * 116999a2dd95SBruce Richardson * @param dev 117099a2dd95SBruce Richardson * Pointer to struct rte_eth_dev. 117199a2dd95SBruce Richardson * @param link 117299a2dd95SBruce Richardson * New link status value. 117399a2dd95SBruce Richardson * @return 117499a2dd95SBruce Richardson * Same convention as eth_link_update operation. 117599a2dd95SBruce Richardson * 0 if link up status has changed 117699a2dd95SBruce Richardson * -1 if link up status was unchanged 117799a2dd95SBruce Richardson */ 117899a2dd95SBruce Richardson static inline int 117999a2dd95SBruce Richardson rte_eth_linkstatus_set(struct rte_eth_dev *dev, 118099a2dd95SBruce Richardson const struct rte_eth_link *new_link) 118199a2dd95SBruce Richardson { 118299a2dd95SBruce Richardson uint64_t *dev_link = (uint64_t *)&(dev->data->dev_link); 118399a2dd95SBruce Richardson union { 118499a2dd95SBruce Richardson uint64_t val64; 118599a2dd95SBruce Richardson struct rte_eth_link link; 118699a2dd95SBruce Richardson } orig; 118799a2dd95SBruce Richardson 118899a2dd95SBruce Richardson RTE_BUILD_BUG_ON(sizeof(*new_link) != sizeof(uint64_t)); 118999a2dd95SBruce Richardson 119099a2dd95SBruce Richardson orig.val64 = __atomic_exchange_n(dev_link, *(const uint64_t *)new_link, 119199a2dd95SBruce Richardson __ATOMIC_SEQ_CST); 119299a2dd95SBruce Richardson 119399a2dd95SBruce Richardson return (orig.link.link_status == new_link->link_status) ? -1 : 0; 119499a2dd95SBruce Richardson } 119599a2dd95SBruce Richardson 119699a2dd95SBruce Richardson /** 119799a2dd95SBruce Richardson * @internal 119899a2dd95SBruce Richardson * Atomically get the link speed and status. 119999a2dd95SBruce Richardson * 120099a2dd95SBruce Richardson * @param dev 120199a2dd95SBruce Richardson * Pointer to struct rte_eth_dev. 120299a2dd95SBruce Richardson * @param link 120399a2dd95SBruce Richardson * link status value. 120499a2dd95SBruce Richardson */ 120599a2dd95SBruce Richardson static inline void 120699a2dd95SBruce Richardson rte_eth_linkstatus_get(const struct rte_eth_dev *dev, 120799a2dd95SBruce Richardson struct rte_eth_link *link) 120899a2dd95SBruce Richardson { 120999a2dd95SBruce Richardson uint64_t *src = (uint64_t *)&(dev->data->dev_link); 121099a2dd95SBruce Richardson uint64_t *dst = (uint64_t *)link; 121199a2dd95SBruce Richardson 121299a2dd95SBruce Richardson RTE_BUILD_BUG_ON(sizeof(*link) != sizeof(uint64_t)); 121399a2dd95SBruce Richardson 121499a2dd95SBruce Richardson *dst = __atomic_load_n(src, __ATOMIC_SEQ_CST); 121599a2dd95SBruce Richardson } 121699a2dd95SBruce Richardson 121799a2dd95SBruce Richardson /** 121899a2dd95SBruce Richardson * Allocate an unique switch domain identifier. 121999a2dd95SBruce Richardson * 122099a2dd95SBruce Richardson * A pool of switch domain identifiers which can be allocated on request. This 122199a2dd95SBruce Richardson * will enabled devices which support the concept of switch domains to request 122299a2dd95SBruce Richardson * a switch domain id which is guaranteed to be unique from other devices 122399a2dd95SBruce Richardson * running in the same process. 122499a2dd95SBruce Richardson * 122599a2dd95SBruce Richardson * @param domain_id 122699a2dd95SBruce Richardson * switch domain identifier parameter to pass back to application 122799a2dd95SBruce Richardson * 122899a2dd95SBruce Richardson * @return 122999a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 123099a2dd95SBruce Richardson */ 123199a2dd95SBruce Richardson __rte_internal 123299a2dd95SBruce Richardson int 123399a2dd95SBruce Richardson rte_eth_switch_domain_alloc(uint16_t *domain_id); 123499a2dd95SBruce Richardson 123599a2dd95SBruce Richardson /** 123699a2dd95SBruce Richardson * Free switch domain. 123799a2dd95SBruce Richardson * 123899a2dd95SBruce Richardson * Return a switch domain identifier to the pool of free identifiers after it is 123999a2dd95SBruce Richardson * no longer in use by device. 124099a2dd95SBruce Richardson * 124199a2dd95SBruce Richardson * @param domain_id 124299a2dd95SBruce Richardson * switch domain identifier to free 124399a2dd95SBruce Richardson * 124499a2dd95SBruce Richardson * @return 124599a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 124699a2dd95SBruce Richardson */ 124799a2dd95SBruce Richardson __rte_internal 124899a2dd95SBruce Richardson int 124999a2dd95SBruce Richardson rte_eth_switch_domain_free(uint16_t domain_id); 125099a2dd95SBruce Richardson 125199a2dd95SBruce Richardson /** 125299a2dd95SBruce Richardson * Generic Ethernet device arguments 125399a2dd95SBruce Richardson * 125499a2dd95SBruce Richardson * One type of representor each structure. 125599a2dd95SBruce Richardson */ 125699a2dd95SBruce Richardson struct rte_eth_devargs { 125799a2dd95SBruce Richardson uint16_t mh_controllers[RTE_MAX_MULTI_HOST_CTRLS]; 125899a2dd95SBruce Richardson /** controller/s number in case of multi-host */ 125999a2dd95SBruce Richardson uint16_t nb_mh_controllers; 126099a2dd95SBruce Richardson /** number of controllers in multi-host controllers field */ 126199a2dd95SBruce Richardson uint16_t ports[RTE_MAX_ETHPORTS]; 126299a2dd95SBruce Richardson /** port/s number to enable on a multi-port single function */ 126399a2dd95SBruce Richardson uint16_t nb_ports; 126499a2dd95SBruce Richardson /** number of ports in ports field */ 126599a2dd95SBruce Richardson uint16_t representor_ports[RTE_MAX_ETHPORTS]; 126699a2dd95SBruce Richardson /** representor port/s identifier to enable on device */ 126799a2dd95SBruce Richardson uint16_t nb_representor_ports; 126899a2dd95SBruce Richardson /** number of ports in representor port field */ 126999a2dd95SBruce Richardson enum rte_eth_representor_type type; /* type of representor */ 127099a2dd95SBruce Richardson }; 127199a2dd95SBruce Richardson 127299a2dd95SBruce Richardson /** 127399a2dd95SBruce Richardson * PMD helper function to get representor ID from location detail. 127499a2dd95SBruce Richardson * 127599a2dd95SBruce Richardson * Get representor ID from controller, pf and (sf or vf). 127699a2dd95SBruce Richardson * The mapping is retrieved from rte_eth_representor_info_get(). 127799a2dd95SBruce Richardson * 127899a2dd95SBruce Richardson * For backward compatibility, if no representor info, direct 127999a2dd95SBruce Richardson * map legacy VF (no controller and pf). 128099a2dd95SBruce Richardson * 128199a2dd95SBruce Richardson * @param ethdev 128299a2dd95SBruce Richardson * Handle of ethdev port. 128399a2dd95SBruce Richardson * @param type 128499a2dd95SBruce Richardson * Representor type. 128599a2dd95SBruce Richardson * @param controller 128699a2dd95SBruce Richardson * Controller ID, -1 if unspecified. 128799a2dd95SBruce Richardson * @param pf 128899a2dd95SBruce Richardson * PF port ID, -1 if unspecified. 128999a2dd95SBruce Richardson * @param representor_port 129099a2dd95SBruce Richardson * VF or SF representor port number, -1 if unspecified. 129199a2dd95SBruce Richardson * @param repr_id 129299a2dd95SBruce Richardson * Pointer to output representor ID. 129399a2dd95SBruce Richardson * 129499a2dd95SBruce Richardson * @return 129599a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 129699a2dd95SBruce Richardson */ 129799a2dd95SBruce Richardson __rte_internal 129899a2dd95SBruce Richardson int 129999a2dd95SBruce Richardson rte_eth_representor_id_get(const struct rte_eth_dev *ethdev, 130099a2dd95SBruce Richardson enum rte_eth_representor_type type, 130199a2dd95SBruce Richardson int controller, int pf, int representor_port, 130299a2dd95SBruce Richardson uint16_t *repr_id); 130399a2dd95SBruce Richardson 130499a2dd95SBruce Richardson /** 130599a2dd95SBruce Richardson * PMD helper function to parse ethdev arguments 130699a2dd95SBruce Richardson * 130799a2dd95SBruce Richardson * @param devargs 130899a2dd95SBruce Richardson * device arguments 130999a2dd95SBruce Richardson * @param eth_devargs 131099a2dd95SBruce Richardson * parsed ethdev specific arguments. 131199a2dd95SBruce Richardson * 131299a2dd95SBruce Richardson * @return 131399a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 131499a2dd95SBruce Richardson */ 131599a2dd95SBruce Richardson __rte_internal 131699a2dd95SBruce Richardson int 131799a2dd95SBruce Richardson rte_eth_devargs_parse(const char *devargs, struct rte_eth_devargs *eth_devargs); 131899a2dd95SBruce Richardson 131999a2dd95SBruce Richardson 132099a2dd95SBruce Richardson typedef int (*ethdev_init_t)(struct rte_eth_dev *ethdev, void *init_params); 132199a2dd95SBruce Richardson typedef int (*ethdev_bus_specific_init)(struct rte_eth_dev *ethdev, 132299a2dd95SBruce Richardson void *bus_specific_init_params); 132399a2dd95SBruce Richardson 132499a2dd95SBruce Richardson /** 132599a2dd95SBruce Richardson * PMD helper function for the creation of a new ethdev ports. 132699a2dd95SBruce Richardson * 132799a2dd95SBruce Richardson * @param device 132899a2dd95SBruce Richardson * rte_device handle. 132999a2dd95SBruce Richardson * @param name 133099a2dd95SBruce Richardson * port name. 133199a2dd95SBruce Richardson * @param priv_data_size 133299a2dd95SBruce Richardson * size of private data required for port. 133399a2dd95SBruce Richardson * @param bus_specific_init 133499a2dd95SBruce Richardson * port bus specific initialisation callback function 133599a2dd95SBruce Richardson * @param bus_init_params 133699a2dd95SBruce Richardson * port bus specific initialisation parameters 133799a2dd95SBruce Richardson * @param ethdev_init 133899a2dd95SBruce Richardson * device specific port initialization callback function 133999a2dd95SBruce Richardson * @param init_params 134099a2dd95SBruce Richardson * port initialisation parameters 134199a2dd95SBruce Richardson * 134299a2dd95SBruce Richardson * @return 134399a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 134499a2dd95SBruce Richardson */ 134599a2dd95SBruce Richardson __rte_internal 134699a2dd95SBruce Richardson int 134799a2dd95SBruce Richardson rte_eth_dev_create(struct rte_device *device, const char *name, 134899a2dd95SBruce Richardson size_t priv_data_size, 134999a2dd95SBruce Richardson ethdev_bus_specific_init bus_specific_init, void *bus_init_params, 135099a2dd95SBruce Richardson ethdev_init_t ethdev_init, void *init_params); 135199a2dd95SBruce Richardson 135299a2dd95SBruce Richardson 135399a2dd95SBruce Richardson typedef int (*ethdev_uninit_t)(struct rte_eth_dev *ethdev); 135499a2dd95SBruce Richardson 135599a2dd95SBruce Richardson /** 135699a2dd95SBruce Richardson * PMD helper function for cleaning up the resources of a ethdev port on it's 135799a2dd95SBruce Richardson * destruction. 135899a2dd95SBruce Richardson * 135999a2dd95SBruce Richardson * @param ethdev 136099a2dd95SBruce Richardson * ethdev handle of port. 136199a2dd95SBruce Richardson * @param ethdev_uninit 136299a2dd95SBruce Richardson * device specific port un-initialise callback function 136399a2dd95SBruce Richardson * 136499a2dd95SBruce Richardson * @return 136599a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 136699a2dd95SBruce Richardson */ 136799a2dd95SBruce Richardson __rte_internal 136899a2dd95SBruce Richardson int 136999a2dd95SBruce Richardson rte_eth_dev_destroy(struct rte_eth_dev *ethdev, ethdev_uninit_t ethdev_uninit); 137099a2dd95SBruce Richardson 137199a2dd95SBruce Richardson /** 137299a2dd95SBruce Richardson * @internal 137399a2dd95SBruce Richardson * Pass the current hairpin queue HW and/or SW information to the peer queue 137499a2dd95SBruce Richardson * and fetch back the information of the peer queue. 137599a2dd95SBruce Richardson * 137699a2dd95SBruce Richardson * @param peer_port 137799a2dd95SBruce Richardson * Peer port identifier of the Ethernet device. 137899a2dd95SBruce Richardson * @param peer_queue 137999a2dd95SBruce Richardson * Peer queue index of the port. 138099a2dd95SBruce Richardson * @param cur_info 138199a2dd95SBruce Richardson * Pointer to the current information structure. 138299a2dd95SBruce Richardson * @param peer_info 138399a2dd95SBruce Richardson * Pointer to the peer information, output. 138499a2dd95SBruce Richardson * @param direction 138599a2dd95SBruce Richardson * Direction to pass the information. 138699a2dd95SBruce Richardson * positive - pass Tx queue information and get peer Rx queue information 138799a2dd95SBruce Richardson * zero - pass Rx queue information and get peer Tx queue information 138899a2dd95SBruce Richardson * 138999a2dd95SBruce Richardson * @return 139099a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 139199a2dd95SBruce Richardson */ 139299a2dd95SBruce Richardson __rte_internal 139399a2dd95SBruce Richardson int 139499a2dd95SBruce Richardson rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue, 139599a2dd95SBruce Richardson struct rte_hairpin_peer_info *cur_info, 139699a2dd95SBruce Richardson struct rte_hairpin_peer_info *peer_info, 139799a2dd95SBruce Richardson uint32_t direction); 139899a2dd95SBruce Richardson 139999a2dd95SBruce Richardson /** 140099a2dd95SBruce Richardson * @internal 140199a2dd95SBruce Richardson * Configure current hairpin queue with the peer information fetched to create 140299a2dd95SBruce Richardson * the connection (bind) with peer queue in the specified direction. 140399a2dd95SBruce Richardson * This function might need to be called twice to fully create the connections. 140499a2dd95SBruce Richardson * 140599a2dd95SBruce Richardson * @param cur_port 140699a2dd95SBruce Richardson * Current port identifier of the Ethernet device. 140799a2dd95SBruce Richardson * @param cur_queue 140899a2dd95SBruce Richardson * Current queue index of the port. 140999a2dd95SBruce Richardson * @param peer_info 141099a2dd95SBruce Richardson * Pointer to the peer information, input. 141199a2dd95SBruce Richardson * @param direction 141299a2dd95SBruce Richardson * Direction to create the connection. 141399a2dd95SBruce Richardson * positive - bind current Tx queue to peer Rx queue 141499a2dd95SBruce Richardson * zero - bind current Rx queue to peer Tx queue 141599a2dd95SBruce Richardson * 141699a2dd95SBruce Richardson * @return 141799a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 141899a2dd95SBruce Richardson */ 141999a2dd95SBruce Richardson __rte_internal 142099a2dd95SBruce Richardson int 142199a2dd95SBruce Richardson rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue, 142299a2dd95SBruce Richardson struct rte_hairpin_peer_info *peer_info, 142399a2dd95SBruce Richardson uint32_t direction); 142499a2dd95SBruce Richardson 142599a2dd95SBruce Richardson /** 142699a2dd95SBruce Richardson * @internal 142799a2dd95SBruce Richardson * Reset the current queue state and configuration to disconnect (unbind) it 142899a2dd95SBruce Richardson * from the peer queue. 142999a2dd95SBruce Richardson * This function might need to be called twice to disconnect each other. 143099a2dd95SBruce Richardson * 143199a2dd95SBruce Richardson * @param cur_port 143299a2dd95SBruce Richardson * Current port identifier of the Ethernet device. 143399a2dd95SBruce Richardson * @param cur_queue 143499a2dd95SBruce Richardson * Current queue index of the port. 143599a2dd95SBruce Richardson * @param direction 143699a2dd95SBruce Richardson * Direction to destroy the connection. 143799a2dd95SBruce Richardson * positive - unbind current Tx queue from peer Rx queue 143899a2dd95SBruce Richardson * zero - unbind current Rx queue from peer Tx queue 143999a2dd95SBruce Richardson * 144099a2dd95SBruce Richardson * @return 144199a2dd95SBruce Richardson * Negative errno value on error, 0 on success. 144299a2dd95SBruce Richardson */ 144399a2dd95SBruce Richardson __rte_internal 144499a2dd95SBruce Richardson int 144599a2dd95SBruce Richardson rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue, 144699a2dd95SBruce Richardson uint32_t direction); 144799a2dd95SBruce Richardson 144899a2dd95SBruce Richardson 144999a2dd95SBruce Richardson /* 145099a2dd95SBruce Richardson * Legacy ethdev API used internally by drivers. 145199a2dd95SBruce Richardson */ 145299a2dd95SBruce Richardson 145399a2dd95SBruce Richardson enum rte_filter_type { 145499a2dd95SBruce Richardson RTE_ETH_FILTER_NONE = 0, 145599a2dd95SBruce Richardson RTE_ETH_FILTER_ETHERTYPE, 145699a2dd95SBruce Richardson RTE_ETH_FILTER_FLEXIBLE, 145799a2dd95SBruce Richardson RTE_ETH_FILTER_SYN, 145899a2dd95SBruce Richardson RTE_ETH_FILTER_NTUPLE, 145999a2dd95SBruce Richardson RTE_ETH_FILTER_TUNNEL, 146099a2dd95SBruce Richardson RTE_ETH_FILTER_FDIR, 146199a2dd95SBruce Richardson RTE_ETH_FILTER_HASH, 146299a2dd95SBruce Richardson RTE_ETH_FILTER_L2_TUNNEL, 146399a2dd95SBruce Richardson }; 146499a2dd95SBruce Richardson 146599a2dd95SBruce Richardson /** 146699a2dd95SBruce Richardson * Define all structures for Ethertype Filter type. 146799a2dd95SBruce Richardson */ 146899a2dd95SBruce Richardson 146999a2dd95SBruce Richardson #define RTE_ETHTYPE_FLAGS_MAC 0x0001 /**< If set, compare mac */ 147099a2dd95SBruce Richardson #define RTE_ETHTYPE_FLAGS_DROP 0x0002 /**< If set, drop packet when match */ 147199a2dd95SBruce Richardson 147299a2dd95SBruce Richardson /** 147399a2dd95SBruce Richardson * A structure used to define the ethertype filter entry 147499a2dd95SBruce Richardson * to support RTE_ETH_FILTER_ETHERTYPE data representation. 147599a2dd95SBruce Richardson */ 147699a2dd95SBruce Richardson struct rte_eth_ethertype_filter { 147799a2dd95SBruce Richardson struct rte_ether_addr mac_addr; /**< Mac address to match. */ 147899a2dd95SBruce Richardson uint16_t ether_type; /**< Ether type to match */ 147999a2dd95SBruce Richardson uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */ 148099a2dd95SBruce Richardson uint16_t queue; /**< Queue assigned to when match*/ 148199a2dd95SBruce Richardson }; 148299a2dd95SBruce Richardson 148399a2dd95SBruce Richardson /** 148499a2dd95SBruce Richardson * A structure used to define the TCP syn filter entry 148599a2dd95SBruce Richardson * to support RTE_ETH_FILTER_SYN data representation. 148699a2dd95SBruce Richardson */ 148799a2dd95SBruce Richardson struct rte_eth_syn_filter { 148899a2dd95SBruce Richardson /** 1 - higher priority than other filters, 0 - lower priority. */ 148999a2dd95SBruce Richardson uint8_t hig_pri; 149099a2dd95SBruce Richardson uint16_t queue; /**< Queue assigned to when match */ 149199a2dd95SBruce Richardson }; 149299a2dd95SBruce Richardson 149399a2dd95SBruce Richardson /** 149499a2dd95SBruce Richardson * filter type of tunneling packet 149599a2dd95SBruce Richardson */ 149699a2dd95SBruce Richardson #define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */ 149799a2dd95SBruce Richardson #define ETH_TUNNEL_FILTER_OIP 0x02 /**< filter by outer IP Addr */ 149899a2dd95SBruce Richardson #define ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */ 149999a2dd95SBruce Richardson #define ETH_TUNNEL_FILTER_IMAC 0x08 /**< filter by inner MAC addr */ 150099a2dd95SBruce Richardson #define ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */ 150199a2dd95SBruce Richardson #define ETH_TUNNEL_FILTER_IIP 0x20 /**< filter by inner IP addr */ 150299a2dd95SBruce Richardson 150399a2dd95SBruce Richardson #define RTE_TUNNEL_FILTER_IMAC_IVLAN (ETH_TUNNEL_FILTER_IMAC | \ 150499a2dd95SBruce Richardson ETH_TUNNEL_FILTER_IVLAN) 150599a2dd95SBruce Richardson #define RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID (ETH_TUNNEL_FILTER_IMAC | \ 150699a2dd95SBruce Richardson ETH_TUNNEL_FILTER_IVLAN | \ 150799a2dd95SBruce Richardson ETH_TUNNEL_FILTER_TENID) 150899a2dd95SBruce Richardson #define RTE_TUNNEL_FILTER_IMAC_TENID (ETH_TUNNEL_FILTER_IMAC | \ 150999a2dd95SBruce Richardson ETH_TUNNEL_FILTER_TENID) 151099a2dd95SBruce Richardson #define RTE_TUNNEL_FILTER_OMAC_TENID_IMAC (ETH_TUNNEL_FILTER_OMAC | \ 151199a2dd95SBruce Richardson ETH_TUNNEL_FILTER_TENID | \ 151299a2dd95SBruce Richardson ETH_TUNNEL_FILTER_IMAC) 151399a2dd95SBruce Richardson 151499a2dd95SBruce Richardson /** 151599a2dd95SBruce Richardson * Select IPv4 or IPv6 for tunnel filters. 151699a2dd95SBruce Richardson */ 151799a2dd95SBruce Richardson enum rte_tunnel_iptype { 151899a2dd95SBruce Richardson RTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4. */ 151999a2dd95SBruce Richardson RTE_TUNNEL_IPTYPE_IPV6, /**< IPv6. */ 152099a2dd95SBruce Richardson }; 152199a2dd95SBruce Richardson 152299a2dd95SBruce Richardson /** 152399a2dd95SBruce Richardson * Tunneling Packet filter configuration. 152499a2dd95SBruce Richardson */ 152599a2dd95SBruce Richardson struct rte_eth_tunnel_filter_conf { 152699a2dd95SBruce Richardson struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ 152799a2dd95SBruce Richardson struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ 152899a2dd95SBruce Richardson uint16_t inner_vlan; /**< Inner VLAN to match. */ 152999a2dd95SBruce Richardson enum rte_tunnel_iptype ip_type; /**< IP address type. */ 153099a2dd95SBruce Richardson /** 153199a2dd95SBruce Richardson * Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP 153299a2dd95SBruce Richardson * is set in filter_type, or inner destination IP address to match 153399a2dd95SBruce Richardson * if ETH_TUNNEL_FILTER_IIP is set in filter_type. 153499a2dd95SBruce Richardson */ 153599a2dd95SBruce Richardson union { 153699a2dd95SBruce Richardson uint32_t ipv4_addr; /**< IPv4 address in big endian. */ 153799a2dd95SBruce Richardson uint32_t ipv6_addr[4]; /**< IPv6 address in big endian. */ 153899a2dd95SBruce Richardson } ip_addr; 153999a2dd95SBruce Richardson /** Flags from ETH_TUNNEL_FILTER_XX - see above. */ 154099a2dd95SBruce Richardson uint16_t filter_type; 154199a2dd95SBruce Richardson enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type. */ 154299a2dd95SBruce Richardson uint32_t tenant_id; /**< Tenant ID to match. VNI, GRE key... */ 154399a2dd95SBruce Richardson uint16_t queue_id; /**< Queue assigned to if match. */ 154499a2dd95SBruce Richardson }; 154599a2dd95SBruce Richardson 154699a2dd95SBruce Richardson #endif /* _RTE_ETHDEV_DRIVER_H_ */ 1547