Message ID | 20220210133115.115967-5-elic@nvidia.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | vdpa tool enhancements | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On 2/10/2022 5:31 AM, Eli Cohen wrote: > 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. > > Example: > $ 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 It'd be nice to add an example output for json pretty format. Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com> > > Signed-off-by: Eli Cohen <elic@nvidia.com> > --- > vdpa/include/uapi/linux/vdpa.h | 1 + > vdpa/vdpa.c | 11 +++++++++++ > 2 files changed, 12 insertions(+) > > diff --git a/vdpa/include/uapi/linux/vdpa.h b/vdpa/include/uapi/linux/vdpa.h > index a3ebf4d4d9b8..96ccbf305d14 100644 > --- a/vdpa/include/uapi/linux/vdpa.h > +++ b/vdpa/include/uapi/linux/vdpa.h > @@ -42,6 +42,7 @@ enum vdpa_attr { > > VDPA_ATTR_DEV_NEGOTIATED_FEATURES, /* u64 */ > VDPA_ATTR_DEV_MGMTDEV_MAX_VQS, /* u32 */ > + VDPA_ATTR_DEV_SUPPORTED_FEATURES, /* u64 */ > > /* new attributes must be added above here */ > VDPA_ATTR_MAX, > diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c > index 99ee828630cc..44b2a3e9e78a 100644 > --- a/vdpa/vdpa.c > +++ b/vdpa/vdpa.c > @@ -83,6 +83,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) > @@ -535,6 +536,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_net_features(vdpa, features, true); > + else > + print_generic_features(vdpa, features, true); > + } > + > pr_out_handle_end(vdpa); > } >
On Fri, Feb 11, 2022 at 04:43:08PM -0800, Si-Wei Liu wrote: > > > On 2/10/2022 5:31 AM, Eli Cohen wrote: > > 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. > > > > Example: > > $ 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 > It'd be nice to add an example output for json pretty format. > Will add > Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com> > > > > > Signed-off-by: Eli Cohen <elic@nvidia.com> > > --- > > vdpa/include/uapi/linux/vdpa.h | 1 + > > vdpa/vdpa.c | 11 +++++++++++ > > 2 files changed, 12 insertions(+) > > > > diff --git a/vdpa/include/uapi/linux/vdpa.h b/vdpa/include/uapi/linux/vdpa.h > > index a3ebf4d4d9b8..96ccbf305d14 100644 > > --- a/vdpa/include/uapi/linux/vdpa.h > > +++ b/vdpa/include/uapi/linux/vdpa.h > > @@ -42,6 +42,7 @@ enum vdpa_attr { > > VDPA_ATTR_DEV_NEGOTIATED_FEATURES, /* u64 */ > > VDPA_ATTR_DEV_MGMTDEV_MAX_VQS, /* u32 */ > > + VDPA_ATTR_DEV_SUPPORTED_FEATURES, /* u64 */ > > /* new attributes must be added above here */ > > VDPA_ATTR_MAX, > > diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c > > index 99ee828630cc..44b2a3e9e78a 100644 > > --- a/vdpa/vdpa.c > > +++ b/vdpa/vdpa.c > > @@ -83,6 +83,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) > > @@ -535,6 +536,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_net_features(vdpa, features, true); > > + else > > + print_generic_features(vdpa, features, true); > > + } > > + > > pr_out_handle_end(vdpa); > > } >
diff --git a/vdpa/include/uapi/linux/vdpa.h b/vdpa/include/uapi/linux/vdpa.h index a3ebf4d4d9b8..96ccbf305d14 100644 --- a/vdpa/include/uapi/linux/vdpa.h +++ b/vdpa/include/uapi/linux/vdpa.h @@ -42,6 +42,7 @@ enum vdpa_attr { VDPA_ATTR_DEV_NEGOTIATED_FEATURES, /* u64 */ VDPA_ATTR_DEV_MGMTDEV_MAX_VQS, /* u32 */ + VDPA_ATTR_DEV_SUPPORTED_FEATURES, /* u64 */ /* new attributes must be added above here */ VDPA_ATTR_MAX, diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c index 99ee828630cc..44b2a3e9e78a 100644 --- a/vdpa/vdpa.c +++ b/vdpa/vdpa.c @@ -83,6 +83,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) @@ -535,6 +536,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_net_features(vdpa, features, true); + else + print_generic_features(vdpa, features, true); + } + pr_out_handle_end(vdpa); }
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. Example: $ 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 Signed-off-by: Eli Cohen <elic@nvidia.com> --- vdpa/include/uapi/linux/vdpa.h | 1 + vdpa/vdpa.c | 11 +++++++++++ 2 files changed, 12 insertions(+)