[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 07/17] plat/xen/drivers/blk: Create blkfront queues
This patch allocates the queues used for communication with the device. One queue is responsible for handling both requests and responses to/from device. Signed-off-by: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx> --- plat/xen/drivers/blk/blkfront.c | 12 +++++++++++- plat/xen/drivers/blk/blkfront.h | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/plat/xen/drivers/blk/blkfront.c b/plat/xen/drivers/blk/blkfront.c index 1a57d2f7..87991909 100644 --- a/plat/xen/drivers/blk/blkfront.c +++ b/plat/xen/drivers/blk/blkfront.c @@ -64,15 +64,24 @@ static int blkfront_configure(struct uk_blkdev *blkdev, UK_ASSERT(blkdev != NULL); 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; +} } static void blkfront_close(struct uk_blkdev *blkdev) @@ -85,6 +94,7 @@ static void blkfront_close(struct uk_blkdev *blkdev) uid = dev->uid; blkfront_xb_fini(dev); uk_blkdev_drv_unregister(blkdev, drv_allocator); + uk_free(drv_allocator, dev->queues); uk_free(drv_allocator, dev); uk_pr_info(DRIVER_NAME": %"PRIu16" closed\n", uid); diff --git a/plat/xen/drivers/blk/blkfront.h b/plat/xen/drivers/blk/blkfront.h index 1368dd2e..553a1117 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; }; -- 2.11.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |