app/proc-info: support xstats by ID
[dpdk.git] / lib / librte_ether / rte_ethdev.h
index 21b41e9..cb6efb7 100644 (file)
@@ -2287,6 +2287,27 @@ int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats);
  */
 void rte_eth_stats_reset(uint8_t port_id);
 
+
+/**
+ * Gets the ID of a statistic from its name.
+ *
+ * This function searches for the statistics using string compares, and
+ * as such should not be used on the fast-path. For fast-path retrieval of
+ * specific statistics, store the ID as provided in *id* from this function,
+ * and pass the ID to rte_eth_xstats_get()
+ *
+ * @param port_id The port to look up statistics from
+ * @param xstat_name The name of the statistic to return
+ * @param[out] id A pointer to an app-supplied uint64_t which should be
+ *                set to the ID of the stat if the stat exists.
+ * @return
+ *    0 on success
+ *    -ENODEV for invalid port_id,
+ *    -EINVAL if the xstat_name doesn't exist in port_id
+ */
+int rte_eth_xstats_get_id_by_name(uint8_t port_id, const char *xstat_name,
+               uint64_t *id);
+
 /**
  * Retrieve all extended statistics of an Ethernet device.
  *
@@ -2309,6 +2330,7 @@ void rte_eth_stats_reset(uint8_t port_id);
  *     shall not be used by the caller.
  *   - A negative value on error (invalid port id).
  */
+__rte_deprecated
 int rte_eth_xstats_get_all(uint8_t port_id, struct rte_eth_xstat *xstats,
        unsigned int n);
 
@@ -2332,6 +2354,7 @@ int rte_eth_xstats_get_all(uint8_t port_id, struct rte_eth_xstat *xstats,
  *     shall not be used by the caller.
  *   - A negative value on error (invalid port id).
  */
+__rte_deprecated
 int rte_eth_xstats_get_names_all(uint8_t port_id,
                struct rte_eth_xstat_name *xstats_names, unsigned int n);