aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hyperv
diff options
context:
space:
mode:
authorSimon Xiao <sixiao@microsoft.com>2015-04-28 04:05:17 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-29 14:45:17 -0400
commit3f300ff41d89fe9674b8dbab950ba2572639ee8d (patch)
tree83afb84a35c2e4f2f81ce5555bb9b4a5f9f9964f /drivers/net/hyperv
parentcb6ccf09d6b94bec4def1ac5cf4678d12b216474 (diff)
hv_netvsc: introduce netif-msg into netvsc module
1. Introduce netif-msg to netvsc to control debug logging output and keep msg_enable in netvsc_device_context so that it is kept persistently. 2. Only call dump_rndis_message() when NETIF_MSG_RX_ERR or above is specified in netvsc module debug param. In non-debug mode, in current code, dump_rndis_message() will not dump anything but it still initialize some local variables and process the switch logic which is unnecessary, especially in high network throughput situation. Signed-off-by: Simon Xiao <sixiao@microsoft.com> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv')
-rw-r--r--drivers/net/hyperv/hyperv_net.h12
-rw-r--r--drivers/net/hyperv/netvsc.c3
-rw-r--r--drivers/net/hyperv/netvsc_drv.c20
-rw-r--r--drivers/net/hyperv/rndis_filter.c3
4 files changed, 31 insertions, 7 deletions
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index a10b31664709..e55c8f4f55ef 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -612,6 +612,15 @@ struct multi_send_data {
612 u32 count; /* counter of batched packets */ 612 u32 count; /* counter of batched packets */
613}; 613};
614 614
615/* The context of the netvsc device */
616struct net_device_context {
617 /* point back to our device context */
618 struct hv_device *device_ctx;
619 struct delayed_work dwork;
620 struct work_struct work;
621 u32 msg_enable; /* debug level */
622};
623
615/* Per netvsc device */ 624/* Per netvsc device */
616struct netvsc_device { 625struct netvsc_device {
617 struct hv_device *dev; 626 struct hv_device *dev;
@@ -667,6 +676,9 @@ struct netvsc_device {
667 struct multi_send_data msd[NR_CPUS]; 676 struct multi_send_data msd[NR_CPUS];
668 u32 max_pkt; /* max number of pkt in one send, e.g. 8 */ 677 u32 max_pkt; /* max number of pkt in one send, e.g. 8 */
669 u32 pkt_align; /* alignment bytes, e.g. 8 */ 678 u32 pkt_align; /* alignment bytes, e.g. 8 */
679
680 /* The net device context */
681 struct net_device_context *nd_ctx;
670}; 682};
671 683
672/* NdisInitialize message */ 684/* NdisInitialize message */
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 2e8ad0636b46..c651d4d8b747 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -1197,6 +1197,9 @@ int netvsc_device_add(struct hv_device *device, void *additional_info)
1197 */ 1197 */
1198 ndev = net_device->ndev; 1198 ndev = net_device->ndev;
1199 1199
1200 /* Add netvsc_device context to netvsc_device */
1201 net_device->nd_ctx = netdev_priv(ndev);
1202
1200 /* Initialize the NetVSC channel extension */ 1203 /* Initialize the NetVSC channel extension */
1201 init_completion(&net_device->channel_init_wait); 1204 init_completion(&net_device->channel_init_wait);
1202 1205
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index a3a9d3898a6e..66c4b0c8d108 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -40,18 +40,21 @@
40 40
41#include "hyperv_net.h" 41#include "hyperv_net.h"
42 42
43struct net_device_context {
44 /* point back to our device context */
45 struct hv_device *device_ctx;
46 struct delayed_work dwork;
47 struct work_struct work;
48};
49 43
50#define RING_SIZE_MIN 64 44#define RING_SIZE_MIN 64
51static int ring_size = 128; 45static int ring_size = 128;
52module_param(ring_size, int, S_IRUGO); 46module_param(ring_size, int, S_IRUGO);
53MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); 47MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
54 48
49static const u32 default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE |
50 NETIF_MSG_LINK | NETIF_MSG_IFUP |
51 NETIF_MSG_IFDOWN | NETIF_MSG_RX_ERR |
52 NETIF_MSG_TX_ERR;
53
54static int debug = -1;
55module_param(debug, int, S_IRUGO);
56MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
57
55static void do_set_multicast(struct work_struct *w) 58static void do_set_multicast(struct work_struct *w)
56{ 59{
57 struct net_device_context *ndevctx = 60 struct net_device_context *ndevctx =
@@ -888,6 +891,11 @@ static int netvsc_probe(struct hv_device *dev,
888 891
889 net_device_ctx = netdev_priv(net); 892 net_device_ctx = netdev_priv(net);
890 net_device_ctx->device_ctx = dev; 893 net_device_ctx->device_ctx = dev;
894 net_device_ctx->msg_enable = netif_msg_init(debug, default_msg);
895 if (netif_msg_probe(net_device_ctx))
896 netdev_dbg(net, "netvsc msg_enable: %d\n",
897 net_device_ctx->msg_enable);
898
891 hv_set_drvdata(dev, net); 899 hv_set_drvdata(dev, net);
892 INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_link_change); 900 INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_link_change);
893 INIT_WORK(&net_device_ctx->work, do_set_multicast); 901 INIT_WORK(&net_device_ctx->work, do_set_multicast);
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 0d92efefd796..9118cea91882 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -429,7 +429,8 @@ int rndis_filter_receive(struct hv_device *dev,
429 429
430 rndis_msg = pkt->data; 430 rndis_msg = pkt->data;
431 431
432 dump_rndis_message(dev, rndis_msg); 432 if (netif_msg_rx_err(net_dev->nd_ctx))
433 dump_rndis_message(dev, rndis_msg);
433 434
434 switch (rndis_msg->ndis_msg_type) { 435 switch (rndis_msg->ndis_msg_type) {
435 case RNDIS_MSG_PACKET: 436 case RNDIS_MSG_PACKET: