Signed-off-by: speech_white <humin29@huawei.com> (cherry picked from commit 39c2c5154122fef74060ffd6dbbe8cd4fdd9d21b)
130 lines
3.9 KiB
Diff
130 lines
3.9 KiB
Diff
From 42a26d7136b259ee7ff1b39325e19ef5ef9fe0e3 Mon Sep 17 00:00:00 2001
|
|
From: "Min Hu (Connor)" <humin29@huawei.com>
|
|
Date: Fri, 11 Feb 2022 12:49:22 +0800
|
|
Subject: [PATCH 01/13] ethdev: introduce dump API
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Added the ethdev dump API which provides querying private info from device.
|
|
There exists many private properties in different PMD drivers, such as
|
|
adapter state, Rx/Tx func algorithm in hns3 PMD. The information of these
|
|
properties is important for debug. As the information is private, the new
|
|
API is introduced.
|
|
|
|
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
|
Acked-by: Morten Brørup <mb@smartsharesystems.com>
|
|
Acked-by: Ray Kinsella <mdr@ashroe.eu>
|
|
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
|
|
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
|
|
---
|
|
lib/ethdev/ethdev_driver.h | 23 +++++++++++++++++++++++
|
|
lib/ethdev/rte_ethdev.c | 17 +++++++++++++++++
|
|
lib/ethdev/rte_ethdev.h | 21 +++++++++++++++++++++
|
|
3 files changed, 61 insertions(+)
|
|
|
|
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
|
|
index d95605a355..e24ff7064c 100644
|
|
--- a/lib/ethdev/ethdev_driver.h
|
|
+++ b/lib/ethdev/ethdev_driver.h
|
|
@@ -990,6 +990,26 @@ typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev,
|
|
typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev,
|
|
uint64_t *features);
|
|
|
|
+/**
|
|
+
|
|
+ * @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);
|
|
+
|
|
/**
|
|
* @internal A structure containing the functions exported by an Ethernet driver.
|
|
*/
|
|
@@ -1186,6 +1206,9 @@ struct eth_dev_ops {
|
|
* kinds of metadata to the PMD
|
|
*/
|
|
eth_rx_metadata_negotiate_t rx_metadata_negotiate;
|
|
+
|
|
+ /** Dump private info from device */
|
|
+ eth_dev_priv_dump_t eth_dev_priv_dump;
|
|
};
|
|
|
|
/**
|
|
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
|
|
index a1d475a292..b9a452107f 100644
|
|
--- a/lib/ethdev/rte_ethdev.c
|
|
+++ b/lib/ethdev/rte_ethdev.c
|
|
@@ -6472,6 +6472,23 @@ rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features)
|
|
(*dev->dev_ops->rx_metadata_negotiate)(dev, features));
|
|
}
|
|
|
|
+int
|
|
+rte_eth_dev_priv_dump(uint16_t port_id, FILE *file)
|
|
+{
|
|
+ struct rte_eth_dev *dev;
|
|
+
|
|
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
|
|
+ dev = &rte_eth_devices[port_id];
|
|
+
|
|
+ if (file == NULL) {
|
|
+ RTE_ETHDEV_LOG(ERR, "Invalid file (NULL)\n");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_dev_priv_dump, -ENOTSUP);
|
|
+ return eth_err(port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file));
|
|
+}
|
|
+
|
|
RTE_LOG_REGISTER_DEFAULT(rte_eth_dev_logtype, INFO);
|
|
|
|
RTE_INIT(ethdev_init_telemetry)
|
|
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
|
|
index fa299c8ad7..b8f135ba3f 100644
|
|
--- a/lib/ethdev/rte_ethdev.h
|
|
+++ b/lib/ethdev/rte_ethdev.h
|
|
@@ -5188,6 +5188,27 @@ int rte_eth_representor_info_get(uint16_t port_id,
|
|
__rte_experimental
|
|
int rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features);
|
|
|
|
+/**
|
|
+ * @warning
|
|
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
|
|
+ *
|
|
+ * Dump private info from device to a file. Provided data and the order depends
|
|
+ * on the PMD.
|
|
+ *
|
|
+ * @param port_id
|
|
+ * The port identifier of the Ethernet device.
|
|
+ * @param file
|
|
+ * A pointer to a file for output.
|
|
+ * @return
|
|
+ * - (0) on success.
|
|
+ * - (-ENODEV) if *port_id* is invalid.
|
|
+ * - (-EINVAL) if null file.
|
|
+ * - (-ENOTSUP) if the device does not support this function.
|
|
+ * - (-EIO) if device is removed.
|
|
+ */
|
|
+__rte_experimental
|
|
+int rte_eth_dev_priv_dump(uint16_t port_id, FILE *file);
|
|
+
|
|
#include <rte_ethdev_core.h>
|
|
|
|
/**
|
|
--
|
|
2.30.0
|
|
|