Skip to content

Commit cdc3c7e

Browse files
dtatuleamstsirkin
authored andcommitted
vdpa/mlx5: Add support for modifying the VQ features field
This is done in preparation for the pre-creation of hardware virtqueues at device add time. Signed-off-by: Dragos Tatulea <[email protected]> Reviewed-by: Cosmin Ratiu <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent f70080c commit cdc3c7e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,15 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev,
12871287
MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0,
12881288
!!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_F_VERSION_1)));
12891289

1290+
if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES) {
1291+
u16 mlx_features = get_features(ndev->mvdev.actual_features);
1292+
1293+
MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_12_3,
1294+
mlx_features >> 3);
1295+
MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_2_0,
1296+
mlx_features & 7);
1297+
}
1298+
12901299
if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY) {
12911300
vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]];
12921301

@@ -2734,7 +2743,8 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features)
27342743
struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i];
27352744

27362745
mvq->modified_fields |= (
2737-
MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION
2746+
MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION |
2747+
MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES
27382748
);
27392749
}
27402750
}

include/linux/mlx5/mlx5_ifc_vdpa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ enum {
150150
MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX = (u64)1 << 8,
151151
MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION = (u64)1 << 10,
152152
MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY = (u64)1 << 11,
153+
MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES = (u64)1 << 12,
153154
MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY = (u64)1 << 14,
154155
};
155156

0 commit comments

Comments
 (0)