[v3] dmadev: add telemetry support
Checks
Commit Message
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}}
Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
Tested-by: Sunil Pai G <sunil.pai.g@intel.com>
---
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(+)
Comments
On Fri, Apr 01, 2022 at 10:24:02AM +0000, Sean Morrissey wrote:
> 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}}
>
> Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
> Tested-by: Sunil Pai G <sunil.pai.g@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
One comment inline below, which I'd like feedback from others on.
> ---
> V3:
> * update docs with correct examples
> * code cleanup and added comments
<snip>
> +
> +#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>
> + 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.
> + 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;
> +}
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Friday 1 April 2022 11:50
> To: Morrissey, Sean <sean.morrissey@intel.com>
> Cc: Chengwen Feng <fengchengwen@huawei.com>; Laatz, Kevin
> <kevin.laatz@intel.com>; dev@dpdk.org; Pai G, Sunil
> <sunil.pai.g@intel.com>
> Subject: Re: [PATCH v3] dmadev: add telemetry support
>
> On Fri, Apr 01, 2022 at 10:24:02AM +0000, Sean Morrissey wrote:
> > 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}}
> >
> > Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
> > Tested-by: Sunil Pai G <sunil.pai.g@intel.com>
>
> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
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 <conor.walsh@intel.com>
>
> One comment inline below, which I'd like feedback from others on.
> > ---
> > V3:
> > * update docs with correct examples
> > * code cleanup and added comments
> <snip>
>
> > +
> > +#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>
> > + 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.
>
> > + 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;
> > +}
On 01/04/2022 12:00, Walsh, Conor wrote:
>> From: Bruce Richardson <bruce.richardson@intel.com>
>> Sent: Friday 1 April 2022 11:50
>> To: Morrissey, Sean <sean.morrissey@intel.com>
>> Cc: Chengwen Feng <fengchengwen@huawei.com>; Laatz, Kevin
>> <kevin.laatz@intel.com>; dev@dpdk.org; Pai G, Sunil
>> <sunil.pai.g@intel.com>
>> Subject: Re: [PATCH v3] dmadev: add telemetry support
>>
>> On Fri, Apr 01, 2022 at 10:24:02AM +0000, Sean Morrissey wrote:
>>> 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}}
>>>
>>> Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
>>> Tested-by: Sunil Pai G <sunil.pai.g@intel.com>
>> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
> 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 <conor.walsh@intel.com>
>
>> One comment inline below, which I'd like feedback from others on.
>>> ---
>>> V3:
>>> * update docs with correct examples
>>> * code cleanup and added comments
>> <snip>
>>
>>> +
>>> +#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>
>>> + 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.
>>> + 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;
>>> +}
On Fri, Apr 01, 2022 at 01:58:49PM +0100, Morrissey, Sean wrote:
>
> On 01/04/2022 12:00, Walsh, Conor wrote:
> > > From: Bruce Richardson <bruce.richardson@intel.com>
> > > Sent: Friday 1 April 2022 11:50
> > > To: Morrissey, Sean <sean.morrissey@intel.com>
> > > Cc: Chengwen Feng <fengchengwen@huawei.com>; Laatz, Kevin
> > > <kevin.laatz@intel.com>; dev@dpdk.org; Pai G, Sunil
> > > <sunil.pai.g@intel.com>
> > > Subject: Re: [PATCH v3] dmadev: add telemetry support
> > >
> > > On Fri, Apr 01, 2022 at 10:24:02AM +0000, Sean Morrissey wrote:
> > > > 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}}
> > > >
> > > > Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
> > > > Tested-by: Sunil Pai G <sunil.pai.g@intel.com>
> > > Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
> > 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 <conor.walsh@intel.com>
> >
> > > One comment inline below, which I'd like feedback from others on.
> > > > ---
> > > > V3:
> > > > * update docs with correct examples
> > > > * code cleanup and added comments
> > > <snip>
> > >
> > > > +
> > > > +#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>
> > > > + 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".
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?
>
> 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
@@ -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`.
@@ -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
-------------
@@ -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']
@@ -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,132 @@ 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;
+}
+
+#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;
+ int dev_id, ret;
+ uint64_t dev_capa;
+ 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");
+
+ /* Function info_get validates dev_id so we dont need to. */
+ ret = rte_dma_info_get(dev_id, &dma_info);
+ if (ret < 0)
+ return -EINVAL;
+ dev_capa = dma_info.dev_capa;
+
+ 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();
+ 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);
+ 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;
+}
+
+#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, ret, vchan_id;
+ char *end_param;
+ const char *vchan_param;
+
+ if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+ return -EINVAL;
+
+ dev_id = strtoul(params, &end_param, 0);
+
+ /* Function info_get validates dev_id so we dont need to. */
+ ret = rte_dma_info_get(dev_id, &dma_info);
+ if (ret < 0)
+ return -EINVAL;
+
+ /* If the device has one vchan the user does not need to supply the
+ * vchan id and only the device id is needed, no extra parameters.
+ */
+ if (dma_info.nb_vchans == 1 && *end_param == '\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;
+}
+
+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 (Optional if only one vchannel)");
+}