X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_ethdev%2Frte_ethdev.h;h=bcc1bb71d9443e6100b04d7332b56f5265f09721;hb=6d13ea8e8e49ab957deae2bba5ecf4a4bfe747d1;hp=e32395346dc075166ae2433d2f19925dc809d251;hpb=7065dff68e9af69d3752ca3f514971d98fc26fbc;p=dpdk.git diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index e32395346d..bcc1bb71d9 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -80,10 +80,12 @@ * rte_eth_dev_stop()/rte_eth_dev_start(). The following configuration will * be retained: * + * - MTU * - flow control settings - * - receive mode configuration (promiscuous mode, hardware checksum mode, - * RSS/VMDQ settings etc.) + * - receive mode configuration (promiscuous mode, all-multicast mode, + * hardware checksum mode, RSS/VMDQ settings etc.) * - VLAN filtering configuration + * - default MAC address * - MAC addresses supplied to MAC address array * - flow director filtering mode (but not filtering rules) * - NIC queue statistics mappings @@ -156,7 +158,6 @@ extern "C" { #include #include "rte_ether.h" -#include "rte_eth_ctrl.h" #include "rte_dev_info.h" extern int rte_eth_dev_logtype; @@ -446,8 +447,43 @@ struct rte_eth_rss_conf { }; /* - * The RSS offload types are defined based on flow types which are defined - * in rte_eth_ctrl.h. Different NIC hardwares may support different RSS offload + * A packet can be identified by hardware as different flow types. Different + * NIC hardware may support different flow types. + * Basically, the NIC hardware identifies the flow type as deep protocol as + * possible, and exclusively. For example, if a packet is identified as + * 'RTE_ETH_FLOW_NONFRAG_IPV4_TCP', it will not be any of other flow types, + * though it is an actual IPV4 packet. + * Note that the flow types are used to define RSS offload types. + */ +#define RTE_ETH_FLOW_UNKNOWN 0 +#define RTE_ETH_FLOW_RAW 1 +#define RTE_ETH_FLOW_IPV4 2 +#define RTE_ETH_FLOW_FRAG_IPV4 3 +#define RTE_ETH_FLOW_NONFRAG_IPV4_TCP 4 +#define RTE_ETH_FLOW_NONFRAG_IPV4_UDP 5 +#define RTE_ETH_FLOW_NONFRAG_IPV4_SCTP 6 +#define RTE_ETH_FLOW_NONFRAG_IPV4_OTHER 7 +#define RTE_ETH_FLOW_IPV6 8 +#define RTE_ETH_FLOW_FRAG_IPV6 9 +#define RTE_ETH_FLOW_NONFRAG_IPV6_TCP 10 +#define RTE_ETH_FLOW_NONFRAG_IPV6_UDP 11 +#define RTE_ETH_FLOW_NONFRAG_IPV6_SCTP 12 +#define RTE_ETH_FLOW_NONFRAG_IPV6_OTHER 13 +#define RTE_ETH_FLOW_L2_PAYLOAD 14 +#define RTE_ETH_FLOW_IPV6_EX 15 +#define RTE_ETH_FLOW_IPV6_TCP_EX 16 +#define RTE_ETH_FLOW_IPV6_UDP_EX 17 +#define RTE_ETH_FLOW_PORT 18 + /**< Consider device port number as a flow differentiator */ +#define RTE_ETH_FLOW_VXLAN 19 /**< VXLAN protocol based flow */ +#define RTE_ETH_FLOW_GENEVE 20 /**< GENEVE protocol based flow */ +#define RTE_ETH_FLOW_NVGRE 21 /**< NVGRE protocol based flow */ +#define RTE_ETH_FLOW_VXLAN_GPE 22 /**< VXLAN-GPE protocol based flow */ +#define RTE_ETH_FLOW_MAX 23 + +/* + * The RSS offload types are defined based on flow types. + * Different NIC hardware may support different RSS offload * types. The supported flow types or RSS offload types can be queried by * rte_eth_dev_info_get(). */ @@ -832,6 +868,24 @@ struct rte_eth_pfc_conf { uint8_t priority; /**< VLAN User Priority. */ }; +/** + * Tunneled type. + */ +enum rte_eth_tunnel_type { + RTE_TUNNEL_TYPE_NONE = 0, + RTE_TUNNEL_TYPE_VXLAN, + RTE_TUNNEL_TYPE_GENEVE, + RTE_TUNNEL_TYPE_TEREDO, + RTE_TUNNEL_TYPE_NVGRE, + RTE_TUNNEL_TYPE_IP_IN_GRE, + RTE_L2_TUNNEL_TYPE_E_TAG, + RTE_TUNNEL_TYPE_VXLAN_GPE, + RTE_TUNNEL_TYPE_MAX, +}; + +/* Deprecated API file for rte_eth_dev_filter_* functions */ +#include "rte_eth_ctrl.h" + /** * Memory space that can be configured to store Flow Director filters * in the board memory. @@ -932,7 +986,7 @@ struct rte_eth_conf { /** Currently,Priority Flow Control(PFC) are supported,if DCB with PFC is needed,and the variable must be set ETH_DCB_PFC_SUPPORT. */ uint32_t dcb_capability_en; - struct rte_fdir_conf fdir_conf; /**< FDIR configuration. */ + struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */ struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */ }; @@ -1086,6 +1140,8 @@ struct rte_eth_dev_info { const char *driver_name; /**< Device Driver name. */ unsigned int if_index; /**< Index to bound host interface, or 0 if none. Use if_indextoname() to translate into an interface name. */ + uint16_t min_mtu; /**< Minimum MTU allowed */ + uint16_t max_mtu; /**< Maximum MTU allowed */ const uint32_t *dev_flags; /**< Device flags */ uint32_t min_rx_bufsize; /**< Minimum size of RX buffer. */ uint32_t max_rx_pktlen; /**< Maximum configurable length of RX pkt. */ @@ -1135,7 +1191,7 @@ struct rte_eth_dev_info { /** * Ethernet device RX queue information structure. - * Used to retieve information about configured queue. + * Used to retrieve information about configured queue. */ struct rte_eth_rxq_info { struct rte_mempool *mp; /**< mempool used by that queue. */ @@ -1383,6 +1439,69 @@ uint16_t rte_eth_find_next(uint16_t port_id); #define RTE_ETH_FOREACH_DEV(p) \ RTE_ETH_FOREACH_DEV_OWNED_BY(p, RTE_ETH_DEV_NO_OWNER) +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Iterates over ethdev ports of a specified device. + * + * @param port_id_start + * The id of the next possible valid port. + * @param parent + * The generic device behind the ports to iterate. + * @return + * Next port id of the device, possibly port_id_start, + * RTE_MAX_ETHPORTS if there is none. + */ +uint16_t __rte_experimental +rte_eth_find_next_of(uint16_t port_id_start, + const struct rte_device *parent); + +/** + * Macro to iterate over all ethdev ports of a specified device. + * + * @param port_id + * The id of the matching port being iterated. + * @param parent + * The rte_device pointer matching the iterated ports. + */ +#define RTE_ETH_FOREACH_DEV_OF(port_id, parent) \ + for (port_id = rte_eth_find_next_of(0, parent); \ + port_id < RTE_MAX_ETHPORTS; \ + port_id = rte_eth_find_next_of(port_id + 1, parent)) + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Iterates over sibling ethdev ports (i.e. sharing the same rte_device). + * + * @param port_id_start + * The id of the next possible valid sibling port. + * @param ref_port_id + * The id of a reference port to compare rte_device with. + * @return + * Next sibling port id, possibly port_id_start or ref_port_id itself, + * RTE_MAX_ETHPORTS if there is none. + */ +uint16_t __rte_experimental +rte_eth_find_next_sibling(uint16_t port_id_start, + uint16_t ref_port_id); + +/** + * Macro to iterate over all ethdev ports sharing the same rte_device + * as the specified port. + * Note: the specified reference port is part of the loop iterations. + * + * @param port_id + * The id of the matching port being iterated. + * @param ref_port_id + * The id of the port being compared. + */ +#define RTE_ETH_FOREACH_DEV_SIBLING(port_id, ref_port_id) \ + for (port_id = rte_eth_find_next_sibling(0, ref_port_id); \ + port_id < RTE_MAX_ETHPORTS; \ + port_id = rte_eth_find_next_sibling(port_id + 1, ref_port_id)) /** * @warning @@ -1493,7 +1612,7 @@ uint16_t rte_eth_dev_count_avail(void); * @return * The total count of Ethernet devices. */ -uint16_t __rte_experimental rte_eth_dev_count_total(void); +uint16_t rte_eth_dev_count_total(void); /** * Convert a numerical speed in Mbps to a bitmap flag that can be used in @@ -2101,7 +2220,7 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id, * A pointer to an ids array passed by application. This tells which * statistics values function should retrieve. This parameter * can be set to NULL if size is 0. In this case function will retrieve - * all avalible statistics. + * all available statistics. * @param values * A pointer to a table to be filled with device statistics values. * @param size @@ -2197,11 +2316,38 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, * A pointer to a structure of type *ether_addr* to be filled with * the Ethernet address of the Ethernet device. */ -void rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr); +void rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Retrieve the contextual information of an Ethernet device. * + * As part of this function, a number of of fields in dev_info will be + * initialized as follows: + * + * rx_desc_lim = lim + * tx_desc_lim = lim + * + * Where lim is defined within the rte_eth_dev_info_get as + * + * const struct rte_eth_desc_lim lim = { + * .nb_max = UINT16_MAX, + * .nb_min = 0, + * .nb_align = 1, + * }; + * + * device = dev->device + * min_mtu = ETHER_MIN_MTU + * max_mtu = UINT16_MAX + * + * The following fields will be populated if support for dev_infos_get() + * exists for the device and the rte_eth_dev 'dev' has been populated + * successfully with a call to it: + * + * driver_name = dev->device->driver->name + * nb_rx_queues = dev->data->nb_rx_queues + * nb_tx_queues = dev->data->nb_tx_queues + * dev_flags = &dev->data->dev_flags + * * @param port_id * The port identifier of the Ethernet device. * @param dev_info @@ -2298,7 +2444,9 @@ int rte_eth_dev_get_mtu(uint16_t port_id, uint16_t *mtu); * - (-ENOTSUP) if operation is not supported. * - (-ENODEV) if *port_id* invalid. * - (-EIO) if device is removed. - * - (-EINVAL) if *mtu* invalid. + * - (-EINVAL) if *mtu* invalid, validation of mtu can occur within + * rte_eth_dev_set_mtu if dev_infos_get is supported by the device or + * when the mtu is set using dev->dev_ops->mtu_set. * - (-EBUSY) if operation is not allowed when the port is running */ int rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu); @@ -2542,7 +2690,7 @@ rte_eth_tx_buffer_count_callback(struct rte_mbuf **pkts, uint16_t unsent, /** * Request the driver to free mbufs currently cached by the driver. The * driver will only free the mbuf if it is no longer in use. It is the - * application's responsibity to ensure rte_eth_tx_buffer_flush(..) is + * application's responsibility to ensure rte_eth_tx_buffer_flush(..) is * called if needed. * * @param port_id @@ -2881,7 +3029,7 @@ int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id, * - (-ENOSPC) if no more MAC addresses can be added. * - (-EINVAL) if MAC address is invalid. */ -int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, +int rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *mac_addr, uint32_t pool); /** @@ -2897,7 +3045,8 @@ int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, * - (-ENODEV) if *port* invalid. * - (-EADDRINUSE) if attempting to remove the default MAC address */ -int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); +int rte_eth_dev_mac_addr_remove(uint16_t port_id, + struct rte_ether_addr *mac_addr); /** * Set the default MAC address. @@ -2913,7 +3062,7 @@ int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); * - (-EINVAL) if MAC address is invalid. */ int rte_eth_dev_default_mac_addr_set(uint16_t port_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device. @@ -2941,7 +3090,8 @@ int rte_eth_dev_rss_reta_update(uint16_t port_id, * @param port_id * The port identifier of the Ethernet device. * @param reta_conf - * RETA to query. + * RETA to query. For each requested reta entry, corresponding bit + * in mask must be set. * @param reta_size * Redirection table size. The table size can be queried by * rte_eth_dev_info_get(). @@ -2974,7 +3124,7 @@ int rte_eth_dev_rss_reta_query(uint16_t port_id, * - (-EIO) if device is removed. * - (-EINVAL) if bad parameter. */ -int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr, +int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, uint8_t on); /** @@ -3154,6 +3304,7 @@ rte_eth_dev_udp_tunnel_port_delete(uint16_t port_id, * - (-ENODEV) if *port_id* invalid. * - (-EIO) if device is removed. */ +__rte_deprecated int rte_eth_dev_filter_supported(uint16_t port_id, enum rte_filter_type filter_type); @@ -3176,6 +3327,7 @@ int rte_eth_dev_filter_supported(uint16_t port_id, * - (-EIO) if device is removed. * - others depends on the specific operations implementation. */ +__rte_deprecated int rte_eth_dev_filter_ctrl(uint16_t port_id, enum rte_filter_type filter_type, enum rte_filter_op filter_op, void *arg); @@ -3517,7 +3669,7 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id, * - (-ENOSPC) if *port_id* has not enough multicast filtering resources. */ int rte_eth_dev_set_mc_addr_list(uint16_t port_id, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /**