X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Fethdev%2Fethdev_driver.h;h=6d697a879a9aa0cfbcbf546d82369696b886225d;hb=a41f593f1bce27cd94eae0e85a8085c592b14b30;hp=96dd0ecaf3a7ae0699ae03edebabd4b0041c49fd;hpb=8c9f976f05bb73e2353741137ff4def526b47cb2;p=dpdk.git diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index 96dd0ecaf3..6d697a879a 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -17,7 +17,165 @@ #include -/**< @internal Declaration of the hairpin peer queue information structure. */ +/** + * @internal + * Structure used to hold information about the callbacks to be called for a + * queue on Rx and Tx. + */ +struct rte_eth_rxtx_callback { + struct rte_eth_rxtx_callback *next; + union{ + rte_rx_callback_fn rx; + rte_tx_callback_fn tx; + } fn; + void *param; +}; + +/** + * @internal + * The generic data structure associated with each Ethernet device. + * + * Pointers to burst-oriented packet receive and transmit functions are + * located at the beginning of the structure, along with the pointer to + * where all the data elements for the particular device are stored in shared + * memory. This split allows the function pointer and driver data to be per- + * process, while the actual configuration data for the device is shared. + */ +struct rte_eth_dev { + eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function */ + eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function */ + + /** Pointer to PMD transmit prepare function */ + eth_tx_prep_t tx_pkt_prepare; + /** Get the number of used Rx descriptors */ + eth_rx_queue_count_t rx_queue_count; + /** Check the status of a Rx descriptor */ + eth_rx_descriptor_status_t rx_descriptor_status; + /** Check the status of a Tx descriptor */ + eth_tx_descriptor_status_t tx_descriptor_status; + + /** + * Device data that is shared between primary and secondary processes + */ + struct rte_eth_dev_data *data; + void *process_private; /**< Pointer to per-process device data */ + const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */ + struct rte_device *device; /**< Backing device */ + struct rte_intr_handle *intr_handle; /**< Device interrupt handle */ + + /** User application callbacks for NIC interrupts */ + struct rte_eth_dev_cb_list link_intr_cbs; + /** + * User-supplied functions called from rx_burst to post-process + * received packets before passing them to the user + */ + struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT]; + /** + * User-supplied functions called from tx_burst to pre-process + * received packets before passing them to the driver for transmission + */ + struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT]; + + enum rte_eth_dev_state state; /**< Flag indicating the port state */ + void *security_ctx; /**< Context for security ops */ +} __rte_cache_aligned; + +struct rte_eth_dev_sriov; +struct rte_eth_dev_owner; + +/** + * @internal + * The data part, with no function pointers, associated with each Ethernet + * device. This structure is safe to place in shared memory to be common + * among different processes in a multi-process configuration. + */ +struct rte_eth_dev_data { + char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */ + + void **rx_queues; /**< Array of pointers to Rx queues */ + void **tx_queues; /**< Array of pointers to Tx queues */ + uint16_t nb_rx_queues; /**< Number of Rx queues */ + uint16_t nb_tx_queues; /**< Number of Tx queues */ + + struct rte_eth_dev_sriov sriov; /**< SRIOV data */ + + /** PMD-specific private data. @see rte_eth_dev_release_port() */ + void *dev_private; + + struct rte_eth_link dev_link; /**< Link-level information & status */ + struct rte_eth_conf dev_conf; /**< Configuration applied to device */ + uint16_t mtu; /**< Maximum Transmission Unit */ + + /** Common Rx buffer size handled by all queues */ + uint32_t min_rx_buf_size; + + uint64_t rx_mbuf_alloc_failed; /**< Rx ring mbuf allocation failures */ + + /** Device Ethernet link address. @see rte_eth_dev_release_port() */ + struct rte_ether_addr *mac_addrs; + /** Bitmap associating MAC addresses to pools */ + uint64_t mac_pool_sel[RTE_ETH_NUM_RECEIVE_MAC_ADDR]; + /** + * Device Ethernet MAC addresses of hash filtering. + * @see rte_eth_dev_release_port() + */ + struct rte_ether_addr *hash_mac_addrs; + + uint16_t port_id; /**< Device [external] port identifier */ + + __extension__ + uint8_t /** Rx promiscuous mode ON(1) / OFF(0) */ + promiscuous : 1, + /** Rx of scattered packets is ON(1) / OFF(0) */ + scattered_rx : 1, + /** Rx all multicast mode ON(1) / OFF(0) */ + all_multicast : 1, + /** Device state: STARTED(1) / STOPPED(0) */ + dev_started : 1, + /** Rx LRO is ON(1) / OFF(0) */ + lro : 1, + /** + * Indicates whether the device is configured: + * CONFIGURED(1) / NOT CONFIGURED(0) + */ + dev_configured : 1; + + /** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */ + uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT]; + /** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */ + uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT]; + + uint32_t dev_flags; /**< Capabilities */ + int numa_node; /**< NUMA node connection */ + + /** VLAN filter configuration */ + struct rte_vlan_filter_conf vlan_filter_conf; + + struct rte_eth_dev_owner owner; /**< The port owner */ + + /** + * Switch-specific identifier. + * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags. + */ + uint16_t representor_id; + /** + * Port ID of the backing device. + * This device will be used to query representor info and calculate + * representor IDs. Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags. + */ + uint16_t backer_port_id; + + pthread_mutex_t flow_ops_mutex; /**< rte_flow ops mutex */ +} __rte_cache_aligned; + +/** + * @internal + * The pool of *rte_eth_dev* structures. The size of the pool + * is configured at compile-time in the file. + */ +extern struct rte_eth_dev rte_eth_devices[]; + +/** @internal Declaration of the hairpin peer queue information structure. */ struct rte_hairpin_peer_info; /* @@ -26,29 +184,29 @@ struct rte_hairpin_peer_info; * structure associated with an Ethernet device. */ +/** @internal Ethernet device configuration. */ typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev); -/**< @internal Ethernet device configuration. */ +/** @internal Function used to start a configured Ethernet device. */ typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev); -/**< @internal Function used to start a configured Ethernet device. */ +/** @internal Function used to stop a configured Ethernet device. */ typedef int (*eth_dev_stop_t)(struct rte_eth_dev *dev); -/**< @internal Function used to stop a configured Ethernet device. */ +/** @internal Function used to link up a configured Ethernet device. */ typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev); -/**< @internal Function used to link up a configured Ethernet device. */ +/** @internal Function used to link down a configured Ethernet device. */ typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev); -/**< @internal Function used to link down a configured Ethernet device. */ +/** @internal Function used to close a configured Ethernet device. */ typedef int (*eth_dev_close_t)(struct rte_eth_dev *dev); -/**< @internal Function used to close a configured Ethernet device. */ +/** @internal Function used to reset a configured Ethernet device. */ typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev); -/** <@internal Function used to reset a configured Ethernet device. */ +/** @internal Function used to detect an Ethernet device removal. */ typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev); -/**< @internal Function used to detect an Ethernet device removal. */ /** * @internal @@ -69,7 +227,7 @@ typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev); * @retval -E_RTE_SECONDARY * Function was called from a secondary process instance and not supported. * @retval -ETIMEDOUT - * Attempt to enable promiscuos mode failed because of timeout. + * Attempt to enable promiscuous mode failed because of timeout. * @retval -EAGAIN * Failed to enable promiscuous mode. */ @@ -94,7 +252,7 @@ typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev); * @retval -E_RTE_SECONDARY * Function was called from a secondary process instance and not supported. * @retval -ETIMEDOUT - * Attempt to disable promiscuos mode failed because of timeout. + * Attempt to disable promiscuous mode failed because of timeout. * @retval -EAGAIN * Failed to disable promiscuous mode. */ @@ -150,13 +308,16 @@ typedef int (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev); */ typedef int (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev); +/** + * @internal + * Get link speed, duplex mode and state (up/down) of an Ethernet device. + */ typedef int (*eth_link_update_t)(struct rte_eth_dev *dev, int wait_to_complete); -/**< @internal Get link speed, duplex mode and state (up/down) of an Ethernet device. */ +/** @internal Get global I/O statistics of an Ethernet device. */ typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats); -/**< @internal Get global I/O statistics of an Ethernet device. */ /** * @internal @@ -179,9 +340,9 @@ typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev, */ typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev); +/** @internal Get extended stats of an Ethernet device. */ typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, unsigned int n); -/**< @internal Get extended stats of an Ethernet device. */ /** * @internal @@ -227,9 +388,9 @@ typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev, */ typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev); +/** @internal Get names of extended stats of an Ethernet device. */ typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev, struct rte_eth_xstat_name *xstats_names, unsigned int size); -/**< @internal Get names of extended stats of an Ethernet device. */ /** * @internal @@ -253,18 +414,21 @@ typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev, const uint64_t *ids, struct rte_eth_xstat_name *xstats_names, unsigned int size); +/** + * @internal + * Set a queue statistics mapping for a Tx/Rx queue of an Ethernet device. + */ typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev, uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx); -/**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */ +/** @internal Get specific information of an Ethernet device. */ typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); -/**< @internal Get specific information of an Ethernet device. */ +/** @internal Get supported ptypes of an Ethernet device. */ typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev); -/**< @internal Get supported ptypes of an Ethernet device. */ /** * @internal @@ -281,46 +445,47 @@ typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *de typedef int (*eth_dev_ptypes_set_t)(struct rte_eth_dev *dev, uint32_t ptype_mask); +/** @internal Start Rx and Tx of a queue of an Ethernet device. */ typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev, uint16_t queue_id); -/**< @internal Start rx and tx of a queue of an Ethernet device. */ +/** @internal Stop Rx and Tx of a queue of an Ethernet device. */ typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev, uint16_t queue_id); -/**< @internal Stop rx and tx of a queue of an Ethernet device. */ +/** @internal Set up a receive queue of an Ethernet device. */ typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool); -/**< @internal Set up a receive queue of an Ethernet device. */ +/** @internal Setup a transmit queue of an Ethernet device. */ typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf); -/**< @internal Setup a transmit queue of an Ethernet device. */ +/** @internal Enable interrupt of a receive queue of an Ethernet device. */ typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev, uint16_t rx_queue_id); -/**< @internal Enable interrupt of a receive queue of an Ethernet device. */ +/** @internal Disable interrupt of a receive queue of an Ethernet device. */ typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev, uint16_t rx_queue_id); -/**< @internal Disable interrupt of a receive queue of an Ethernet device. */ -typedef void (*eth_queue_release_t)(void *queue); -/**< @internal Release memory resources allocated by given RX/TX queue. */ +/** @internal Release memory resources allocated by given Rx/Tx queue. */ +typedef void (*eth_queue_release_t)(struct rte_eth_dev *dev, + uint16_t queue_id); +/** @internal Get firmware information of an Ethernet device. */ typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev, char *fw_version, size_t fw_size); -/**< @internal Get firmware information of an Ethernet device. */ +/** @internal Force mbufs to be from Tx ring. */ typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt); -/**< @internal Force mbufs to be from TX ring. */ typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev, uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo); @@ -331,169 +496,166 @@ typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev, typedef int (*eth_burst_mode_get_t)(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_burst_mode *mode); +/** @internal Set MTU. */ typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu); -/**< @internal Set MTU. */ +/** @internal Filtering of a VLAN Tag Identifier by an Ethernet device. */ typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev, uint16_t vlan_id, int on); -/**< @internal filtering of a VLAN Tag Identifier by an Ethernet device. */ +/** @internal Set the outer/inner VLAN-TPID by an Ethernet device. */ typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev, enum rte_vlan_type type, uint16_t tpid); -/**< @internal set the outer/inner VLAN-TPID by an Ethernet device. */ +/** @internal Set VLAN offload function by an Ethernet device. */ typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask); -/**< @internal set VLAN offload function by an Ethernet device. */ +/** @internal Set port based Tx VLAN insertion by an Ethernet device. */ typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev, uint16_t vlan_id, int on); -/**< @internal set port based TX VLAN insertion by an Ethernet device. */ +/** @internal VLAN stripping enable/disable by an queue of Ethernet device. */ typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev, uint16_t rx_queue_id, int on); -/**< @internal VLAN stripping enable/disable by an queue of Ethernet device. */ +/** @internal Get current flow control parameter on an Ethernet device. */ typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); -/**< @internal Get current flow control parameter on an Ethernet device */ +/** @internal Setup flow control parameter on an Ethernet device. */ typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); -/**< @internal Setup flow control parameter on an Ethernet device */ +/** @internal Setup priority flow control parameter on an Ethernet device. */ typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf); -/**< @internal Setup priority flow control parameter on an Ethernet device */ +/** @internal Get info for queue based PFC on an Ethernet device. */ +typedef int (*priority_flow_ctrl_queue_info_get_t)(struct rte_eth_dev *dev, + struct rte_eth_pfc_queue_info *pfc_queue_info); +/** @internal Configure queue based PFC parameter on an Ethernet device. */ +typedef int (*priority_flow_ctrl_queue_config_t)(struct rte_eth_dev *dev, + struct rte_eth_pfc_queue_conf *pfc_queue_conf); + +/** @internal Update RSS redirection table on an Ethernet device. */ typedef int (*reta_update_t)(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size); -/**< @internal Update RSS redirection table on an Ethernet device */ +/** @internal Query RSS redirection table on an Ethernet device. */ typedef int (*reta_query_t)(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size); -/**< @internal Query RSS redirection table on an Ethernet device */ +/** @internal Update RSS hash configuration of an Ethernet device. */ typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); -/**< @internal Update RSS hash configuration of an Ethernet device */ +/** @internal Get current RSS hash configuration of an Ethernet device. */ typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); -/**< @internal Get current RSS hash configuration of an Ethernet device */ +/** @internal Turn on SW controllable LED on an Ethernet device. */ typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev); -/**< @internal Turn on SW controllable LED on an Ethernet device */ +/** @internal Turn off SW controllable LED on an Ethernet device. */ typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev); -/**< @internal Turn off SW controllable LED on an Ethernet device */ +/** @internal Remove MAC address from receive address register. */ typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index); -/**< @internal Remove MAC address from receive address register */ +/** @internal Set a MAC address into Receive Address Register. */ typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); -/**< @internal Set a MAC address into Receive Address Register */ +/** @internal Set a MAC address into Receive Address Register. */ typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); -/**< @internal Set a MAC address into Receive Address Register */ +/** @internal Set a Unicast Hash bitmap. */ typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint8_t on); -/**< @internal Set a Unicast Hash bitmap */ +/** @internal Set all Unicast Hash bitmap. */ typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev, uint8_t on); -/**< @internal Set all Unicast Hash bitmap */ +/** @internal Set queue Tx rate. */ typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t tx_rate); -/**< @internal Set queue TX rate */ - -typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev, - struct rte_eth_mirror_conf *mirror_conf, - uint8_t rule_id, - uint8_t on); -/**< @internal Add a traffic mirroring rule on an Ethernet device */ - -typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev, - uint8_t rule_id); -/**< @internal Remove a traffic mirroring rule on an Ethernet device */ +/** @internal Add tunneling UDP port. */ typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *tunnel_udp); -/**< @internal Add tunneling UDP port */ +/** @internal Delete tunneling UDP port. */ typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *tunnel_udp); -/**< @internal Delete tunneling UDP port */ +/** @internal set the list of multicast addresses on an Ethernet device. */ typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); -/**< @internal set the list of multicast addresses on an Ethernet device */ +/** @internal Function used to enable IEEE1588/802.1AS timestamping. */ typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev); -/**< @internal Function used to enable IEEE1588/802.1AS timestamping. */ +/** @internal Function used to disable IEEE1588/802.1AS timestamping. */ typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev); -/**< @internal Function used to disable IEEE1588/802.1AS timestamping. */ +/** @internal Function used to read an Rx IEEE1588/802.1AS timestamp. */ typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev, struct timespec *timestamp, uint32_t flags); -/**< @internal Function used to read an RX IEEE1588/802.1AS timestamp. */ +/** @internal Function used to read a Tx IEEE1588/802.1AS timestamp. */ typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev, struct timespec *timestamp); -/**< @internal Function used to read a TX IEEE1588/802.1AS timestamp. */ +/** @internal Function used to adjust the device clock. */ typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t); -/**< @internal Function used to adjust the device clock */ +/** @internal Function used to get time from the device clock. */ typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev, struct timespec *timestamp); -/**< @internal Function used to get time from the device clock. */ +/** @internal Function used to get time from the device clock. */ typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev, const struct timespec *timestamp); -/**< @internal Function used to get time from the device clock */ +/** @internal Function used to get the current value of the device clock. */ typedef int (*eth_read_clock)(struct rte_eth_dev *dev, uint64_t *timestamp); -/**< @internal Function used to get the current value of the device clock. */ +/** @internal Retrieve registers. */ typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev, struct rte_dev_reg_info *info); -/**< @internal Retrieve registers */ +/** @internal Retrieve EEPROM size. */ typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev); -/**< @internal Retrieve eeprom size */ +/** @internal Retrieve EEPROM data. */ typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); -/**< @internal Retrieve eeprom data */ +/** @internal Program EEPROM data. */ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); -/**< @internal Program eeprom data */ +/** @internal Retrieve type and size of plugin module EEPROM. */ typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev, struct rte_eth_dev_module_info *modinfo); -/**< @internal Retrieve type and size of plugin module eeprom */ +/** @internal Retrieve plugin module EEPROM data. */ typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); -/**< @internal Retrieve plugin module eeprom data */ struct rte_flow_ops; /** @@ -506,19 +668,19 @@ struct rte_flow_ops; typedef int (*eth_flow_ops_get_t)(struct rte_eth_dev *dev, const struct rte_flow_ops **ops); +/** @internal Get Traffic Management (TM) operations on an Ethernet device. */ typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops); -/**< @internal Get Traffic Management (TM) operations on an Ethernet device */ +/** @internal Get Traffic Metering and Policing (MTR) operations. */ typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops); -/**< @internal Get Traffic Metering and Policing (MTR) operations */ +/** @internal Get DCB information on an Ethernet device. */ typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev, struct rte_eth_dcb_info *dcb_info); -/**< @internal Get dcb information on an Ethernet device */ +/** @internal Test if a port supports specific mempool ops. */ typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev, const char *pool); -/**< @internal Test if a port supports specific mempool ops */ /** * @internal @@ -542,16 +704,16 @@ typedef int (*eth_hairpin_cap_get_t)(struct rte_eth_dev *dev, /** * @internal - * Setup RX hairpin queue. + * Setup Rx hairpin queue. * * @param dev * ethdev handle of port. * @param rx_queue_id - * the selected RX queue index. + * the selected Rx queue index. * @param nb_rx_desc * the requested number of descriptors for this queue. 0 - use PMD default. * @param conf - * the RX hairpin configuration structure. + * the Rx hairpin configuration structure. * * @return * Negative errno value on error, 0 on success. @@ -572,16 +734,16 @@ typedef int (*eth_rx_hairpin_queue_setup_t) /** * @internal - * Setup TX hairpin queue. + * Setup Tx hairpin queue. * * @param dev * ethdev handle of port. * @param tx_queue_id - * the selected TX queue index. + * the selected Tx queue index. * @param nb_tx_desc * the requested number of descriptors for this queue. 0 - use PMD default. * @param conf - * the TX hairpin configuration structure. + * the Tx hairpin configuration structure. * * @return * Negative errno value on error, 0 on success. @@ -760,20 +922,20 @@ typedef int (*eth_hairpin_bind_t)(struct rte_eth_dev *dev, typedef int (*eth_hairpin_unbind_t)(struct rte_eth_dev *dev, uint16_t rx_port); +/** @internal Update and fetch peer queue information. */ typedef int (*eth_hairpin_queue_peer_update_t) (struct rte_eth_dev *dev, uint16_t peer_queue, struct rte_hairpin_peer_info *current_info, struct rte_hairpin_peer_info *peer_info, uint32_t direction); -/**< @internal Update and fetch peer queue information. */ +/** @internal Bind peer queue to the current queue with fetched information. */ typedef int (*eth_hairpin_queue_peer_bind_t) (struct rte_eth_dev *dev, uint16_t cur_queue, struct rte_hairpin_peer_info *peer_info, uint32_t direction); -/**< @internal Bind peer queue to the current queue with fetched information. */ +/** @internal Unbind peer queue from the current queue. */ typedef int (*eth_hairpin_queue_peer_unbind_t) (struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction); -/**< @internal Unbind peer queue from the current queue. */ /** * @internal @@ -820,165 +982,298 @@ typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev, struct rte_eth_representor_info *info); /** - * @internal A structure containing the functions exported by an Ethernet driver. + * @internal + * Negotiate the NIC's ability to deliver specific kinds of metadata to the PMD. + * + * @param dev + * Port (ethdev) handle + * + * @param[inout] features + * Feature selection buffer + * + * @return + * Negative errno value on error, zero otherwise */ -struct eth_dev_ops { - eth_dev_configure_t dev_configure; /**< Configure device. */ - eth_dev_start_t dev_start; /**< Start device. */ - eth_dev_stop_t dev_stop; /**< Stop device. */ - eth_dev_set_link_up_t dev_set_link_up; /**< Device link up. */ - eth_dev_set_link_down_t dev_set_link_down; /**< Device link down. */ - eth_dev_close_t dev_close; /**< Close device. */ - eth_dev_reset_t dev_reset; /**< Reset device. */ - eth_link_update_t link_update; /**< Get device link state. */ - eth_is_removed_t is_removed; - /**< Check if the device was physically removed. */ - - eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON. */ - eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF. */ - eth_allmulticast_enable_t allmulticast_enable;/**< RX multicast ON. */ - eth_allmulticast_disable_t allmulticast_disable;/**< RX multicast OFF. */ - eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address. */ - eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address. */ - eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address. */ - eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs. */ - mtu_set_t mtu_set; /**< Set MTU. */ - - eth_stats_get_t stats_get; /**< Get generic device statistics. */ - eth_stats_reset_t stats_reset; /**< Reset generic device statistics. */ - eth_xstats_get_t xstats_get; /**< Get extended device statistics. */ - eth_xstats_reset_t xstats_reset; /**< Reset extended device statistics. */ - eth_xstats_get_names_t xstats_get_names; - /**< Get names of extended statistics. */ - eth_queue_stats_mapping_set_t queue_stats_mapping_set; - /**< Configure per queue stat counter mapping. */ - - eth_dev_infos_get_t dev_infos_get; /**< Get device info. */ - eth_rxq_info_get_t rxq_info_get; /**< retrieve RX queue information. */ - eth_txq_info_get_t txq_info_get; /**< retrieve TX queue information. */ - eth_burst_mode_get_t rx_burst_mode_get; /**< Get RX burst mode */ - eth_burst_mode_get_t tx_burst_mode_get; /**< Get TX burst mode */ - eth_fw_version_get_t fw_version_get; /**< Get firmware version. */ - eth_dev_supported_ptypes_get_t dev_supported_ptypes_get; - /**< Get packet types supported and identified by device. */ - eth_dev_ptypes_set_t dev_ptypes_set; - /**< Inform Ethernet device about reduced range of packet types to handle. */ - - vlan_filter_set_t vlan_filter_set; /**< Filter VLAN Setup. */ - vlan_tpid_set_t vlan_tpid_set; /**< Outer/Inner VLAN TPID Setup. */ - vlan_strip_queue_set_t vlan_strip_queue_set; /**< VLAN Stripping on queue. */ - vlan_offload_set_t vlan_offload_set; /**< Set VLAN Offload. */ - vlan_pvid_set_t vlan_pvid_set; /**< Set port based TX VLAN insertion. */ +typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev, + uint64_t *features); - eth_queue_start_t rx_queue_start;/**< Start RX for a queue. */ - eth_queue_stop_t rx_queue_stop; /**< Stop RX for a queue. */ - eth_queue_start_t tx_queue_start;/**< Start TX for a queue. */ - eth_queue_stop_t tx_queue_stop; /**< Stop TX for a queue. */ - eth_rx_queue_setup_t rx_queue_setup;/**< Set up device RX queue. */ - eth_queue_release_t rx_queue_release; /**< Release RX queue. */ - - eth_rx_enable_intr_t rx_queue_intr_enable; /**< Enable Rx queue interrupt. */ - eth_rx_disable_intr_t rx_queue_intr_disable; /**< Disable Rx queue interrupt. */ - eth_tx_queue_setup_t tx_queue_setup;/**< Set up device TX queue. */ - eth_queue_release_t tx_queue_release; /**< Release TX queue. */ - eth_tx_done_cleanup_t tx_done_cleanup;/**< Free tx ring mbufs */ - - eth_dev_led_on_t dev_led_on; /**< Turn on LED. */ - eth_dev_led_off_t dev_led_off; /**< Turn off LED. */ +/** + * @internal + * Get IP reassembly offload capability of a PMD. + * + * @param dev + * Port (ethdev) handle + * + * @param[out] conf + * IP reassembly capability supported by the PMD + * + * @return + * Negative errno value on error, zero otherwise + */ +typedef int (*eth_ip_reassembly_capability_get_t)(struct rte_eth_dev *dev, + struct rte_eth_ip_reassembly_params *capa); - flow_ctrl_get_t flow_ctrl_get; /**< Get flow control. */ - flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control. */ - priority_flow_ctrl_set_t priority_flow_ctrl_set; /**< Setup priority flow control. */ +/** + * @internal + * Get IP reassembly offload configuration parameters set in PMD. + * + * @param dev + * Port (ethdev) handle + * + * @param[out] conf + * Configuration parameters for IP reassembly. + * + * @return + * Negative errno value on error, zero otherwise + */ +typedef int (*eth_ip_reassembly_conf_get_t)(struct rte_eth_dev *dev, + struct rte_eth_ip_reassembly_params *conf); - eth_uc_hash_table_set_t uc_hash_table_set; /**< Set Unicast Table Array. */ - eth_uc_all_hash_table_set_t uc_all_hash_table_set; /**< Set Unicast hash bitmap. */ +/** + * @internal + * Set configuration parameters for enabling IP reassembly offload in hardware. + * + * @param dev + * Port (ethdev) handle + * + * @param[in] conf + * Configuration parameters for IP reassembly. + * + * @return + * Negative errno value on error, zero otherwise + */ +typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev, + const struct rte_eth_ip_reassembly_params *conf); - eth_mirror_rule_set_t mirror_rule_set; /**< Add a traffic mirror rule. */ - eth_mirror_rule_reset_t mirror_rule_reset; /**< reset a traffic mirror rule. */ +/** + * @internal + * Dump private info from device to a file. + * + * @param dev + * Port (ethdev) handle. + * @param file + * A pointer to a file for output. + * + * @return + * Negative value on error, 0 on success. + * + * @retval 0 + * Success + * @retval -EINVAL + * Invalid file + */ +typedef int (*eth_dev_priv_dump_t)(struct rte_eth_dev *dev, FILE *file); - eth_udp_tunnel_port_add_t udp_tunnel_port_add; /** Add UDP tunnel port. */ - eth_udp_tunnel_port_del_t udp_tunnel_port_del; /** Del UDP tunnel port. */ +/** + * @internal A structure containing the functions exported by an Ethernet driver. + */ +struct eth_dev_ops { + eth_dev_configure_t dev_configure; /**< Configure device */ + eth_dev_start_t dev_start; /**< Start device */ + eth_dev_stop_t dev_stop; /**< Stop device */ + eth_dev_set_link_up_t dev_set_link_up; /**< Device link up */ + eth_dev_set_link_down_t dev_set_link_down; /**< Device link down */ + eth_dev_close_t dev_close; /**< Close device */ + eth_dev_reset_t dev_reset; /**< Reset device */ + eth_link_update_t link_update; /**< Get device link state */ + /** Check if the device was physically removed */ + eth_is_removed_t is_removed; - eth_set_queue_rate_limit_t set_queue_rate_limit; /**< Set queue rate limit. */ + eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON */ + eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF */ + eth_allmulticast_enable_t allmulticast_enable;/**< Rx multicast ON */ + eth_allmulticast_disable_t allmulticast_disable;/**< Rx multicast OFF */ + eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address */ + eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address */ + eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address */ + /** Set list of multicast addresses */ + eth_set_mc_addr_list_t set_mc_addr_list; + mtu_set_t mtu_set; /**< Set MTU */ + + /** Get generic device statistics */ + eth_stats_get_t stats_get; + /** Reset generic device statistics */ + eth_stats_reset_t stats_reset; + /** Get extended device statistics */ + eth_xstats_get_t xstats_get; + /** Reset extended device statistics */ + eth_xstats_reset_t xstats_reset; + /** Get names of extended statistics */ + eth_xstats_get_names_t xstats_get_names; + /** Configure per queue stat counter mapping */ + eth_queue_stats_mapping_set_t queue_stats_mapping_set; - rss_hash_update_t rss_hash_update; /** Configure RSS hash protocols. */ - rss_hash_conf_get_t rss_hash_conf_get; /** Get current RSS hash configuration. */ - reta_update_t reta_update; /** Update redirection table. */ - reta_query_t reta_query; /** Query redirection table. */ + eth_dev_infos_get_t dev_infos_get; /**< Get device info */ + /** Retrieve Rx queue information */ + eth_rxq_info_get_t rxq_info_get; + /** Retrieve Tx queue information */ + eth_txq_info_get_t txq_info_get; + eth_burst_mode_get_t rx_burst_mode_get; /**< Get Rx burst mode */ + eth_burst_mode_get_t tx_burst_mode_get; /**< Get Tx burst mode */ + eth_fw_version_get_t fw_version_get; /**< Get firmware version */ - eth_get_reg_t get_reg; /**< Get registers. */ - eth_get_eeprom_length_t get_eeprom_length; /**< Get eeprom length. */ - eth_get_eeprom_t get_eeprom; /**< Get eeprom data. */ - eth_set_eeprom_t set_eeprom; /**< Set eeprom. */ + /** Get packet types supported and identified by device */ + eth_dev_supported_ptypes_get_t dev_supported_ptypes_get; + /** + * Inform Ethernet device about reduced range of packet types to + * handle + */ + eth_dev_ptypes_set_t dev_ptypes_set; + /** Filter VLAN Setup */ + vlan_filter_set_t vlan_filter_set; + /** Outer/Inner VLAN TPID Setup */ + vlan_tpid_set_t vlan_tpid_set; + /** VLAN Stripping on queue */ + vlan_strip_queue_set_t vlan_strip_queue_set; + /** Set VLAN Offload */ + vlan_offload_set_t vlan_offload_set; + /** Set port based Tx VLAN insertion */ + vlan_pvid_set_t vlan_pvid_set; + + eth_queue_start_t rx_queue_start;/**< Start Rx for a queue */ + eth_queue_stop_t rx_queue_stop; /**< Stop Rx for a queue */ + eth_queue_start_t tx_queue_start;/**< Start Tx for a queue */ + eth_queue_stop_t tx_queue_stop; /**< Stop Tx for a queue */ + eth_rx_queue_setup_t rx_queue_setup;/**< Set up device Rx queue */ + eth_queue_release_t rx_queue_release; /**< Release Rx queue */ + + /** Enable Rx queue interrupt */ + eth_rx_enable_intr_t rx_queue_intr_enable; + /** Disable Rx queue interrupt */ + eth_rx_disable_intr_t rx_queue_intr_disable; + + eth_tx_queue_setup_t tx_queue_setup;/**< Set up device Tx queue */ + eth_queue_release_t tx_queue_release; /**< Release Tx queue */ + eth_tx_done_cleanup_t tx_done_cleanup;/**< Free Tx ring mbufs */ + + eth_dev_led_on_t dev_led_on; /**< Turn on LED */ + eth_dev_led_off_t dev_led_off; /**< Turn off LED */ + + flow_ctrl_get_t flow_ctrl_get; /**< Get flow control */ + flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control */ + /** Setup priority flow control */ + priority_flow_ctrl_set_t priority_flow_ctrl_set; + /** Priority flow control queue info get */ + priority_flow_ctrl_queue_info_get_t priority_flow_ctrl_queue_info_get; + /** Priority flow control queue configure */ + priority_flow_ctrl_queue_config_t priority_flow_ctrl_queue_config; + + /** Set Unicast Table Array */ + eth_uc_hash_table_set_t uc_hash_table_set; + /** Set Unicast hash bitmap */ + eth_uc_all_hash_table_set_t uc_all_hash_table_set; + + /** Add UDP tunnel port */ + eth_udp_tunnel_port_add_t udp_tunnel_port_add; + /** Delete UDP tunnel port */ + eth_udp_tunnel_port_del_t udp_tunnel_port_del; + + /** Set queue rate limit */ + eth_set_queue_rate_limit_t set_queue_rate_limit; + + /** Configure RSS hash protocols and hashing key */ + rss_hash_update_t rss_hash_update; + /** Get current RSS hash configuration */ + rss_hash_conf_get_t rss_hash_conf_get; + /** Update redirection table */ + reta_update_t reta_update; + /** Query redirection table */ + reta_query_t reta_query; + + eth_get_reg_t get_reg; /**< Get registers */ + eth_get_eeprom_length_t get_eeprom_length; /**< Get EEPROM length */ + eth_get_eeprom_t get_eeprom; /**< Get EEPROM data */ + eth_set_eeprom_t set_eeprom; /**< Set EEPROM */ + + /** Get plugin module EEPROM attribute */ eth_get_module_info_t get_module_info; - /** Get plugin module eeprom attribute. */ + /** Get plugin module EEPROM data */ eth_get_module_eeprom_t get_module_eeprom; - /** Get plugin module eeprom data. */ - eth_flow_ops_get_t flow_ops_get; /**< Get flow operations. */ + eth_flow_ops_get_t flow_ops_get; /**< Get flow operations */ - eth_get_dcb_info get_dcb_info; /** Get DCB information. */ + eth_get_dcb_info get_dcb_info; /**< Get DCB information */ + /** Turn IEEE1588/802.1AS timestamping on */ eth_timesync_enable_t timesync_enable; - /** Turn IEEE1588/802.1AS timestamping on. */ + /** Turn IEEE1588/802.1AS timestamping off */ eth_timesync_disable_t timesync_disable; - /** Turn IEEE1588/802.1AS timestamping off. */ + /** Read the IEEE1588/802.1AS Rx timestamp */ eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp; - /** Read the IEEE1588/802.1AS RX timestamp. */ + /** Read the IEEE1588/802.1AS Tx timestamp */ eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp; - /** Read the IEEE1588/802.1AS TX timestamp. */ - eth_timesync_adjust_time timesync_adjust_time; /** Adjust the device clock. */ - eth_timesync_read_time timesync_read_time; /** Get the device clock time. */ - eth_timesync_write_time timesync_write_time; /** Set the device clock time. */ + /** Adjust the device clock */ + eth_timesync_adjust_time timesync_adjust_time; + /** Get the device clock time */ + eth_timesync_read_time timesync_read_time; + /** Set the device clock time */ + eth_timesync_write_time timesync_write_time; eth_read_clock read_clock; + /** Get extended device statistic values by ID */ eth_xstats_get_by_id_t xstats_get_by_id; - /**< Get extended device statistic values by ID. */ + /** Get name of extended device statistics by ID */ eth_xstats_get_names_by_id_t xstats_get_names_by_id; - /**< Get name of extended device statistics by ID. */ + /** Get Traffic Management (TM) operations */ eth_tm_ops_get_t tm_ops_get; - /**< Get Traffic Management (TM) operations. */ + /** Get Traffic Metering and Policing (MTR) operations */ eth_mtr_ops_get_t mtr_ops_get; - /**< Get Traffic Metering and Policing (MTR) operations. */ + /** Test if a port supports specific mempool ops */ eth_pool_ops_supported_t pool_ops_supported; - /**< Test if a port supports specific mempool ops */ + /** Returns the hairpin capabilities */ eth_hairpin_cap_get_t hairpin_cap_get; - /**< Returns the hairpin capabilities. */ + /** Set up device Rx hairpin queue */ eth_rx_hairpin_queue_setup_t rx_hairpin_queue_setup; - /**< Set up device RX hairpin queue. */ + /** Set up device Tx hairpin queue */ eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup; - /**< Set up device TX hairpin queue. */ + /** Get Forward Error Correction(FEC) capability */ eth_fec_get_capability_t fec_get_capability; - /**< Get Forward Error Correction(FEC) capability. */ + /** Get Forward Error Correction(FEC) mode */ eth_fec_get_t fec_get; - /**< Get Forward Error Correction(FEC) mode. */ + /** Set Forward Error Correction(FEC) mode */ eth_fec_set_t fec_set; - /**< Set Forward Error Correction(FEC) mode. */ + + /** Get hairpin peer ports list */ hairpin_get_peer_ports_t hairpin_get_peer_ports; - /**< Get hairpin peer ports list. */ + /** Bind all hairpin Tx queues of device to the peer port Rx queues */ eth_hairpin_bind_t hairpin_bind; - /**< Bind all hairpin Tx queues of device to the peer port Rx queues. */ + /** Unbind all hairpin Tx queues from the peer port Rx queues */ eth_hairpin_unbind_t hairpin_unbind; - /**< Unbind all hairpin Tx queues from the peer port Rx queues. */ + /** Pass the current queue info and get the peer queue info */ eth_hairpin_queue_peer_update_t hairpin_queue_peer_update; - /**< Pass the current queue info and get the peer queue info. */ + /** Set up the connection between the pair of hairpin queues */ eth_hairpin_queue_peer_bind_t hairpin_queue_peer_bind; - /**< Set up the connection between the pair of hairpin queues. */ + /** Disconnect the hairpin queues of a pair from each other */ eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind; - /**< Disconnect the hairpin queues of a pair from each other. */ + /** Get power monitoring condition for Rx queue */ eth_get_monitor_addr_t get_monitor_addr; - /**< Get power monitoring condition for Rx queue. */ + /** Get representor info */ eth_representor_info_get_t representor_info_get; - /**< Get representor info. */ + + /** + * Negotiate the NIC's ability to deliver specific + * kinds of metadata to the PMD + */ + eth_rx_metadata_negotiate_t rx_metadata_negotiate; + + /** Get IP reassembly capability */ + eth_ip_reassembly_capability_get_t ip_reassembly_capability_get; + /** Get IP reassembly configuration */ + eth_ip_reassembly_conf_get_t ip_reassembly_conf_get; + /** Set IP reassembly configuration */ + eth_ip_reassembly_conf_set_t ip_reassembly_conf_set; + + /** Dump private info from device */ + eth_dev_priv_dump_t eth_dev_priv_dump; }; /** @@ -1025,7 +1320,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name); /** * @internal - * Allocates a new ethdev slot for an ethernet device and returns the pointer + * Allocates a new ethdev slot for an Ethernet device and returns the pointer * to that slot for the driver to use. * * @param name Unique identifier name for each Ethernet device @@ -1214,12 +1509,29 @@ rte_eth_linkstatus_get(const struct rte_eth_dev *dev, *dst = __atomic_load_n(src, __ATOMIC_SEQ_CST); } +/** + * @internal + * Dummy DPDK callback for Rx/Tx packet burst. + * + * @param queue + * Pointer to Rx/Tx queue + * @param pkts + * Packet array + * @param nb_pkts + * Number of packets in packet array + */ +__rte_internal +uint16_t +rte_eth_pkt_burst_dummy(void *queue __rte_unused, + struct rte_mbuf **pkts __rte_unused, + uint16_t nb_pkts __rte_unused); + /** * Allocate an unique switch domain identifier. * * A pool of switch domain identifiers which can be allocated on request. This * will enabled devices which support the concept of switch domains to request - * a switch domain id which is guaranteed to be unique from other devices + * a switch domain ID which is guaranteed to be unique from other devices * running in the same process. * * @param domain_id @@ -1278,8 +1590,8 @@ struct rte_eth_devargs { * For backward compatibility, if no representor info, direct * map legacy VF (no controller and pf). * - * @param ethdev - * Handle of ethdev port. + * @param port_id + * Port ID of the backing device. * @param type * Representor type. * @param controller @@ -1296,7 +1608,7 @@ struct rte_eth_devargs { */ __rte_internal int -rte_eth_representor_id_get(const struct rte_eth_dev *ethdev, +rte_eth_representor_id_get(uint16_t port_id, enum rte_eth_representor_type type, int controller, int pf, int representor_port, uint16_t *repr_id); @@ -1422,6 +1734,24 @@ rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue, struct rte_hairpin_peer_info *peer_info, uint32_t direction); +/** + * @internal + * Get rte_eth_dev from device name. The device name should be specified + * as below: + * - PCIe address (Domain:Bus:Device.Function), for example 0000:2:00.0 + * - SoC device name, for example fsl-gmac0 + * - vdev dpdk name, for example net_[pcap0|null0|tap0] + * + * @param name + * PCI address or name of the device + * @return + * - rte_eth_dev if successful + * - NULL on failure + */ +__rte_internal +struct rte_eth_dev* +rte_eth_dev_get_by_name(const char *name); + /** * @internal * Reset the current queue state and configuration to disconnect (unbind) it @@ -1445,6 +1775,14 @@ int rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue, uint32_t direction); +/** + * @internal + * Register mbuf dynamic field and flag for IP reassembly incomplete case. + */ +__rte_internal +int +rte_eth_ip_reassembly_dynfield_register(int *field_offset, int *flag); + /* * Legacy ethdev API used internally by drivers. @@ -1474,10 +1812,10 @@ enum rte_filter_type { * to support RTE_ETH_FILTER_ETHERTYPE data representation. */ struct rte_eth_ethertype_filter { - struct rte_ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match */ uint16_t ether_type; /**< Ether type to match */ uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */ - uint16_t queue; /**< Queue assigned to when match*/ + uint16_t queue; /**< Queue assigned to when match */ }; /** @@ -1485,7 +1823,7 @@ struct rte_eth_ethertype_filter { * to support RTE_ETH_FILTER_SYN data representation. */ struct rte_eth_syn_filter { - /** 1 - higher priority than other filters, 0 - lower priority. */ + /** 1 - higher priority than other filters, 0 - lower priority */ uint8_t hig_pri; uint16_t queue; /**< Queue assigned to when match */ }; @@ -1493,54 +1831,54 @@ struct rte_eth_syn_filter { /** * filter type of tunneling packet */ -#define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */ -#define ETH_TUNNEL_FILTER_OIP 0x02 /**< filter by outer IP Addr */ -#define ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */ -#define ETH_TUNNEL_FILTER_IMAC 0x08 /**< filter by inner MAC addr */ -#define ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */ -#define ETH_TUNNEL_FILTER_IIP 0x20 /**< filter by inner IP addr */ - -#define RTE_TUNNEL_FILTER_IMAC_IVLAN (ETH_TUNNEL_FILTER_IMAC | \ - ETH_TUNNEL_FILTER_IVLAN) -#define RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID (ETH_TUNNEL_FILTER_IMAC | \ - ETH_TUNNEL_FILTER_IVLAN | \ - ETH_TUNNEL_FILTER_TENID) -#define RTE_TUNNEL_FILTER_IMAC_TENID (ETH_TUNNEL_FILTER_IMAC | \ - ETH_TUNNEL_FILTER_TENID) -#define RTE_TUNNEL_FILTER_OMAC_TENID_IMAC (ETH_TUNNEL_FILTER_OMAC | \ - ETH_TUNNEL_FILTER_TENID | \ - ETH_TUNNEL_FILTER_IMAC) +#define RTE_ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */ +#define RTE_ETH_TUNNEL_FILTER_OIP 0x02 /**< filter by outer IP Addr */ +#define RTE_ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */ +#define RTE_ETH_TUNNEL_FILTER_IMAC 0x08 /**< filter by inner MAC addr */ +#define RTE_ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */ +#define RTE_ETH_TUNNEL_FILTER_IIP 0x20 /**< filter by inner IP addr */ + +#define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN (RTE_ETH_TUNNEL_FILTER_IMAC | \ + RTE_ETH_TUNNEL_FILTER_IVLAN) +#define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \ + RTE_ETH_TUNNEL_FILTER_IVLAN | \ + RTE_ETH_TUNNEL_FILTER_TENID) +#define RTE_ETH_TUNNEL_FILTER_IMAC_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \ + RTE_ETH_TUNNEL_FILTER_TENID) +#define RTE_ETH_TUNNEL_FILTER_OMAC_TENID_IMAC (RTE_ETH_TUNNEL_FILTER_OMAC | \ + RTE_ETH_TUNNEL_FILTER_TENID | \ + RTE_ETH_TUNNEL_FILTER_IMAC) /** * Select IPv4 or IPv6 for tunnel filters. */ enum rte_tunnel_iptype { - RTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4. */ - RTE_TUNNEL_IPTYPE_IPV6, /**< IPv6. */ + RTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4 */ + RTE_TUNNEL_IPTYPE_IPV6, /**< IPv6 */ }; /** * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ - struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ - uint16_t inner_vlan; /**< Inner VLAN to match. */ - enum rte_tunnel_iptype ip_type; /**< IP address type. */ + struct rte_ether_addr outer_mac; /**< Outer MAC address to match */ + struct rte_ether_addr inner_mac; /**< Inner MAC address to match */ + uint16_t inner_vlan; /**< Inner VLAN to match */ + enum rte_tunnel_iptype ip_type; /**< IP address type */ /** * Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP * is set in filter_type, or inner destination IP address to match * if ETH_TUNNEL_FILTER_IIP is set in filter_type. */ union { - uint32_t ipv4_addr; /**< IPv4 address in big endian. */ - uint32_t ipv6_addr[4]; /**< IPv6 address in big endian. */ + uint32_t ipv4_addr; /**< IPv4 address in big endian */ + uint32_t ipv6_addr[4]; /**< IPv6 address in big endian */ } ip_addr; - /** Flags from ETH_TUNNEL_FILTER_XX - see above. */ + /** Flags from ETH_TUNNEL_FILTER_XX - see above */ uint16_t filter_type; - enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type. */ - uint32_t tenant_id; /**< Tenant ID to match. VNI, GRE key... */ - uint16_t queue_id; /**< Queue assigned to if match. */ + enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type */ + uint32_t tenant_id; /**< Tenant ID to match: VNI, GRE key... */ + uint16_t queue_id; /**< Queue assigned to if match */ }; #endif /* _RTE_ETHDEV_DRIVER_H_ */