Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 248951
b: refs/heads/master
c: 98e0870
h: refs/heads/master
i:
  248949: 846076f
  248947: 96fa2c1
  248943: dfbea1f
v: v3
  • Loading branch information
Hank Janssen authored and Greg Kroah-Hartman committed Apr 5, 2011
1 parent 9ef3ff9 commit 67c121f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 253 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f3365453a3c4a1e8ca28c0dedabf371385456d1f
refs/heads/master: 98e087022b611c6f748c74d952193ccf69280f52
70 changes: 7 additions & 63 deletions trunk/drivers/staging/hv/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
Expand Down Expand Up @@ -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,
Expand All @@ -291,19 +275,16 @@ 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);
list_del(&openInfo->msglistentry);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);

kfree(openInfo);
return 0;
return err;

errorout:
ringbuffer_cleanup(&newchannel->outbound);
Expand All @@ -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++)
Expand Down Expand Up @@ -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) {
Expand All @@ -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,
Expand All @@ -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:
Expand Down Expand Up @@ -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)); */
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand All @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand All @@ -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) {
Expand Down
51 changes: 4 additions & 47 deletions trunk/drivers/staging/hv/channel_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,7 @@ static void release_channel(struct work_struct *work)
struct vmbus_channel,
work);

DPRINT_DBG(VMBUS, "releasing channel (%p)", channel);
destroy_workqueue(channel->controlwq);
DPRINT_DBG(VMBUS, "channel released (%p)", channel);

kfree(channel);
}
Expand Down Expand Up @@ -384,8 +382,6 @@ static void vmbus_process_offer(struct work_struct *work)
spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);

if (!fnew) {
DPRINT_DBG(VMBUS, "Ignoring duplicate offer for relid (%d)",
newchannel->offermsg.child_relid);
free_channel(newchannel);
return;
}
Expand All @@ -400,9 +396,6 @@ static void vmbus_process_offer(struct work_struct *work)
&newchannel->offermsg.offer.if_instance,
newchannel);

DPRINT_DBG(VMBUS, "child device object allocated - %p",
newchannel->device_obj);

/*
* Add the new device to the bus. This will kick off device-driver
* binding which eventually invokes the device driver's AddDevice()
Expand Down Expand Up @@ -470,49 +463,19 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
}
}

if (!fsupported) {
DPRINT_DBG(VMBUS, "Ignoring channel offer notification for "
"child relid %d", offer->child_relid);
if (!fsupported)
return;
}

guidtype = &offer->offer.if_type;
guidinstance = &offer->offer.if_instance;

DPRINT_INFO(VMBUS, "Channel offer notification - "
"child relid %d monitor id %d allocated %d, "
"type {%02x%02x%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x%02x%02x%02x%02x%02x%02x} "
"instance {%02x%02x%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x%02x%02x%02x%02x%02x%02x}",
offer->child_relid, offer->monitorid,
offer->monitor_allocated,
guidtype->data[3], guidtype->data[2],
guidtype->data[1], guidtype->data[0],
guidtype->data[5], guidtype->data[4],
guidtype->data[7], guidtype->data[6],
guidtype->data[8], guidtype->data[9],
guidtype->data[10], guidtype->data[11],
guidtype->data[12], guidtype->data[13],
guidtype->data[14], guidtype->data[15],
guidinstance->data[3], guidinstance->data[2],
guidinstance->data[1], guidinstance->data[0],
guidinstance->data[5], guidinstance->data[4],
guidinstance->data[7], guidinstance->data[6],
guidinstance->data[8], guidinstance->data[9],
guidinstance->data[10], guidinstance->data[11],
guidinstance->data[12], guidinstance->data[13],
guidinstance->data[14], guidinstance->data[15]);

/* Allocate the channel object and save this offer. */
newchannel = alloc_channel();
if (!newchannel) {
DPRINT_ERR(VMBUS, "unable to allocate channel object");
return;
}

DPRINT_DBG(VMBUS, "channel object allocated - %p", newchannel);

memcpy(&newchannel->offermsg, offer,
sizeof(struct vmbus_channel_offer_channel));
newchannel->monitor_grp = (u8)offer->monitorid / 32;
Expand All @@ -535,11 +498,10 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)

rescind = (struct vmbus_channel_rescind_offer *)hdr;
channel = relid2channel(rescind->child_relid);
if (channel == NULL) {
DPRINT_DBG(VMBUS, "channel not found for relId %d",
rescind->child_relid);

if (channel == NULL)
/* Just return here, no channel found */
return;
}

/* work is initialized for vmbus_process_rescind_offer() from
* vmbus_process_offer() where the channel got created */
Expand Down Expand Up @@ -573,7 +535,6 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr)
unsigned long flags;

result = (struct vmbus_channel_open_result *)hdr;
DPRINT_DBG(VMBUS, "vmbus open result - %d", result->status);

/*
* Find the open msg, copy the result and signal/unblock the wait event
Expand Down Expand Up @@ -618,8 +579,6 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr)
unsigned long flags;

gpadlcreated = (struct vmbus_channel_gpadl_created *)hdr;
DPRINT_DBG(VMBUS, "vmbus gpadl created result - %d",
gpadlcreated->creation_status);

/*
* Find the establish msg, copy the result and signal/unblock the wait
Expand Down Expand Up @@ -770,8 +729,6 @@ void vmbus_onmessage(void *context)
hdr = (struct vmbus_channel_message_header *)msg->u.payload;
size = msg->header.payload_size;

DPRINT_DBG(VMBUS, "message type %d size %d", hdr->msgtype, size);

if (hdr->msgtype >= CHANNELMSG_COUNT) {
DPRINT_ERR(VMBUS,
"Received invalid channel message type %d size %d",
Expand Down
9 changes: 0 additions & 9 deletions trunk/drivers/staging/hv/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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); */
Expand Down
Loading

0 comments on commit 67c121f

Please sign in to comment.