#include "rte_ether.h"
#include "rte_eth_ctrl.h"
#include "rte_dev_info.h"
-#include "rte_compat.h"
struct rte_mbuf;
/** @internal Structure to keep track of registered callbacks */
TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
-
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
-#define RTE_PMD_DEBUG_TRACE(...) \
- rte_pmd_debug_trace(__func__, __VA_ARGS__)
-#else
-#define RTE_PMD_DEBUG_TRACE(...)
-#endif
-
-
/* Macros to check for valid port */
#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
if (!rte_eth_dev_is_valid_port(port_id)) { \
} \
} while (0)
+#define RTE_ETH_DEV_TO_PCI(eth_dev) RTE_DEV_TO_PCI((eth_dev)->device)
+
/**
* l2 tunnel configuration.
*/
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);
+typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
+ const 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);
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,
+typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names, const 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,
typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
/**< @internal Remove MAC address from receive address register */
-typedef void (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
+typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
struct ether_addr *mac_addr,
uint32_t index,
uint32_t vmdq);
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;
+
+ eth_xstats_get_by_id_t xstats_get_by_id;
+ /**< Get extended device statistic values by ID. */
+ eth_xstats_get_names_by_id_t xstats_get_names_by_id;
/**< Get name of extended device statistics by ID. */
- eth_xstats_get_by_name_t xstats_get_by_name;
- /**< Get extended device statistics by name. */
};
/**
*/
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.
- *
- * @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).
- */
-__rte_deprecated
-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.
+ * Retrieve names of extended statistics of an Ethernet device.
*
* @param port_id
* The port identifier of the Ethernet device.
* 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 n
+ * @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
* 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);
+int rte_eth_xstats_get_names(uint8_t port_id,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int size);
/**
* Retrieve extended statistics of an Ethernet device.
* shall not be used by the caller.
* - A negative value on error (invalid port id).
*/
-int rte_eth_xstats_get_v22(uint8_t port_id, struct rte_eth_xstat *xstats,
- unsigned int n);
+int rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstat *xstats,
+ unsigned int n);
/**
- * Retrieve extended statistics of an Ethernet device.
+ * 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
- * 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).
+ * 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 n: success. The return value
+ * - 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 n: error, the given statistics 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_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);
+int
+rte_eth_xstats_get_names_by_id(uint8_t port_id,
+ struct rte_eth_xstat_name *xstats_names, unsigned int size,
+ uint64_t *ids);
/**
* 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 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 xstats array (number of elements).
+ * 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.
* 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);
+int rte_eth_xstats_get_by_id(uint8_t port_id, const uint64_t *ids,
+ uint64_t *values, unsigned int n);
/**
- * Retrieve names of extended statistics of an Ethernet device.
+ * Gets the ID of a statistic from its name.
*
- * @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).
+ * 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
- * - 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).
+ * 0 on success
+ * -ENODEV for invalid port_id,
+ * -EINVAL if the xstat_name doesn't exist in 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);
+int rte_eth_xstats_get_id_by_name(uint8_t port_id, const char *xstat_name,
+ uint64_t *id);
/**
* Reset extended statistics of an Ethernet device.
* causing N packets to be sent, and the error callback to be called for
* the rest.
*/
-static inline uint16_t __attribute__((always_inline))
+static __rte_always_inline uint16_t
rte_eth_tx_buffer(uint8_t port_id, uint16_t queue_id,
struct rte_eth_dev_tx_buffer *buffer, struct rte_mbuf *tx_pkt)
{
* @param port_id
* pointer to port identifier of the device
* @return
-* - (0) if successful.
+* - (0) if successful and port_id is filled.
* - (-ENODEV or -EINVAL) on failure.
*/
int