[PATCH 371/577] Staging: hv: ring parameter

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

 



From: Stephen Hemminger <shemminger@xxxxxxxxxx>

The ring size parameter should be number of pages (not bytes).
Add module parameter information as well.

Signed-off-by: Stephen Hemminger <shemminger@xxxxxxxxxx>
Acked-by: Hank Janssen <hjanssen@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/staging/hv/NetVscApi.h  |    1 -
 drivers/staging/hv/netvsc_drv.c |    9 ++++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/NetVscApi.h b/drivers/staging/hv/NetVscApi.h
index 95d7a32..c372c98 100644
--- a/drivers/staging/hv/NetVscApi.h
+++ b/drivers/staging/hv/NetVscApi.h
@@ -28,7 +28,6 @@
 #include "VmbusApi.h"
 
 /* Defines */
-#define NETVSC_DEVICE_RING_BUFFER_SIZE	(64*PAGE_SIZE)
 #define HW_MACADDR_LEN			6
 
 /* Fwd declaration */
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 2ce9437..b02455c 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -52,7 +52,11 @@ struct netvsc_driver_context {
 	struct netvsc_driver drv_obj;
 };
 
-static int netvsc_ringbuffer_size = NETVSC_DEVICE_RING_BUFFER_SIZE;
+/* Need at least MAX_SKB_FRAGS (18) + 1
+   to handle worst case fragmented packet */
+static int ring_size = roundup_pow_of_two(2*MAX_SKB_FRAGS+1);
+module_param(ring_size, int, S_IRUGO);
+MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
 
 /* The one and only one */
 static struct netvsc_driver_context g_netvsc_drv;
@@ -536,7 +540,7 @@ static int netvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
 
 	vmbus_get_interface(&net_drv_obj->Base.VmbusChannelInterface);
 
-	net_drv_obj->RingBufferSize = netvsc_ringbuffer_size;
+	net_drv_obj->RingBufferSize = ring_size * PAGE_SIZE;
 	net_drv_obj->OnReceiveCallback = netvsc_recv_callback;
 	net_drv_obj->OnLinkStatusChanged = netvsc_linkstatus_callback;
 
@@ -582,7 +586,6 @@ static void __exit netvsc_exit(void)
 MODULE_LICENSE("GPL");
 MODULE_VERSION(HV_DRV_VERSION);
 MODULE_DESCRIPTION("Microsoft Hyper-V network driver");
-module_param(netvsc_ringbuffer_size, int, S_IRUGO);
 
 module_init(netvsc_init);
 module_exit(netvsc_exit);
-- 
1.7.0.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux