Re: [PATCH vhost v7 3/6] virtio: find_vqs: pass struct instead of multi parameters

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

 



On Thu, 28 Mar 2024 16:03:45 +0800
Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx> wrote:

> --- a/drivers/s390/virtio/virtio_ccw.c
> +++ b/drivers/s390/virtio/virtio_ccw.c
> @@ -499,9 +499,8 @@ static void virtio_ccw_del_vqs(struct virtio_device *vdev)
>  }
>  
>  static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
> -					     int i, vq_callback_t *callback,
> -					     const char *name, bool ctx,
> -					     struct ccw1 *ccw)
> +					     int i, struct ccw1 *ccw,
> +					     struct virtio_vq_config *cfg)
>  {
>  	struct virtio_ccw_device *vcdev = to_vc_device(vdev);
>  	bool (*notify)(struct virtqueue *vq);
> @@ -538,8 +537,11 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
>  	}
>  	may_reduce = vcdev->revision > 0;
>  	vq = vring_create_virtqueue(i, info->num, KVM_VIRTIO_CCW_RING_ALIGN,
> -				    vdev, true, may_reduce, ctx,
> -				    notify, callback, name);
> +				    vdev, true, may_reduce,
> +				    cfg->ctx ? cfg->ctx[i] : false,
> +				    notify,
> +				    cfg->callbacks[i],
> +				    cfg->names[i]);
>  
>  	if (!vq) {
>  		/* For now, we fail if we can't get the requested size. */
> @@ -650,15 +652,13 @@ static int virtio_ccw_register_adapter_ind(struct virtio_ccw_device *vcdev,
>  	return ret;
>  }
>  
> -static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs,
> -			       struct virtqueue *vqs[],
> -			       vq_callback_t *callbacks[],
> -			       const char * const names[],
> -			       const bool *ctx,
> -			       struct irq_affinity *desc)
> +static int virtio_ccw_find_vqs(struct virtio_device *vdev,
> +			       struct virtio_vq_config *cfg)
>  {
>  	struct virtio_ccw_device *vcdev = to_vc_device(vdev);
> +	struct virtqueue **vqs = cfg->vqs;
>  	unsigned long *indicatorp = NULL;
> +	unsigned int nvqs = cfg->nvqs;
>  	int ret, i;
>  	struct ccw1 *ccw;
>  
> @@ -667,14 +667,12 @@ static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs,
>  		return -ENOMEM;
>  
>  	for (i = 0; i < nvqs; ++i) {
> -		if (!names[i]) {
> +		if (!cfg->names[i]) {
>  			ret = -EINVAL;
>  			goto out;
>  		}
>  
> -		vqs[i] = virtio_ccw_setup_vq(vdev, i, callbacks[i],
> -					     names[i], ctx ? ctx[i] : false,
> -					     ccw);
> +		vqs[i] = virtio_ccw_setup_vq(vdev, i, ccw, cfg);
>  		if (IS_ERR(vqs[i])) {
>  			ret = PTR_ERR(vqs[i]);
>  			vqs[i] = NULL;

For the virtio-ccw part:
Acked-by: Halil Pasic <pasic@xxxxxxxxxxxxx>




[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