Commit eb335bc4 authored by Hank Janssen's avatar Hank Janssen Committed by Greg Kroah-Hartman

staging: hv: replace DPRINT with native primitives in hv_netvsc

Replace all remaining DPRINT calls with their native dev_ and
netvsc_ calls. And also change some of the verbiage to be more useful.

rndis_filter has a few remaining DPRINT calls in it that will be removed
in a future patch because the debug will be implemented differently.
Signed-off-by: default avatarHank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0a46618d
This diff is collapsed.
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* Haiyang Zhang <haiyangz@microsoft.com> * Haiyang Zhang <haiyangz@microsoft.com>
* Hank Janssen <hjanssen@microsoft.com> * Hank Janssen <hjanssen@microsoft.com>
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/highmem.h> #include <linux/highmem.h>
...@@ -77,14 +79,14 @@ static int netvsc_open(struct net_device *net) ...@@ -77,14 +79,14 @@ static int netvsc_open(struct net_device *net)
/* Open up the device */ /* Open up the device */
ret = rndis_filter_open(device_obj); ret = rndis_filter_open(device_obj);
if (ret != 0) { if (ret != 0) {
DPRINT_ERR(NETVSC_DRV, netdev_err(net, "unable to open device (ret %d).\n",
"unable to open device (ret %d).", ret); ret);
return ret; return ret;
} }
netif_start_queue(net); netif_start_queue(net);
} else { } else {
DPRINT_ERR(NETVSC_DRV, "unable to open device...link is down."); netdev_err(net, "unable to open device...link is down.\n");
} }
return ret; return ret;
...@@ -100,7 +102,7 @@ static int netvsc_close(struct net_device *net) ...@@ -100,7 +102,7 @@ static int netvsc_close(struct net_device *net)
ret = rndis_filter_close(device_obj); ret = rndis_filter_close(device_obj);
if (ret != 0) if (ret != 0)
DPRINT_ERR(NETVSC_DRV, "unable to close device (ret %d).", ret); netdev_err(net, "unable to close device (ret %d).\n", ret);
return ret; return ret;
} }
...@@ -147,7 +149,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) ...@@ -147,7 +149,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
net_drv_obj->req_ext_size, GFP_ATOMIC); net_drv_obj->req_ext_size, GFP_ATOMIC);
if (!packet) { if (!packet) {
/* out of memory, silently drop packet */ /* out of memory, silently drop packet */
DPRINT_ERR(NETVSC_DRV, "unable to allocate hv_netvsc_packet"); netdev_err(net, "unable to allocate hv_netvsc_packet\n");
dev_kfree_skb(skb); dev_kfree_skb(skb);
net->stats.tx_dropped++; net->stats.tx_dropped++;
...@@ -214,8 +216,8 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj, ...@@ -214,8 +216,8 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj,
struct net_device *net = dev_get_drvdata(&device_obj->device); struct net_device *net = dev_get_drvdata(&device_obj->device);
if (!net) { if (!net) {
DPRINT_ERR(NETVSC_DRV, "got link status but net device " netdev_err(net, "got link status but net device "
"not initialized yet"); "not initialized yet\n");
return; return;
} }
...@@ -243,8 +245,8 @@ static int netvsc_recv_callback(struct hv_device *device_obj, ...@@ -243,8 +245,8 @@ static int netvsc_recv_callback(struct hv_device *device_obj,
unsigned long flags; unsigned long flags;
if (!net) { if (!net) {
DPRINT_ERR(NETVSC_DRV, "got receive callback but net device " netdev_err(net, "got receive callback but net device"
"not initialized yet"); " not initialized yet\n");
return 0; return 0;
} }
...@@ -350,8 +352,7 @@ static int netvsc_probe(struct device *device) ...@@ -350,8 +352,7 @@ static int netvsc_probe(struct device *device)
free_netdev(net); free_netdev(net);
dev_set_drvdata(device, NULL); dev_set_drvdata(device, NULL);
DPRINT_ERR(NETVSC_DRV, "unable to add netvsc device (ret %d)", netdev_err(net, "unable to add netvsc device (ret %d)\n", ret);
ret);
return ret; return ret;
} }
...@@ -397,7 +398,7 @@ static int netvsc_remove(struct device *device) ...@@ -397,7 +398,7 @@ static int netvsc_remove(struct device *device)
int ret; int ret;
if (net == NULL) { if (net == NULL) {
DPRINT_INFO(NETVSC, "no net device to remove"); dev_err(device, "No net device to remove\n");
return 0; return 0;
} }
...@@ -417,7 +418,7 @@ static int netvsc_remove(struct device *device) ...@@ -417,7 +418,7 @@ static int netvsc_remove(struct device *device)
ret = net_drv_obj->base.dev_rm(device_obj); ret = net_drv_obj->base.dev_rm(device_obj);
if (ret != 0) { if (ret != 0) {
/* TODO: */ /* TODO: */
DPRINT_ERR(NETVSC, "unable to remove vsc device (ret %d)", ret); netdev_err(net, "unable to remove vsc device (ret %d)\n", ret);
} }
free_netdev(net); free_netdev(net);
...@@ -446,16 +447,13 @@ static void netvsc_drv_exit(void) ...@@ -446,16 +447,13 @@ static void netvsc_drv_exit(void)
/* Get the device */ /* Get the device */
ret = driver_for_each_device(&drv->driver, NULL, ret = driver_for_each_device(&drv->driver, NULL,
&current_dev, netvsc_drv_exit_cb); &current_dev, netvsc_drv_exit_cb);
if (ret)
DPRINT_WARN(NETVSC_DRV,
"driver_for_each_device returned %d", ret);
if (current_dev == NULL) if (current_dev == NULL)
break; break;
/* Initiate removal from the top-down */ /* Initiate removal from the top-down */
DPRINT_INFO(NETVSC_DRV, "unregistering device (%p)...", dev_err(current_dev, "unregistering device (%s)...\n",
current_dev); dev_name(current_dev));
device_unregister(current_dev); device_unregister(current_dev);
} }
...@@ -509,7 +507,7 @@ MODULE_DEVICE_TABLE(dmi, hv_netvsc_dmi_table); ...@@ -509,7 +507,7 @@ MODULE_DEVICE_TABLE(dmi, hv_netvsc_dmi_table);
static int __init netvsc_init(void) static int __init netvsc_init(void)
{ {
DPRINT_INFO(NETVSC_DRV, "Netvsc initializing...."); pr_info("initializing....");
if (!dmi_check_system(hv_netvsc_dmi_table)) if (!dmi_check_system(hv_netvsc_dmi_table))
return -ENODEV; return -ENODEV;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/netdevice.h>
#include "logging.h" #include "logging.h"
#include "hv_api.h" #include "hv_api.h"
#include "netvsc_api.h" #include "netvsc_api.h"
...@@ -294,8 +294,9 @@ static void rndis_filter_receive_response(struct rndis_device *dev, ...@@ -294,8 +294,9 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
memcpy(&request->response_msg, resp, memcpy(&request->response_msg, resp,
resp->msg_len); resp->msg_len);
} else { } else {
DPRINT_ERR(NETVSC, "rndis response buffer overflow " dev_err(&dev->net_dev->dev->device,
"detected (size %u max %zu)", "rndis response buffer overflow "
"detected (size %u max %zu)\n",
resp->msg_len, resp->msg_len,
sizeof(struct rndis_filter_packet)); sizeof(struct rndis_filter_packet));
...@@ -314,8 +315,9 @@ static void rndis_filter_receive_response(struct rndis_device *dev, ...@@ -314,8 +315,9 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
request->wait_condition = 1; request->wait_condition = 1;
wake_up(&request->wait_event); wake_up(&request->wait_event);
} else { } else {
DPRINT_ERR(NETVSC, "no rndis request found for this response " dev_err(&dev->net_dev->dev->device,
"(id 0x%x res type 0x%x)", "no rndis request found for this response "
"(id 0x%x res type 0x%x)\n",
resp->msg.init_complete.req_id, resp->msg.init_complete.req_id,
resp->ndis_msg_type); resp->ndis_msg_type);
} }
...@@ -380,15 +382,15 @@ static int rndis_filter_receive(struct hv_device *dev, ...@@ -380,15 +382,15 @@ static int rndis_filter_receive(struct hv_device *dev,
/* Make sure the rndis device state is initialized */ /* Make sure the rndis device state is initialized */
if (!net_dev->extension) { if (!net_dev->extension) {
DPRINT_ERR(NETVSC, "got rndis message but no rndis device..." dev_err(&dev->device, "got rndis message but no rndis device - "
"dropping this message!"); "dropping this message!\n");
return -1; return -1;
} }
rndis_dev = (struct rndis_device *)net_dev->extension; rndis_dev = (struct rndis_device *)net_dev->extension;
if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED) { if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED) {
DPRINT_ERR(NETVSC, "got rndis message but rndis device " dev_err(&dev->device, "got rndis message but rndis device "
"uninitialized...dropping this message!"); "uninitialized...dropping this message!\n");
return -1; return -1;
} }
...@@ -409,8 +411,8 @@ static int rndis_filter_receive(struct hv_device *dev, ...@@ -409,8 +411,8 @@ static int rndis_filter_receive(struct hv_device *dev,
kunmap_atomic(rndis_hdr - pkt->page_buf[0].offset, kunmap_atomic(rndis_hdr - pkt->page_buf[0].offset,
KM_IRQ0); KM_IRQ0);
DPRINT_ERR(NETVSC, "invalid rndis message? (expected %u " dev_err(&dev->device, "invalid rndis message? (expected %u "
"bytes got %u)...dropping this message!", "bytes got %u)...dropping this message!\n",
rndis_hdr->msg_len, rndis_hdr->msg_len,
pkt->total_data_buflen); pkt->total_data_buflen);
return -1; return -1;
...@@ -419,8 +421,8 @@ static int rndis_filter_receive(struct hv_device *dev, ...@@ -419,8 +421,8 @@ static int rndis_filter_receive(struct hv_device *dev,
if ((rndis_hdr->ndis_msg_type != REMOTE_NDIS_PACKET_MSG) && if ((rndis_hdr->ndis_msg_type != REMOTE_NDIS_PACKET_MSG) &&
(rndis_hdr->msg_len > sizeof(struct rndis_message))) { (rndis_hdr->msg_len > sizeof(struct rndis_message))) {
DPRINT_ERR(NETVSC, "incoming rndis message buffer overflow " dev_err(&dev->device, "incoming rndis message buffer overflow "
"detected (got %u, max %zu)...marking it an error!", "detected (got %u, max %zu)..marking it an error!\n",
rndis_hdr->msg_len, rndis_hdr->msg_len,
sizeof(struct rndis_message)); sizeof(struct rndis_message));
} }
...@@ -452,7 +454,8 @@ static int rndis_filter_receive(struct hv_device *dev, ...@@ -452,7 +454,8 @@ static int rndis_filter_receive(struct hv_device *dev,
rndis_filter_receive_indicate_status(rndis_dev, &rndis_msg); rndis_filter_receive_indicate_status(rndis_dev, &rndis_msg);
break; break;
default: default:
DPRINT_ERR(NETVSC, "unhandled rndis message (type %u len %u)", dev_err(&dev->device,
"unhandled rndis message (type %u len %u)\n",
rndis_msg.ndis_msg_type, rndis_msg.ndis_msg_type,
rndis_msg.msg_len); rndis_msg.msg_len);
break; break;
...@@ -575,7 +578,8 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev, ...@@ -575,7 +578,8 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev,
msecs_to_jiffies(2000)); msecs_to_jiffies(2000));
if (request->wait_condition == 0) { if (request->wait_condition == 0) {
ret = -1; ret = -1;
DPRINT_ERR(NETVSC, "timeout before we got a set response..."); dev_err(&dev->net_dev->dev->device,
"timeout before we got a set response...\n");
/* /*
* We cant deallocate the request since we may still receive a * We cant deallocate the request since we may still receive a
* send completion for it. * send completion for it.
...@@ -789,16 +793,15 @@ static int rndis_filte_device_add(struct hv_device *dev, ...@@ -789,16 +793,15 @@ static int rndis_filte_device_add(struct hv_device *dev,
*/ */
} }
DPRINT_INFO(NETVSC, "Device 0x%p mac addr %pM",
rndisDevice, rndisDevice->hw_mac_adr);
memcpy(deviceInfo->mac_adr, rndisDevice->hw_mac_adr, ETH_ALEN); memcpy(deviceInfo->mac_adr, rndisDevice->hw_mac_adr, ETH_ALEN);
rndis_filter_query_device_link_status(rndisDevice); rndis_filter_query_device_link_status(rndisDevice);
deviceInfo->link_state = rndisDevice->link_stat; deviceInfo->link_state = rndisDevice->link_stat;
DPRINT_INFO(NETVSC, "Device 0x%p link state %s", rndisDevice,
((deviceInfo->link_state) ? ("down") : ("up"))); dev_info(&dev->device, "Device MAC %pM link state %s",
rndisDevice->hw_mac_adr,
((deviceInfo->link_state) ? ("down\n") : ("up\n")));
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment