vdpa/mlx5: Report max device capabilities
Configure max supported virtqueues and features on the management device. This info can be retrieved using: $ 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> Link: https://lore.kernel.org/r/20220105114646.577224-12-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:
parent
cd2629f6df
commit
79de65edf8
@ -1866,22 +1866,29 @@ static u64 mlx_to_vritio_features(u16 dev_features)
|
||||
return result;
|
||||
}
|
||||
|
||||
static u64 get_supported_features(struct mlx5_core_dev *mdev)
|
||||
{
|
||||
u64 mlx_vdpa_features = 0;
|
||||
u16 dev_features;
|
||||
|
||||
dev_features = MLX5_CAP_DEV_VDPA_EMULATION(mdev, device_features_bits_mask);
|
||||
mlx_vdpa_features |= mlx_to_vritio_features(dev_features);
|
||||
if (MLX5_CAP_DEV_VDPA_EMULATION(mdev, virtio_version_1_0))
|
||||
mlx_vdpa_features |= BIT_ULL(VIRTIO_F_VERSION_1);
|
||||
mlx_vdpa_features |= BIT_ULL(VIRTIO_F_ACCESS_PLATFORM);
|
||||
mlx_vdpa_features |= BIT_ULL(VIRTIO_NET_F_CTRL_VQ);
|
||||
mlx_vdpa_features |= BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR);
|
||||
mlx_vdpa_features |= BIT_ULL(VIRTIO_NET_F_MQ);
|
||||
mlx_vdpa_features |= BIT_ULL(VIRTIO_NET_F_STATUS);
|
||||
mlx_vdpa_features |= BIT_ULL(VIRTIO_NET_F_MTU);
|
||||
|
||||
return mlx_vdpa_features;
|
||||
}
|
||||
|
||||
static u64 mlx5_vdpa_get_device_features(struct vdpa_device *vdev)
|
||||
{
|
||||
struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev);
|
||||
struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
|
||||
u16 dev_features;
|
||||
|
||||
dev_features = MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, device_features_bits_mask);
|
||||
ndev->mvdev.mlx_features |= mlx_to_vritio_features(dev_features);
|
||||
if (MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, virtio_version_1_0))
|
||||
ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_F_VERSION_1);
|
||||
ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_F_ACCESS_PLATFORM);
|
||||
ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_NET_F_CTRL_VQ);
|
||||
ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR);
|
||||
ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_NET_F_MQ);
|
||||
ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_NET_F_STATUS);
|
||||
ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_NET_F_MTU);
|
||||
|
||||
print_features(mvdev, ndev->mvdev.mlx_features, false);
|
||||
return ndev->mvdev.mlx_features;
|
||||
@ -2563,6 +2570,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
|
||||
if (IS_ERR(ndev))
|
||||
return PTR_ERR(ndev);
|
||||
|
||||
ndev->mvdev.mlx_features = mgtdev->mgtdev.supported_features;
|
||||
ndev->mvdev.max_vqs = max_vqs;
|
||||
mvdev = &ndev->mvdev;
|
||||
mvdev->mdev = mdev;
|
||||
@ -2696,6 +2704,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,
|
||||
mgtdev->mgtdev.id_table = id_table;
|
||||
mgtdev->mgtdev.config_attr_mask = BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR) |
|
||||
BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MAX_VQP);
|
||||
mgtdev->mgtdev.max_supported_vqs =
|
||||
MLX5_CAP_DEV_VDPA_EMULATION(mdev, max_num_virtio_queues) + 1;
|
||||
mgtdev->mgtdev.supported_features = get_supported_features(mdev);
|
||||
mgtdev->madev = madev;
|
||||
|
||||
err = vdpa_mgmtdev_register(&mgtdev->mgtdev);
|
||||
|
Loading…
Reference in New Issue
Block a user