[PATCH] examples/vdpa: support show protocol features
fengchengwen
fengchengwen at huawei.com
Thu Nov 6 01:37:24 CET 2025
ping for review / upstream
On 10/30/2025 2:57 PM, Chengwen Feng wrote:
> This commit adds show device's protocol features in list command.
>
> Signed-off-by: Chengwen Feng <fengchengwen at 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);
> }
> }
>
More information about the dev
mailing list