|
|
7570e2 |
From 03beee452fb8b857906d8cb4bcfd8e3db6a9fdd1 Mon Sep 17 00:00:00 2001
|
|
|
7570e2 |
Message-Id: <03beee452fb8b857906d8cb4bcfd8e3db6a9fdd1.1647984433.git.aclaudi@redhat.com>
|
|
|
7570e2 |
In-Reply-To: <cef782ca658d695c5ca2d174ba1f89cba6bd84e5.1647984433.git.aclaudi@redhat.com>
|
|
|
7570e2 |
References: <cef782ca658d695c5ca2d174ba1f89cba6bd84e5.1647984433.git.aclaudi@redhat.com>
|
|
|
7570e2 |
From: Andrea Claudi <aclaudi@redhat.com>
|
|
|
7570e2 |
Date: Mon, 21 Mar 2022 16:35:16 +0100
|
|
|
7570e2 |
Subject: [PATCH] vdpa: Support reading device features
|
|
|
7570e2 |
|
|
|
7570e2 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2059427
|
|
|
7570e2 |
Upstream Status: iproute2-next.git commit 56eb8bf4
|
|
|
7570e2 |
|
|
|
7570e2 |
commit 56eb8bf45aa3d509eb119201341d0323ea81ef84
|
|
|
7570e2 |
Author: Eli Cohen <elic@nvidia.com>
|
|
|
7570e2 |
Date: Sun Mar 13 19:12:19 2022 +0200
|
|
|
7570e2 |
|
|
|
7570e2 |
vdpa: Support reading device features
|
|
|
7570e2 |
|
|
|
7570e2 |
When showing the available management devices, check if
|
|
|
7570e2 |
VDPA_ATTR_DEV_SUPPORTED_FEATURES feature is available and print the
|
|
|
7570e2 |
supported features for a management device.
|
|
|
7570e2 |
|
|
|
7570e2 |
Examples:
|
|
|
7570e2 |
$ vdpa mgmtdev show
|
|
|
7570e2 |
auxiliary/mlx5_core.sf.1:
|
|
|
7570e2 |
supported_classes net
|
|
|
7570e2 |
max_supported_vqs 257
|
|
|
7570e2 |
dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ \
|
|
|
7570e2 |
CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM
|
|
|
7570e2 |
|
|
|
7570e2 |
$ vdpa -jp mgmtdev show
|
|
|
7570e2 |
{
|
|
|
7570e2 |
"mgmtdev": {
|
|
|
7570e2 |
"auxiliary/mlx5_core.sf.1": {
|
|
|
7570e2 |
"supported_classes": [ "net" ],
|
|
|
7570e2 |
"max_supported_vqs": 257,
|
|
|
7570e2 |
"dev_features": [
|
|
|
7570e2 |
"CSUM","GUEST_CSUM","MTU","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ",\
|
|
|
7570e2 |
"CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM" ]
|
|
|
7570e2 |
}
|
|
|
7570e2 |
}
|
|
|
7570e2 |
}
|
|
|
7570e2 |
|
|
|
7570e2 |
Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
|
|
|
7570e2 |
Acked-by: Jason Wang <jasowang@redhat.com>
|
|
|
7570e2 |
Signed-off-by: Eli Cohen <elic@nvidia.com>
|
|
|
7570e2 |
Signed-off-by: David Ahern <dsahern@kernel.org>
|
|
|
7570e2 |
---
|
|
|
7570e2 |
vdpa/vdpa.c | 15 +++++++++++++--
|
|
|
7570e2 |
1 file changed, 13 insertions(+), 2 deletions(-)
|
|
|
7570e2 |
|
|
|
7570e2 |
diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c
|
|
|
7570e2 |
index 9985b6ca..3ae1b78f 100644
|
|
|
7570e2 |
--- a/vdpa/vdpa.c
|
|
|
7570e2 |
+++ b/vdpa/vdpa.c
|
|
|
7570e2 |
@@ -84,6 +84,7 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
|
|
|
7570e2 |
[VDPA_ATTR_DEV_MAX_VQ_SIZE] = MNL_TYPE_U16,
|
|
|
7570e2 |
[VDPA_ATTR_DEV_NEGOTIATED_FEATURES] = MNL_TYPE_U64,
|
|
|
7570e2 |
[VDPA_ATTR_DEV_MGMTDEV_MAX_VQS] = MNL_TYPE_U32,
|
|
|
7570e2 |
+ [VDPA_ATTR_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
|
|
|
7570e2 |
};
|
|
|
7570e2 |
|
|
|
7570e2 |
static int attr_cb(const struct nlattr *attr, void *data)
|
|
|
7570e2 |
@@ -492,14 +493,14 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
|
|
|
7570e2 |
static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh,
|
|
|
7570e2 |
struct nlattr **tb)
|
|
|
7570e2 |
{
|
|
|
7570e2 |
+ uint64_t classes = 0;
|
|
|
7570e2 |
const char *class;
|
|
|
7570e2 |
unsigned int i;
|
|
|
7570e2 |
|
|
|
7570e2 |
pr_out_handle_start(vdpa, tb);
|
|
|
7570e2 |
|
|
|
7570e2 |
if (tb[VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES]) {
|
|
|
7570e2 |
- uint64_t classes = mnl_attr_get_u64(tb[VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES]);
|
|
|
7570e2 |
-
|
|
|
7570e2 |
+ classes = mnl_attr_get_u64(tb[VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES]);
|
|
|
7570e2 |
pr_out_array_start(vdpa, "supported_classes");
|
|
|
7570e2 |
|
|
|
7570e2 |
for (i = 1; i < 64; i++) {
|
|
|
7570e2 |
@@ -520,6 +521,16 @@ static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh,
|
|
|
7570e2 |
print_uint(PRINT_ANY, "max_supported_vqs", " max_supported_vqs %d", num_vqs);
|
|
|
7570e2 |
}
|
|
|
7570e2 |
|
|
|
7570e2 |
+ if (tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES]) {
|
|
|
7570e2 |
+ uint64_t features;
|
|
|
7570e2 |
+
|
|
|
7570e2 |
+ features = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES]);
|
|
|
7570e2 |
+ if (classes & BIT(VIRTIO_ID_NET))
|
|
|
7570e2 |
+ print_features(vdpa, features, true, VIRTIO_ID_NET);
|
|
|
7570e2 |
+ else
|
|
|
7570e2 |
+ print_features(vdpa, features, true, 0);
|
|
|
7570e2 |
+ }
|
|
|
7570e2 |
+
|
|
|
7570e2 |
pr_out_handle_end(vdpa);
|
|
|
7570e2 |
}
|
|
|
7570e2 |
|
|
|
7570e2 |
--
|
|
|
7570e2 |
2.35.1
|
|
|
7570e2 |
|