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>,
"Ferruh Yigit" <ferruh.yigit@intel.com>,
"Thomas Monjalon" <thomas@monjalon.net>,
"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>
Subject: [PATCH v4] ethdev: introduce dump API
Date: Fri, 4 Mar 2022 09:22:55 +0800 [thread overview]
Message-ID: <20220304012257.39247-4-humin29@huawei.com> (raw)
In-Reply-To: <20220304012257.39247-1-humin29@huawei.com>
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>
---
v4:
* fix comments for API.
v3:
* change 'ethdev' to 'device'.
v2:
* fixed comments from Ferruh.
---
doc/guides/rel_notes/release_22_03.rst | 7 +++++++
lib/ethdev/ethdev_driver.h | 22 ++++++++++++++++++++++
lib/ethdev/rte_ethdev.c | 17 +++++++++++++++++
lib/ethdev/rte_ethdev.h | 20 ++++++++++++++++++++
lib/ethdev/version.map | 1 +
5 files changed, 67 insertions(+)
diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst
index 0f1d3adaf2..10ac807e1c 100644
--- a/doc/guides/rel_notes/release_22_03.rst
+++ b/doc/guides/rel_notes/release_22_03.rst
@@ -80,6 +80,13 @@ New Features
New APIs, ``rte_eth_dev_priority_flow_ctrl_queue_info_get()`` and
``rte_eth_dev_priority_flow_ctrl_queue_configure()``, was added.
+* **Added the private dump API, for query private info from device.**
+
+ Added the private dump API which provides querying 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.
+
* **Updated AF_XDP PMD**
* Added support for libxdp >=v1.2.2.
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 76a3975c1b..617b450d57 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -1045,6 +1045,25 @@ typedef int (*eth_ip_reassembly_conf_get_t)(struct rte_eth_dev *dev,
typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev,
const struct rte_eth_ip_reassembly_params *conf);
+/**
+ * @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.
*/
@@ -1252,6 +1271,9 @@ struct eth_dev_ops {
eth_ip_reassembly_conf_get_t ip_reassembly_conf_get;
/** Set IP reassembly configuration */
eth_ip_reassembly_conf_set_t ip_reassembly_conf_set;
+
+ /** 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 c95b3cd3db..2a479bea21 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -6750,6 +6750,23 @@ rte_eth_ip_reassembly_dynfield_register(int *field_offset, int *flag_offset)
return 0;
}
+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 f554e716bc..3439b04119 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -5432,6 +5432,26 @@ typedef struct {
uint16_t nb_frags;
} rte_eth_ip_reassembly_dynfield_t;
+/**
+ * @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>
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 1ca7ec33ee..fb82c8bf53 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -263,6 +263,7 @@ EXPERIMENTAL {
rte_eth_ip_reassembly_capability_get;
rte_eth_ip_reassembly_conf_get;
rte_eth_ip_reassembly_conf_set;
+ rte_eth_dev_priv_dump;
};
INTERNAL {
--
2.33.0
next prev parent reply other threads:[~2022-03-04 1:23 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 3:26 [PATCH] app/testpmd: add help messages for multi-process Min Hu (Connor)
2022-02-28 8:57 ` Thomas Monjalon
2022-03-01 3:41 ` Min Hu (Connor)
2022-03-01 8:36 ` Thomas Monjalon
2022-03-01 9:19 ` Min Hu (Connor)
2022-03-01 3:39 ` [PATCH v2] " Min Hu (Connor)
2022-03-01 8:35 ` Thomas Monjalon
2022-03-01 9:17 ` Min Hu (Connor)
2022-03-01 9:16 ` [PATCH v3] " Min Hu (Connor)
2022-03-03 12:09 ` Ferruh Yigit
2022-03-03 14:59 ` Ajit Khaparde
2022-03-04 1:28 ` Min Hu (Connor)
2022-03-04 1:22 ` [PATCH] 1 version Min Hu (Connor)
2022-03-04 1:22 ` [PATCH] app/testpmd: add help messages for multi-process Min Hu (Connor)
2022-03-04 1:25 ` Min Hu (Connor)
2022-03-04 1:22 ` [PATCH] dpdk: show dev basic info Min Hu (Connor)
2022-03-04 1:25 ` Min Hu (Connor)
2022-03-04 1:22 ` Min Hu (Connor) [this message]
2022-03-04 1:26 ` [PATCH v4] ethdev: introduce dump API Min Hu (Connor)
2022-03-04 1:22 ` [PATCH] net/bonding: fix slaves initializing on mtu setting Min Hu (Connor)
2022-03-04 1:27 ` Min Hu (Connor)
2022-03-04 1:25 ` [PATCH] 1 version Min Hu (Connor)
2022-03-04 1:27 ` [PATCH v4] app/testpmd: add help messages for multi-process Min Hu (Connor)
2022-03-04 2:50 ` Zhang, Yuying
2022-03-04 6:29 ` Min Hu (Connor)
2022-03-04 6:26 ` [PATCH v5] " Min Hu (Connor)
2022-03-04 9:11 ` Zhang, Yuying
2022-03-04 15:35 ` Ferruh Yigit
2022-03-06 22:52 ` Thomas Monjalon
2022-03-07 1:05 ` Min Hu (Connor)
2022-03-04 14:46 ` Ferruh Yigit
2022-03-07 1:04 ` Min Hu (Connor)
2022-04-25 6:51 ` Min Hu (Connor)
2022-06-02 2:24 ` Min Hu (Connor)
2022-06-02 23:08 ` Ferruh Yigit
2022-06-09 8:07 ` Dongdong Liu
2022-06-09 8:52 ` [PATCH v6] " Dongdong Liu
2022-06-09 14:06 ` Ferruh Yigit
2022-06-09 14:58 ` Ferruh Yigit
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=20220304012257.39247-4-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).