Skip to contentSkip to conversation

v2: Driver: hv: netvsc: call dump_rndis_message() only in netvsc debug mode

PATCH In review [email protected] 2 participants 4 messages Apr 21, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 v2: Driver: hv: netvsc: call dump_rndis_message() only in netvsc debug mode

From: Simon Xiao <[email protected]>

---
 drivers/net/hyperv/hyperv_net.h   | 3 +++
 drivers/net/hyperv/netvsc_drv.c   | 8 ++++++++
 drivers/net/hyperv/rndis_filter.c | 3 ++-
 3 files changed, 13 insertions(+), 1 deletion(-)
drivers/net/hyperv/hyperv_net.h +3 -0
index a10b316..c9be35e 100644
@@ -28,6 +28,9 @@
 #include <linux/hyperv.h>
 #include <linux/rndis.h>
 
+/* flag for netvsc debug mode */
+extern int debug_mode;
+
 /* RSS related */
 #define OID_GEN_RECEIVE_SCALE_CAPABILITIES 0x00010203  /* query only */
 #define OID_GEN_RECEIVE_SCALE_PARAMETERS 0x00010204  /* query and set */
drivers/net/hyperv/netvsc_drv.c +8 -0
index a3a9d38..7c41864 100644
@@ -52,6 +52,10 @@ static int ring_size = 128;
 module_param(ring_size, int, S_IRUGO);
 MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
 
+int debug_mode = 0;
+module_param(debug_mode, int, S_IRUGO);
+MODULE_PARM_DESC(debug_mode, "debug mode: zero(0) for non-debug mode; non-zero for debug mode");
+
 static void do_set_multicast(struct work_struct *w)
 {
 	struct net_device_context *ndevctx =
@@ -999,6 +1003,10 @@ static int __init netvsc_drv_init(void)
 		pr_info("Increased ring_size to %d (min allowed)\n",
 			ring_size);
 	}
+
+	if (debug_mode != 0)
+		pr_info("Run netvsc in debug mode");
+
 	return vmbus_driver_register(&netvsc_drv);
 }
 
drivers/net/hyperv/rndis_filter.c +2 -1
index 0d92efe..a3f43f6 100644
@@ -429,7 +429,8 @@ int rndis_filter_receive(struct hv_device *dev,
 
 	rndis_msg = pkt->data;
 
-	dump_rndis_message(dev, rndis_msg);
+	if (debug_mode != 0)
+		dump_rndis_message(dev, rndis_msg);
 
 	switch (rndis_msg->ndis_msg_type) {
 	case RNDIS_MSG_PACKET:
Signature · 1 line
1.8.5.2
maintainer
#1 lore raw

From: [email protected]
Date: Tue, 21 Apr 2015 14:43:55 -0700

Quoted 3 lines

From: Simon Xiao <[email protected]>

This commit message is lacking an explanation why you want to do what you are doing.

Also, we have an existing mechanism to control network device driver debug logging output, please use it rather than invent your own facility.

author
#2 lore raw
In reply to [email protected]

Sorry - this patch should be sent to net-next so please ignore it.

Thanks,
Simon

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, April 21, 2015 2:44 PM
To: KY Srinivasan; Haiyang Zhang; [email protected]; [email protected]
Cc: Simon Xiao
Subject: [PATCH 1/1] v2: Driver: hv: netvsc: call dump_rndis_message() only in netvsc debug mode

From: Simon Xiao <[email protected]>

---
 drivers/net/hyperv/hyperv_net.h   | 3 +++
 drivers/net/hyperv/netvsc_drv.c   | 8 ++++++++
 drivers/net/hyperv/rndis_filter.c | 3 ++-
 3 files changed, 13 insertions(+), 1 deletion(-)
drivers/net/hyperv/hyperv_net.h +12 -1
@@ -28,6 +28,9 @@
 #include <linux/hyperv.h>
 #include <linux/rndis.h>
 
+/* flag for netvsc debug mode */
+extern int debug_mode;
+
 /* RSS related */
 #define OID_GEN_RECEIVE_SCALE_CAPABILITIES 0x00010203  /* query only */  #define OID_GEN_RECEIVE_SCALE_PARAMETERS 0x00010204  /* query and set */ diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index a3a9d38..7c41864 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -52,6 +52,10 @@ static int ring_size = 128;  module_param(ring_size, int, S_IRUGO);  MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
 
+int debug_mode = 0;
+module_param(debug_mode, int, S_IRUGO); MODULE_PARM_DESC(debug_mode, 
+"debug mode: zero(0) for non-debug mode; non-zero for debug mode");
+
 static void do_set_multicast(struct work_struct *w)  {
 	struct net_device_context *ndevctx =
@@ -999,6 +1003,10 @@ static int __init netvsc_drv_init(void)
 		pr_info("Increased ring_size to %d (min allowed)\n",
 			ring_size);
 	}
+
+	if (debug_mode != 0)
+		pr_info("Run netvsc in debug mode");
+
 	return vmbus_driver_register(&netvsc_drv);
 }
 
drivers/net/hyperv/rndis_filter.c +2 -1
index 0d92efe..a3f43f6 100644
@@ -429,7 +429,8 @@ int rndis_filter_receive(struct hv_device *dev,
 
 	rndis_msg = pkt->data;
 
-	dump_rndis_message(dev, rndis_msg);
+	if (debug_mode != 0)
+		dump_rndis_message(dev, rndis_msg);
 
 	switch (rndis_msg->ndis_msg_type) {
 	case RNDIS_MSG_PACKET:

--
1.8.5.2

maintainer
#3 lore raw

From: Simon Xiao <[email protected]>
Date: Tue, 21 Apr 2015 21:47:32 +0000

Quoted 1 line

Sorry - this patch should be sent to net-next so please ignore it.

Please do not top post.

First, provide exactly the necessary quoted material, and only the most necessary quoted material.

Then place your response afterwards, rather than beforehand.

Again, please do not ever top-post or quote more material in your reponse tha necessary.

This is a very serious pet peeve of experienced people who read this list every day, so please do your best to abide to do this properly.