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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 25, 2021 at 12:56 AM Eli Cohen <elic@xxxxxxxxxx> wrote:
>
> Implement the get_vq_stats calback of vdpa_config_ops to return the
> statistics for a virtqueue.
>
> Signed-off-by: Eli Cohen <elic@xxxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization



[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux