dmadev: add telemetry support
PATCH 1/1 dmadev: add telemetry support
Telemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0}} --> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}
--- doc/guides/prog_guide/dmadev.rst | 24 ++++++ doc/guides/rel_notes/release_22_07.rst | 4 + lib/dmadev/meson.build | 2 + lib/dmadev/rte_dmadev.c | 105 +++++++++++++++++++++++++ 4 files changed, 135 insertions(+)
doc/guides/prog_guide/dmadev.rst +24 -0
@@ -118,3 +118,27 @@ i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a * ``submitted``: The number of operations submitted to the device. * ``completed``: The number of operations which have completed (successful and failed). * ``errors``: The number of operations that completed with error. + +The dmadev library has support for displaying DMA device information +through the Telemetry interface. Telemetry commands that can be used +are shown below. + +#. Get the list of available DMA devices by ID:: + + --> /dmadev/list + {"/dmadev/list": [0, 1]} + +#. Get general information from a DMA device:: + + --> /dmadev/info,0 + {"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, + "numa_node": 0}} + +#. Get the statistics for a particular DMA device and virtual DMA channel:: + + --> /dmadev/stats,0,0 + {"/dmadev/stats": {"submitted": 0, "completed": 0, + "errors": 0}} + +For more information on how to use the Telemetry interface, see +the :doc:`../howto/telemetry`.
doc/guides/rel_notes/release_22_07.rst +4 -0
@@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added telemetry callbacks to dmadev library.** + + Added telemetry callback functions which allow for a list of DMA devices, + stats for a DMA device, and other DMA device information to be queried. Removed Items -------------
lib/dmadev/meson.build +2 -0
@@ -5,3 +5,5 @@ sources = files('rte_dmadev.c') headers = files('rte_dmadev.h') indirect_headers += files('rte_dmadev_core.h') driver_sdk_headers += files('rte_dmadev_pmd.h') + +deps += ['telemetry']
lib/dmadev/rte_dmadev.c +105 -0
114 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 28 lines
-----Original Message-----
From: Sean Morrissey <[email protected]>
Sent: Wednesday, March 23, 2022 10:19 PM
To: Chengwen Feng <[email protected]>; Laatz, Kevin <[email protected]>; Richardson, Bruce <[email protected]>
Cc: [email protected]; Morrissey, Sean <[email protected]>
Subject: [PATCH v1] dmadev: add telemetry supportTelemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Connecting to
/var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0}} --> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}
Quoted 8 lines
Signed-off-by Sean Morrissey <[email protected]>--- doc/guides/prog_guide/dmadev.rst | 24 ++++++ doc/guides/rel_notes/release_22_07.rst | 4 + lib/dmadev/meson.build | 2 + lib/dmadev/rte_dmadev.c | 105 +++++++++++++++++++++++++ 4 files changed, 135 insertions(+)
Thanks for adding the telemetry support.
Regards,
Sunil
Quoted 7 lines · Sean Morrissey
Telemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Quoted 11 lines
Connecting to
/var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0}} --> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}
I am wondering if for simplicity we should allow the vchan id to be omitted if only one vchan is present. For automated use by tools it probably won't matter, but for interactive use it might be nice.
Quoted 19 lines
Signed-off-by Sean Morrissey <[email protected]>--- doc/guides/prog_guide/dmadev.rst | 24 ++++++ doc/guides/rel_notes/release_22_07.rst | 4 + lib/dmadev/meson.build | 2 + lib/dmadev/rte_dmadev.c | 105 +++++++++++++++++++++++++ 4 files changed, 135 insertions(+)doc/guides/prog_guide/dmadev.rst +2
-0@@ -118,3 +118,27 @@ i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a * ``submitted``: The number of operations submitted to the device. * ``completed``: The number of operations which have completed (successful and failed). * ``errors``: The number of operations that completed with error. + +The dmadev library has support for displaying DMA device information
doc/guides/prog_guide/dmadev.rst i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a · line 132
Quoted 10 lines
doc/guides/prog_guide/dmadev.rst +10
-0+through the Telemetry interface. Telemetry commands that can be used +are shown below. + +#. Get the list of available DMA devices by ID:: + + --> /dmadev/list + {"/dmadev/list": [0, 1]} + +#. Get general information from a DMA device:: +
Explain here that the device id is passed as parameter.
doc/guides/prog_guide/dmadev.rst i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a · line 139
Quoted 7 lines
doc/guides/prog_guide/dmadev.rst +7
-0+ --> /dmadev/info,0 + {"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, + "numa_node": 0}} + +#. Get the statistics for a particular DMA device and virtual DMA channel:: + + --> /dmadev/stats,0,0
Again, explain the parameters.
Quoted 25 lines
doc/guides/prog_guide/dmadev.rst +5
-0+ {"/dmadev/stats": {"submitted": 0, "completed": 0, + "errors": 0}} + +For more information on how to use the Telemetry interface, see +the :doc:`../howto/telemetry`.doc/guides/rel_notes/release_22_07.rst +4
-0@@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added telemetry callbacks to dmadev library.** + + Added telemetry callback functions which allow for a list of DMA devices, + stats for a DMA device, and other DMA device information to be queried. Removed Items -------------lib/dmadev/meson.build +0
-0
lib/dmadev/meson.build sources = files('rte_dmadev.c') · line 9
Quoted 5 lines
lib/dmadev/meson.build +2
-0@@ -5,3 +5,5 @@ sources = files('rte_dmadev.c') headers = files('rte_dmadev.h') indirect_headers += files('rte_dmadev_core.h') driver_sdk_headers += files('rte_dmadev_pmd.h') + +deps += ['telemetry']
This is actually unnecessary as EAL depends on telemetry so it's an implicit dependency of every other lib. While functionally it doesn't hurt to list it, I'd tend towards not doing so, as in the past I've seen meson configuration runs slow down if we have unnecessary dependencies called out that then need to be deduplicated in python.
Quoted 17 lines
lib/dmadev/rte_dmadev.c +2
-0@@ -11,6 +11,7 @@#include <rte_malloc.h> #include <rte_memzone.h> #include <rte_string_fns.h> +#include <rte_telemetry.h> #include "rte_dmadev.h" #include "rte_dmadev_pmd.h" @@ -864,3 +865,107 @@ dma_fp_object_dummy(struct rte_dma_fp_object *obj) obj->completed_status = dummy_completed_status; obj->burst_capacity = dummy_burst_capacity; } +
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 878
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+static int +dmadev_handle_dev_list(const char *cmd __rte_unused, + const char *params __rte_unused, +struct rte_tel_data *d) +{ +int dev_id; + +if (rte_dma_count_avail () ==0 ) +return -EINVAL ; +
Rather than error, we should just return an empty list. Just removing this check should do the trick.
Quoted 31 lines
lib/dmadev/rte_dmadev.c +31
-0+rte_tel_data_start_array (d,RTE_TEL_INT_VAL ); +for (dev_id =0 ; dev_id < dma_devices_max; dev_id++) +if (rte_dma_is_valid (dev_id)) +rte_tel_data_add_array_int (d, dev_id); + +return 0 ; +} + +static int +dmadev_handle_dev_info(const char *cmd __rte_unused, +const char *params,struct rte_tel_data *d) +{ +struct rte_dma_info dma_info; +int dev_id, ret; +char *end_param; + +if (params ==NULL ||strlen (params) ==0 || !isdigit (*params)) +return -EINVAL ; + + dev_id =strtoul (params, &end_param,0 ); +if (*end_param !='\0' ) +RTE_DMA_LOG (ERR , +"Extra parameters passed to dmadev telemetry command, ignoring" ); + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + + ret =rte_dma_info_get (dev_id, &dma_info); +if (ret <0 ) +return -EINVAL ; +
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 919
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+rte_tel_data_start_dict (d); +rte_tel_data_add_dict_string (d,"name" , + dma_info.dev_name); +rte_tel_data_add_dict_int (d,"nb_vchans" , + dma_info.nb_vchans); +rte_tel_data_add_dict_int (d,"numa_node" , + dma_info.numa_node); + +return 0 ; +}
There is more information returned by info_get function than called out here, so I think the function should be expanded. For the capabilities, for example, I think each one should be called out by name with a 0 or 1 value, so things are nice and clear.
Quoted 15 lines
lib/dmadev/rte_dmadev.c +15
-0+ +#define ADD_DICT_STAT (s) rte_tel_data_add_dict_u64(d, #s, dma_stats.s) + +static int +dmadev_handle_dev_stats(const char *cmd __rte_unused, +const char *params, +struct rte_tel_data *d) +{ +struct rte_dma_stats dma_stats; +int dev_id, vchan_id, ret; +char *end_param; +const char *vchan_param; + +if (params ==NULL ||strlen (params) ==0 || !isdigit (*params)) +return -EINVAL ;
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 944
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+ + dev_id =strtoul (params, &end_param,0 ); + vchan_param =strtok (end_param,"," ); +if (!vchan_param ||strlen (vchan_param) ==0 || !isdigit (*vchan_param)) +return -EINVAL ; + + vchan_id =strtoul (vchan_param, &end_param,0 ); +if (*end_param !='\0' ) +RTE_DMA_LOG (ERR , +"Extra parameters passed to dmadev telemetry command, ignoring" );
You don't need to split these lines like this. Lines up to 100 chars are allowed, and any strings are allowed to continue on past that, so it's only after a long string you need to split the line. Also, according to our coding guidelines, line continuations should be double-indented or alternatively aligned to the opening brace on the previous line. Check what is done already the file and keep it consistent with that.
Quoted 11 lines
lib/dmadev/rte_dmadev.c +11
-0+ +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + + ret =rte_dma_stats_get (dev_id, vchan_id, &dma_stats); +if (ret <0 ) +return -EINVAL ; + +rte_tel_data_start_dict (d); +ADD_DICT_STAT (submitted); +ADD_DICT_STAT (completed);
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 965
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+ADD_DICT_STAT (errors); + +return 0 ; +} + +RTE_INIT (dmadev_init_telemetry) +{ +rte_telemetry_register_cmd ("/dmadev/list" , + dmadev_handle_dev_list, +"Returns list of available dmadev devices by IDs. No parameters." );
This can be shrunk to 2 lines I think.
Quoted 9 lines
lib/dmadev/rte_dmadev.c +6
-0+rte_telemetry_register_cmd ("/dmadev/info" , dmadev_handle_dev_info, +"Returns information for a dmadev. Parameters: int dev_id" ); +rte_telemetry_register_cmd ("/dmadev/stats" , + dmadev_handle_dev_stats, +"Returns the stats for a dmadev. Parameters: int dev_id, vchan_id" ); +}Signature · 1 line
2.25.1
PATCH v2 1/1 dmadev: add telemetry support
In reply to Sean MorrisseyTelemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0}} --> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}
---
V2:
* add device capabilities to info command
* no requirement to pass vchan id
if the device only has one vchan
* minor code cleanup
--- doc/guides/prog_guide/dmadev.rst | 27 ++++++ doc/guides/rel_notes/release_22_07.rst | 4 + lib/dmadev/meson.build | 2 + lib/dmadev/rte_dmadev.c | 127 +++++++++++++++++++++++++ 4 files changed, 160 insertions(+)
doc/guides/prog_guide/dmadev.rst +27 -0
@@ -118,3 +118,30 @@ i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a * ``submitted``: The number of operations submitted to the device. * ``completed``: The number of operations which have completed (successful and failed). * ``errors``: The number of operations that completed with error. + +The dmadev library has support for displaying DMA device information +through the Telemetry interface. Telemetry commands that can be used +are shown below. + +#. Get the list of available DMA devices by ID:: + + --> /dmadev/list + {"/dmadev/list": [0, 1]} + +#. Get general information from a DMA device by passing the device id as a parameter:: + + --> /dmadev/info,0 + {"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0}} + +#. Get the statistics for a particular DMA device and virtual DMA channel by passing the device id and vchan id as parameters:: + + --> /dmadev/stats,0,0 + {"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}} + +#. If a DMA device only has one virtual DMA channel you only need to pass the device id to get its statistics:: + + --> /dmadev/stats,0 + {"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}} + +For more information on how to use the Telemetry interface, see +the :doc:`../howto/telemetry`.
doc/guides/rel_notes/release_22_07.rst +4 -0
@@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added telemetry callbacks to dmadev library.** + + Added telemetry callback functions which allow for a list of DMA devices, + stats for a DMA device, and other DMA device information to be queried. Removed Items -------------
lib/dmadev/meson.build +2 -0
@@ -5,3 +5,5 @@ sources = files('rte_dmadev.c') headers = files('rte_dmadev.h') indirect_headers += files('rte_dmadev_core.h') driver_sdk_headers += files('rte_dmadev_pmd.h') + +deps += ['telemetry']
lib/dmadev/rte_dmadev.c +127 -0
136 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 7 lines · Sean Morrissey
Telemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Quoted 9 lines
Connecting to
/var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0}}
This needs an update now that more info is being output. It probably all does not need to be displayed here, so adding "..." may be enough if you like.
Quoted 31 lines
--> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}Signed-off-by Sean Morrissey <[email protected]>Tested-by Sunil Pai G <[email protected]>---
V2:
* add device capabilities to info command
* no requirement to pass vchan id
if the device only has one vchan
* minor code cleanup--- doc/guides/prog_guide/dmadev.rst | 27 ++++++ doc/guides/rel_notes/release_22_07.rst | 4 + lib/dmadev/meson.build | 2 + lib/dmadev/rte_dmadev.c | 127 +++++++++++++++++++++++++ 4 files changed, 160 insertions(+)doc/guides/prog_guide/dmadev.rst +5
-0@@ -118,3 +118,30 @@ i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a * ``submitted``: The number of operations submitted to the device. * ``completed``: The number of operations which have completed (successful and failed). * ``errors``: The number of operations that completed with error. + +The dmadev library has support for displaying DMA device information +through the Telemetry interface. Telemetry commands that can be used +are shown below. +
doc/guides/prog_guide/dmadev.rst i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a · line 135
Quoted 10 lines
doc/guides/prog_guide/dmadev.rst +10
-0+#. Get the list of available DMA devices by ID:: + + --> /dmadev/list + {"/dmadev/list": [0, 1]} + +#. Get general information from a DMA device by passing the device id as a parameter:: + + --> /dmadev/info,0 + {"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0}} +
As above
doc/guides/prog_guide/dmadev.rst i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a · line 145
Quoted 10 lines
doc/guides/prog_guide/dmadev.rst +10
-0+#. Get the statistics for a particular DMA device and virtual DMA channel by passing the device id and vchan id as parameters:: + + --> /dmadev/stats,0,0 + {"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}} + +#. If a DMA device only has one virtual DMA channel you only need to pass the device id to get its statistics:: + + --> /dmadev/stats,0 + {"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}} +
Since this is only a convenience, I think you can omit the example for it, and just include the info about it in brackets at the end of the bullet point above - it doesn't need its own bullet.
Quoted 7 lines
doc/guides/prog_guide/dmadev.rst +2
-0+For more information on how to use the Telemetry interface, see +the :doc:`../howto/telemetry`.doc/guides/rel_notes/release_22_07.rst +0
-0
doc/guides/rel_notes/release_22_07.rst New Features · line 62
Quoted 8 lines
doc/guides/rel_notes/release_22_07.rst +4
-0@@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added telemetry callbacks to dmadev library.** + + Added telemetry callback functions which allow for a list of DMA devices, + stats for a DMA device, and other DMA device information to be queried.
For correct formatting of the doc, I think you need to add a new blank line here, since sections end with two empty lines.
Quoted 51 lines
doc/guides/rel_notes/release_22_07.rst +0
-0Removed Items -------------lib/dmadev/meson.build +2
-0@@ -5,3 +5,5 @@ sources = files('rte_dmadev.c') headers = files('rte_dmadev.h') indirect_headers += files('rte_dmadev_core.h') driver_sdk_headers += files('rte_dmadev_pmd.h') + +deps += ['telemetry']lib/dmadev/rte_dmadev.c +24
-0@@ -11,6 +11,7 @@#include <rte_malloc.h> #include <rte_memzone.h> #include <rte_string_fns.h> +#include <rte_telemetry.h> #include "rte_dmadev.h" #include "rte_dmadev_pmd.h" @@ -864,3 +865,129 @@ dma_fp_object_dummy(struct rte_dma_fp_object *obj) obj->completed_status = dummy_completed_status; obj->burst_capacity = dummy_burst_capacity; } + +static int +dmadev_handle_dev_list(const char *cmd __rte_unused, + const char *params __rte_unused, +struct rte_tel_data *d) +{ +int dev_id; + +rte_tel_data_start_array (d,RTE_TEL_INT_VAL ); +for (dev_id =0 ; dev_id < dma_devices_max; dev_id++) +if (rte_dma_is_valid (dev_id)) +rte_tel_data_add_array_int (d, dev_id); + +return 0 ; +} + +static int +dmadev_handle_dev_info(const char *cmd __rte_unused, +const char *params,struct rte_tel_data *d) +{ +struct rte_dma_info dma_info; +struct rte_tel_data *dma_caps; +int dev_id, ret;
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 900
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+char *end_param; + +if (params ==NULL ||strlen (params) ==0 || !isdigit (*params)) +return -EINVAL ; + + dev_id =strtoul (params, &end_param,0 ); +if (*end_param !='\0' ) +RTE_DMA_LOG (WARNING ,"Extra parameters passed to dmadev telemetry command, ignoring" ); + + ret =rte_dma_info_get (dev_id, &dma_info);
For clarity, I think it might be worthwhile adding a one-line comment here that info_get does parameter checking of dev_id so we don't need to do so. Same comment would also apply to stats function below.
Quoted 13 lines
lib/dmadev/rte_dmadev.c +13
-0+if (ret <0 ) +return -EINVAL ; + +rte_tel_data_start_dict (d); +rte_tel_data_add_dict_string (d,"name" , dma_info.dev_name); +rte_tel_data_add_dict_int (d,"nb_vchans" , dma_info.nb_vchans); +rte_tel_data_add_dict_int (d,"numa_node" , dma_info.numa_node); +rte_tel_data_add_dict_int (d,"max_vchans" , dma_info.max_vchans); +rte_tel_data_add_dict_int (d,"max_desc" , dma_info.max_desc); +rte_tel_data_add_dict_int (d,"min_desc" , dma_info.min_desc); +rte_tel_data_add_dict_int (d,"max_sges" , dma_info.max_sges); + + dma_caps =rte_tel_data_alloc ();
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 923
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+if (!dma_caps) +return -ENOMEM ; + +rte_tel_data_start_dict (dma_caps); +rte_tel_data_add_dict_int (dma_caps,"fill" , !!(dma_info.dev_capa &RTE_DMA_CAPA_OPS_FILL )); +rte_tel_data_add_dict_int (dma_caps,"sva" , !!(dma_info.dev_capa &RTE_DMA_CAPA_SVA )); +rte_tel_data_add_dict_int (dma_caps,"silent" , !!(dma_info.dev_capa &RTE_DMA_CAPA_SILENT )); +rte_tel_data_add_dict_int (dma_caps,"copy" , !!(dma_info.dev_capa &RTE_DMA_CAPA_OPS_COPY )); +rte_tel_data_add_dict_int (dma_caps,"mem2mem" , + !!(dma_info.dev_capa &RTE_DMA_CAPA_MEM_TO_MEM ));
Two ideas here in case you wan to consider them for shortening these lines:
* assign "dma_info.dev_capa" to a local var with a short name
* define a macro for adding the capabilities based on the name, something like (completely untested!):
#define ADD_CAPA (td, c, name) \ rte_tel_data_add_dict_int(td, #name, !!(RTE_DMA_CAPA_ ## name & c))
...ADD_CAPA(dma_caps, dev_capa, MEM_TO_MEM);ADD_CAPA(dma_caps, dev_capa, MEM_TO_DEV);
The small downside of the macro scheme is that you'd have to do extra work to avoid having the capabilities in caps, but it does guarantee consistency of naming.
Quoted 28 lines
lib/dmadev/rte_dmadev.c +28
-0+rte_tel_data_add_dict_int (dma_caps,"mem2dev" , + !!(dma_info.dev_capa &RTE_DMA_CAPA_MEM_TO_DEV )); +rte_tel_data_add_dict_int (dma_caps,"dev2mem" , + !!(dma_info.dev_capa &RTE_DMA_CAPA_DEV_TO_MEM )); +rte_tel_data_add_dict_int (dma_caps,"dev2dev" , + !!(dma_info.dev_capa &RTE_DMA_CAPA_DEV_TO_DEV )); +rte_tel_data_add_dict_int (dma_caps,"copy_sg" , + !!(dma_info.dev_capa &RTE_DMA_CAPA_OPS_COPY_SG )); +rte_tel_data_add_dict_int (dma_caps,"handles_errors" , + !!(dma_info.dev_capa &RTE_DMA_CAPA_HANDLES_ERRORS )); +rte_tel_data_add_dict_container (d,"capabilities" , dma_caps,0 ); + +return 0 ; +} + +#define ADD_DICT_STAT (s) rte_tel_data_add_dict_u64(d, #s, dma_stats.s) + +static int +dmadev_handle_dev_stats(const char *cmd __rte_unused, +const char *params, +struct rte_tel_data *d) +{ +struct rte_dma_info dma_info; +struct rte_dma_stats dma_stats; +int dev_id, vchan_id, ret; +char *end_param; +const char *vchan_param; +
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 961
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+if (params ==NULL ||strlen (params) ==0 || !isdigit (*params)) +return -EINVAL ; + + dev_id =strtoul (params, &end_param,0 ); + + ret =rte_dma_info_get (dev_id, &dma_info); +if (ret <0 ) +return -EINVAL ; + +if (dma_info.nb_vchans ==1 && *end_param =='\0' ) {
Needs a comment explaining what is happening.
Also for single-line blocks in DPDK, we allow omitting the braces (even if the else leg needs them).
If you want to remove this block, you can also just set vchan_id = 0 when defining it, and then change the else to be and if with the inverse of the condition above
Quoted 21 lines
lib/dmadev/rte_dmadev.c +21
-0+ vchan_id =0 ; + }else { + vchan_param =strtok (end_param,"," ); +if (!vchan_param ||strlen (vchan_param) ==0 || !isdigit (*vchan_param)) +return -EINVAL ; + + vchan_id =strtoul (vchan_param, &end_param,0 ); + } +if (*end_param !='\0' ) +RTE_DMA_LOG (WARNING ,"Extra parameters passed to dmadev telemetry command, ignoring" ); + + ret =rte_dma_stats_get (dev_id, vchan_id, &dma_stats); +if (ret <0 ) +return -EINVAL ; + +rte_tel_data_start_dict (d); +ADD_DICT_STAT (submitted); +ADD_DICT_STAT (completed); +ADD_DICT_STAT (errors); + +return 0 ;
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 992
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+} + +RTE_INIT (dmadev_init_telemetry) +{ +rte_telemetry_register_cmd ("/dmadev/list" , dmadev_handle_dev_list, +"Returns list of available dmadev devices by IDs. No parameters." ); +rte_telemetry_register_cmd ("/dmadev/info" , dmadev_handle_dev_info, +"Returns information for a dmadev. Parameters: int dev_id" ); +rte_telemetry_register_cmd ("/dmadev/stats" , dmadev_handle_dev_stats, +"Returns the stats for a dmadev vchannel. Parameters: int dev_id, vchan_id (If only one vchannel, vchan_id param is optional)" );
Can shorten text in brackets to "(Optional if only one vchannel)", since it immediately follows the parameter.
Regards,
/Bruce
PATCH v3 1/1 dmadev: add telemetry support
In reply to Sean MorrisseyTelemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0, "max_vchans": 1, "max_desc": 4096, "min_desc": 32, "max_sges": 0, "capabilities": {"fill": 1, "sva": 0, "silent": 0, ...}}}
--> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}
---
V3:
* update docs with correct examples
* code cleanup and added comments
V2:
* add device capabilities to info command
* no requirement to pass vchan id
if the device only has one vchan
* minor code cleanup
--- doc/guides/prog_guide/dmadev.rst | 24 +++++ doc/guides/rel_notes/release_22_07.rst | 5 + lib/dmadev/meson.build | 2 + lib/dmadev/rte_dmadev.c | 130 +++++++++++++++++++++++++ 4 files changed, 161 insertions(+)
doc/guides/prog_guide/dmadev.rst +24 -0
@@ -118,3 +118,27 @@ i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a * ``submitted``: The number of operations submitted to the device. * ``completed``: The number of operations which have completed (successful and failed). * ``errors``: The number of operations that completed with error. + +The dmadev library has support for displaying DMA device information +through the Telemetry interface. Telemetry commands that can be used +are shown below. + +#. Get the list of available DMA devices by ID:: + + --> /dmadev/list + {"/dmadev/list": [0, 1]} + +#. Get general information from a DMA device by passing the device id as a parameter:: + + --> /dmadev/info,0 + {"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0, "max_vchans": 1, "max_desc": 4096, + "min_desc": 32, "max_sges": 0, "capabilities": {"fill": 1, "sva": 0, "silent": 0, ...}}} + +#. Get the statistics for a particular DMA device and virtual DMA channel by passing the device id and vchan id as parameters + (if a DMA device only has one virtual DMA channel you only need to pass the device id):: + + --> /dmadev/stats,0,0 + {"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}} + +For more information on how to use the Telemetry interface, see +the :doc:`../howto/telemetry`.
doc/guides/rel_notes/release_22_07.rst +5 -0
@@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added telemetry callbacks to dmadev library.** + + Added telemetry callback functions which allow for a list of DMA devices, + stats for a DMA device, and other DMA device information to be queried. + Removed Items -------------
lib/dmadev/meson.build +2 -0
@@ -5,3 +5,5 @@ sources = files('rte_dmadev.c') headers = files('rte_dmadev.h') indirect_headers += files('rte_dmadev_core.h') driver_sdk_headers += files('rte_dmadev_pmd.h') + +deps += ['telemetry']
lib/dmadev/rte_dmadev.c +130 -0
139 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 21 lines · Sean Morrissey
Telemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Connecting to
/var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0, "max_vchans": 1, "max_desc": 4096, "min_desc": 32, "max_sges": 0, "capabilities": {"fill": 1, "sva": 0, "silent": 0, ...}}}
--> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}
Quoted 2 lines
Signed-off-by Sean Morrissey <[email protected]>Tested-by Sunil Pai G <[email protected]>
One comment inline below, which I'd like feedback from others on.
Quoted 4 lines
---
V3:
* update docs with correct examples
* code cleanup and added comments
<snip>
Quoted 9 lines
lib/dmadev/rte_dmadev.c +9
-0+ +#define ADD_CAPA (c, s) rte_tel_data_add_dict_int(dma_caps, #c, !!(dev_capa & RTE_DMA_CAPA_ ## s)) + +static int +dmadev_handle_dev_info(const char *cmd __rte_unused, +const char *params,struct rte_tel_data *d) +{ +struct rte_dma_info dma_info; +struct rte_tel_data *dma_caps;
<snip>
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 927
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+ dma_caps =rte_tel_data_alloc (); +if (!dma_caps) +return -ENOMEM ; + +rte_tel_data_start_dict (dma_caps); +ADD_CAPA (fill,OPS_FILL ); +ADD_CAPA (sva,SVA ); +ADD_CAPA (silent,SILENT ); +ADD_CAPA (copy,OPS_COPY ); +ADD_CAPA (mem2mem,MEM_TO_MEM );
I'm not 100% sure about this approach of having slightly different names compared to the flags, just to have things in lower-case. Looking to have some more input here - I'd tend to have the capabilities in upper case to avoid duplicating parameters, but I'm not massively concerned either way.
Quoted 9 lines
lib/dmadev/rte_dmadev.c +9
-0+ADD_CAPA (mem2dev,MEM_TO_DEV ); +ADD_CAPA (dev2mem,DEV_TO_MEM ); +ADD_CAPA (dev2dev,DEV_TO_DEV ); +ADD_CAPA (copy_sg,OPS_COPY_SG ); +ADD_CAPA (handles_errors,HANDLES_ERRORS ); +rte_tel_data_add_dict_container (d,"capabilities" , dma_caps,0 ); + +return 0 ; +}
Walsh, Conor
Reviewed-byQuoted 31 lines
From: Bruce Richardson <[email protected]>
Sent: Friday 1 April 2022 11:50
To: Morrissey, Sean <[email protected]>
Cc: Chengwen Feng <[email protected]>; Laatz, Kevin <[email protected]>; [email protected]; Pai G, Sunil <[email protected]>
Subject: Re: [PATCH v3] dmadev: add telemetry supportQuoted 7 lines · Sean Morrissey
Telemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Quoted 9 lines
Connecting to
/var/run/dpdk/rte/dpdk_telemetry.v2{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node":0,
Quoted 5 lines
"
max_vchans": 1, "max_desc": 4096, "min_desc": 32, "max_sges": 0, "capabilities": {"fill": 1, "sva": 0, "silent": 0, ...}}} --> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}
Quoted 4 lines
Quoted 2 lines
Signed-off-by Sean Morrissey <[email protected]>Tested-by Sunil Pai G <[email protected]>Reviewed-by Bruce Richardson <[email protected]>
Hi Sean,
I'd agree with Bruce's comment below about trying to keep the names the same. Looks good to me though and I've tested it with IOAT and dmafwd.
Thanks,
Quoted 44 lines
One comment inline below, which I'd like feedback from others on.
Quoted 4 lines
---
V3:
* update docs with correct examples
* code cleanup and added comments<snip>
Review
Quoted 2 lines
(quoted diff) +2
-0+ +#define ADD_CAPA(c, s) rte_tel_data_add_dict_int(dma_caps, #c,!!(dev_capa &
RTE_DMA_CAPA_## s))Quoted 7 lines
lib/dmadev/rte_dmadev.c +7
-0+ +static int +dmadev_handle_dev_info(const char *cmd __rte_unused, +const char *params,struct rte_tel_data *d) +{ +struct rte_dma_info dma_info; +struct rte_tel_data *dma_caps;<snip>
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 927
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+ dma_caps =rte_tel_data_alloc (); +if (!dma_caps) +return -ENOMEM ; + +rte_tel_data_start_dict (dma_caps); +ADD_CAPA (fill,OPS_FILL ); +ADD_CAPA (sva,SVA ); +ADD_CAPA (silent,SILENT ); +ADD_CAPA (copy,OPS_COPY ); +ADD_CAPA (mem2mem,MEM_TO_MEM );I'm not 100% sure about this approach of having slightly different names compared to the flags, just to have things in lower-case. Looking to have some more input here - I'd tend to have the capabilities in upper case to avoid duplicating parameters, but I'm not massively concerned either way.
Quoted 9 lines
lib/dmadev/rte_dmadev.c +9
-0+ADD_CAPA (mem2dev,MEM_TO_DEV ); +ADD_CAPA (dev2mem,DEV_TO_MEM ); +ADD_CAPA (dev2dev,DEV_TO_DEV ); +ADD_CAPA (copy_sg,OPS_COPY_SG ); +ADD_CAPA (handles_errors,HANDLES_ERRORS ); +rte_tel_data_add_dict_container (d,"capabilities" , dma_caps,0 ); + +return 0 ; +}
Quoted 33 lines · Conor
Quoted 33 lines
From: Bruce Richardson <[email protected]>
Sent: Friday 1 April 2022 11:50
To: Morrissey, Sean <[email protected]>
Cc: Chengwen Feng <[email protected]>; Laatz, Kevin <[email protected]>; [email protected]; Pai G, Sunil <[email protected]>
Subject: Re: [PATCH v3] dmadev: add telemetry supportQuoted 7 lines · Sean Morrissey
Telemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Quoted 9 lines
Connecting to
/var/run/dpdk/rte/dpdk_telemetry.v2{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node":0,
Quoted 7 lines
"
max_vchans": 1, "max_desc": 4096, "min_desc": 32, "max_sges": 0, "capabilities": {"fill": 1, "sva": 0, "silent": 0, ...}}} --> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}Signed-off-by Sean Morrissey <[email protected]>Tested-by Sunil Pai G <[email protected]>
Quoted 41 lines
Quoted 1 line
Reviewed-by Bruce Richardson <[email protected]>Hi Sean,
I'd agree with Bruce's comment below about trying to keep the names the same. Looks good to me though and I've tested it with IOAT and dmafwd.
Thanks,
Reviewed-by Conor Walsh <[email protected]>Quoted 32 lines
One comment inline below, which I'd like feedback from others on.
Quoted 4 lines
---
V3:
* update docs with correct examples
* code cleanup and added comments<snip>
Review
Quoted 2 lines
(quoted diff) +2
-0+ +#define ADD_CAPA(c, s) rte_tel_data_add_dict_int(dma_caps, #c,!!(dev_capa &
RTE_DMA_CAPA_## s))Quoted 7 lines
lib/dmadev/rte_dmadev.c +7
-0+ +static int +dmadev_handle_dev_info(const char *cmd __rte_unused, +const char *params,struct rte_tel_data *d) +{ +struct rte_dma_info dma_info; +struct rte_tel_data *dma_caps;<snip>
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 927
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+ dma_caps =rte_tel_data_alloc (); +if (!dma_caps) +return -ENOMEM ; + +rte_tel_data_start_dict (dma_caps); +ADD_CAPA (fill,OPS_FILL ); +ADD_CAPA (sva,SVA ); +ADD_CAPA (silent,SILENT ); +ADD_CAPA (copy,OPS_COPY ); +ADD_CAPA (mem2mem,MEM_TO_MEM );I'm not 100% sure about this approach of having slightly different names compared to the flags, just to have things in lower-case. Looking to have some more input here - I'd tend to have the capabilities in upper case to avoid duplicating parameters, but I'm not massively concerned either way.
Hi all,
If that is the preferred approach then I will send another version. I got the lower case
names from the capa_names struct in the dma_capability_name() function and these
naming conventions are also used in the logs i.e. "Device %d don't support mem2mem transfer".
For this reason, I thought this was the preferred approach to naming the capabilities, however
I will keep the names consistent with the flags as suggested.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
lib/dmadev/rte_dmadev.c +9
-0+ADD_CAPA (mem2dev,MEM_TO_DEV ); +ADD_CAPA (dev2mem,DEV_TO_MEM ); +ADD_CAPA (dev2dev,DEV_TO_DEV ); +ADD_CAPA (copy_sg,OPS_COPY_SG ); +ADD_CAPA (handles_errors,HANDLES_ERRORS ); +rte_tel_data_add_dict_container (d,"capabilities" , dma_caps,0 ); + +return 0 ; +}
Quoted 79 lines · Sean
Quoted 33 lines · Conor
Quoted 33 lines
From: Bruce Richardson <[email protected]>
Sent: Friday 1 April 2022 11:50
To: Morrissey, Sean <[email protected]>
Cc: Chengwen Feng <[email protected]>; Laatz, Kevin <[email protected]>; [email protected]; Pai G, Sunil <[email protected]>
Subject: Re: [PATCH v3] dmadev: add telemetry supportQuoted 7 lines · Sean Morrissey
Telemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Quoted 9 lines
Connecting to
/var/run/dpdk/rte/dpdk_telemetry.v2{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node":0,
Quoted 7 lines
"
max_vchans": 1, "max_desc": 4096, "min_desc": 32, "max_sges": 0, "capabilities": {"fill": 1, "sva": 0, "silent": 0, ...}}} --> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}Signed-off-by Sean Morrissey <[email protected]>Tested-by Sunil Pai G <[email protected]>Quoted 41 lines
Quoted 1 line
Reviewed-by Bruce Richardson <[email protected]>Hi Sean,
I'd agree with Bruce's comment below about trying to keep the names the same. Looks good to me though and I've tested it with IOAT and dmafwd.
Thanks,
Reviewed-by Conor Walsh <[email protected]>Quoted 32 lines
One comment inline below, which I'd like feedback from others on.
Quoted 4 lines
---
V3:
* update docs with correct examples
* code cleanup and added comments<snip>
Review
Quoted 2 lines
(quoted diff) +2
-0+ +#define ADD_CAPA(c, s) rte_tel_data_add_dict_int(dma_caps, #c,!!(dev_capa &
RTE_DMA_CAPA_## s))Quoted 7 lines
lib/dmadev/rte_dmadev.c +7
-0+ +static int +dmadev_handle_dev_info(const char *cmd __rte_unused, +const char *params,struct rte_tel_data *d) +{ +struct rte_dma_info dma_info; +struct rte_tel_data *dma_caps;<snip>
lib/dmadev/rte_dmadev.c dma_fp_object_dummy(struct rte_dma_fp_object *obj) · line 927
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+ dma_caps =rte_tel_data_alloc (); +if (!dma_caps) +return -ENOMEM ; + +rte_tel_data_start_dict (dma_caps); +ADD_CAPA (fill,OPS_FILL ); +ADD_CAPA (sva,SVA ); +ADD_CAPA (silent,SILENT ); +ADD_CAPA (copy,OPS_COPY ); +ADD_CAPA (mem2mem,MEM_TO_MEM );I'm not 100% sure about this approach of having slightly different names compared to the flags, just to have things in lower-case. Looking to have some more input here - I'd tend to have the capabilities in upper case to avoid duplicating parameters, but I'm not massively concerned either way.
Hi all,
Quoted 8 lines
If that is the preferred approach then I will send another version. I got the lower case
names from the
capa_namesstruct in thedma_capability_name()function and thesenaming conventions are also used in the logs i.e. "Device %d don't support mem2mem transfer".
My apologies, I didn't realise that that function and list of names existed. Can that be used instead of hard-coding the names and values here? Can we iterate through the array of names and check if the relevant bit position is set?
Quoted 6 lines
For this reason, I thought this was the preferred approach to naming the capabilities, however
I will keep the names consistent with the flags as suggested.
If there are printable names elsewhere that is what we should keep consistent with. However, we should not duplicate those in this code, but reuse existing defined names.
/Bruce
PATCH v4 1/1 dmadev: add telemetry support
In reply to Sean MorrisseyTelemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0, "max_vchans": 1, "max_desc": 4096, "min_desc": 32, "max_sges": 0, "capabilities": {"mem2mem": 1, "mem2dev": 0, "dev2mem": 0, ...}}} --> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}
---
V4:
* get capability name from function
instead of hardcoded
* fix checkpatch warnings
V3:
* update docs with correct examples
* code cleanup and added comments
V2:
* add device capabilities to info command
* no requirement to pass vchan id
if the device only has one vchan
* minor code cleanup
--- doc/guides/prog_guide/dmadev.rst | 24 ++++ doc/guides/rel_notes/release_22_07.rst | 5 + lib/dmadev/meson.build | 2 + lib/dmadev/rte_dmadev.c | 162 ++++++++++++++++++++++--- 4 files changed, 177 insertions(+), 16 deletions(-)
doc/guides/prog_guide/dmadev.rst +24 -0
@@ -118,3 +118,27 @@ i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a * ``submitted``: The number of operations submitted to the device. * ``completed``: The number of operations which have completed (successful and failed). * ``errors``: The number of operations that completed with error. + +The dmadev library has support for displaying DMA device information +through the Telemetry interface. Telemetry commands that can be used +are shown below. + +#. Get the list of available DMA devices by ID:: + + --> /dmadev/list + {"/dmadev/list": [0, 1]} + +#. Get general information from a DMA device by passing the device id as a parameter:: + + --> /dmadev/info,0 + {"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0, "max_vchans": 1, "max_desc": 4096, + "min_desc": 32, "max_sges": 0, "capabilities": {"mem2mem": 1, "mem2dev": 0, "dev2mem": 0, ...}}} + +#. Get the statistics for a particular DMA device and virtual DMA channel by passing the device id and vchan id as parameters + (if a DMA device only has one virtual DMA channel you only need to pass the device id):: + + --> /dmadev/stats,0,0 + {"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}} + +For more information on how to use the Telemetry interface, see +the :doc:`../howto/telemetry`.
doc/guides/rel_notes/release_22_07.rst +5 -0
@@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added telemetry callbacks to dmadev library.** + + Added telemetry callback functions which allow for a list of DMA devices, + stats for a DMA device, and other DMA device information to be queried. + Removed Items -------------
lib/dmadev/meson.build +2 -0
@@ -5,3 +5,5 @@ sources = files('rte_dmadev.c') headers = files('rte_dmadev.h') indirect_headers += files('rte_dmadev_core.h') driver_sdk_headers += files('rte_dmadev_pmd.h') + +deps += ['telemetry']
lib/dmadev/rte_dmadev.c +146 -16
183 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v5 1/1 dmadev: add telemetry support
Telemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0, "max_vchans": 1, "max_desc": 4096, "min_desc": 32, "max_sges": 0, "capabilities": {"mem2mem": 1, "mem2dev": 0, "dev2mem": 0, ...}}} --> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}
---
V5:
* move capa_names struct back to function
V4:
* get capability name from function
instead of hardcoded
* fix checkpatch warnings
V3:
* update docs with correct examples
* code cleanup and added comments
V2:
* add device capabilities to info command
* no requirement to pass vchan id
if the device only has one vchan
* minor code cleanup
--- doc/guides/prog_guide/dmadev.rst | 24 +++++ doc/guides/rel_notes/release_22_07.rst | 5 + lib/dmadev/meson.build | 2 + lib/dmadev/rte_dmadev.c | 130 +++++++++++++++++++++++++ 4 files changed, 161 insertions(+)
doc/guides/prog_guide/dmadev.rst +24 -0
@@ -118,3 +118,27 @@ i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a * ``submitted``: The number of operations submitted to the device. * ``completed``: The number of operations which have completed (successful and failed). * ``errors``: The number of operations that completed with error. + +The dmadev library has support for displaying DMA device information +through the Telemetry interface. Telemetry commands that can be used +are shown below. + +#. Get the list of available DMA devices by ID:: + + --> /dmadev/list + {"/dmadev/list": [0, 1]} + +#. Get general information from a DMA device by passing the device id as a parameter:: + + --> /dmadev/info,0 + {"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0, "max_vchans": 1, "max_desc": 4096, + "min_desc": 32, "max_sges": 0, "capabilities": {"mem2mem": 1, "mem2dev": 0, "dev2mem": 0, ...}}} + +#. Get the statistics for a particular DMA device and virtual DMA channel by passing the device id and vchan id as parameters + (if a DMA device only has one virtual DMA channel you only need to pass the device id):: + + --> /dmadev/stats,0,0 + {"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}} + +For more information on how to use the Telemetry interface, see +the :doc:`../howto/telemetry`.
doc/guides/rel_notes/release_22_07.rst +5 -0
@@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added telemetry callbacks to dmadev library.** + + Added telemetry callback functions which allow for a list of DMA devices, + stats for a DMA device, and other DMA device information to be queried. + Removed Items -------------
lib/dmadev/meson.build +2 -0
@@ -5,3 +5,5 @@ sources = files('rte_dmadev.c') headers = files('rte_dmadev.h') indirect_headers += files('rte_dmadev_core.h') driver_sdk_headers += files('rte_dmadev_pmd.h') + +deps += ['telemetry']
lib/dmadev/rte_dmadev.c +130 -0
139 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 40 lines · Sean Morrissey
Telemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
Connecting to
/var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} Connected to application: "dpdk-dma"
--> /
{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} --> /dmadev/list
{"/dmadev/list": [0, 1]}
--> /dmadev/info,0
{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0, "max_vchans": 1, "max_desc": 4096, "min_desc": 32, "max_sges": 0, "capabilities": {"mem2mem": 1, "mem2dev": 0, "dev2mem": 0, ...}}} --> /dmadev/stats,0,0
{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}}Signed-off-by Sean Morrissey <[email protected]>Tested-by Sunil Pai G <[email protected]>Reviewed-by Bruce Richardson <[email protected]>Reviewed-by Conor Walsh <[email protected]>---
V5:
* movecapa_namesstruct back to function
V4:
* get capability name from function
instead of hardcoded
* fix checkpatch warnings
V3:
* update docs with correct examples
* code cleanup and added comments
V2:
* add device capabilities to info command
* no requirement to pass vchan id
if the device only has one vchan
* minor code cleanup
Quoted 7 lines
--- doc/guides/prog_guide/dmadev.rst | 24 +++++ doc/guides/rel_notes/release_22_07.rst | 5 + lib/dmadev/meson.build | 2 + lib/dmadev/rte_dmadev.c | 130 +++++++++++++++++++++++++ 4 files changed, 161 insertions(+)
Thanks for adding this, Sean.
Thanks
Quoted 7 lines · Sean Morrissey
Telemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
An example usage can be seen below:
...
Quoted 1 line
Thomas Monjalon
AppliedQuoted 7 lines · Sean Morrissey
Quoted 4 lines
Telemetry commands are now registered through the dmadev library for the gathering of DSA stats. The corresponding callback functions for listing dmadevs and providing info and stats for a specific dmadev are implemented in the dmadev library.
Acked-by Chengwen Feng <[email protected]>
Applied, thanks.