Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249557
b: refs/heads/master
c: 35abb21
h: refs/heads/master
i:
  249555: 9ba44ef
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed May 11, 2011
1 parent 6bb6906 commit 61b3f2c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 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: bc1bf5dd638a563255dac3dd2c552079a29487c2
refs/heads/master: 35abb21ace3413de6ea8d5c7750cedfd46111f0c
32 changes: 13 additions & 19 deletions trunk/drivers/staging/hv/netvsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)
static int netvsc_init_recv_buf(struct hv_device *device)
{
int ret = 0;
int t;
struct netvsc_device *net_device;
struct nvsp_message *init_packet;

Expand Down Expand Up @@ -260,7 +261,6 @@ static int netvsc_init_recv_buf(struct hv_device *device)
send_recv_buf.id = NETVSC_RECEIVE_BUFFER_ID;

/* Send the gpadl notification request */
net_device->wait_condition = 0;
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
Expand All @@ -272,10 +272,8 @@ static int netvsc_init_recv_buf(struct hv_device *device)
goto cleanup;
}

wait_event_timeout(net_device->channel_init_wait,
net_device->wait_condition,
msecs_to_jiffies(1000));
BUG_ON(net_device->wait_condition == 0);
t = wait_for_completion_timeout(&net_device->channel_init_wait, HZ);
BUG_ON(t == 0);


/* Check the response */
Expand Down Expand Up @@ -394,6 +392,7 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)
static int netvsc_init_send_buf(struct hv_device *device)
{
int ret = 0;
int t;
struct netvsc_device *net_device;
struct nvsp_message *init_packet;

Expand Down Expand Up @@ -443,7 +442,6 @@ static int netvsc_init_send_buf(struct hv_device *device)
NETVSC_SEND_BUFFER_ID;

/* Send the gpadl notification request */
net_device->wait_condition = 0;
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
Expand All @@ -455,10 +453,9 @@ static int netvsc_init_send_buf(struct hv_device *device)
goto cleanup;
}

wait_event_timeout(net_device->channel_init_wait,
net_device->wait_condition,
msecs_to_jiffies(1000));
BUG_ON(net_device->wait_condition == 0);
t = wait_for_completion_timeout(&net_device->channel_init_wait, HZ);

BUG_ON(t == 0);

/* Check the response */
if (init_packet->msg.v1_msg.
Expand Down Expand Up @@ -487,7 +484,7 @@ static int netvsc_init_send_buf(struct hv_device *device)

static int netvsc_connect_vsp(struct hv_device *device)
{
int ret;
int ret, t;
struct netvsc_device *net_device;
struct nvsp_message *init_packet;
int ndis_version;
Expand All @@ -509,7 +506,6 @@ static int netvsc_connect_vsp(struct hv_device *device)
NVSP_MAX_PROTOCOL_VERSION;

/* Send the init request */
net_device->wait_condition = 0;
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
Expand All @@ -519,10 +515,9 @@ static int netvsc_connect_vsp(struct hv_device *device)
if (ret != 0)
goto cleanup;

wait_event_timeout(net_device->channel_init_wait,
net_device->wait_condition,
msecs_to_jiffies(1000));
if (net_device->wait_condition == 0) {
t = wait_for_completion_timeout(&net_device->channel_init_wait, HZ);

if (t == 0) {
ret = -ETIMEDOUT;
goto cleanup;
}
Expand Down Expand Up @@ -647,8 +642,7 @@ static void netvsc_send_completion(struct hv_device *device,
/* Copy the response back */
memcpy(&net_device->channel_init_pkt, nvsp_packet,
sizeof(struct nvsp_message));
net_device->wait_condition = 1;
wake_up(&net_device->channel_init_wait);
complete(&net_device->channel_init_wait);
} else if (nvsp_packet->hdr.msg_type ==
NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE) {
/* Get the send context */
Expand Down Expand Up @@ -1123,7 +1117,7 @@ int netvsc_device_add(struct hv_device *device, void *additional_info)
list_add_tail(&packet->list_ent,
&net_device->recv_pkt_list);
}
init_waitqueue_head(&net_device->channel_init_wait);
init_completion(&net_device->channel_init_wait);

/* Open the channel */
ret = vmbus_open(device->channel, net_driver->ring_buf_size,
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/hv/netvsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@ struct netvsc_device {
struct nvsp_1_receive_buffer_section *recv_section;

/* Used for NetVSP initialization protocol */
int wait_condition;
wait_queue_head_t channel_init_wait;
struct completion channel_init_wait;
struct nvsp_message channel_init_pkt;

struct nvsp_message revoke_packet;
Expand Down

0 comments on commit 61b3f2c

Please sign in to comment.