Allow setting size of ring buffer for host communication via module parameter. Signed-off-by: Stephen Hemminger <sthemmin@xxxxxxxxxxxxx> --- drivers/uio/uio_hv_generic.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c index 8d5f529a1dc1..24f8689fdb14 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c @@ -39,6 +39,13 @@ #define DRIVER_AUTHOR "Stephen Hemminger <sthemmin at microsoft.com>" #define DRIVER_DESC "Generic UIO driver for VMBus devices" +#define RING_SIZE_MIN 64 +#define RING_SIZE_MAX 512 + +static unsigned int ring_size = 128; +module_param(ring_size, uint, 0444); +MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); + /* * List of resources to be mapped to user space * can be extended up to MAX_UIO_MAPS(5) items @@ -49,8 +56,6 @@ enum hv_uio_map { MON_PAGE_MAP, }; -#define HV_RING_SIZE 512 - struct hv_uio_private_data { struct uio_info info; struct hv_device *device; @@ -102,8 +107,8 @@ hv_uio_probe(struct hv_device *dev, if (!pdata) return -ENOMEM; - ret = vmbus_open(dev->channel, HV_RING_SIZE * PAGE_SIZE, - HV_RING_SIZE * PAGE_SIZE, NULL, 0, + ret = vmbus_open(dev->channel, ring_size * PAGE_SIZE, + ring_size * PAGE_SIZE, NULL, 0, hv_uio_channel_cb, pdata); if (ret) goto fail; @@ -183,6 +188,18 @@ static struct hv_driver hv_uio_drv = { static int __init hyperv_module_init(void) { + if (ring_size < RING_SIZE_MIN) { + ring_size = RING_SIZE_MIN; + pr_info("Increased ring_size to %u (min allowed)\n", + ring_size); + } + + if (ring_size > RING_SIZE_MAX) { + ring_size = RING_SIZE_MAX; + pr_info("Decreased ring_size to %u (max allowed)\n", + ring_size); + } + return vmbus_driver_register(&hv_uio_drv); } -- 2.15.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel