vdpa: Support reporting max device capabilities
Add max_supported_vqs and supported_features fields to struct vdpa_mgmt_dev. Upstream drivers need to feel these values according to the device capabilities. These values are reported back in a netlink message when showing management devices. Examples: $ 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 -j 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"]}}} $ 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"] } } } Signed-off-by: Eli Cohen <elic@nvidia.com> Link: https://lore.kernel.org/r/20220105114646.577224-11-elic@nvidia.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Si-Wei Liu<si-wei.liu@oracle.com>
This commit is contained in:
Родитель
37e07e7058
Коммит
cd2629f6df
|
@ -514,6 +514,16 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m
|
|||
err = -EMSGSIZE;
|
||||
goto msg_err;
|
||||
}
|
||||
if (nla_put_u32(msg, VDPA_ATTR_DEV_MGMTDEV_MAX_VQS,
|
||||
mdev->max_supported_vqs)) {
|
||||
err = -EMSGSIZE;
|
||||
goto msg_err;
|
||||
}
|
||||
if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_SUPPORTED_FEATURES,
|
||||
mdev->supported_features, VDPA_ATTR_PAD)) {
|
||||
err = -EMSGSIZE;
|
||||
goto msg_err;
|
||||
}
|
||||
|
||||
genlmsg_end(msg, hdr);
|
||||
return 0;
|
||||
|
|
|
@ -460,6 +460,8 @@ struct vdpa_mgmt_dev {
|
|||
const struct virtio_device_id *id_table;
|
||||
u64 config_attr_mask;
|
||||
struct list_head list;
|
||||
u64 supported_features;
|
||||
u32 max_supported_vqs;
|
||||
};
|
||||
|
||||
int vdpa_mgmtdev_register(struct vdpa_mgmt_dev *mdev);
|
||||
|
|
|
@ -44,6 +44,8 @@ enum vdpa_attr {
|
|||
VDPA_ATTR_DEV_NET_CFG_MTU, /* u16 */
|
||||
|
||||
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,
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче