Skip to contentSkip to conversation

cryptodev: add telemetry callbacks

PATCH In review Rebecca Troy 7 participants 18 messages Aug 19, 2021 – Oct 26, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cryptodev: add telemetry callbacks

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs and stats for a cryptodev to be queried.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2 {"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/list", "/cryptodev/stats", ...]}
--> /cryptodev/list

{"/cryptodev/list": {"0000:1a:01.0_qat_sym": 0, "0000:1a:01.0_qat_asym": \
	1}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}
---
 lib/cryptodev/rte_cryptodev.c | 62 +++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
lib/cryptodev/rte_cryptodev.c +62 -0
index 447aa9d519..1e3ab633cc 100644
@@ -36,6 +36,7 @@
 #include <rte_errno.h>
 #include <rte_spinlock.h>
 #include <rte_string_fns.h>
+#include <rte_telemetry.h>
 
 #include "rte_crypto.h"
 #include "rte_cryptodev.h"
@@ -2427,3 +2428,64 @@ rte_cryptodev_allocate_driver(struct cryptodev_driver *crypto_drv,
 
 	return nb_drivers++;
 }
+
+static int
+cryptodev_handle_dev_list(const char *cmd __rte_unused,
+		const char *params __rte_unused,
+		struct rte_tel_data *d)
+{
+	int dev_id;
+
+	if (rte_cryptodev_count() < 1)
+		return -1;
+
+	rte_tel_data_start_dict(d);
+	for (dev_id = 0; dev_id < RTE_CRYPTO_MAX_DEVS; dev_id++)
+		if (rte_cryptodev_pmd_is_valid_dev(dev_id))
+			rte_tel_data_add_dict_int(d,
+				rte_cryptodev_name_get(dev_id), dev_id);
+
+	return 0;
+}
+
+#define ADD_DICT_STAT(stats, s) rte_tel_data_add_dict_u64(d, #s, stats.s)
+
+static int
+cryptodev_handle_dev_stats(const char *cmd __rte_unused,
+		const char *params,
+		struct rte_tel_data *d)
+{
+	struct rte_cryptodev_stats cryptodev_stats;
+	int dev_id, ret;
+	char *end_param;
+
+	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+		return -1;
+
+	dev_id = strtoul(params, &end_param, 0);
+	if (*end_param != '\0')
+		CDEV_LOG_ERR("Extra parameters passed to cryptodev telemetry command, ignoring");
+	if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
+		return -1;
+
+	ret = rte_cryptodev_stats_get(dev_id, &cryptodev_stats);
+	if (ret < 0)
+		return -1;
+
+	rte_tel_data_start_dict(d);
+	ADD_DICT_STAT(cryptodev_stats, enqueued_count);
+	ADD_DICT_STAT(cryptodev_stats, dequeued_count);
+	ADD_DICT_STAT(cryptodev_stats, enqueue_err_count);
+	ADD_DICT_STAT(cryptodev_stats, dequeue_err_count);
+
+	return 0;
+}
+
+RTE_INIT(cryptodev_init_telemetry)
+{
+	rte_telemetry_register_cmd("/cryptodev/list", cryptodev_handle_dev_list,
+			"Returns list of available cryptodev names and IDs.");
+	rte_telemetry_register_cmd("/cryptodev/stats",
+			cryptodev_handle_dev_stats,
+			"Returns the stats for a cryptodev. Parameters: int dev_id");
+}
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 21 lines

-----Original Message-----
From: Troy, Rebecca <[email protected]>
Sent: Thursday, August 19, 2021 11:22 AM
To: [email protected]
Cc: Zhang, Roy Fan <[email protected]>; Power, Ciara <[email protected]>; Troy, Rebecca <[email protected]>; Akhil Goyal <[email protected]>; Doherty, Declan <[email protected]>
Subject: [PATCH] cryptodev: add telemetry callbacks

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs and stats for a cryptodev to be queried.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2 {"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/list", "/cryptodev/stats", ...]}
--> /cryptodev/list

Quoted 7 lines
{"/cryptodev/list": {"0000:1a:01.0_qat_sym": 0, "0000:1a:01.0_qat_asym": \
	1}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}
#2 lore raw
In reply to Rebecca Troy
Quoted 12 lines

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs and stats for a cryptodev to be queried.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2 {"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/list", "/cryptodev/stats", ...]}
--> /cryptodev/list

Quoted 8 lines
{"/cryptodev/list": {"0000:1a:01.0_qat_sym": 0, "0000:1a:01.0_qat_asym": \
	1}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}

---

Can we add documentation in cryptodevs.rst?

#3 lore raw
In reply to Rebecca Troy
Quoted 18 lines

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs and stats for a cryptodev to be queried.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2 {"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/list", "/cryptodev/stats", ...]}
--> /cryptodev/list

{"/cryptodev/list": {"0000:1a:01.0_qat_sym": 0, "0000:1a:01.0_qat_asym": \
	1}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}
Quoted 4 lines
---
 lib/cryptodev/rte_cryptodev.c | 62

+++++++++++++++++++++++++++++++++++

Release notes also missing.

#4 lore raw
In reply to Rebecca Troy
Quoted 9 lines

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2 {"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/list", "/cryptodev/stats", ...]}
--> /cryptodev/list

{"/cryptodev/list": {"0000:1a:01.0_qat_sym": 0, "0000:1a:01.0_qat_asym": \
	1}}

Will this be better if we list keys by port ID, as port ID is used as param in appropriate endpoints ? Just a suggestion.

Quoted 30 lines

--> /cryptodev/stats,0

{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}
---
 lib/cryptodev/rte_cryptodev.c | 62 +++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
lib/cryptodev/rte_cryptodev.c index renamed from lib/cryptodev/rte_cryptodev.c +0 -0

447aa9d519..1e3ab633cc 100644

lib/cryptodev/rte_cryptodev.c +5 -0
@@ -36,6 +36,7 @@
 #include <rte_errno.h>
 #include <rte_spinlock.h>
 #include <rte_string_fns.h>
+#include <rte_telemetry.h>
 
 #include "rte_crypto.h"
 #include "rte_cryptodev.h"
@@ -2427,3 +2428,64 @@ rte_cryptodev_allocate_driver(struct
 cryptodev_driver *crypto_drv,
 
 	return nb_drivers++;
 }
+
+static int
+cryptodev_handle_dev_list(const char *cmd __rte_unused,
+		const char *params __rte_unused,

lib/cryptodev/rte_cryptodev.c rte_cryptodev_allocate_driver(struct · line 2444

Quoted 10 lines
lib/cryptodev/rte_cryptodev.c +10 -0
+		struct rte_tel_data *d)
+{
+	int dev_id;
+
+	if (rte_cryptodev_count() < 1)
+		return -1;
+
+	rte_tel_data_start_dict(d);
+	for (dev_id = 0; dev_id < RTE_CRYPTO_MAX_DEVS; dev_id++)
+		if (rte_cryptodev_pmd_is_valid_dev(dev_id))

This is broken now. Correct function is rte_cryptodev_is_valid_dev() .

Thanks,
Gowrishankar

#5 lore raw
Quoted 10 lines · Gowrishankar Muthukrishnan
Quoted 9 lines

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2 {"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/list", "/cryptodev/stats", ...]}
--> /cryptodev/list

{"/cryptodev/list": {"0000:1a:01.0_qat_sym": 0, "0000:1a:01.0_qat_asym": \
	1}}
Quoted 3 lines

Will this be better if we list keys by port ID, as port ID is used as param in appropriate endpoints ? Just a suggestion.

+1 to that suggestion

#6 lore raw

PATCH 1/1 cryptodev: add telemetry callbacks

In reply to Rebecca Troy

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs to be queried, as well as info and stats for the corresponding cryptodev.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/info", "/cryptodev/list", "/cryptodev/stats", ...]} --> /cryptodev/list
{"/cryptodev/list": [0,1,2,3]}
--> /cryptodev/info,0

{"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym", \
	 "max_nb_queue_pairs": 2}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}

---
v2:
- Added documentation and release notes.
- Changed the /cryptodev/list command to list the devices as an array of IDs, rather than as names and IDs.
- Added the /cryptodev/info command as described above.

---
 doc/guides/prog_guide/cryptodev_lib.rst | 30 ++++++++
 doc/guides/rel_notes/release_21_11.rst  |  5 ++
 lib/cryptodev/rte_cryptodev.c           | 92 +++++++++++++++++++++++++
 3 files changed, 127 insertions(+)
doc/guides/prog_guide/cryptodev_lib.rst +30 -0
index 9b1cf8d49f..b94d3caa60 100644
@@ -1282,3 +1282,33 @@ Asymmetric Crypto Device API
 
 The cryptodev Library API is described in the
 `DPDK API Reference <https://doc.dpdk.org/api/>`_
+
+
+Device Statistics
+~~~~~~~~~~~~~~~~~
+
+The Cryptodev library has support for displaying cryptodev information
+through the Telemetry interface. Telemetry commands that can be used
+are shown below.
+
+#. Get the list of available Crypto devices by ID::
+
+     --> /cryptodev/list
+     {"/cryptodev/list": [0, 1, 2, 3]}
+
+#. Get general information from a Crypto device::
+
+     --> /cryptodev/info,0
+     {"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym",
+     "max_nb_queue_pairs": 2}}
+
+#. Get the statistics for a particular Crypto device::
+
+     --> /cryptodev/stats,0
+     {"/cryptodev/stats": {"enqueued_count": 0,
+     "dequeued_count": 0, "enqueue_err_count": 0,
+     "dequeue_err_count": 0}}
+
+
+For more information on how to use the Telemetry interface, see
+the :doc:../howto/telemetry.
doc/guides/rel_notes/release_21_11.rst +5 -0
index dfc2cbdeed..762c6f050a 100644
@@ -110,6 +110,11 @@ New Features
 
   * Added PDCP short MAC-I support.
 
+* **Added Telemetry callbacks to Cryptodev library.**
+
+  Added Telemetry callback functions which allow a list of Crypto devices,
+  stats for a Crypto device, and other device information to be queried.
+
 * **Added multi-process support for testpmd.**
 
   Added command-line options to specify total number of processes and
lib/cryptodev/rte_cryptodev.c +92 -0

101 lines not on this page · raw message

Signature · 1 line
2.25.1
#7 lore raw

PATCH v3 1/1 cryptodev: add telemetry callbacks

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs to be queried, as well as info and stats for the corresponding cryptodev.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/info", "/cryptodev/list", "/cryptodev/stats", ...]} --> /cryptodev/list
{"/cryptodev/list": [0,1,2,3]}
--> /cryptodev/info,0

{"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym", \
	 "max_nb_queue_pairs": 2}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}

---
v3:
- Added missing version tag to patch.
v2:
- Added documentation and release notes.
- Changed the /cryptodev/list command to list the devices as an array of IDs, rather than as names and IDs.
- Added the /cryptodev/info command as described above.
---

---
 doc/guides/prog_guide/cryptodev_lib.rst | 30 ++++++++
 doc/guides/rel_notes/release_21_11.rst  |  5 ++
 lib/cryptodev/rte_cryptodev.c           | 92 +++++++++++++++++++++++++
 3 files changed, 127 insertions(+)
doc/guides/prog_guide/cryptodev_lib.rst +30 -0
index 9b1cf8d49f..b94d3caa60 100644
@@ -1282,3 +1282,33 @@ Asymmetric Crypto Device API
 
 The cryptodev Library API is described in the
 `DPDK API Reference <https://doc.dpdk.org/api/>`_
+
+
+Device Statistics
+~~~~~~~~~~~~~~~~~
+
+The Cryptodev library has support for displaying cryptodev information
+through the Telemetry interface. Telemetry commands that can be used
+are shown below.
+
+#. Get the list of available Crypto devices by ID::
+
+     --> /cryptodev/list
+     {"/cryptodev/list": [0, 1, 2, 3]}
+
+#. Get general information from a Crypto device::
+
+     --> /cryptodev/info,0
+     {"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym",
+     "max_nb_queue_pairs": 2}}
+
+#. Get the statistics for a particular Crypto device::
+
+     --> /cryptodev/stats,0
+     {"/cryptodev/stats": {"enqueued_count": 0,
+     "dequeued_count": 0, "enqueue_err_count": 0,
+     "dequeue_err_count": 0}}
+
+
+For more information on how to use the Telemetry interface, see
+the :doc:../howto/telemetry.
doc/guides/rel_notes/release_21_11.rst +5 -0
index efeffe37a0..487a9b0c73 100644
@@ -114,6 +114,11 @@ New Features
 
   * Added PDCP short MAC-I support.
 
+* **Added Telemetry callbacks to Cryptodev library.**
+
+  Added Telemetry callback functions which allow a list of Crypto devices,
+  stats for a Crypto device, and other device information to be queried.
+
 * **Added multi-process support for testpmd.**
 
   Added command-line options to specify total number of processes and
lib/cryptodev/rte_cryptodev.c +92 -0

101 lines not on this page · raw message

Signature · 1 line
2.25.1
#8 lore raw

Hi Becky,

Quoted 55 lines

-----Original Message-----
From: Troy, Rebecca <[email protected]>
Sent: Thursday 7 October 2021 15:11
To: [email protected]
Cc: Power, Ciara <[email protected]>; Zhang, Roy Fan <[email protected]>; Troy, Rebecca <[email protected]>; Akhil Goyal <[email protected]>; Doherty, Declan <[email protected]>
Subject: [PATCH v3] cryptodev: add telemetry callbacks

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs to be queried, as well as info and stats for the corresponding cryptodev.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/info", "/cryptodev/list", "/cryptodev/stats", ...]} --> /cryptodev/list
{"/cryptodev/list": [0,1,2,3]}
--> /cryptodev/info,0

{"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym", \
	 "max_nb_queue_pairs": 2}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}

---
v3:
- Added missing version tag to patch.
v2:
- Added documentation and release notes.
- Changed the /cryptodev/list command to list the devices as an array of IDs, rather than as names and IDs.
- Added the /cryptodev/info command as described above.
---
---

doc/guides/prog_guide/cryptodev_lib.rst | 30 ++++++++
doc/guides/rel_notes/release_21_11.rst  |  5 ++
lib/cryptodev/rte_cryptodev.c           | 92 +++++++++++++++++++++++++
3 files changed, 127 insertions(+)
doc/guides/prog_guide/cryptodev_lib.rst +0 -0
index 9b1cf8d49f..b94d3caa60 100644
@@ -1282,3 +1282,33 @@ Asymmetric Crypto Device API
 

The cryptodev Library API is described in the `DPDK API Reference
<https://doc.dpdk.org/api/>`_

doc/guides/prog_guide/cryptodev_lib.rst Asymmetric Crypto Device API · line 1288

Quoted 4 lines
doc/guides/prog_guide/cryptodev_lib.rst +4 -0
+
+
+Device Statistics
+~~~~~~~~~~~~~~~~~

This header underline (~~~) means this section will be a subsection of "Asymmetric crypto Sample code", which isn't correct. I suggest changing the underline to "----" to move it up a level to be its own section.

Quoted 16 lines
doc/guides/prog_guide/cryptodev_lib.rst +16 -0
+
+The Cryptodev library has support for displaying cryptodev information
+through the Telemetry interface. Telemetry commands that can be used
+are shown below.
+
+#. Get the list of available Crypto devices by ID::
+
+     --> /cryptodev/list
+     {"/cryptodev/list": [0, 1, 2, 3]}
+
+#. Get general information from a Crypto device::
+
+     --> /cryptodev/info,0
+     {"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym",
+     "max_nb_queue_pairs": 2}}
+

doc/guides/prog_guide/cryptodev_lib.rst Asymmetric Crypto Device API

Quoted 10 lines
doc/guides/prog_guide/cryptodev_lib.rst +10 -0
+#. Get the statistics for a particular Crypto device::
+
+     --> /cryptodev/stats,0
+     {"/cryptodev/stats": {"enqueued_count": 0,
+     "dequeued_count": 0, "enqueue_err_count": 0,
+     "dequeue_err_count": 0}}
+
+
+For more information on how to use the Telemetry interface, see the
+:doc:../howto/telemetry.

There are ` symbols missing here, so this link doesn't work. Needs to be:

     :doc:`../howto/telemetry`

<snip>

Quoted 14 lines
doc/guides/prog_guide/cryptodev_lib.rst +13 -0
+static int
+cryptodev_handle_dev_info(const char *cmd __rte_unused,
+		const char *params, struct rte_tel_data *d) {
+	struct rte_cryptodev_info cryptodev_info;
+	int dev_id;
+	char *end_param;
+
+	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+		return -EINVAL;
+
+	dev_id = strtoul(params, &end_param, 0);
+	if (*end_param != '\0')
+		CDEV_LOG_ERR("Extra parameters passed to command,

ignoring");

doc/guides/prog_guide/cryptodev_lib.rst

Quoted 2 lines
doc/guides/prog_guide/cryptodev_lib.rst +2 -0
+	if (!rte_cryptodev_is_valid_dev(dev_id))
+		return -1;

Maybe -EINVAL return value would be better here, same comment for handle_dev_stats function.

<snip>

Thanks,
Ciara

#9 lore raw

PATCH v4 1/1 cryptodev: add telemetry callbacks

In reply to Rebecca Troy

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs to be queried, as well as info and stats for the corresponding cryptodev.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/info", "/cryptodev/list", "/cryptodev/stats", ...]} --> /cryptodev/list
{"/cryptodev/list": [0,1,2,3]}
--> /cryptodev/info,0

{"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym", \
	 "max_nb_queue_pairs": 2}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}

---
v4:
- Corrected doc heading underline and link
- Replaced remaining -1 return values with -EINVAL
v3:
- Added missing version tag to patch.
v2:
- Added documentation and release notes.
- Changed the /cryptodev/list command to list the devices as an array of IDs, rather than as names and IDs.
- Added the /cryptodev/info command as described above.

---
 doc/guides/prog_guide/cryptodev_lib.rst | 28 ++++++++
 doc/guides/rel_notes/release_21_11.rst  |  5 ++
 lib/cryptodev/rte_cryptodev.c           | 92 +++++++++++++++++++++++++
 3 files changed, 125 insertions(+)
doc/guides/prog_guide/cryptodev_lib.rst +28 -0
index 9b1cf8d49f..25663e552e 100644
@@ -1282,3 +1282,31 @@ Asymmetric Crypto Device API
 
 The cryptodev Library API is described in the
 `DPDK API Reference <https://doc.dpdk.org/api/>`_
+
+
+Device Statistics
+-----------------
+
+The Cryptodev library has support for displaying Crypto device information
+through the Telemetry interface. Telemetry commands that can be used
+are shown below.
+
+#. Get the list of available Crypto devices by ID::
+
+     --> /cryptodev/list
+     {"/cryptodev/list": [0, 1, 2, 3]}
+
+#. Get general information from a Crypto device::
+
+     --> /cryptodev/info,0
+     {"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym",
+     "max_nb_queue_pairs": 2}}
+
+#. Get the statistics for a particular Crypto device::
+
+     --> /cryptodev/stats,0
+     {"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0,
+     "enqueue_err_count": 0, "dequeue_err_count": 0}}
+
+For more information on how to use the Telemetry interface, see
+the :doc:`../howto/telemetry`.
doc/guides/rel_notes/release_21_11.rst +5 -0
index f643a61f44..f3242acb15 100644
@@ -137,6 +137,11 @@ New Features
 
   Added support for more comprehensive CRC options.
 
+* **Added Telemetry callbacks to Cryptodev library.**
+
+  Added Telemetry callback functions which allow a list of Crypto devices,
+  stats for a Crypto device, and other device information to be queried.
+
 * **Added multi-process support for testpmd.**
 
   Added command-line options to specify total number of processes and
lib/cryptodev/rte_cryptodev.c +92 -0

101 lines not on this page · raw message

Signature · 1 line
2.25.1
Acked-by on v4 1/1
#10 lore raw
Quoted 30 lines

-----Original Message-----
From: Troy, Rebecca <[email protected]>
Sent: Wednesday 13 October 2021 11:22
To: [email protected]
Cc: Power, Ciara <[email protected]>; Zhang, Roy Fan <[email protected]>; Troy, Rebecca <[email protected]>; Akhil Goyal <[email protected]>; Doherty, Declan <[email protected]>
Subject: [PATCH v4] cryptodev: add telemetry callbacks

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs to be queried, as well as info and stats for the corresponding cryptodev.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/info", "/cryptodev/list", "/cryptodev/stats", ...]} --> /cryptodev/list
{"/cryptodev/list": [0,1,2,3]}
--> /cryptodev/info,0

{"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym", \
	 "max_nb_queue_pairs": 2}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}

<snip>

#11 lore raw
In reply to Rebecca Troy
Quoted 10 lines

Subject: [dpdk-dev] [PATCH v4] cryptodev: add telemetry callbacks

External email: Use caution opening links or attachments

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs to be queried, as well as info and stats for the corresponding cryptodev.

The build of this patch fails on Windows with the following error:

../lib/cryptodev/rte_cryptodev.c:38:10: fatal error: rte_telemetry.h: No such file or directory
#include <rte_telemetry.h>

To resolve it you need to add telemetry to the list of deps in cryptodev's meson.build file.

#12 lore raw

PATCH v5 1/1 cryptodev: add telemetry callbacks

In reply to Rebecca Troy

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs to be queried, as well as info and stats for the corresponding cryptodev.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/info", "/cryptodev/list", "/cryptodev/stats", ...]} --> /cryptodev/list
{"/cryptodev/list": [0,1,2,3]}
--> /cryptodev/info,0

{"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym", \
	 "max_nb_queue_pairs": 2}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}

---
v5:
- Added missing telemetry dependency to meson.build.
v4:
- Corrected doc heading underline and link.
- Replaced remaining -1 return values with -EINVAL.
v3:
- Added missing version tag to patch.
v2:
- Added documentation and release notes.
- Changed the /cryptodev/list command to list the devices as an array of IDs, rather than as names and IDs.
- Added the /cryptodev/info command as described above.

---
 doc/guides/prog_guide/cryptodev_lib.rst | 28 ++++++++
 doc/guides/rel_notes/release_21_11.rst  |  5 ++
 lib/cryptodev/meson.build               |  2 +-
 lib/cryptodev/rte_cryptodev.c           | 92 +++++++++++++++++++++++++
 4 files changed, 126 insertions(+), 1 deletion(-)
doc/guides/prog_guide/cryptodev_lib.rst +28 -0
index 9b1cf8d49f..25663e552e 100644
@@ -1282,3 +1282,31 @@ Asymmetric Crypto Device API
 
 The cryptodev Library API is described in the
 `DPDK API Reference <https://doc.dpdk.org/api/>`_
+
+
+Device Statistics
+-----------------
+
+The Cryptodev library has support for displaying Crypto device information
+through the Telemetry interface. Telemetry commands that can be used
+are shown below.
+
+#. Get the list of available Crypto devices by ID::
+
+     --> /cryptodev/list
+     {"/cryptodev/list": [0, 1, 2, 3]}
+
+#. Get general information from a Crypto device::
+
+     --> /cryptodev/info,0
+     {"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym",
+     "max_nb_queue_pairs": 2}}
+
+#. Get the statistics for a particular Crypto device::
+
+     --> /cryptodev/stats,0
+     {"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0,
+     "enqueue_err_count": 0, "dequeue_err_count": 0}}
+
+For more information on how to use the Telemetry interface, see
+the :doc:`../howto/telemetry`.
doc/guides/rel_notes/release_21_11.rst +5 -0
index f643a61f44..f3242acb15 100644
@@ -137,6 +137,11 @@ New Features
 
   Added support for more comprehensive CRC options.
 
+* **Added Telemetry callbacks to Cryptodev library.**
+
+  Added Telemetry callback functions which allow a list of Crypto devices,
+  stats for a Crypto device, and other device information to be queried.
+
 * **Added multi-process support for testpmd.**
 
   Added command-line options to specify total number of processes and
lib/cryptodev/meson.build +1 -1
index 51371c3aa2..7d8c7fdd62 100644
@@ -19,4 +19,4 @@ driver_sdk_headers += files(
         'cryptodev_pmd.h',
 )
 
-deps += ['kvargs', 'mbuf', 'rcu']
+deps += ['kvargs', 'mbuf', 'rcu', 'telemetry']
lib/cryptodev/rte_cryptodev.c +92 -0

101 lines not on this page · raw message

Signature · 1 line
2.25.1
#13 lore raw
Quoted 20 lines · Rebecca Troy

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs to be queried, as well as info and stats for the corresponding cryptodev.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/info", "/cryptodev/list", "/cryptodev/stats", ...]} --> /cryptodev/list
{"/cryptodev/list": [0,1,2,3]}
--> /cryptodev/info,0

{"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym", \
	 "max_nb_queue_pairs": 2}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}
Quoted 6 lines

---
v5:
- Added missing telemetry dependency to meson.build.

Just FYI: This addition is harmless but actually unnecessary, since telemetry is automatically added as a recursive dependency since EAL uses the telemetry lib.

Patch LGTM.

/Bruce

#14 lore raw
In reply to Rebecca Troy
Quoted 8 lines

---
v5:
- Added missing telemetry dependency to meson.build.
v4:
- Corrected doc heading underline and link.
- Replaced remaining -1 return values with -EINVAL.

lib/cryptodev/rte_cryptodev.c rte_cryptodev_allocate_driver(struct cryptodev_driver *crypto_drv, · line 2439

Quoted 10 lines
lib/cryptodev/rte_cryptodev.c +10 -0
+
+static int
+cryptodev_handle_dev_list(const char *cmd __rte_unused,
+		const char *params __rte_unused,
+		struct rte_tel_data *d)
+{
+	int dev_id;
+
+	if (rte_cryptodev_count() < 1)
+		return -1;

EINVAL missed here.

#15 lore raw
Quoted 16 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Monday 25 October 2021 05:32
To: Troy, Rebecca <[email protected]>; [email protected]
Cc: Power, Ciara <[email protected]>; Zhang, Roy Fan <[email protected]>; Doherty, Declan <[email protected]>
Subject: RE: [EXT] [PATCH v5] cryptodev: add telemetry callbacks

Quoted 6 lines

---
v5:
- Added missing telemetry dependency to meson.build.
v4:
- Corrected doc heading underline and link.
- Replaced remaining -1 return values with -EINVAL.

Quoted 13 lines

lib/cryptodev/rte_cryptodev.c rte_cryptodev_allocate_driver(struct cryptodev_driver *crypto_drv, · line 2439

Quoted 10 lines
lib/cryptodev/rte_cryptodev.c +10 -0
+
+static int
+cryptodev_handle_dev_list(const char *cmd __rte_unused,
+		const char *params __rte_unused,
+		struct rte_tel_data *d)
+{
+	int dev_id;
+
+	if (rte_cryptodev_count() < 1)
+		return -1;

EINVAL missed here.

Good catch, thanks! Will fix now.

#16 lore raw

PATCH v6 1/1 cryptodev: add telemetry callbacks

In reply to Rebecca Troy

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs to be queried, as well as info and stats for the corresponding cryptodev.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/info", "/cryptodev/list", "/cryptodev/stats", ...]} --> /cryptodev/list
{"/cryptodev/list": [0,1,2,3]}
--> /cryptodev/info,0

{"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym", \
	 "max_nb_queue_pairs": 2}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}

---
v6:
- Replaced missed -1 return value
v5:
- Added missing telemetry dependency to meson.build.
v4:
- Corrected doc heading underline and link.
- Replaced remaining -1 return values with -EINVAL.
v3:
- Added missing version tag to patch.
v2:
- Added documentation and release notes.
- Changed the /cryptodev/list command to list the devices as an array of IDs, rather than as names and IDs.
- Added the /cryptodev/info command as described above.

---
 doc/guides/prog_guide/cryptodev_lib.rst | 28 ++++++++
 doc/guides/rel_notes/release_21_11.rst  |  5 ++
 lib/cryptodev/meson.build               |  2 +-
 lib/cryptodev/rte_cryptodev.c           | 92 +++++++++++++++++++++++++
 4 files changed, 126 insertions(+), 1 deletion(-)
doc/guides/prog_guide/cryptodev_lib.rst +28 -0
index 9b1cf8d49f..25663e552e 100644
@@ -1282,3 +1282,31 @@ Asymmetric Crypto Device API
 
 The cryptodev Library API is described in the
 `DPDK API Reference <https://doc.dpdk.org/api/>`_
+
+
+Device Statistics
+-----------------
+
+The Cryptodev library has support for displaying Crypto device information
+through the Telemetry interface. Telemetry commands that can be used
+are shown below.
+
+#. Get the list of available Crypto devices by ID::
+
+     --> /cryptodev/list
+     {"/cryptodev/list": [0, 1, 2, 3]}
+
+#. Get general information from a Crypto device::
+
+     --> /cryptodev/info,0
+     {"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym",
+     "max_nb_queue_pairs": 2}}
+
+#. Get the statistics for a particular Crypto device::
+
+     --> /cryptodev/stats,0
+     {"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0,
+     "enqueue_err_count": 0, "dequeue_err_count": 0}}
+
+For more information on how to use the Telemetry interface, see
+the :doc:`../howto/telemetry`.
doc/guides/rel_notes/release_21_11.rst +5 -0
index 1ccac87b73..ee1e557309 100644
@@ -269,6 +269,11 @@ New Features
   * Added support for SA telemetry.
   * Added support for setting a non default starting ESN value.
 
+* **Added Telemetry callbacks to Cryptodev library.**
+
+  Added Telemetry callback functions which allow a list of Crypto devices,
+  stats for a Crypto device, and other device information to be queried.
+
 * **Added multi-process support for testpmd.**
 
   Added command-line options to specify total number of processes and
lib/cryptodev/meson.build +1 -1
index 289b66ab76..19de3073bb 100644
@@ -21,4 +21,4 @@ driver_sdk_headers += files(
         'cryptodev_pmd.h',
 )
 
-deps += ['kvargs', 'mbuf', 'rcu']
+deps += ['kvargs', 'mbuf', 'rcu', 'telemetry']
lib/cryptodev/rte_cryptodev.c +92 -0

101 lines not on this page · raw message

Signature · 1 line
2.25.1
Acked-by on v6 1/1 Applied
#17 lore raw
Quoted 14 lines

The cryptodev library now registers commands with telemetry, and implements the corresponding callback functions. These commands allow a list of cryptodevs to be queried, as well as info and stats for the corresponding cryptodev.

An example usage can be seen below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 21.11.0-rc0", "pid": 1135019, "max_output_len": 16384} --> /
{"/": ["/", "/cryptodev/info", "/cryptodev/list", "/cryptodev/stats", ...]} --> /cryptodev/list
{"/cryptodev/list": [0,1,2,3]}
--> /cryptodev/info,0

Quoted 9 lines
{"/cryptodev/info": {"device_name": "0000:1c:01.0_qat_sym", \
	 "max_nb_queue_pairs": 2}}
--> /cryptodev/stats,0
{"/cryptodev/stats": {"enqueued_count": 0, "dequeued_count": 0, \
	"enqueue_err_count": 0, "dequeue_err_count": 0}}

Applied to dpdk-next-crypto

Thanks.