From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: "Min Hu (Connor)" <humin29@huawei.com>,
"Morten Brørup" <mb@smartsharesystems.com>,
"Ray Kinsella" <mdr@ashroe.eu>,
"Ajit Khaparde" <ajit.khaparde@broadcom.com>,
"Thomas Monjalon" <thomas@monjalon.net>,
"Ferruh Yigit" <ferruh.yigit@intel.com>,
"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>
Subject: [PATCH] ethdev: introduce ethdev dump API
Date: Mon, 7 Feb 2022 09:47:19 +0800 [thread overview]
Message-ID: <20220207014719.16611-1-humin29@huawei.com> (raw)
In-Reply-To: <20220111115437.32855-1-humin29@huawei.com>
Added the ethdev dump API which provides functions for query 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>
---
doc/guides/rel_notes/release_22_03.rst | 7 +++++++
lib/ethdev/ethdev_driver.h | 17 +++++++++++++++++
lib/ethdev/rte_ethdev.c | 15 +++++++++++++++
lib/ethdev/rte_ethdev.h | 16 ++++++++++++++++
lib/ethdev/version.map | 3 +++
5 files changed, 58 insertions(+)
diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst
index b20716c521..5895194cde 100644
--- a/doc/guides/rel_notes/release_22_03.rst
+++ b/doc/guides/rel_notes/release_22_03.rst
@@ -92,6 +92,13 @@ New Features
* Called ``rte_ipv4/6_udptcp_cksum_mbuf()`` functions in testpmd csum mode
to support software UDP/TCP checksum over multiple segments.
+* **Added the private ethdev dump API, for query private info of ethdev.**
+
+ Added the private ethdev dump API which provides functions for query
+ private info from device. There exists many private properties in
+ different PMD drivers. The information of these properties is important
+ for debug. As the information is private, the new API is introduced.
+
Removed Items
-------------
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 7d27781f7d..d41d8a2c9d 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -990,6 +990,20 @@ 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 ethdev private info to a file.
+ *
+ * @param file
+ * A pointer to a file for output.
+ * @param dev
+ * Port (ethdev) handle.
+ *
+ * @return
+ * Negative errno value on error, positive value on success.
+ */
+typedef int (*eth_dev_priv_dump_t)(FILE *file, struct rte_eth_dev *dev);
+
/**
* @internal A structure containing the functions exported by an Ethernet driver.
*/
@@ -1186,6 +1200,9 @@ struct eth_dev_ops {
* kinds of metadata to the PMD
*/
eth_rx_metadata_negotiate_t rx_metadata_negotiate;
+
+ /** Dump ethdev private info */
+ eth_dev_priv_dump_t eth_dev_priv_dump;
};
/**
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 917a320afa..07838cc2d9 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -6485,6 +6485,21 @@ 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(FILE *file, uint16_t port_id)
+{
+ struct rte_eth_dev *dev;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_dev_priv_dump, -ENOTSUP);
+ ret = (*dev->dev_ops->eth_dev_priv_dump)(file, dev);
+
+ return ret;
+}
+
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 147cc1ced3..1c00fdbcd2 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -5902,6 +5902,22 @@ rte_eth_tx_buffer(uint16_t port_id, uint16_t queue_id,
return rte_eth_tx_buffer_flush(port_id, queue_id, buffer);
}
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Dump ethdev private info to a file.
+ *
+ * @param file
+ * A pointer to a file for output.
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @return
+ * Negative errno value on error, positive value on success.
+ */
+__rte_experimental
+int rte_eth_dev_priv_dump(FILE *file, uint16_t port_id);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 1f7359c846..376ea139aa 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -256,6 +256,9 @@ EXPERIMENTAL {
rte_flow_flex_item_create;
rte_flow_flex_item_release;
rte_flow_pick_transfer_proxy;
+
+ # added in 22.03
+ rte_eth_dev_priv_dump;
};
INTERNAL {
--
2.33.0
next prev parent reply other threads:[~2022-02-07 1:47 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-11 11:54 [RFC] ethdev: introduce ethdev dump API Min Hu (Connor)
2022-01-11 12:10 ` Morten Brørup
2022-01-12 2:40 ` Min Hu (Connor)
2022-01-11 12:48 ` Thomas Monjalon
2022-01-12 2:41 ` Min Hu (Connor)
2022-01-12 2:44 ` Min Hu (Connor)
2022-01-12 10:13 ` Thomas Monjalon
2022-01-12 10:56 ` Min Hu (Connor)
2022-01-12 2:40 ` [RFC v2] " Min Hu (Connor)
2022-01-12 7:20 ` Morten Brørup
2022-01-12 11:15 ` Min Hu (Connor)
2022-01-14 17:56 ` Ajit Khaparde
2022-01-15 0:24 ` Min Hu (Connor)
2022-01-18 15:33 ` Ajit Khaparde
2022-01-12 11:14 ` [RFC v3] " Min Hu (Connor)
2022-01-12 12:05 ` Ray Kinsella
2022-01-18 15:34 ` Ajit Khaparde
2022-01-25 12:56 ` Ferruh Yigit
2022-01-25 12:58 ` Ferruh Yigit
2022-01-25 13:45 ` Min Hu (Connor)
2022-02-03 13:21 ` Ferruh Yigit
2022-02-07 1:37 ` Min Hu (Connor)
2022-02-07 1:35 ` Min Hu (Connor)
2022-02-07 1:47 ` Min Hu (Connor) [this message]
2022-02-07 11:46 ` [PATCH] " Ferruh Yigit
2022-02-07 12:18 ` Morten Brørup
2022-02-07 12:35 ` Ferruh Yigit
2022-02-07 12:56 ` Morten Brørup
2022-02-07 15:35 ` Ferruh Yigit
2022-02-08 0:39 ` Min Hu (Connor)
2022-02-08 10:21 ` Ferruh Yigit
2022-02-08 11:14 ` Min Hu (Connor)
2022-02-08 12:59 ` Ferruh Yigit
2022-02-08 13:52 ` Thomas Monjalon
2022-02-09 1:07 ` Min Hu (Connor)
2022-02-09 1:06 ` Min Hu (Connor)
2022-02-08 2:46 ` Min Hu (Connor)
2022-02-08 2:45 ` [PATCH v2] ethdev: introduce " Min Hu (Connor)
2022-02-09 1:21 ` [PATCH v3] " Min Hu (Connor)
2022-02-10 12:32 ` Ferruh Yigit
2022-02-10 12:34 ` Ferruh Yigit
2022-02-11 4:53 ` Min Hu (Connor)
2022-02-10 12:37 ` Ferruh Yigit
2022-02-10 13:16 ` Min Hu (Connor)
2022-02-10 13:22 ` Ferruh Yigit
2022-02-10 15:50 ` Ferruh Yigit
2022-02-11 4:52 ` Min Hu (Connor)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220207014719.16611-1-humin29@huawei.com \
--to=humin29@huawei.com \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=mb@smartsharesystems.com \
--cc=mdr@ashroe.eu \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.