DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] examples/vdpa: support show protocol features
@ 2025-10-30  6:57 Chengwen Feng
  0 siblings, 0 replies; only message in thread
From: Chengwen Feng @ 2025-10-30  6:57 UTC (permalink / raw)
  To: thomas, stephen; +Cc: dev

This commit adds show device's protocol features in list command.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
 doc/guides/sample_app_ug/vdpa.rst |  8 ++++----
 examples/vdpa/main.c              | 13 ++++++++++---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/doc/guides/sample_app_ug/vdpa.rst b/doc/guides/sample_app_ug/vdpa.rst
index cd3ec99054..873efbf7c7 100644
--- a/doc/guides/sample_app_ug/vdpa.rst
+++ b/doc/guides/sample_app_ug/vdpa.rst
@@ -70,10 +70,10 @@ Then we can create 2 vdpa ports in interactive cmdline.
 .. code-block:: console
 
         vdpa> list
-        device id       device address  queue num       supported features
-        0               0000:06:00.3    1               0x14c238020
-        1               0000:06:00.4    1               0x14c238020
-        2               0000:06:00.5    1               0x14c238020
+        device id       device address  queue num       supported features      supported protocol features
+        0               0000:06:00.3    1               0x14c238020             0x10c33
+        1               0000:06:00.4    1               0x14c238020             0x10c33
+        2               0000:06:00.5    1               0x14c238020             0x10c33
 
         vdpa> create /tmp/vdpa-socket0 0000:06:00.3
         vdpa> create /tmp/vdpa-socket1 0000:06:00.4
diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 289db26498..505e563a57 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -324,11 +324,12 @@ void cmd_list_parsed(
 {
 	uint32_t queue_num;
 	uint64_t features;
+	uint64_t protocol_features;
 	struct rte_vdpa_device *vdev;
 	struct rte_device *dev;
 	struct rte_dev_iterator dev_iter;
 
-	cmdline_printf(cl, "device name\tqueue num\tsupported features\n");
+	cmdline_printf(cl, "device name\tqueue num\tsupported features\tsupported protocol features\n");
 	RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
 		vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
 		if (!vdev)
@@ -345,8 +346,14 @@ void cmd_list_parsed(
 				"for device %s.\n", rte_dev_name(dev));
 			continue;
 		}
-		cmdline_printf(cl, "%s\t\t%" PRIu32 "\t\t0x%" PRIx64 "\n",
-			rte_dev_name(dev), queue_num, features);
+		if (rte_vdpa_get_protocol_features(vdev, &protocol_features) < 0) {
+			RTE_LOG(ERR, VDPA,
+				"failed to get vdpa protocol features "
+				"for device %s.\n", rte_dev_name(dev));
+			continue;
+		}
+		cmdline_printf(cl, "%s\t\t%" PRIu32 "\t\t0x%" PRIx64 "\t\t0x%" PRIx64 "\n",
+			rte_dev_name(dev), queue_num, features, protocol_features);
 	}
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-30  6:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-30  6:57 [PATCH] examples/vdpa: support show protocol features Chengwen Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).