diff mbox series

[RFC,v3] ethdev: introduce ethdev dump API

Message ID 20220112111424.20594-1-humin29@huawei.com (mailing list archive)
State New
Delegated to: Ferruh Yigit
Headers show
Series [RFC,v3] ethdev: introduce ethdev dump API | expand

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Min Hu (Connor) Jan. 12, 2022, 11:14 a.m. UTC
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>
---
v3:
* fix comment.
* add rte_eth_dev_priv_dump to version.map file.

v2:
* fix dump API name
* adjust description in doc.
---
 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(+)

Comments

Ray Kinsella Jan. 12, 2022, 12:05 p.m. UTC | #1
Min Hu (Connor) <humin29@huawei.com> writes:

> 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>
> ---
> v3:
> * fix comment.
> * add rte_eth_dev_priv_dump to version.map file.
>
> v2:
> * fix dump API name
> * adjust description in doc.
> ---
>  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(+)
>

Acked-by: Ray Kinsella <mdr@ashroe.eu>
Ajit Khaparde Jan. 18, 2022, 3:34 p.m. UTC | #2
On Wed, Jan 12, 2022 at 4:06 AM Ray Kinsella <mdr@ashroe.eu> wrote:
>
>
> Min Hu (Connor) <humin29@huawei.com> writes:
>
> > 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>
> > ---
> > v3:
> > * fix comment.
> > * add rte_eth_dev_priv_dump to version.map file.
> >
> > v2:
> > * fix dump API name
> > * adjust description in doc.
> > ---
> >  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(+)
> >
>
> Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Ferruh Yigit Jan. 25, 2022, 12:56 p.m. UTC | #3
On 1/18/2022 3:34 PM, Ajit Khaparde wrote:
> On Wed, Jan 12, 2022 at 4:06 AM Ray Kinsella <mdr@ashroe.eu> wrote:
>>
>>
>> Min Hu (Connor) <humin29@huawei.com> writes:
>>
>>> 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>
>>> ---
>>> v3:
>>> * fix comment.
>>> * add rte_eth_dev_priv_dump to version.map file.
>>>
>>> v2:
>>> * fix dump API name
>>> * adjust description in doc.
>>> ---
>>>   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(+)
>>>
>>
>> Acked-by: Ray Kinsella <mdr@ashroe.eu>
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>


I have a concern and this "private info", it can be useful for debug
but still it will lead to a PMD specific applications, I wonder if some
common information can be provided. Is there any list in your mind what
can be part of this private info?

Also why not use existing xstats or telemetry to get more data from the
drivers?
As synced with Ciara (cc'ed), she mentioned more information can be get
via registering callbacks to ethdev.
Ferruh Yigit Jan. 25, 2022, 12:58 p.m. UTC | #4
On 1/25/2022 12:56 PM, Ferruh Yigit wrote:
> On 1/18/2022 3:34 PM, Ajit Khaparde wrote:
>> On Wed, Jan 12, 2022 at 4:06 AM Ray Kinsella <mdr@ashroe.eu> wrote:
>>>
>>>
>>> Min Hu (Connor) <humin29@huawei.com> writes:
>>>
>>>> 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>
>>>> ---
>>>> v3:
>>>> * fix comment.
>>>> * add rte_eth_dev_priv_dump to version.map file.
>>>>
>>>> v2:
>>>> * fix dump API name
>>>> * adjust description in doc.
>>>> ---
>>>>   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(+)
>>>>
>>>
>>> Acked-by: Ray Kinsella <mdr@ashroe.eu>
>> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> 
> 
> I have a concern and this "private info", it can be useful for debug
> but still it will lead to a PMD specific applications, I wonder if some
> common information can be provided. Is there any list in your mind what
> can be part of this private info?
> 
> Also why not use existing xstats or telemetry to get more data from the
> drivers?
> As synced with Ciara (cc'ed), she mentioned more information can be get
> via registering callbacks to ethdev.

Opps, Ciara (Power) cc'ed now.
Min Hu (Connor) Jan. 25, 2022, 1:45 p.m. UTC | #5
Hi, Ferruh,

在 2022/1/25 20:58, Ferruh Yigit 写道:
> On 1/25/2022 12:56 PM, Ferruh Yigit wrote:
>> On 1/18/2022 3:34 PM, Ajit Khaparde wrote:
>>> On Wed, Jan 12, 2022 at 4:06 AM Ray Kinsella <mdr@ashroe.eu> wrote:
>>>>
>>>>
>>>> Min Hu (Connor) <humin29@huawei.com> writes:
>>>>
>>>>> 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>
>>>>> ---
>>>>> v3:
>>>>> * fix comment.
>>>>> * add rte_eth_dev_priv_dump to version.map file.
>>>>>
>>>>> v2:
>>>>> * fix dump API name
>>>>> * adjust description in doc.
>>>>> ---
>>>>>   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(+)
>>>>>
>>>>
>>>> Acked-by: Ray Kinsella <mdr@ashroe.eu>
>>> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
>>
>>
>> I have a concern and this "private info", it can be useful for debug
>> but still it will lead to a PMD specific applications, I wonder if some
>> common information can be provided.
The purpose of introducing the API is to enhance dump ability for NICs.
It will be used in APP proc-info, I will add "show-port-private" option
for it. As for common information, I will add them in "show-port" option
which already exists.


  Is there any list in your mind what
>> can be part of this private info?
Private info for NICs, take HNS3 PMD NICS as an example,
   - Dev Capability:
           -- support DCB: no
           -- support COPPER: no
           -- support FD QUEUE REGION: no
           -- support PTP: no
           -- support TX PUSH: no
           -- support INDEP TXRX: no
           -- support STASH: no
           -- support SIMPLE BD: no
           -- support RXD Advanced Layout: no
           -- support OUTER UDP CKSUM: no
           -- support RAS IMP: no
           -- support TM: no
           -- support VF VLAN FILTER MOD: no
   - VLAN Config Info:
           -- Port VLAN filter configuration
                nic_ingress           :Disable
                nic_egress            :Disable
           -- VF VLAN filter configuration
                nic_ingress           :Disable
                nic_egress            :Disable
           -- RX VLAN configuration
                vlan1_strip_en        :Disable
                vlan2_strip_en        :Disable
                vlan1_vlan_prionly    :Disable
                vlan2_vlan_prionly    :Disable
                vlan1_strip_discard   :Disable
                vlan2_strip_discard   :Disable
           -- TX VLAN configuration
                accept_tag1           :Enable
                accept_untag1         :Enable
                insert_tag1_en        :Disable
                default_vlan_tag1 = 0, qos = 0
                accept_tag2           :Enable
                accept_untag2         :Enable
                insert_tag2_en        :Disable
                default_vlan_tag2 = 0, qos = 0
                vlan_shift_mode       :Disable
           -- pvid status: off
   - Fdir Info:
           -- mode=0 max_key_len=400 rule_num:512 cnt_num:32
           -- key_sel=1 tuple_active=0x3bdfd890 meta_data_active=0xd0
           -- ipv6_word_en: in_s=3 in_d=3 out_s=0 out_d=0
....

These info is private for hns3 PMD.


>>
>> Also why not use existing xstats or telemetry to get more data from the
>> drivers?
Xstats is used to query statistics rather than state. Like above info,
many keys is "enable" or "disable". It is not appropriated to put the
date in xstats.

Telemetry is used to query common info for NICs, not for private info.
  It is not also appropriated to put private date in telemetry.



>> As synced with Ciara (cc'ed), she mentioned more information can be get
>> via registering callbacks to ethdev.
> 
> Opps, Ciara (Power) cc'ed now.
> .
diff mbox series

Patch

diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst
index 6d99d1eaa9..4f97df942d 100644
--- a/doc/guides/rel_notes/release_22_03.rst
+++ b/doc/guides/rel_notes/release_22_03.rst
@@ -55,6 +55,13 @@  New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **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 d95605a355..0e3d99b07e 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 a1d475a292..9fc6d91d76 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -6472,6 +6472,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 fa299c8ad7..d17e0f177d 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -5888,6 +5888,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 c2fb0669a4..f29c60eda4 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 {