From: Eli Cohen <elic@nvidia.com>
To: <dsahern@kernel.org>, <stephen@networkplumber.org>,
<netdev@vger.kernel.org>,
<virtualization@lists.linux-foundation.org>,
<jasowang@redhat.com>, <si-wei.liu@oracle.com>
Cc: <mst@redhat.com>, <lulu@redhat.com>, <parav@nvidia.com>,
Eli Cohen <elic@nvidia.com>
Subject: [PATCH v7 4/4] vdpa: Support reading device features
Date: Sun, 13 Mar 2022 19:12:19 +0200 [thread overview]
Message-ID: <20220313171219.305089-5-elic@nvidia.com> (raw)
In-Reply-To: <20220313171219.305089-1-elic@nvidia.com>
When showing the available management devices, check if
VDPA_ATTR_DEV_SUPPORTED_FEATURES feature is available and print the
supported features for a management device.
Examples:
$ vdpa mgmtdev show
auxiliary/mlx5_core.sf.1:
supported_classes net
max_supported_vqs 257
dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ \
CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM
$ vdpa -jp mgmtdev show
{
"mgmtdev": {
"auxiliary/mlx5_core.sf.1": {
"supported_classes": [ "net" ],
"max_supported_vqs": 257,
"dev_features": [
"CSUM","GUEST_CSUM","MTU","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ",\
"CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM" ]
}
}
}
Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eli Cohen <elic@nvidia.com>
---
vdpa/vdpa.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c
index c2b1207af8cf..ffda00e85c26 100644
--- a/vdpa/vdpa.c
+++ b/vdpa/vdpa.c
@@ -84,6 +84,7 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
[VDPA_ATTR_DEV_MAX_VQ_SIZE] = MNL_TYPE_U16,
[VDPA_ATTR_DEV_NEGOTIATED_FEATURES] = MNL_TYPE_U64,
[VDPA_ATTR_DEV_MGMTDEV_MAX_VQS] = MNL_TYPE_U32,
+ [VDPA_ATTR_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
};
static int attr_cb(const struct nlattr *attr, void *data)
@@ -495,14 +496,14 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh,
struct nlattr **tb)
{
+ uint64_t classes = 0;
const char *class;
unsigned int i;
pr_out_handle_start(vdpa, tb);
if (tb[VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES]) {
- uint64_t classes = mnl_attr_get_u64(tb[VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES]);
-
+ classes = mnl_attr_get_u64(tb[VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES]);
pr_out_array_start(vdpa, "supported_classes");
for (i = 1; i < 64; i++) {
@@ -523,6 +524,16 @@ static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh,
print_uint(PRINT_ANY, "max_supported_vqs", " max_supported_vqs %d", num_vqs);
}
+ if (tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES]) {
+ uint64_t features;
+
+ features = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES]);
+ if (classes & BIT(VIRTIO_ID_NET))
+ print_features(vdpa, features, true, VIRTIO_ID_NET);
+ else
+ print_features(vdpa, features, true, 0);
+ }
+
pr_out_handle_end(vdpa);
}
--
2.35.1
next prev parent reply other threads:[~2022-03-13 17:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-13 17:12 [PATCH v7 0/4] vdpa tool enhancements Eli Cohen
2022-03-13 17:12 ` [PATCH v7 1/4] vdpa: Remove unsupported command line option Eli Cohen
2022-03-13 17:12 ` [PATCH v7 2/4] vdpa: Allow for printing negotiated features of a device Eli Cohen
2022-03-13 17:33 ` Stephen Hemminger
2022-03-13 18:04 ` Eli Cohen
2022-03-14 14:51 ` David Ahern
2022-03-14 14:54 ` Eli Cohen
2022-03-14 15:07 ` David Ahern
2022-03-14 15:34 ` Eli Cohen
2022-03-14 16:00 ` David Ahern
2022-03-15 11:35 ` Eli Cohen
2022-03-16 15:46 ` David Ahern
2022-03-13 17:12 ` [PATCH v7 3/4] vdpa: Support for configuring max VQ pairs for " Eli Cohen
2022-03-14 15:09 ` David Ahern
2022-03-14 15:35 ` Eli Cohen
2022-03-14 15:45 ` Eli Cohen
2022-03-14 16:01 ` David Ahern
2022-03-13 17:12 ` Eli Cohen [this message]
2022-03-14 15:10 ` [PATCH v7 0/4] vdpa tool enhancements patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220313171219.305089-5-elic@nvidia.com \
--to=elic@nvidia.com \
--cc=dsahern@kernel.org \
--cc=jasowang@redhat.com \
--cc=lulu@redhat.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=parav@nvidia.com \
--cc=si-wei.liu@oracle.com \
--cc=stephen@networkplumber.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.