Skip to content

Commit e5bcbd1

Browse files
dtatuleamstsirkin
authored andcommitted
vdpa/mlx5: Clear and reinitialize software VQ data on reset
The hardware VQ configuration is mirrored by data in struct mlx5_vdpa_virtqueue . Instead of clearing just a few fields at reset, fully clear the struct and initialize with the appropriate default values. As clear_vqs_ready() is used only during reset, get rid of it. Reviewed-by: Cosmin Ratiu <[email protected]> Acked-by: Eugenio Pérez <[email protected]> Signed-off-by: Dragos Tatulea <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 1835ed4 commit e5bcbd1

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2941,18 +2941,6 @@ static void teardown_vq_resources(struct mlx5_vdpa_net *ndev)
29412941
ndev->setup = false;
29422942
}
29432943

2944-
static void clear_vqs_ready(struct mlx5_vdpa_net *ndev)
2945-
{
2946-
int i;
2947-
2948-
for (i = 0; i < ndev->mvdev.max_vqs; i++) {
2949-
ndev->vqs[i].ready = false;
2950-
ndev->vqs[i].modified_fields = 0;
2951-
}
2952-
2953-
ndev->mvdev.cvq.ready = false;
2954-
}
2955-
29562944
static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev)
29572945
{
29582946
struct mlx5_control_vq *cvq = &mvdev->cvq;
@@ -3035,12 +3023,14 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags)
30353023
down_write(&ndev->reslock);
30363024
unregister_link_notifier(ndev);
30373025
teardown_vq_resources(ndev);
3038-
clear_vqs_ready(ndev);
3026+
init_mvqs(ndev);
3027+
30393028
if (flags & VDPA_RESET_F_CLEAN_MAP)
30403029
mlx5_vdpa_destroy_mr_resources(&ndev->mvdev);
30413030
ndev->mvdev.status = 0;
30423031
ndev->mvdev.suspended = false;
30433032
ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT;
3033+
ndev->mvdev.cvq.ready = false;
30443034
ndev->mvdev.cvq.received_desc = 0;
30453035
ndev->mvdev.cvq.completed_desc = 0;
30463036
memset(ndev->event_cbs, 0, sizeof(*ndev->event_cbs) * (mvdev->max_vqs + 1));

0 commit comments

Comments
 (0)