X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_ether%2Frte_ethdev.h;h=21b41e93a559a6188460808162c0e6f4c7f918dc;hb=ea85e7d711b664558a53a8131e22fdff952e5241;hp=6da5b27bfd7a5a952c0c4f1b8914c82ba6e09435;hpb=9dca21fb80b6c43e58d83c794e161ddc671c07ba;p=dpdk.git diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 6da5b27bfd..21b41e93a5 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -179,13 +179,13 @@ extern "C" { #include #include -#include #include #include #include #include "rte_ether.h" #include "rte_eth_ctrl.h" #include "rte_dev_info.h" +#include "rte_compat.h" struct rte_mbuf; @@ -901,6 +901,8 @@ struct rte_eth_conf { #define DEV_TX_OFFLOAD_GENEVE_TNL_TSO 0x00001000 /**< Used for tunneling packet. */ #define DEV_TX_OFFLOAD_MACSEC_INSERT 0x00002000 +struct rte_pci_device; + /** * Ethernet device information */ @@ -1118,6 +1120,10 @@ typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, unsigned n); /**< @internal Get extended stats of an Ethernet device. */ +typedef int (*eth_xstats_get_by_ids_t)(struct rte_eth_dev *dev, + uint64_t *ids, uint64_t *values, unsigned int n); +/**< @internal Get extended stats of an Ethernet device. */ + typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev); /**< @internal Reset extended stats of an Ethernet device. */ @@ -1125,6 +1131,17 @@ typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev, struct rte_eth_xstat_name *xstats_names, unsigned size); /**< @internal Get names of extended stats of an Ethernet device. */ +typedef int (*eth_xstats_get_names_by_ids_t)(struct rte_eth_dev *dev, + struct rte_eth_xstat_name *xstats_names, uint64_t *ids, + unsigned int size); +/**< @internal Get names of extended stats of an Ethernet device. */ + +typedef int (*eth_xstats_get_by_name_t)(struct rte_eth_dev *dev, + struct rte_eth_xstat_name *xstats_names, + struct rte_eth_xstat *xstat, + const char *name); +/**< @internal Get xstat specified by name 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, @@ -1563,6 +1580,12 @@ struct eth_dev_ops { 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. */ + eth_xstats_get_by_ids_t xstats_get_by_ids; + /**< Get extended device statistics by ID. */ + eth_xstats_get_names_by_ids_t xstats_get_names_by_ids; + /**< Get name of extended device statistics by ID. */ + eth_xstats_get_by_name_t xstats_get_by_name; + /**< Get extended device statistics by name. */ }; /** @@ -1666,7 +1689,7 @@ struct rte_eth_dev { * 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:8; /**< Flag indicating the port state */ + enum rte_eth_dev_state state; /**< Flag indicating the port state */ } __rte_cache_aligned; struct rte_eth_dev_sriov { @@ -2265,7 +2288,32 @@ int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats); void rte_eth_stats_reset(uint8_t port_id); /** - * Retrieve names of extended statistics of an Ethernet device. + * Retrieve all extended statistics of an Ethernet device. + * + * @param port_id + * The port identifier of the Ethernet device. + * @param xstats + * A pointer to a table of structure of type *rte_eth_xstat* + * to be filled with device statistics ids and values: id is the + * index of the name string in xstats_names (see rte_eth_xstats_get_names()), + * and value is the statistic counter. + * This parameter can be set to NULL if n is 0. + * @param n + * The size of the xstats array (number of elements). + * @return + * - A positive value lower or equal to n: success. The return value + * is the number of entries filled in the stats table. + * - A positive value higher than n: error, the given statistics table + * is too small. The return value corresponds to the size that should + * be given to succeed. The entries in the table are not valid and + * shall not be used by the caller. + * - A negative value on error (invalid port id). + */ +int rte_eth_xstats_get_all(uint8_t port_id, struct rte_eth_xstat *xstats, + unsigned int n); + +/** + * Retrieve names of all extended statistics of an Ethernet device. * * @param port_id * The port identifier of the Ethernet device. @@ -2273,7 +2321,7 @@ void rte_eth_stats_reset(uint8_t port_id); * An rte_eth_xstat_name array of at least *size* elements to * be filled. If set to NULL, the function returns the required number * of elements. - * @param size + * @param n * The size of the xstats_names array (number of elements). * @return * - A positive value lower or equal to size: success. The return value @@ -2284,9 +2332,8 @@ void rte_eth_stats_reset(uint8_t port_id); * shall not be used by the caller. * - A negative value on error (invalid port id). */ -int rte_eth_xstats_get_names(uint8_t port_id, - struct rte_eth_xstat_name *xstats_names, - unsigned size); +int rte_eth_xstats_get_names_all(uint8_t port_id, + struct rte_eth_xstat_name *xstats_names, unsigned int n); /** * Retrieve extended statistics of an Ethernet device. @@ -2310,8 +2357,92 @@ int rte_eth_xstats_get_names(uint8_t port_id, * shall not be used by the caller. * - A negative value on error (invalid port id). */ -int rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstat *xstats, - unsigned n); +int rte_eth_xstats_get_v22(uint8_t port_id, struct rte_eth_xstat *xstats, + unsigned int n); + +/** + * Retrieve extended statistics of an Ethernet device. + * + * @param port_id + * The port identifier of the Ethernet device. + * @param ids + * A pointer to an ids array passed by application. This tells wich + * statistics values function should retrieve. This parameter + * can be set to NULL if n is 0. In this case function will retrieve + * all avalible statistics. + * @param values + * A pointer to a table to be filled with device statistics values. + * @param n + * The size of the ids array (number of elements). + * @return + * - A positive value lower or equal to n: success. The return value + * is the number of entries filled in the stats table. + * - A positive value higher than n: error, the given statistics table + * is too small. The return value corresponds to the size that should + * be given to succeed. The entries in the table are not valid and + * shall not be used by the caller. + * - A negative value on error (invalid port id). + */ +int rte_eth_xstats_get_v1705(uint8_t port_id, uint64_t *ids, uint64_t *values, + unsigned int n); + +int rte_eth_xstats_get(uint8_t port_id, uint64_t *ids, uint64_t *values, + unsigned int n); + +/** + * Retrieve extended statistics of an Ethernet device. + * + * @param port_id + * The port identifier of the Ethernet device. + * @param xstats_names + * A pointer to a table of structure of type *rte_eth_xstat* + * to be filled with device statistics ids and values: id is the + * index of the name string in xstats_names (see rte_eth_xstats_get_names()), + * and value is the statistic counter. + * This parameter can be set to NULL if n is 0. + * @param n + * The size of the xstats array (number of elements). + * @return + * - A positive value lower or equal to n: success. The return value + * is the number of entries filled in the stats table. + * - A positive value higher than n: error, the given statistics table + * is too small. The return value corresponds to the size that should + * be given to succeed. The entries in the table are not valid and + * shall not be used by the caller. + * - A negative value on error (invalid port id). + */ +int rte_eth_xstats_get_names_v1607(uint8_t port_id, + struct rte_eth_xstat_name *xstats_names, unsigned int n); + +/** + * Retrieve names of extended statistics of an Ethernet device. + * + * @param port_id + * The port identifier of the Ethernet device. + * @param xstats_names + * An rte_eth_xstat_name array of at least *size* elements to + * be filled. If set to NULL, the function returns the required number + * of elements. + * @param ids + * IDs array given by app to retrieve specific statistics + * @param size + * The size of the xstats_names array (number of elements). + * @return + * - A positive value lower or equal to size: success. The return value + * is the number of entries filled in the stats table. + * - A positive value higher than size: error, the given statistics table + * is too small. The return value corresponds to the size that should + * be given to succeed. The entries in the table are not valid and + * shall not be used by the caller. + * - A negative value on error (invalid port id). + */ +int rte_eth_xstats_get_names_v1705(uint8_t port_id, + struct rte_eth_xstat_name *xstats_names, unsigned int size, + uint64_t *ids); + +int rte_eth_xstats_get_names(uint8_t port_id, + struct rte_eth_xstat_name *xstats_names, unsigned int size, + uint64_t *ids); /** * Reset extended statistics of an Ethernet device. @@ -4421,20 +4552,6 @@ int rte_eth_timesync_read_time(uint8_t port_id, struct timespec *time); */ int rte_eth_timesync_write_time(uint8_t port_id, const struct timespec *time); -/** - * Copy pci device info to the Ethernet device data. - * - * @param eth_dev - * The *eth_dev* pointer is the address of the *rte_eth_dev* structure. - * @param pci_dev - * The *pci_dev* pointer is the address of the *rte_pci_device* structure. - * - * @return - * - 0 on success, negative on error - */ -void rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, - struct rte_pci_device *pci_dev); - /** * Create memzone for HW rings. * malloc can't be used as the physical address is needed.