Remove and replace all un-needed DPRINT and printk
Subsystems (2)
PATCH 1/7 Remove all unneeded DPRINT from hv_vmbus
In reply to Hank JanssenRemove all un-needed DPRINT calls from hv_vmbus. Several are remaining that will be cleaned up in my next set of patches. They deal with printing out the ringbuffer debugging which is going to be implemented slightly differently.
This patch deals with hv_vmbus only.
--- drivers/staging/hv/channel.c | 70 ++++--------------------------------- drivers/staging/hv/channel_mgmt.c | 51 ++------------------------- drivers/staging/hv/connection.c | 9 ----- drivers/staging/hv/hv.c | 54 ++++------------------------ drivers/staging/hv/ring_buffer.c | 20 ---------- drivers/staging/hv/vmbus_drv.c | 69 +----------------------------------- 6 files changed, 21 insertions(+), 252 deletions(-)
drivers/staging/hv/channel.c +7 -63
@@ -213,9 +213,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,/* Establish the gpadl for the ring buffer */ -DPRINT_DBG (VMBUS ,"Establishing ring buffer's gpadl for channel %p..." , - newchannel); - newchannel->ringbuffer_gpadlhandle =0 ; ret = vmbus_establish_gpadl(newchannel,
@@ -229,16 +226,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, goto errorout; } -DPRINT_DBG (VMBUS ,"channel %p <relid %d gpadl 0x%x send ring %p " -"size %d recv ring %p size %d, downstreamoffset %d>" , - newchannel, newchannel->offermsg.child_relid, - newchannel->ringbuffer_gpadlhandle, - newchannel->outbound.ring_buffer, - newchannel->outbound.ring_size, - newchannel->inbound.ring_buffer, - newchannel->inbound.ring_size, - send_ringbuffer_size); -/* Create and init the channel open message */ openInfo = kmalloc(sizeof(*openInfo) + sizeof(struct vmbus_channel_open_channel),
@@ -272,14 +259,11 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, &vmbus_connection.chn_msg_list);spin_unlock_irqrestore (&vmbus_connection.channelmsg_lock, flags); -DPRINT_DBG (VMBUS ,"Sending channel open msg..." ); - ret =vmbus_post_msg (openMsg,sizeof (struct vmbus_channel_open_channel )); -if (ret !=0 ) { -DPRINT_ERR (VMBUS ,"unable to open channel - %d" , ret); + +if (ret !=0 ) goto Cleanup; - } openInfo->wait_condition =0 ; wait_event_timeout(openInfo->waitevent,
@@ -291,11 +275,8 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } -if (openInfo->response.open_result.status ==0 ) -DPRINT_INFO (VMBUS ,"channel <%p> open success!!" , newchannel); -else -DPRINT_INFO (VMBUS ,"channel <%p> open failed - %d!!" , - newchannel, openInfo->response.open_result.status); +if (openInfo->response.open_result.status) + err = openInfo->response.open_result.status; Cleanup:spin_lock_irqsave (&vmbus_connection.channelmsg_lock, flags);
@@ -303,7 +284,7 @@ Cleanup:spin_unlock_irqrestore (&vmbus_connection.channelmsg_lock, flags);kfree (openInfo); -return 0 ; +return err; errorout:ringbuffer_cleanup (&newchannel->outbound);
@@ -326,6 +307,7 @@ static void dump_gpadl_body(struct vmbus_channel_gpadl_body *gpadl, u32 len) pfncount = (len -sizeof (struct vmbus_channel_gpadl_body )) /sizeof (u64); +DPRINT_DBG (VMBUS ,"gpadl body - len %d pfn count %d" , len, pfncount);for (i =0 ; i < pfncount; i++)
@@ -530,19 +512,12 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, &vmbus_connection.chn_msg_list);spin_unlock_irqrestore (&vmbus_connection.channelmsg_lock, flags); -DPRINT_DBG (VMBUS ,"buffer %p, size %d msg cnt %d" , - kbuffer, size, msgcount); - -DPRINT_DBG (VMBUS ,"Sending GPADL Header - len %zd" , - msginfo->msgsize -sizeof (*msginfo)); msginfo->wait_condition =0 ; ret =vmbus_post_msg (gpadlmsg, msginfo->msgsize -sizeof (*msginfo)); -if (ret !=0 ) { -DPRINT_ERR (VMBUS ,"Unable to open channel - %d" , ret); +if (ret !=0 ) goto Cleanup; - }if (msgcount >1 ) {list_for_each (curr, &msginfo->submsglist) {
@@ -556,10 +531,6 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,CHANNELMSG_GPADL_BODY ; gpadl_body->gpadl = next_gpadl_handle; -DPRINT_DBG (VMBUS ,"Sending GPADL Body - len %zd" , - submsginfo->msgsize - -sizeof (*submsginfo)); -dump_gpadl_body (gpadl_body, submsginfo->msgsize -sizeof (*submsginfo)); ret = vmbus_post_msg(gpadl_body,
@@ -577,12 +548,6 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,/* At this point, we received the gpadl created msg */ -DPRINT_DBG (VMBUS ,"Received GPADL created " -"(relid %d, status %d handle %x)" , - channel->offermsg.child_relid, - msginfo->response.gpadl_created.creation_status, - gpadlmsg->gpadl); - *gpadl_handle = gpadlmsg->gpadl; Cleanup:
@@ -730,9 +695,6 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,u64 aligned_data =0 ;int ret; -DPRINT_DBG (VMBUS ,"channel %p buffer %p len %d" , - channel, buffer, bufferlen); -dump_vmbus_channel (channel);/* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
@@ -846,10 +808,6 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,dump_vmbus_channel (channel); -DPRINT_DBG (VMBUS ,"data buffer - offset %u len %u pfn count %u" , - multi_pagebuffer->offset, - multi_pagebuffer->len, pfncount); -if ((pfncount <0 ) || (pfncount >MAX_MULTIPAGE_BUFFER_COUNT ))return -EINVAL ;
@@ -926,8 +884,6 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, sizeof(struct vmpacket_descriptor));if (ret !=0 ) {spin_unlock_irqrestore (&channel->inbound_lock, flags); - -/* DPRINT_DBG(VMBUS, "nothing to read!!"); */ return 0 ; }
@@ -937,11 +893,6 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, userlen = packetlen - (desc.offset8 <<3 );/* ASSERT(userLen > 0); */ -DPRINT_DBG (VMBUS ,"packet received on channel %p relid %d <type %d " -"flag %d tid %llx pktlen %d datalen %d> " , - channel, channel->offermsg.child_relid, desc.type, - desc.flags, desc.trans_id, packetlen, userlen); - *buffer_actual_len = userlen;if (userlen > bufferlen) {
@@ -986,8 +937,6 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, sizeof(struct vmpacket_descriptor));if (ret !=0 ) {spin_unlock_irqrestore (&channel->inbound_lock, flags); - -/* DPRINT_DBG(VMBUS, "nothing to read!!"); */ return 0 ; }
@@ -996,11 +945,6 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, packetlen = desc.len8 <<3 ; userlen = packetlen - (desc.offset8 <<3 ); -DPRINT_DBG (VMBUS ,"packet received on channel %p relid %d <type %d " -"flag %d tid %llx pktlen %d datalen %d> " , - channel, channel->offermsg.child_relid, desc.type, - desc.flags, desc.trans_id, packetlen, userlen); - *buffer_actual_len = packetlen;if (packetlen > bufferlen) {
drivers/staging/hv/channel_mgmt.c +4 -47
112 lines not on this page · raw message
drivers/staging/hv/connection.c +0 -9
@@ -121,11 +121,6 @@ int vmbus_connect(void)spin_unlock_irqrestore (&vmbus_connection.channelmsg_lock, flags); -DPRINT_DBG (VMBUS ,"Vmbus connection - interrupt pfn %llx, " -"monitor1 pfn %llx,, monitor2 pfn %llx" , - msg->interrupt_page, msg->monitor_page1, msg->monitor_page2); - -DPRINT_DBG (VMBUS ,"Sending channel initiate msg..." ); ret =vmbus_post_msg (msg,sizeof (struct vmbus_channel_initiate_contact ));if (ret !=0 ) {
@@ -156,9 +151,7 @@ int vmbus_connect(void)/* Check if successful */ if (msginfo->response.version_response.version_supported) { -DPRINT_INFO (VMBUS ,"Vmbus connected!!" ); vmbus_connection.conn_state =CONNECTED ; - }else { DPRINT_ERR(VMBUS, "Vmbus connection failed!!..." "current version (%d) not supported",
@@ -300,11 +293,9 @@ void vmbus_on_event(unsigned long data) (unsigned long *) &recv_int_page[dword])) { relid = (dword <<5 ) + bit; -DPRINT_DBG (VMBUS ,"event detected for relid - %d" , relid);if (relid ==0 ) {/* special case - vmbus channel protocol msg */ -DPRINT_DBG (VMBUS ,"invalid relid - %d" , relid);continue ; }else {/* QueueWorkItem(VmbusProcessEvent, (void*)relid); */
drivers/staging/hv/hv.c +8 -46
151 lines not on this page · raw message
drivers/staging/hv/ring_buffer.c +0 -20
@@ -372,20 +372,12 @@ int ringbuffer_write(struct hv_ring_buffer_info *outring_info, &bytes_avail_toread, &bytes_avail_towrite); -DPRINT_DBG (VMBUS ,"Writing %u bytes..." , totalbytes_towrite); -/* Dumpring_info(Outring_info, "BEFORE "); */ /* If there is only room for the packet, assume it is full. */ /* Otherwise, the next time around, we think the ring buffer */ /* is empty since the read index == write index */ if (bytes_avail_towrite <= totalbytes_towrite) { -DPRINT_DBG (VMBUS , -"No more space left on outbound ring buffer " -"(needed %u, avail %u)" , - totalbytes_towrite, - bytes_avail_towrite); -spin_unlock_irqrestore (&outring_info->ring_lock, flags);return -1 ; }
@@ -499,18 +491,10 @@ int ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer, &bytes_avail_toread, &bytes_avail_towrite); -DPRINT_DBG (VMBUS ,"Reading %u bytes..." , buflen); -/* Dumpring_info(Inring_info, "BEFORE "); */ /* Make sure there is something to read */ if (bytes_avail_toread < buflen) { -DPRINT_DBG (VMBUS , -"got callback but not enough to read " -"<avail to read %d read size %d>!!" , - bytes_avail_toread, - buflen); -spin_unlock_irqrestore (&inring_info->ring_lock, flags);return -1 ;
@@ -568,8 +552,6 @@ copyto_ringbuffer(/* wrap-around detected! */ if (srclen > ring_buffer_size - start_write_offset) { -DPRINT_DBG (VMBUS ,"wrap-around detected!" ); - frag_len = ring_buffer_size - start_write_offset;memcpy (ring_buffer + start_write_offset, src, frag_len);memcpy (ring_buffer, src + frag_len, srclen - frag_len);
@@ -607,8 +589,6 @@ copyfrom_ringbuffer(/* wrap-around detected at the src */ if (destlen > ring_buffer_size - start_read_offset) { -DPRINT_DBG (VMBUS ,"src wrap-around detected!" ); - frag_len = ring_buffer_size - start_read_offset;memcpy (dest, ring_buffer + start_read_offset, frag_len);
drivers/staging/hv/vmbus_drv.c +2 -67
125 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 3/7 Remove all unneeded DPRINT from hv_utils
In reply to Hank JanssenRemove all un-needed DPRINT calls from hv_utils.
This patch deals with hv_utils only.
--- drivers/staging/hv/hv_kvp.c | 3 --- drivers/staging/hv/hv_util.c | 12 ------------ 2 files changed, 0 insertions(+), 15 deletions(-)
drivers/staging/hv/hv_kvp.c +0 -3
@@ -259,9 +259,6 @@ void hv_kvp_onchannelcallback(void *context)vmbus_recvpacket (channel, recv_buffer,PAGE_SIZE , &recvlen, &requestid);if (recvlen >0 ) { -DPRINT_DBG (VMBUS ,"KVP packet: len=%d, requestid=%lld" , - recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)&recv_buffer[sizeof (struct vmbuspipe_hdr )];
drivers/staging/hv/hv_util.c +0 -12
@@ -59,9 +59,6 @@ static void shutdown_onchannelcallback(void *context) PAGE_SIZE, &recvlen, &requestid);if (recvlen >0 ) { -DPRINT_DBG (VMBUS ,"shutdown packet: len=%d, requestid=%lld" , - recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)&shut_txf_buf[sizeof (struct vmbuspipe_hdr )];
@@ -159,9 +156,6 @@ static void timesync_onchannelcallback(void *context) PAGE_SIZE, &recvlen, &requestid);if (recvlen >0 ) { -DPRINT_DBG (VMBUS ,"timesync packet: recvlen=%d, requestid=%lld" , - recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)&time_txf_buf[sizeof (struct vmbuspipe_hdr )];
@@ -200,9 +194,6 @@ static void heartbeat_onchannelcallback(void *context) PAGE_SIZE, &recvlen, &requestid);if (recvlen >0 ) { -DPRINT_DBG (VMBUS ,"heartbeat packet: len=%d, requestid=%lld" , - recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)&hbeat_txf_buf[sizeof (struct vmbuspipe_hdr )];
@@ -214,9 +205,6 @@ static void heartbeat_onchannelcallback(void *context)sizeof (struct vmbuspipe_hdr ) + sizeof(struct icmsg_hdr)]; -DPRINT_DBG (VMBUS ,"heartbeat seq = %lld" , - heartbeat_msg->seq_num); - heartbeat_msg->seq_num +=1 ; }
Signature · 1 line
1.6.0.2
PATCH 4/7 Replace DPRINT with natives in hv_vmbus
In reply to Hank JanssenReplace all remaining DPRINT calls (excluding the ringbuffer debug which is going to be done in a next set of patches) with their native pr_ calls. And also changed some of the printouts to be more useful.
--- drivers/staging/hv/channel.c | 9 +++++-- drivers/staging/hv/channel_mgmt.c | 25 ++++++++++----------- drivers/staging/hv/connection.c | 12 ++++++---- drivers/staging/hv/hv.c | 10 ++++---- drivers/staging/hv/ring_buffer.c | 1 + drivers/staging/hv/vmbus_drv.c | 43 +++++++++++++++--------------------- 6 files changed, 49 insertions(+), 51 deletions(-)
drivers/staging/hv/channel.c +6 -3
@@ -18,6 +18,8 @@* Haiyang Zhang <[email protected]> * Hank Janssen <[email protected]> */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/sched.h> #include <linux/wait.h>
@@ -898,7 +900,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,if (userlen > bufferlen) {spin_unlock_irqrestore (&channel->inbound_lock, flags); -DPRINT_ERR (VMBUS ,"buffer too small - got %d needs %d" , +pr_err ("Buffer too small - got %d needs %d\n" , bufferlen, userlen);return -1 ; }
@@ -950,8 +952,9 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,if (packetlen > bufferlen) {spin_unlock_irqrestore (&channel->inbound_lock, flags); -DPRINT_ERR (VMBUS ,"buffer too small - needed %d bytes but " -"got space for only %d bytes" , packetlen, bufferlen); +pr_err ("Buffer too small - needed %d bytes but " +"got space for only %d bytes\n" , + packetlen, bufferlen);return -2 ; }
drivers/staging/hv/channel_mgmt.c +12 -13
@@ -18,6 +18,8 @@* Haiyang Zhang <[email protected]> * Hank Janssen <[email protected]> */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/sched.h> #include <linux/wait.h>
@@ -403,8 +405,7 @@ static void vmbus_process_offer(struct work_struct *work)*/ ret =vmbus_child_device_register (newchannel->device_obj);if (ret !=0 ) { -DPRINT_ERR (VMBUS , -"unable to add child device object (relid %d)" , +pr_err ("unable to add child device object (relid %d)\n" , newchannel->offermsg.child_relid);spin_lock_irqsave (&vmbus_connection.channel_lock, flags);
@@ -430,8 +431,9 @@ static void vmbus_process_offer(struct work_struct *work) hv_cb_utils[cnt].callback, newchannel) == 0) { hv_cb_utils[cnt].channel = newchannel; -DPRINT_INFO (VMBUS ,"%s" , - hv_cb_utils[cnt].log_msg); + +pr_info ("%s\n" , hv_cb_utils[cnt].log_msg); +count_hv_channel (); } }
@@ -472,7 +474,7 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)/* Allocate the channel object and save this offer. */ newchannel =alloc_channel ();if (!newchannel) { -DPRINT_ERR (VMBUS ,"unable to allocate channel object" ); +pr_err ("Unable to allocate channel object\n" );return ; }
@@ -730,8 +732,7 @@ void vmbus_onmessage(void *context) size = msg->header.payload_size;if (hdr->msgtype >=CHANNELMSG_COUNT ) { -DPRINT_ERR (VMBUS , -"Received invalid channel message type %d size %d" , +pr_err ("Received invalid channel message type %d size %d\n" , hdr->msgtype, size);print_hex_dump_bytes ("" ,DUMP_PREFIX_NONE , (unsigned char *)msg->u.payload, size);
@@ -741,8 +742,7 @@ void vmbus_onmessage(void *context)if (gChannelMessageTable[hdr->msgtype].messageHandler) gChannelMessageTable[hdr->msgtype].messageHandler (hdr);else -DPRINT_ERR (VMBUS ,"Unhandled channel message type %d" , - hdr->msgtype); +pr_err ("Unhandled channel message type %d\n" , hdr->msgtype); }/*
@@ -770,7 +770,7 @@ int vmbus_request_offers(void) ret =vmbus_post_msg (msg,sizeof (struct vmbus_channel_message_header ));if (ret !=0 ) { -DPRINT_ERR (VMBUS ,"Unable to request offers - %d" , ret); +pr_err ("Unable to request offers - %d\n" , ret); goto cleanup; }
@@ -810,9 +810,8 @@ void vmbus_release_unattached_channels(void)if (!channel->device_obj->drv) {list_del (&channel->listentry); -DPRINT_INFO (VMBUS , -"Releasing unattached device object %p" , - channel->device_obj); + +pr_err ("Releasing unattached device object\n" );vmbus_child_device_unregister (channel->device_obj);free_channel (channel);
drivers/staging/hv/connection.c +7 -5
@@ -20,6 +20,8 @@* Hank Janssen <[email protected]> * */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/sched.h> #include <linux/wait.h>
@@ -153,9 +155,9 @@ int vmbus_connect(void)if (msginfo->response.version_response.version_supported) { vmbus_connection.conn_state =CONNECTED ; }else { -DPRINT_ERR (VMBUS ,"Vmbus connection failed!!..." -"current version (%d) not supported" , -VMBUS_REVISION_NUMBER ); +pr_err ("Unable to connect, " +"Version %d not supported by Hyper-V\n" , +VMBUS_REVISION_NUMBER ); ret =-1 ; goto Cleanup; }
@@ -216,7 +218,7 @@ int vmbus_disconnect(void) vmbus_connection.conn_state =DISCONNECTED ; -DPRINT_INFO (VMBUS ,"Vmbus disconnected!!" ); +pr_info ("hv_vmbus disconnected\n" ); Cleanup:kfree (msg);
@@ -269,7 +271,7 @@ static void process_chn_event(void *context)* (void*)channel); */ }else { -DPRINT_ERR (VMBUS ,"channel not found for relid - %d." , relid); +pr_err ("channel not found for relid - %d\n" , relid); } }
drivers/staging/hv/hv.c +5 -5
@@ -19,6 +19,8 @@* Hank Janssen <[email protected]> * */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/mm.h> #include <linux/slab.h>
@@ -116,7 +118,7 @@ static int query_hypervisor_info(void) edx =0 ; op =HVCPUID_VERSION ;cpuid (op, &eax, &ebx, &ecx, &edx); - DPRINT_INFO(VMBUS, "OS Build:%d-%d.%d-%d-%d.%d",\ + pr_info("Hyper-V Host OS Build:%d-%d.%d-%d-%d.%d\n", eax, ebx >> 16, ebx & 0xFFFF,
@@ -369,8 +371,7 @@ void hv_synic_init(void *irqarg) (void *)get_zeroed_page (GFP_ATOMIC );if (hv_context.synic_message_page[cpu] ==NULL ) { -DPRINT_ERR (VMBUS , -"unable to allocate SYNIC message page!!" ); +pr_err ("Unable to allocate SYNIC message page\n" ); goto Cleanup; }
@@ -378,8 +379,7 @@ void hv_synic_init(void *irqarg) (void *)get_zeroed_page (GFP_ATOMIC );if (hv_context.synic_event_page[cpu] ==NULL ) { -DPRINT_ERR (VMBUS , -"unable to allocate SYNIC event page!!" ); +pr_err ("Unable to allocate SYNIC event page\n" ); goto Cleanup; }
drivers/staging/hv/ring_buffer.c +1 -0
@@ -20,6 +20,7 @@* Hank Janssen <[email protected]> * */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/kernel.h> #include <linux/mm.h>
drivers/staging/hv/vmbus_drv.c +18 -25
113 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 2/7 Remove all unneeded DPRINT from hv_netvsc
In reply to Hank JanssenRemove all un-needed DPRINT calls from hv_netvsc.
This patch deals with hv_netvsc only.
--- drivers/staging/hv/netvsc.c | 102 ++----------------------------------- drivers/staging/hv/netvsc_drv.c | 10 ---- drivers/staging/hv/rndis_filter.c | 13 ----- 3 files changed, 4 insertions(+), 121 deletions(-)
drivers/staging/hv/netvsc.c +4 -98
@@ -178,13 +178,6 @@ int netvsc_initialize(struct hv_driver *drv) {struct netvsc_driver *driver = (struct netvsc_driver *)drv; -DPRINT_DBG (NETVSC ,"sizeof(struct hv_netvsc_packet)=%zd, " -"sizeof(struct nvsp_message)=%zd, " -"sizeof(struct vmtransfer_page_packet_header)=%zd" , -sizeof (struct hv_netvsc_packet ), -sizeof (struct nvsp_message ), -sizeof (struct vmtransfer_page_packet_header )); - drv->name = driver_name;memcpy (&drv->dev_type, &netvsc_device_type,sizeof (struct hv_guid ));
@@ -223,8 +216,6 @@ static int netvsc_init_recv_buf(struct hv_device *device) goto cleanup; } -DPRINT_INFO (NETVSC ,"Establishing receive buffer's GPADL..." ); -/* * Establish the gpadl handle for this buffer on this * channel. Note: This call uses the vmbus connection rather
@@ -241,8 +232,6 @@ static int netvsc_init_recv_buf(struct hv_device *device)/* Notify the NetVsp of the gpadl handle */ -DPRINT_INFO (NETVSC ,"Sending NvspMessage1TypeSendReceiveBuffer..." ); - init_packet = &net_device->channel_init_pkt;memset (init_packet,0 ,sizeof (struct nvsp_message ));
@@ -301,14 +290,6 @@ static int netvsc_init_recv_buf(struct hv_device *device) net_device->recv_section_cnt * sizeof(struct nvsp_1_receive_buffer_section)); -DPRINT_INFO (NETVSC ,"Receive sections info (count %d, offset %d, " -"endoffset %d, suballoc size %d, num suballocs %d)" , - net_device->recv_section_cnt, - net_device->recv_section[0 ].offset, - net_device->recv_section[0 ].end_offset, - net_device->recv_section[0 ].sub_alloc_size, - net_device->recv_section[0 ].num_sub_allocs); -/* * For 1st release, there should only be 1 section that represents the * entire receive buffer
@@ -356,8 +337,6 @@ static int netvsc_init_send_buf(struct hv_device *device) goto cleanup; } -DPRINT_INFO (NETVSC ,"Establishing send buffer's GPADL..." ); -/* * Establish the gpadl handle for this buffer on this * channel. Note: This call uses the vmbus connection rather
@@ -372,8 +351,6 @@ static int netvsc_init_send_buf(struct hv_device *device) }/* Notify the NetVsp of the gpadl handle */ -DPRINT_INFO (NETVSC ,"Sending NvspMessage1TypeSendSendBuffer..." ); - init_packet = &net_device->channel_init_pkt;memset (init_packet,0 ,sizeof (struct nvsp_message ));
@@ -438,9 +415,6 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)* to send a revoke msg here */ if (net_device->recv_section_cnt) { -DPRINT_INFO (NETVSC , -"Sending NvspMessage1TypeRevokeReceiveBuffer..." ); -/* Send the revoke receive buffer */ revoke_packet = &net_device->revoke_packet;memset (revoke_packet,0 ,sizeof (struct nvsp_message ));
@@ -468,8 +442,6 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)/* Teardown the gpadl on the vsp end */ if (net_device->recv_buf_gpadl_handle) { -DPRINT_INFO (NETVSC ,"Tearing down receive buffer's GPADL..." ); - ret =vmbus_teardown_gpadl (net_device->dev->channel, net_device->recv_buf_gpadl_handle);
@@ -483,8 +455,6 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device) }if (net_device->recv_buf) { -DPRINT_INFO (NETVSC ,"Freeing up receive buffer..." ); -/* Free up the receive buffer */ free_pages ((unsigned long )net_device->recv_buf,get_order (net_device->recv_buf_size));
@@ -512,9 +482,6 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)* to send a revoke msg here */ if (net_device->send_section_size) { -DPRINT_INFO (NETVSC , -"Sending NvspMessage1TypeRevokeSendBuffer..." ); -/* Send the revoke send buffer */ revoke_packet = &net_device->revoke_packet;memset (revoke_packet,0 ,sizeof (struct nvsp_message ));
@@ -542,7 +509,6 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)/* Teardown the gpadl on the vsp end */ if (net_device->send_buf_gpadl_handle) { -DPRINT_INFO (NETVSC ,"Tearing down send buffer's GPADL..." ); ret =vmbus_teardown_gpadl (net_device->dev->channel, net_device->send_buf_gpadl_handle);
@@ -559,8 +525,6 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device) }if (net_device->send_buf) { -DPRINT_INFO (NETVSC ,"Freeing up send buffer..." ); -/* Free up the receive buffer */ free_pages ((unsigned long )net_device->send_buf,get_order (net_device->send_buf_size));
@@ -594,8 +558,6 @@ static int netvsc_connect_vsp(struct hv_device *device) init_packet->msg.init_msg.init.max_protocol_ver =NVSP_MAX_PROTOCOL_VERSION ; -DPRINT_INFO (NETVSC ,"Sending NvspMessageTypeInit..." ); -/* Send the init request */ net_device->wait_condition =0 ; ret = vmbus_sendpacket(device->channel, init_packet,
@@ -604,10 +566,8 @@ static int netvsc_connect_vsp(struct hv_device *device)VM_PKT_DATA_INBAND , VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); -if (ret !=0 ) { -DPRINT_ERR (NETVSC ,"unable to send NvspMessageTypeInit" ); +if (ret !=0 ) goto cleanup; - } wait_event_timeout(net_device->channel_init_wait, net_device->wait_condition,
@@ -617,31 +577,17 @@ static int netvsc_connect_vsp(struct hv_device *device) goto cleanup; } -DPRINT_INFO (NETVSC ,"NvspMessageTypeInit status(%d) max mdl chain (%d)" , - init_packet->msg.init_msg.init_complete.status, - init_packet->msg.init_msg. - init_complete.max_mdl_chain_len); - -if (init_packet->msg.init_msg.init_complete.status != +if (init_packet->msg.init_msg.init_complete.status !=NVSP_STAT_SUCCESS ) { -DPRINT_ERR (NETVSC , -"unable to initialize with netvsp (status 0x%x)" , - init_packet->msg.init_msg.init_complete.status); ret =-1 ; goto cleanup; }if (init_packet->msg.init_msg.init_complete. negotiated_protocol_ver !=NVSP_PROTOCOL_VERSION_1 ) { -DPRINT_ERR (NETVSC ,"unable to initialize with netvsp " -"(version expected 1 got %d)" , - init_packet->msg.init_msg. - init_complete.negotiated_protocol_ver); ret =-1 ; goto cleanup; } -DPRINT_INFO (NETVSC ,"Sending NvspMessage1TypeSendNdisVersion..." ); -/* Send the ndis version */ memset (init_packet,0 ,sizeof (struct nvsp_message ));
@@ -661,8 +607,6 @@ static int netvsc_connect_vsp(struct hv_device *device) (unsigned long )init_packet, VM_PKT_DATA_INBAND, 0);if (ret !=0 ) { -DPRINT_ERR (NETVSC , -"unable to send NvspMessage1TypeSendNdisVersion" ); ret =-1 ; goto cleanup; }
@@ -702,8 +646,6 @@ static int netvsc_device_add(struct hv_device *device, void *additional_info) goto cleanup; } -DPRINT_DBG (NETVSC ,"netvsc channel object allocated - %p" , net_device); -/* Initialize the NetVSC channel extension */ net_device->recv_buf_size =NETVSC_RECEIVE_BUFFER_SIZE ;spin_lock_init (&net_device->recv_pkt_list_lock);
@@ -716,12 +658,9 @@ static int netvsc_device_add(struct hv_device *device, void *additional_info) packet =kzalloc (sizeof (struct hv_netvsc_packet ) + (NETVSC_RECEIVE_SG_COUNT *sizeof (struct hv_page_buffer )),GFP_KERNEL ); -if (!packet) { -DPRINT_DBG (NETVSC ,"unable to allocate netvsc pkts " -"for receive pool (wanted %d got %d)" , -NETVSC_RECEIVE_PACKETLIST_COUNT , i); +if (!packet)break ; - } +list_add_tail (&packet->list_ent, &net_device->recv_pkt_list); }
@@ -749,9 +688,6 @@ static int netvsc_device_add(struct hv_device *device, void *additional_info) goto close; } -DPRINT_INFO (NETVSC ,"*** NetVSC channel handshake result - %d ***" , - ret); -return ret; close:
@@ -785,9 +721,6 @@ static int netvsc_device_remove(struct hv_device *device)struct netvsc_device *net_device;struct hv_netvsc_packet *netvsc_packet, *pos; -DPRINT_INFO (NETVSC ,"Disabling outbound traffic on net device (%p)..." , - device->ext); -/* Stop outbound traffic ie sends and receives completions */ net_device =release_outbound_net_device (device);if (!net_device) {
@@ -802,13 +735,8 @@ static int netvsc_device_remove(struct hv_device *device)udelay (100 ); } -DPRINT_INFO (NETVSC ,"Disconnecting from netvsp..." ); -NetVscDisconnectFromVsp (net_device); -DPRINT_INFO (NETVSC ,"Disabling inbound traffic on net device (%p)..." , - device->ext); -/* Stop inbound traffic ie receives and sends completions */ net_device =release_inbound_net_device (device);
@@ -853,9 +781,6 @@ static void netvsc_send_completion(struct hv_device *device, nvsp_packet = (struct nvsp_message *)((unsigned long )packet + (packet->offset8 <<3 )); -DPRINT_DBG (NETVSC ,"send completion packet - type %d" , - nvsp_packet->hdr.msg_type); - if ((nvsp_packet->hdr.msg_type == NVSP_MSG_TYPE_INIT_COMPLETE) || (nvsp_packet->hdr.msg_type == NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE) ||
@@ -985,9 +910,6 @@ static void netvsc_receive(struct hv_device *device,return ; } -DPRINT_DBG (NETVSC ,"NVSP packet received - type %d" , - nvsp_packet->hdr.msg_type); - vmxferpage_packet = (struct vmtransfer_page_packet_header *)packet;if (vmxferpage_packet->xfer_pageset_id !=NETVSC_RECEIVE_BUFFER_ID ) {
@@ -998,9 +920,6 @@ static void netvsc_receive(struct hv_device *device,return ; } -DPRINT_DBG (NETVSC ,"xfer page - range count %d" , - vmxferpage_packet->range_cnt); -/* * Grab free packets (range count + 1) to represent this xfer * page packet. +1 to represent the xfer page packet itself.
@@ -1117,13 +1036,6 @@ static void netvsc_receive(struct hv_device *device,break ; } } -DPRINT_DBG (NETVSC ,"[%d] - (abs offset %u len %u) => " -"(pfn %llx, offset %u, len %u)" , i, - vmxferpage_packet->ranges[i].byte_offset, - vmxferpage_packet->ranges[i].byte_count, - netvsc_packet->page_buf[0 ].pfn, - netvsc_packet->page_buf[0 ].offset, - netvsc_packet->page_buf[0 ].len);/* Pass it to the upper layer */ ((struct netvsc_driver *)device->drv)->
@@ -1143,9 +1055,6 @@ static void netvsc_send_recv_completion(struct hv_device *device,int retries =0 ;int ret; -DPRINT_DBG (NETVSC ,"Sending receive completion pkt - %llx" , - transaction_id); - recvcompMessage.hdr.msg_type =NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE ;
@@ -1261,9 +1170,6 @@ static void netvsc_channel_cb(void *context) &bytes_recvd, &request_id);if (ret ==0 ) {if (bytes_recvd >0 ) { -DPRINT_DBG (NETVSC ,"receive %d bytes, tid %llx" , - bytes_recvd, request_id); - desc = (struct vmpacket_descriptor *)buffer;switch (desc->type) {case VM_PKT_COMP :
drivers/staging/hv/netvsc_drv.c +0 -10
@@ -136,9 +136,6 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)int ret;unsigned int i, num_pages; -DPRINT_DBG (NETVSC_DRV ,"xmit packet - len %d data_len %d" , - skb->len, skb->data_len); -/* Add 1 for skb->data and additional one for RNDIS */ num_pages =skb_shinfo (skb)->nr_frags +1 +1 ;if (num_pages > net_device_ctx->avail)
@@ -196,10 +193,6 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) net->stats.tx_bytes += skb->len; net->stats.tx_packets++; -DPRINT_DBG (NETVSC_DRV ,"# of xmits %lu total size %lu" , - net->stats.tx_packets, - net->stats.tx_bytes); - net_device_ctx->avail -= num_pages;if (net_device_ctx->avail <PACKET_PAGES_LOWATER )netif_stop_queue (net);
@@ -297,9 +290,6 @@ static int netvsc_recv_callback(struct hv_device *device_obj,*/ netif_rx (skb); -DPRINT_DBG (NETVSC_DRV ,"# of recvs %lu total size %lu" , - net->stats.rx_packets, net->stats.rx_bytes); -return 0 ; }
drivers/staging/hv/rndis_filter.c +0 -13
@@ -283,14 +283,6 @@ static void rndis_filter_receive_response(struct rndis_device *dev,*/ if (request->request_msg.msg.init_req.req_id == resp->msg.init_complete.req_id) { -DPRINT_DBG (NETVSC ,"found rndis request for " -"this response (id 0x%x req type 0x%x res " -"type 0x%x)" , - request->request_msg.msg. - init_req.req_id, - request->request_msg.ndis_msg_type, - resp->ndis_msg_type); - found = true;break ; }
@@ -605,9 +597,6 @@ Exit:int rndis_filter_init (struct netvsc_driver *drv) { -DPRINT_DBG (NETVSC ,"sizeof(struct rndis_filter_packet) == %zd" , -sizeof (struct rndis_filter_packet )); - drv->req_ext_size =sizeof (struct rndis_filter_packet );/* Driver->Context = rndisDriver; */
@@ -765,8 +754,6 @@ static int rndis_filte_device_add(struct hv_device *dev,if (!rndisDevice)return -1 ; -DPRINT_DBG (NETVSC ,"rndis device object allocated - %p" , rndisDevice); -/* * Let the inner driver handle this first to create the netvsc channel * NOTE! Once the channel is created, we may get a receive callback
Signature · 1 line
1.6.0.2
PATCH 6/7 Replaced DPRINT and printk with native functions in hv_utils
In reply to Hank JanssenReplaced all DPRINT and printk calls with pr_ calls
--- drivers/staging/hv/hv_kvp.c | 6 +++--- drivers/staging/hv/hv_util.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-)
drivers/staging/hv/hv_kvp.c +3 -3
@@ -20,7 +20,7 @@* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ - +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/net.h> #include <linux/nls.h>
@@ -114,7 +114,7 @@ kvp_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) message = (struct hv_ku_msg *)msg->data;if (msg->seq ==KVP_REGISTER ) { -printk (KERN_INFO "KVP: user-mode registering done.\n" ); +pr_info ("KVP: user-mode registering done.\n" );kvp_register (); }
@@ -174,7 +174,7 @@ kvp_respond_to_host(char *key, char *value, int error)/* * This is a spurious call! */ -printk (KERN_WARNING "KVP: Transaction not active\n" ); +pr_warn ("KVP: Transaction not active\n" );return ; }/*
drivers/staging/hv/hv_util.c +9 -8
@@ -18,6 +18,8 @@* Haiyang Zhang <[email protected]> * Hank Janssen <[email protected]> */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/init.h> #include <linux/module.h>
@@ -76,15 +78,15 @@ static void shutdown_onchannelcallback(void *context) icmsghdrp->status =HV_S_OK ; execute_shutdown = true; -DPRINT_INFO (VMBUS ,"Shutdown request received -" -" gracefull shutdown initiated" ); +pr_info ("Shutdown request received -" +" gracefull shutdown initiated\n" );break ;default : icmsghdrp->status =HV_E_FAIL ; execute_shutdown = false; -DPRINT_INFO (VMBUS ,"Shutdown request received -" -" Invalid request" ); +pr_info ("Shutdown request received -" +" Invalid request\n" );break ; }; }
@@ -242,7 +244,7 @@ MODULE_DEVICE_TABLE(dmi, hv_utils_dmi_table);static int __init init_hyperv_utils (void ) { -printk (KERN_INFO "Registering HyperV Utility Driver\n" ); +pr_info ("Registering HyperV Utility Driver\n" );if (hv_kvp_init ())return -ENODEV ;
@@ -256,8 +258,7 @@ static int __init init_hyperv_utils(void) hbeat_txf_buf =kmalloc (PAGE_SIZE ,GFP_KERNEL );if (!shut_txf_buf || !time_txf_buf || !hbeat_txf_buf) { -printk (KERN_INFO -"Unable to allocate memory for receive buffer\n" ); +pr_info ("Unable to allocate memory for receive buffer\n" );kfree (shut_txf_buf);kfree (time_txf_buf);kfree (hbeat_txf_buf);
@@ -286,7 +287,7 @@ static int __init init_hyperv_utils(void)static void exit_hyperv_utils (void ) { -printk (KERN_INFO "De-Registered HyperV Utility Driver\n" ); +pr_info ("De-Registered HyperV Utility Driver\n" ); hv_cb_utils[HV_SHUTDOWN_MSG ].channel->onchannel_callback = &chn_cb_negotiate;
Signature · 1 line
1.6.0.2
PATCH 5/7 replace DPRINT with native primitives in hv_netvsc
In reply to Hank JanssenReplace 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.
--- drivers/staging/hv/netvsc.c | 115 +++++++++++++++++++------------------ drivers/staging/hv/netvsc_drv.c | 36 ++++++------ drivers/staging/hv/rndis_filter.c | 51 +++++++++-------- 3 files changed, 103 insertions(+), 99 deletions(-)
drivers/staging/hv/netvsc.c +59 -56
@@ -18,6 +18,8 @@* Haiyang Zhang <[email protected]> * Hank Janssen <[email protected]> */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/sched.h> #include <linux/wait.h>
@@ -200,7 +202,7 @@ static int netvsc_init_recv_buf(struct hv_device *device) net_device =get_outbound_net_device (device);if (!net_device) { -DPRINT_ERR (NETVSC ,"unable to get net device..." +dev_err (&device->device,"unable to get net device..." "device being destroyed?" );return -1 ; }
@@ -209,9 +211,8 @@ static int netvsc_init_recv_buf(struct hv_device *device) (void *)__get_free_pages (GFP_KERNEL |__GFP_ZERO,get_order (net_device->recv_buf_size));if (!net_device->recv_buf) { -DPRINT_ERR (NETVSC , -"unable to allocate receive buffer of size %d" , - net_device->recv_buf_size); +dev_err (&device->device,"unable to allocate receive " +"buffer of size %d" , net_device->recv_buf_size); ret =-1 ; goto cleanup; }
@@ -225,8 +226,8 @@ static int netvsc_init_recv_buf(struct hv_device *device) net_device->recv_buf_size, &net_device->recv_buf_gpadl_handle);if (ret !=0 ) { -DPRINT_ERR (NETVSC , -"unable to establish receive buffer's gpadl" ); +dev_err (&device->device, +"unable to establish receive buffer's gpadl" ); goto cleanup; }
@@ -250,8 +251,8 @@ static int netvsc_init_recv_buf(struct hv_device *device)VM_PKT_DATA_INBAND , VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);if (ret !=0 ) { -DPRINT_ERR (NETVSC , -"unable to send receive buffer's gpadl to netvsp" ); +dev_err (&device->device, +"unable to send receive buffer's gpadl to netvsp" ); goto cleanup; }
@@ -264,7 +265,7 @@ static int netvsc_init_recv_buf(struct hv_device *device)/* Check the response */ if (init_packet->msg.v1_msg. send_recv_buf_complete.status !=NVSP_STAT_SUCCESS ) { -DPRINT_ERR (NETVSC ,"Unable to complete receive buffer " +dev_err (&device->device,"Unable to complete receive buffer " "initialzation with NetVsp - status %d" , init_packet->msg.v1_msg. send_recv_buf_complete.status);
@@ -318,7 +319,7 @@ static int netvsc_init_send_buf(struct hv_device *device) net_device =get_outbound_net_device (device);if (!net_device) { -DPRINT_ERR (NETVSC ,"unable to get net device..." +dev_err (&device->device,"unable to get net device..." "device being destroyed?" );return -1 ; }
@@ -331,8 +332,8 @@ static int netvsc_init_send_buf(struct hv_device *device) (void *)__get_free_pages (GFP_KERNEL |__GFP_ZERO,get_order (net_device->send_buf_size));if (!net_device->send_buf) { -DPRINT_ERR (NETVSC ,"unable to allocate send buffer of size %d" , - net_device->send_buf_size); +dev_err (&device->device,"unable to allocate send " +"buffer of size %d" , net_device->send_buf_size); ret =-1 ; goto cleanup; }
@@ -346,7 +347,7 @@ static int netvsc_init_send_buf(struct hv_device *device) net_device->send_buf_size, &net_device->send_buf_gpadl_handle);if (ret !=0 ) { -DPRINT_ERR (NETVSC ,"unable to establish send buffer's gpadl" ); +dev_err (&device->device,"unable to establish send buffer's gpadl" ); goto cleanup; }
@@ -369,7 +370,7 @@ static int netvsc_init_send_buf(struct hv_device *device)VM_PKT_DATA_INBAND , VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);if (ret !=0 ) { -DPRINT_ERR (NETVSC , +dev_err (&device->device,"unable to send receive buffer's gpadl to netvsp" ); goto cleanup; }
@@ -382,7 +383,7 @@ static int netvsc_init_send_buf(struct hv_device *device)/* Check the response */ if (init_packet->msg.v1_msg. send_send_buf_complete.status !=NVSP_STAT_SUCCESS ) { -DPRINT_ERR (NETVSC ,"Unable to complete send buffer " +dev_err (&device->device,"Unable to complete send buffer " "initialzation with NetVsp - status %d" , init_packet->msg.v1_msg. send_send_buf_complete.status);
@@ -434,8 +435,8 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)* have a leak rather than continue and a bugchk */ if (ret !=0 ) { -DPRINT_ERR (NETVSC ,"unable to send revoke receive " -"buffer to netvsp" ); +dev_err (&net_device->dev->device,"unable to send " +"revoke receive buffer to netvsp" );return -1 ; } }
@@ -447,7 +448,7 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)/* If we failed here, we might as well return and have a leak rather than continue and a bugchk */ if (ret !=0 ) { -DPRINT_ERR (NETVSC , +dev_err (&net_device->dev->device,"unable to teardown receive buffer's gpadl" );return -1 ; }
@@ -501,8 +502,8 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)* rather than continue and a bugchk */ if (ret !=0 ) { -DPRINT_ERR (NETVSC ,"unable to send revoke send buffer " -"to netvsp" ); +dev_err (&net_device->dev->device,"unable to send " +"revoke send buffer to netvsp" );return -1 ; } }
@@ -517,8 +518,8 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)* rather than continue and a bugchk */ if (ret !=0 ) { -DPRINT_ERR (NETVSC ,"unable to teardown send buffer's " -"gpadl" ); +dev_err (&net_device->dev->device, +"unable to teardown send buffer's gpadl" );return -1 ; } net_device->send_buf_gpadl_handle =0 ;
@@ -544,7 +545,7 @@ static int netvsc_connect_vsp(struct hv_device *device) net_device =get_outbound_net_device (device);if (!net_device) { -DPRINT_ERR (NETVSC ,"unable to get net device..." +dev_err (&device->device,"unable to get net device..." "device being destroyed?" );return -1 ; }
@@ -672,18 +673,19 @@ static int netvsc_device_add(struct hv_device *device, void *additional_info) netvsc_channel_cb, device);if (ret !=0 ) { -DPRINT_ERR (NETVSC ,"unable to open channel: %d" , ret); +dev_err (&device->device,"unable to open channel: %d" , ret); ret =-1 ; goto cleanup; }/* Channel is opened */ -DPRINT_INFO (NETVSC ,"*** NetVSC channel opened successfully! ***" ); +pr_info ("hv_netvsc channel opened successfully" );/* Connect with the NetVsp */ ret =netvsc_connect_vsp (device);if (ret !=0 ) { -DPRINT_ERR (NETVSC ,"unable to connect to NetVSP - %d" , ret); +dev_err (&device->device, +"unable to connect to NetVSP - %d" , ret); ret =-1 ; goto close; }
@@ -724,14 +726,15 @@ static int netvsc_device_remove(struct hv_device *device)/* Stop outbound traffic ie sends and receives completions */ net_device =release_outbound_net_device (device);if (!net_device) { -DPRINT_ERR (NETVSC ,"No net device present!!" ); +dev_err (&device->device,"No net device present!!" );return -1 ; }/* Wait for all send completions */ while (atomic_read (&net_device->num_outstanding_sends)) { -DPRINT_INFO (NETVSC ,"waiting for %d requests to complete..." , -atomic_read (&net_device->num_outstanding_sends)); +dev_err (&device->device, +"waiting for %d requests to complete..." , +atomic_read (&net_device->num_outstanding_sends));udelay (100 ); }
@@ -741,7 +744,7 @@ static int netvsc_device_remove(struct hv_device *device) net_device =release_inbound_net_device (device);/* At this point, no one should be accessing netDevice except in here */ -DPRINT_INFO (NETVSC ,"net device (%p) safe to remove" , net_device); +dev_notice (&device->device,"net device safe to remove" );/* Now, we can close the channel safely */ vmbus_close (device->channel);
@@ -773,7 +776,7 @@ static void netvsc_send_completion(struct hv_device *device, net_device =get_inbound_net_device (device);if (!net_device) { -DPRINT_ERR (NETVSC ,"unable to get net device..." +dev_err (&device->device,"unable to get net device..." "device being destroyed?" );return ; }
@@ -803,7 +806,7 @@ static void netvsc_send_completion(struct hv_device *device,atomic_dec (&net_device->num_outstanding_sends); }else { -DPRINT_ERR (NETVSC ,"Unknown send completion packet type - " +dev_err (&device->device,"Unknown send completion packet type- " "%d received!!" , nvsp_packet->hdr.msg_type); }
@@ -820,7 +823,7 @@ static int netvsc_send(struct hv_device *device, net_device =get_outbound_net_device (device);if (!net_device) { -DPRINT_ERR (NETVSC ,"net device (%p) shutting down..." +dev_err (&device->device,"net device (%p) shutting down..." "ignoring outbound packets" , net_device);return -2 ; }
@@ -856,7 +859,7 @@ static int netvsc_send(struct hv_device *device, }if (ret !=0 ) -DPRINT_ERR (NETVSC ,"Unable to send packet %p ret %d" , +dev_err (&device->device,"Unable to send packet %p ret %d" , packet, ret);atomic_inc (&net_device->num_outstanding_sends);
@@ -882,7 +885,7 @@ static void netvsc_receive(struct hv_device *device, net_device =get_inbound_net_device (device);if (!net_device) { -DPRINT_ERR (NETVSC ,"unable to get net device..." +dev_err (&device->device,"unable to get net device..." "device being destroyed?" );return ; }
@@ -892,7 +895,7 @@ static void netvsc_receive(struct hv_device *device,* packet */ if (packet->type !=VM_PKT_DATA_USING_XFER_PAGES ) { -DPRINT_ERR (NETVSC ,"Unknown packet type received - %d" , +dev_err (&device->device,"Unknown packet type received - %d" , packet->type);put_net_device (device);return ;
@@ -904,8 +907,8 @@ static void netvsc_receive(struct hv_device *device,/* Make sure this is a valid nvsp packet */ if (nvsp_packet->hdr.msg_type !=NVSP_MSG1_TYPE_SEND_RNDIS_PKT ) { -DPRINT_ERR (NETVSC ,"Unknown nvsp packet type received - %d" , - nvsp_packet->hdr.msg_type); +dev_err (&device->device,"Unknown nvsp packet type received-" +" %d" , nvsp_packet->hdr.msg_type);put_net_device (device);return ; }
@@ -913,7 +916,7 @@ static void netvsc_receive(struct hv_device *device, vmxferpage_packet = (struct vmtransfer_page_packet_header *)packet;if (vmxferpage_packet->xfer_pageset_id !=NETVSC_RECEIVE_BUFFER_ID ) { -DPRINT_ERR (NETVSC ,"Invalid xfer page set id - " +dev_err (&device->device,"Invalid xfer page set id - " "expecting %x got %x" ,NETVSC_RECEIVE_BUFFER_ID , vmxferpage_packet->xfer_pageset_id);put_net_device (device);
@@ -940,9 +943,9 @@ static void netvsc_receive(struct hv_device *device,* some of the xfer page packet ranges... */ if (count <2 ) { -DPRINT_ERR (NETVSC ,"Got only %d netvsc pkt...needed %d pkts. " -"Dropping this xfer page packet completely!" , - count, vmxferpage_packet->range_cnt +1 ); +dev_err (&device->device,"Got only %d netvsc pkt...needed " +"%d pkts. Dropping this xfer page packet completely!" , + count, vmxferpage_packet->range_cnt +1 );/* Return it to the freelist */ spin_lock_irqsave (&net_device->recv_pkt_list_lock, flags);
@@ -968,9 +971,9 @@ static void netvsc_receive(struct hv_device *device, xferpage_packet->count = count -1 ;if (xferpage_packet->count != vmxferpage_packet->range_cnt) { -DPRINT_INFO (NETVSC ,"Needed %d netvsc pkts to satisy this xfer " -"page...got %d" , vmxferpage_packet->range_cnt, - xferpage_packet->count); +dev_err (&device->device,"Needed %d netvsc pkts to satisy " +"this xfer page...got %d" , + vmxferpage_packet->range_cnt, xferpage_packet->count); }/* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */
@@ -1073,20 +1076,20 @@ retry_send_cmplt: }else if (ret ==-1 ) {/* no more room...wait a bit and attempt to retry 3 times */ retries++; -DPRINT_ERR (NETVSC ,"unable to send receive completion pkt " -"(tid %llx)...retrying %d" , transaction_id, retries); +dev_err (&device->device,"unable to send receive completion pkt" +" (tid %llx)...retrying %d" , transaction_id, retries);if (retries <4 ) {udelay (100 ); goto retry_send_cmplt; }else { -DPRINT_ERR (NETVSC ,"unable to send receive completion " -"pkt (tid %llx)...give up retrying" , - transaction_id); +dev_err (&device->device,"unable to send receive " +"completion pkt (tid %llx)...give up retrying" , + transaction_id); } }else { -DPRINT_ERR (NETVSC ,"unable to send receive completion pkt - " -"%llx" , transaction_id); +dev_err (&device->device,"unable to send receive " +"completion pkt - %llx" , transaction_id); } }
@@ -1107,7 +1110,7 @@ static void netvsc_receive_completion(void *context)*/ net_device =get_inbound_net_device (device);if (!net_device) { -DPRINT_ERR (NETVSC ,"unable to get net device..." +dev_err (&device->device,"unable to get net device..." "device being destroyed?" );return ; }
@@ -1160,7 +1163,7 @@ static void netvsc_channel_cb(void *context) net_device =get_inbound_net_device (device);if (!net_device) { -DPRINT_ERR (NETVSC ,"net device (%p) shutting down..." +dev_err (&device->device,"net device (%p) shutting down..." "ignoring inbound packets" , net_device); goto out; }
@@ -1181,7 +1184,7 @@ static void netvsc_channel_cb(void *context)break ;default : - DPRINT_ERR(NETVSC, + dev_err(&device->device, "unhandled packet type %d, " "tid %llx len %d\n", desc->type, request_id,
@@ -1210,7 +1213,7 @@ static void netvsc_channel_cb(void *context) buffer =kmalloc (bytes_recvd,GFP_ATOMIC );if (buffer ==NULL ) {/* Try again next time around */ -DPRINT_ERR (NETVSC , +dev_err (&device->device,"unable to allocate buffer of size " "(%d)!!" , bytes_recvd);break ;
drivers/staging/hv/netvsc_drv.c +17 -19
@@ -18,6 +18,8 @@* Haiyang Zhang <[email protected]> * Hank Janssen <[email protected]> */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/init.h> #include <linux/module.h> #include <linux/highmem.h>
@@ -77,14 +79,14 @@ static int netvsc_open(struct net_device *net)/* Open up the device */ ret =rndis_filter_open (device_obj);if (ret !=0 ) { -DPRINT_ERR (NETVSC_DRV , -"unable to open device (ret %d)." , ret); +netdev_err (net,"unable to open device (ret %d).\n" , + ret);return ret; }netif_start_queue (net); }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;
@@ -100,7 +102,7 @@ static int netvsc_close(struct net_device *net) ret =rndis_filter_close (device_obj);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; }
@@ -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);if (!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); net->stats.tx_dropped++;
@@ -214,8 +216,8 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj,struct net_device *net =dev_get_drvdata (&device_obj->device);if (!net) { -DPRINT_ERR (NETVSC_DRV ,"got link status but net device " -"not initialized yet" ); +netdev_err (net,"got link status but net device " +"not initialized yet\n" );return ; }
@@ -243,8 +245,8 @@ static int netvsc_recv_callback(struct hv_device *device_obj,unsigned long flags;if (!net) { -DPRINT_ERR (NETVSC_DRV ,"got receive callback but net device " -"not initialized yet" ); +netdev_err (net,"got receive callback but net device" +" not initialized yet\n" );return 0 ; }
@@ -350,8 +352,7 @@ static int netvsc_probe(struct device *device)free_netdev (net);dev_set_drvdata (device,NULL ); -DPRINT_ERR (NETVSC_DRV ,"unable to add netvsc device (ret %d)" , - ret); +netdev_err (net,"unable to add netvsc device (ret %d)\n" , ret);return ret; }
@@ -397,7 +398,7 @@ static int netvsc_remove(struct device *device)int ret;if (net ==NULL ) { -DPRINT_INFO (NETVSC ,"no net device to remove" ); +dev_err (device,"No net device to remove\n" );return 0 ; }
@@ -417,7 +418,7 @@ static int netvsc_remove(struct device *device) ret = net_drv_obj->base.dev_rm (device_obj);if (ret !=0 ) {/* 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);
@@ -446,16 +447,13 @@ static void netvsc_drv_exit(void)/* Get the device */ ret =driver_for_each_device (&drv->driver,NULL , ¤t_dev, netvsc_drv_exit_cb); -if (ret) -DPRINT_WARN (NETVSC_DRV , -"driver_for_each_device returned %d" , ret);if (current_dev ==NULL )break ;/* Initiate removal from the top-down */ -DPRINT_INFO (NETVSC_DRV ,"unregistering device (%p)..." , - current_dev); +dev_err (current_dev,"unregistering device (%s)...\n" , +dev_name (current_dev));device_unregister (current_dev); }
@@ -509,7 +507,7 @@ MODULE_DEVICE_TABLE(dmi, hv_netvsc_dmi_table);static int __init netvsc_init (void ) { -DPRINT_INFO (NETVSC_DRV ,"Netvsc initializing...." ); +pr_info ("initializing...." );if (!dmi_check_system (hv_netvsc_dmi_table))return -ENODEV ;
drivers/staging/hv/rndis_filter.c +27 -24
115 lines not on this page · raw message
Signature · 1 line
1.6.0.2
cover Remove and replace all un-needed DPRINT and printk
This patch set removes all un-needed DPRINT and printk calls and replaces the remaining ones with the correct pr_, dev_ and netdev_ calls from hv_vmbus, hv_netvsc, hv_timesource and hv_utils.
Several DPRINTS are remaining that will be cleaned up in my next set of patches. They deal with printing out certain debugging that will be implemented slightly differently.
The remaining hv_storvsc and hv_blkvsc will get the same treatment in a different set of patches.
Regards,
Hank Janssen <[email protected]>
PATCH 7/7 Replaced printk with pr_info in hv_timesource
Replaced printk in hv_timesource with pr_ calls
--- drivers/staging/hv/hv_timesource.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/hv/hv_timesource.c +2 -1
@@ -20,6 +20,7 @@* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/version.h> #include <linux/clocksource.h>
@@ -91,7 +92,7 @@ static int __init init_hv_clocksource(void)if (!dmi_check_system (hv_timesource_dmi_table))return -ENODEV ; -printk (KERN_INFO "Registering HyperV clock source\n" ); +pr_info ("Registering HyperV clock source\n" );return clocksource_register (&hyperv_cs); }
Signature · 1 line
1.6.0.2
Re: [PATCH 07/07] Replaced printk with pr_info in hv_timesource
Quoted 23 lines · Hank Janssen
Replaced printk in
hv_timesourcewithpr_callsSigned-off-by Hank Janssen <[email protected]>Signed-off-by Haiyang Zhang <[email protected]>Signed-off-by K. Y. Srinivasan <[email protected]>--- drivers/staging/hv/hv_timesource.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/staging/hv/hv_timesource.c +1
-0@@ -20,6 +20,7 @@* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/version.h> #include <linux/clocksource.h>
drivers/staging/hv/hv_timesource.c static int __init init_hv_clocksource(void) · line 95
Quoted 5 lines
drivers/staging/hv/hv_timesource.c +1
-1@@ -91,7 +92,7 @@ static int __init init_hv_clocksource(void)if (!dmi_check_system (hv_timesource_dmi_table))return -ENODEV ; -printk (KERN_INFO "Registering HyperV clock source\n" ); +pr_info ("Registering HyperV clock source\n" );
Why is this line even needed at all? Please remove it in future patches.
thanks,
greg k-h
RE: [PATCH 07/07] Replaced printk with pr_info in hv_timesource
Quoted 16 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, April 04, 2011 10:01 PM
To: Hank Janssen
Cc: Haiyang Zhang; [email protected]; [email protected]; [email protected]; [email protected]; KY Srinivasan
Subject: Re: [PATCH 07/07] Replaced printk withpr_infoinhv_timesourceQuoted 6 lines
#include <
linux/version.h>
#include <linux/clocksource.h>drivers/staging/hv/hv_timesource.c +0
-0@@ -91,7 +92,7 @@ static int __init init_hv_clocksource(void)if (!dmi_check_system (hv_timesource_dmi_table))return -ENODEV ;
Quoted 5 lines
drivers/staging/hv/hv_timesource.c static int __init init_hv_clocksource(void) · line 95
Quoted 2 lines
drivers/staging/hv/hv_timesource.c +1
-1-printk (KERN_INFO "Registering HyperV clock source\n" ); +pr_info ("Registering HyperV clock source\n" );Why is this line even needed at all? Please remove it in future patches.
Of course, since there have been so many changes I will wait a day or two To get stuff settled in staging and I will send the patch to remove it.
Hank.