Thread (1 message) 1 message, 1 author, 2021-11-25

Re: [PATH v1 2/2] vdpa/mlx5: Add support for reading descriptor statistics

From: Jason Wang <hidden>
Date: 2021-11-25 04:58:13

On Thu, Nov 25, 2021 at 12:56 AM Eli Cohen [off-list ref] wrote:
Implement the get_vq_stats calback of vdpa_config_ops to return the
statistics for a virtqueue.

Signed-off-by: Eli Cohen <redacted>
---
V0 -> V1:
Use mutex to sync stats query with change of number of queues
[...]
+static int mlx5_get_vq_stats(struct vdpa_device *vdev, u16 *idx,
+                            struct vdpa_vq_stats *stats)
+{
+       struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev);
+       struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
+       struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[*idx];
+       struct mlx5_control_vq *cvq;
+       int err;
+
+       mutex_lock(&ndev->numq_lock);
+       if ((!ctrl_vq_active(mvdev) && *idx >= ndev->cur_num_vqs) ||
+           (*idx != ctrl_vq_idx(mvdev) && *idx >= ndev->cur_num_vqs)) {
+               err = -EINVAL;
+               goto out;
Interesting, I wonder if it's simpler that we just allow stats up to
the max vqs. It's sometimes useful to dump the stats of all the vqs so
we can let that policy to userspace. Then we can get rid of the mutex.

Thanks

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help