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

Re: [Minios-devel] [UNIKRAFT PATCH v3 07/17] plat/xen/drivers/blk: Create blkfront queues



Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx>

On 10/30/19 5:54 PM, Roxana Nicolescu wrote:
> This patch allocates the queues used for communication with the device.
> One queue is responsible for handling both requests and responses
> to / from the device.
> 
> Signed-off-by: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>
> ---
>  plat/xen/drivers/blk/blkfront.c | 13 ++++++++++++-
>  plat/xen/drivers/blk/blkfront.h | 14 ++++++++++++++
>  2 files changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/plat/xen/drivers/blk/blkfront.c b/plat/xen/drivers/blk/blkfront.c
> index ae98a79c..58d33ddd 100644
> --- a/plat/xen/drivers/blk/blkfront.c
> +++ b/plat/xen/drivers/blk/blkfront.c
> @@ -66,15 +66,25 @@ static int blkfront_configure(struct uk_blkdev *blkdev,
>  
>       dev = to_blkfront(blkdev);
>       dev->nb_queues = conf->nb_queues;
> +     dev->queues = uk_calloc(drv_allocator, dev->nb_queues,
> +                             sizeof(*dev->queues));
> +     if (!dev->queues)
> +             return -ENOMEM;
> +
>       err = blkfront_xb_write_nb_queues(dev);
>       if (err) {
>               uk_pr_err("Failed to write nb of queues: %d.\n", err);
> -             goto out;
> +             goto out_err;
>       }
>  
>       uk_pr_info(DRIVER_NAME": %"PRIu16" configured\n", dev->uid);
>  out:
>       return err;
> +out_err:
> +     uk_free(drv_allocator, dev->queues);
> +     goto out;
> +}
> +     return err;
>  }
>  
>  static int blkfront_unconfigure(struct uk_blkdev *blkdev)
> @@ -83,6 +93,7 @@ static int blkfront_unconfigure(struct uk_blkdev *blkdev)
>  
>       UK_ASSERT(blkdev != NULL);
>       dev = to_blkfront(blkdev);
> +     uk_free(drv_allocator, dev->queues);
>  
>       return 0;
>  }
> diff --git a/plat/xen/drivers/blk/blkfront.h b/plat/xen/drivers/blk/blkfront.h
> index 5833f826..6b7d5cad 100644
> --- a/plat/xen/drivers/blk/blkfront.h
> +++ b/plat/xen/drivers/blk/blkfront.h
> @@ -43,6 +43,18 @@
>   */
>  #include <uk/blkdev.h>
>  
> +/*
> + * Structure used to describe a queue used for both requests and responses
> + */
> +struct uk_blkdev_queue {
> +     /* Allocator for this queue. */
> +     struct uk_alloc *a;
> +     /* The libukblkdev queue identifier */
> +     uint16_t queue_id;
> +     /* Reference to the Blkfront Device */
> +     struct blkfront_dev *dev;
> +};
> +
>  /**
>   * Structure used to describe the Blkfront device.
>   */
> @@ -55,6 +67,8 @@ struct blkfront_dev {
>       blkif_vdev_t    handle;
>       /* Number of configured queues used for requests */
>       uint16_t nb_queues;
> +     /* Vector of queues used for communication with backend */
> +     struct uk_blkdev_queue *queues;
>       /* The blkdev identifier */
>       __u16 uid;
>  };
> 

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.