* [PATCH 119/206] Staging: hv: Get rid of some dead code in connection.c
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Get rid some commented code and dated comments.T
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/connection.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index 3632bcc..dd62585 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -263,11 +263,6 @@ static void process_chn_event(u32 relid)
if (channel) {
vmbus_onchannel_event(channel);
- /*
- * WorkQueueQueueWorkItem(channel->dataWorkQueue,
- * vmbus_onchannel_event,
- * (void*)channel);
- */
} else {
pr_err("channel not found for relid - %u\n", relid);
}
@@ -295,7 +290,10 @@ void vmbus_on_event(unsigned long data)
relid = (dword << 5) + bit;
if (relid == 0) {
- /* special case - vmbus channel protocol msg */
+ /*
+ * Special case - vmbus
+ * channel protocol msg
+ */
continue;
}
process_chn_event(relid);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 118/206] Staging: hv: Change Cleanup to cleanup
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/connection.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index 92add38..3632bcc 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -58,7 +58,7 @@ int vmbus_connect(void)
vmbus_connection.work_queue = create_workqueue("hv_vmbus_con");
if (!vmbus_connection.work_queue) {
ret = -1;
- goto Cleanup;
+ goto cleanup;
}
INIT_LIST_HEAD(&vmbus_connection.chn_msg_list);
@@ -75,7 +75,7 @@ int vmbus_connect(void)
(void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, 0);
if (vmbus_connection.int_page == NULL) {
ret = -1;
- goto Cleanup;
+ goto cleanup;
}
vmbus_connection.recv_int_page = vmbus_connection.int_page;
@@ -91,7 +91,7 @@ int vmbus_connect(void)
(void *)__get_free_pages((GFP_KERNEL|__GFP_ZERO), 1);
if (vmbus_connection.monitor_pages == NULL) {
ret = -1;
- goto Cleanup;
+ goto cleanup;
}
msginfo = kzalloc(sizeof(*msginfo) +
@@ -99,7 +99,7 @@ int vmbus_connect(void)
GFP_KERNEL);
if (msginfo == NULL) {
ret = -ENOMEM;
- goto Cleanup;
+ goto cleanup;
}
init_completion(&msginfo->waitevent);
@@ -131,7 +131,7 @@ int vmbus_connect(void)
list_del(&msginfo->msglistentry);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock,
flags);
- goto Cleanup;
+ goto cleanup;
}
/* Wait for the connection response */
@@ -143,7 +143,7 @@ int vmbus_connect(void)
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock,
flags);
ret = -ETIMEDOUT;
- goto Cleanup;
+ goto cleanup;
}
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
@@ -158,13 +158,13 @@ int vmbus_connect(void)
"Version %d not supported by Hyper-V\n",
VMBUS_REVISION_NUMBER);
ret = -1;
- goto Cleanup;
+ goto cleanup;
}
kfree(msginfo);
return 0;
-Cleanup:
+cleanup:
vmbus_connection.conn_state = DISCONNECTED;
if (vmbus_connection.work_queue)
@@ -207,7 +207,7 @@ int vmbus_disconnect(void)
ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_message_header));
if (ret != 0)
- goto Cleanup;
+ goto cleanup;
free_pages((unsigned long)vmbus_connection.int_page, 0);
free_pages((unsigned long)vmbus_connection.monitor_pages, 1);
@@ -219,7 +219,7 @@ int vmbus_disconnect(void)
pr_info("hv_vmbus disconnected\n");
-Cleanup:
+cleanup:
kfree(msg);
return ret;
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 117/206] Staging: hv: Get rid of some dead code in channel.c
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel.c | 71 ------------------------------------------
1 files changed, 0 insertions(+), 71 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 1b50cb7..a2a190e 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -42,37 +42,6 @@ static int create_gpadl_header(
static void dump_vmbus_channel(struct vmbus_channel *channel);
static void vmbus_setevent(struct vmbus_channel *channel);
-
-#if 0
-static void DumpMonitorPage(struct hv_monitor_page *MonitorPage)
-{
- int i = 0;
- int j = 0;
-
- DPRINT_DBG(VMBUS, "monitorPage - %p, trigger state - %d",
- MonitorPage, MonitorPage->trigger_state);
-
- for (i = 0; i < 4; i++)
- DPRINT_DBG(VMBUS, "trigger group (%d) - %llx", i,
- MonitorPage->trigger_group[i].as_uint64);
-
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 32; j++) {
- DPRINT_DBG(VMBUS, "latency (%d)(%d) - %llx", i, j,
- MonitorPage->latency[i][j]);
- }
- }
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 32; j++) {
- DPRINT_DBG(VMBUS, "param-conn id (%d)(%d) - %d", i, j,
- MonitorPage->parameter[i][j].connectionid.asu32);
- DPRINT_DBG(VMBUS, "param-flag (%d)(%d) - %d", i, j,
- MonitorPage->parameter[i][j].flag_number);
- }
- }
-}
-#endif
-
/*
* vmbus_setevent- Trigger an event notification on the specified
* channel.
@@ -99,28 +68,6 @@ static void vmbus_setevent(struct vmbus_channel *channel)
}
}
-#if 0
-static void VmbusChannelClearEvent(struct vmbus_channel *channel)
-{
- struct hv_monitor_page *monitorPage;
-
- if (Channel->offermsg.monitor_allocated) {
- /* Each u32 represents 32 channels */
- sync_clear_bit(Channel->offermsg.child_relid & 31,
- (unsigned long *)vmbus_connection.send_int_page +
- (Channel->offermsg.child_relid >> 5));
-
- monitorPage = (struct hv_monitor_page *)
- vmbus_connection.monitor_pages;
- monitorPage++; /* Get the child to parent monitor page */
-
- sync_clear_bit(Channel->monitor_bit,
- (unsigned long *)&monitorPage->trigger_group
- [Channel->monitor_grp].Pending);
- }
-}
-
-#endif
/*
* vmbus_get_debug_info -Retrieve various channel debug info
*/
@@ -179,10 +126,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
unsigned long flags;
int ret, t, err = 0;
- /* Aligned to page size */
- /* ASSERT(!(SendRingBufferSize & (PAGE_SIZE - 1))); */
- /* ASSERT(!(RecvRingBufferSize & (PAGE_SIZE - 1))); */
-
newchannel->onchannel_callback = onchannelcallback;
newchannel->channel_callback_context = context;
@@ -193,7 +136,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
if (!out)
return -ENOMEM;
- /* ASSERT(((unsigned long)out & (PAGE_SIZE-1)) == 0); */
in = (void *)((unsigned long)out + send_ringbuffer_size);
@@ -361,9 +303,6 @@ static int create_gpadl_header(void *kbuffer, u32 size,
int pfnsum, pfncount, pfnleft, pfncurr, pfnsize;
- /* ASSERT((kbuffer & (PAGE_SIZE-1)) == 0); */
- /* ASSERT((Size & (PAGE_SIZE-1)) == 0); */
-
pagecount = size >> PAGE_SHIFT;
pfn = virt_to_phys(kbuffer) >> PAGE_SHIFT;
@@ -695,8 +634,6 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
dump_vmbus_channel(channel);
- /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
-
/* Setup the descriptor */
desc.type = type; /* VmbusPacketTypeDataInBand; */
desc.flags = flags; /* VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; */
@@ -754,8 +691,6 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
packetlen = descsize + bufferlen;
packetlen_aligned = ALIGN(packetlen, sizeof(u64));
- /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
-
/* Setup the descriptor */
desc.type = VM_PKT_DATA_USING_GPA_DIRECT;
desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
@@ -819,7 +754,6 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
packetlen = descsize + bufferlen;
packetlen_aligned = ALIGN(packetlen, sizeof(u64));
- /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
/* Setup the descriptor */
desc.type = VM_PKT_DATA_USING_GPA_DIRECT;
@@ -885,11 +819,8 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
return 0;
}
- /* VmbusChannelClearEvent(Channel); */
-
packetlen = desc.len8 << 3;
userlen = packetlen - (desc.offset8 << 3);
- /* ASSERT(userLen > 0); */
*buffer_actual_len = userlen;
@@ -938,7 +869,6 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,
return 0;
}
- /* VmbusChannelClearEvent(Channel); */
packetlen = desc.len8 << 3;
userlen = packetlen - (desc.offset8 << 3);
@@ -970,7 +900,6 @@ EXPORT_SYMBOL_GPL(vmbus_recvpacket_raw);
void vmbus_onchannel_event(struct vmbus_channel *channel)
{
dump_vmbus_channel(channel);
- /* ASSERT(Channel->OnChannelCallback); */
channel->onchannel_callback(channel->channel_callback_context);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 116/206] Staging: hv: Use the completion abstraction in struct rndis_request
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Use the completion abstraction in struct rndis_request to synchronize.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/rndis_filter.c | 33 ++++++++++++++-------------------
1 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index ee74cd1..2037836 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -59,8 +59,7 @@ struct rndis_device {
struct rndis_request {
struct list_head list_ent;
- int wait_condition;
- wait_queue_head_t wait_event;
+ struct completion wait_event;
/*
* FIXME: We assumed a fixed size response here. If we do ever need to
@@ -125,7 +124,7 @@ static struct rndis_request *get_rndis_request(struct rndis_device *dev,
if (!request)
return NULL;
- init_waitqueue_head(&request->wait_event);
+ init_completion(&request->wait_event);
rndis_msg = &request->request_msg;
rndis_msg->ndis_msg_type = msg_type;
@@ -305,8 +304,7 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
}
}
- request->wait_condition = 1;
- wake_up(&request->wait_event);
+ complete(&request->wait_event);
} else {
dev_err(&dev->net_dev->dev->device,
"no rndis request found for this response "
@@ -465,6 +463,7 @@ static int rndis_filter_query_device(struct rndis_device *dev, u32 oid,
struct rndis_query_request *query;
struct rndis_query_complete *query_complete;
int ret = 0;
+ int t;
if (!result)
return -EINVAL;
@@ -484,14 +483,12 @@ static int rndis_filter_query_device(struct rndis_device *dev, u32 oid,
query->info_buflen = 0;
query->dev_vc_handle = 0;
- request->wait_condition = 0;
ret = rndis_filter_send_request(dev, request);
if (ret != 0)
goto Cleanup;
- wait_event_timeout(request->wait_event, request->wait_condition,
- msecs_to_jiffies(1000));
- if (request->wait_condition == 0) {
+ t = wait_for_completion_timeout(&request->wait_event, HZ);
+ if (t == 0) {
ret = -ETIMEDOUT;
goto Cleanup;
}
@@ -543,7 +540,7 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev,
struct rndis_set_request *set;
struct rndis_set_complete *set_complete;
u32 status;
- int ret;
+ int ret, t;
request = get_rndis_request(dev, REMOTE_NDIS_SET_MSG,
RNDIS_MESSAGE_SIZE(struct rndis_set_request) +
@@ -562,14 +559,13 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev,
memcpy((void *)(unsigned long)set + sizeof(struct rndis_set_request),
&new_filter, sizeof(u32));
- request->wait_condition = 0;
ret = rndis_filter_send_request(dev, request);
if (ret != 0)
goto Cleanup;
- wait_event_timeout(request->wait_event, request->wait_condition,
- msecs_to_jiffies(2000));
- if (request->wait_condition == 0) {
+ t = wait_for_completion_timeout(&request->wait_event, HZ);
+
+ if (t == 0) {
ret = -1;
dev_err(&dev->net_dev->dev->device,
"timeout before we got a set response...\n");
@@ -624,7 +620,7 @@ static int rndis_filter_init_device(struct rndis_device *dev)
struct rndis_initialize_request *init;
struct rndis_initialize_complete *init_complete;
u32 status;
- int ret;
+ int ret, t;
request = get_rndis_request(dev, REMOTE_NDIS_INITIALIZE_MSG,
RNDIS_MESSAGE_SIZE(struct rndis_initialize_request));
@@ -642,7 +638,6 @@ static int rndis_filter_init_device(struct rndis_device *dev)
dev->state = RNDIS_DEV_INITIALIZING;
- request->wait_condition = 0;
ret = rndis_filter_send_request(dev, request);
if (ret != 0) {
dev->state = RNDIS_DEV_UNINITIALIZED;
@@ -650,9 +645,9 @@ static int rndis_filter_init_device(struct rndis_device *dev)
}
- wait_event_timeout(request->wait_event, request->wait_condition,
- msecs_to_jiffies(1000));
- if (request->wait_condition == 0) {
+ t = wait_for_completion_timeout(&request->wait_event, HZ);
+
+ if (t == 0) {
ret = -ETIMEDOUT;
goto Cleanup;
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 115/206] Staging: hv: Use completion abstraction in struct netvsc_device
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Use completion abstraction in struct netvsc_device instead of
struct wait_queue_head_t to synchronize.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/netvsc.c | 32 +++++++++++++-------------------
drivers/staging/hv/netvsc.h | 3 +--
2 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 832f62e..4eb4482 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -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;
@@ -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,
@@ -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 */
@@ -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;
@@ -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,
@@ -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.
@@ -487,7 +484,7 @@ exit:
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;
@@ -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,
@@ -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;
}
@@ -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 */
@@ -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,
diff --git a/drivers/staging/hv/netvsc.h b/drivers/staging/hv/netvsc.h
index 45d24b9..9ebea3b 100644
--- a/drivers/staging/hv/netvsc.h
+++ b/drivers/staging/hv/netvsc.h
@@ -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;
--
1.7.4.1
^ permalink raw reply related
* [PATCH 114/206] Staging: hv: Get rid of some unnecessary state from struct vmbus_msginfo
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
This state is not used anywhere; get rid of it.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_private.h | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/hv/vmbus_private.h b/drivers/staging/hv/vmbus_private.h
index 6f0d8df..bea331e 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -91,10 +91,6 @@ struct vmbus_msginfo {
/* Bookkeeping stuff */
struct list_head msglist_entry;
- /* Synchronize the request/response if needed */
- int wait_condition;
- wait_queue_head_t wait_event;
-
/* The message itself */
unsigned char msg[0];
};
--
1.7.4.1
^ permalink raw reply related
* [PATCH 113/206] Staging: hv: Use completion abstraction to synchronize in vmbus_channel_msginfo
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Use completion abstraction to synchronize in vmbus_channel_msginfo.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel.c | 31 ++++++++++++-------------------
drivers/staging/hv/channel_mgmt.c | 31 ++++++++++++++-----------------
drivers/staging/hv/channel_mgmt.h | 4 ++--
drivers/staging/hv/connection.c | 9 ++++-----
4 files changed, 32 insertions(+), 43 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 5fcf9d3..1b50cb7 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -177,7 +177,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
struct vmbus_channel_msginfo *openInfo = NULL;
void *in, *out;
unsigned long flags;
- int ret, err = 0;
+ int ret, t, err = 0;
/* Aligned to page size */
/* ASSERT(!(SendRingBufferSize & (PAGE_SIZE - 1))); */
@@ -240,7 +240,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
goto errorout;
}
- init_waitqueue_head(&openInfo->waitevent);
+ init_completion(&openInfo->waitevent);
openMsg = (struct vmbus_channel_open_channel *)openInfo->msg;
openMsg->header.msgtype = CHANNELMSG_OPENCHANNEL;
@@ -270,11 +270,8 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
if (ret != 0)
goto Cleanup;
- openInfo->wait_condition = 0;
- wait_event_timeout(openInfo->waitevent,
- openInfo->wait_condition,
- msecs_to_jiffies(1000));
- if (openInfo->wait_condition == 0) {
+ t = wait_for_completion_timeout(&openInfo->waitevent, HZ);
+ if (t == 0) {
err = -ETIMEDOUT;
goto errorout;
}
@@ -495,6 +492,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
u32 next_gpadl_handle;
unsigned long flags;
int ret = 0;
+ int t;
next_gpadl_handle = atomic_read(&vmbus_connection.next_gpadl_handle);
atomic_inc(&vmbus_connection.next_gpadl_handle);
@@ -503,7 +501,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
if (ret)
return ret;
- init_waitqueue_head(&msginfo->waitevent);
+ init_completion(&msginfo->waitevent);
gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->msg;
gpadlmsg->header.msgtype = CHANNELMSG_GPADL_HEADER;
@@ -518,7 +516,6 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
- msginfo->wait_condition = 0;
ret = vmbus_post_msg(gpadlmsg, msginfo->msgsize -
sizeof(*msginfo));
if (ret != 0)
@@ -546,10 +543,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
}
}
- wait_event_timeout(msginfo->waitevent,
- msginfo->wait_condition,
- msecs_to_jiffies(1000));
- BUG_ON(msginfo->wait_condition == 0);
+ t = wait_for_completion_timeout(&msginfo->waitevent, HZ);
+ BUG_ON(t == 0);
/* At this point, we received the gpadl created msg */
@@ -573,7 +568,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
struct vmbus_channel_gpadl_teardown *msg;
struct vmbus_channel_msginfo *info;
unsigned long flags;
- int ret;
+ int ret, t;
/* ASSERT(gpadl_handle != 0); */
@@ -582,7 +577,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
if (!info)
return -ENOMEM;
- init_waitqueue_head(&info->waitevent);
+ init_completion(&info->waitevent);
msg = (struct vmbus_channel_gpadl_teardown *)info->msg;
@@ -594,14 +589,12 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
list_add_tail(&info->msglistentry,
&vmbus_connection.chn_msg_list);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
- info->wait_condition = 0;
ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_gpadl_teardown));
BUG_ON(ret != 0);
- wait_event_timeout(info->waitevent,
- info->wait_condition, msecs_to_jiffies(1000));
- BUG_ON(info->wait_condition == 0);
+ t = wait_for_completion_timeout(&info->waitevent, HZ);
+ BUG_ON(t == 0);
/* Received a torndown response */
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index 95eef92..33cb5d5 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -556,9 +556,9 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr)
openmsg->openid == result->openid) {
memcpy(&msginfo->response.open_result,
result,
- sizeof(struct vmbus_channel_open_result));
- msginfo->wait_condition = 1;
- wake_up(&msginfo->waitevent);
+ sizeof(
+ struct vmbus_channel_open_result));
+ complete(&msginfo->waitevent);
break;
}
}
@@ -603,9 +603,9 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr)
(gpadlcreated->gpadl == gpadlheader->gpadl)) {
memcpy(&msginfo->response.gpadl_created,
gpadlcreated,
- sizeof(struct vmbus_channel_gpadl_created));
- msginfo->wait_condition = 1;
- wake_up(&msginfo->waitevent);
+ sizeof(
+ struct vmbus_channel_gpadl_created));
+ complete(&msginfo->waitevent);
break;
}
}
@@ -648,9 +648,9 @@ static void vmbus_ongpadl_torndown(
if (gpadl_torndown->gpadl == gpadl_teardown->gpadl) {
memcpy(&msginfo->response.gpadl_torndown,
gpadl_torndown,
- sizeof(struct vmbus_channel_gpadl_torndown));
- msginfo->wait_condition = 1;
- wake_up(&msginfo->waitevent);
+ sizeof(
+ struct vmbus_channel_gpadl_torndown));
+ complete(&msginfo->waitevent);
break;
}
}
@@ -689,8 +689,7 @@ static void vmbus_onversion_response(
memcpy(&msginfo->response.version_response,
version_response,
sizeof(struct vmbus_channel_version_response));
- msginfo->wait_condition = 1;
- wake_up(&msginfo->waitevent);
+ complete(&msginfo->waitevent);
}
}
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
@@ -753,7 +752,7 @@ int vmbus_request_offers(void)
{
struct vmbus_channel_message_header *msg;
struct vmbus_channel_msginfo *msginfo;
- int ret;
+ int ret, t;
msginfo = kmalloc(sizeof(*msginfo) +
sizeof(struct vmbus_channel_message_header),
@@ -761,7 +760,7 @@ int vmbus_request_offers(void)
if (!msginfo)
return -ENOMEM;
- init_waitqueue_head(&msginfo->waitevent);
+ init_completion(&msginfo->waitevent);
msg = (struct vmbus_channel_message_header *)msginfo->msg;
@@ -776,10 +775,8 @@ int vmbus_request_offers(void)
goto cleanup;
}
- msginfo->wait_condition = 0;
- wait_event_timeout(msginfo->waitevent, msginfo->wait_condition,
- msecs_to_jiffies(1000));
- if (msginfo->wait_condition == 0) {
+ t = wait_for_completion_timeout(&msginfo->waitevent, HZ);
+ if (t == 0) {
ret = -ETIMEDOUT;
goto cleanup;
}
diff --git a/drivers/staging/hv/channel_mgmt.h b/drivers/staging/hv/channel_mgmt.h
index 3b2c393..f895d0a 100644
--- a/drivers/staging/hv/channel_mgmt.h
+++ b/drivers/staging/hv/channel_mgmt.h
@@ -28,6 +28,7 @@
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
+#include <linux/completion.h>
#include "ring_buffer.h"
#include "vmbus_channel_interface.h"
#include "vmbus_packet_format.h"
@@ -290,8 +291,7 @@ struct vmbus_channel_msginfo {
struct list_head submsglist;
/* Synchronize the request/response if needed */
- int wait_condition;
- wait_queue_head_t waitevent;
+ struct completion waitevent;
union {
struct vmbus_channel_version_supported version_supported;
struct vmbus_channel_open_result open_result;
diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index 4f411a9..92add38 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -44,6 +44,7 @@ struct vmbus_connection vmbus_connection = {
int vmbus_connect(void)
{
int ret = 0;
+ int t;
struct vmbus_channel_msginfo *msginfo = NULL;
struct vmbus_channel_initiate_contact *msg;
unsigned long flags;
@@ -101,7 +102,7 @@ int vmbus_connect(void)
goto Cleanup;
}
- init_waitqueue_head(&msginfo->waitevent);
+ init_completion(&msginfo->waitevent);
msg = (struct vmbus_channel_initiate_contact *)msginfo->msg;
@@ -134,10 +135,8 @@ int vmbus_connect(void)
}
/* Wait for the connection response */
- msginfo->wait_condition = 0;
- wait_event_timeout(msginfo->waitevent, msginfo->wait_condition,
- msecs_to_jiffies(1000));
- if (msginfo->wait_condition == 0) {
+ t = wait_for_completion_timeout(&msginfo->waitevent, HZ);
+ if (t == 0) {
spin_lock_irqsave(&vmbus_connection.channelmsg_lock,
flags);
list_del(&msginfo->msglistentry);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 112/206] Staging: hv: Rename the variable gChannelMessageTable
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel_mgmt.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index a8be565..95eef92 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -698,7 +698,7 @@ static void vmbus_onversion_response(
/* Channel message dispatch table */
static struct vmbus_channel_message_table_entry
- gChannelMessageTable[CHANNELMSG_COUNT] = {
+ channel_message_table[CHANNELMSG_COUNT] = {
{CHANNELMSG_INVALID, NULL},
{CHANNELMSG_OFFERCHANNEL, vmbus_onoffer},
{CHANNELMSG_RESCIND_CHANNELOFFER, vmbus_onoffer_rescind},
@@ -740,8 +740,8 @@ void vmbus_onmessage(void *context)
return;
}
- if (gChannelMessageTable[hdr->msgtype].message_handler)
- gChannelMessageTable[hdr->msgtype].message_handler(hdr);
+ if (channel_message_table[hdr->msgtype].message_handler)
+ channel_message_table[hdr->msgtype].message_handler(hdr);
else
pr_err("Unhandled channel message type %d\n", hdr->msgtype);
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 111/206] Staging: hv: Rename the variable messageType
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel_mgmt.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index bc6e235..a8be565 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -34,7 +34,7 @@
#include "utils.h"
struct vmbus_channel_message_table_entry {
- enum vmbus_channel_message_type messageType;
+ enum vmbus_channel_message_type message_type;
void (*message_handler)(struct vmbus_channel_message_header *msg);
};
--
1.7.4.1
^ permalink raw reply related
* [PATCH 110/206] Staging: hv: Rename the variable messageHandler
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel_mgmt.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index 71b79c6..bc6e235 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -35,7 +35,7 @@
struct vmbus_channel_message_table_entry {
enum vmbus_channel_message_type messageType;
- void (*messageHandler)(struct vmbus_channel_message_header *msg);
+ void (*message_handler)(struct vmbus_channel_message_header *msg);
};
#define MAX_MSG_TYPES 4
@@ -740,8 +740,8 @@ void vmbus_onmessage(void *context)
return;
}
- if (gChannelMessageTable[hdr->msgtype].messageHandler)
- gChannelMessageTable[hdr->msgtype].messageHandler(hdr);
+ if (gChannelMessageTable[hdr->msgtype].message_handler)
+ gChannelMessageTable[hdr->msgtype].message_handler(hdr);
else
pr_err("Unhandled channel message type %d\n", hdr->msgtype);
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 109/206] Staging: hv: Rename the variable gSupportedDeviceClasses
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel_mgmt.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index 1929ab3..71b79c6 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -42,7 +42,7 @@ struct vmbus_channel_message_table_entry {
#define MAX_NUM_DEVICE_CLASSES_SUPPORTED 8
static const struct hv_guid
- gSupportedDeviceClasses[MAX_NUM_DEVICE_CLASSES_SUPPORTED] = {
+ supported_device_classes[MAX_NUM_DEVICE_CLASSES_SUPPORTED] = {
/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */
/* Storage - SCSI */
{
@@ -459,7 +459,8 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
offer = (struct vmbus_channel_offer_channel *)hdr;
for (i = 0; i < MAX_NUM_DEVICE_CLASSES_SUPPORTED; i++) {
if (memcmp(&offer->offer.if_type,
- &gSupportedDeviceClasses[i], sizeof(struct hv_guid)) == 0) {
+ &supported_device_classes[i],
+ sizeof(struct hv_guid)) == 0) {
fsupported = 1;
break;
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 108/206] Staging: hv: Cleanup ring_buffer.h
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Access to these variables is already serialized via a spin lock. Get
rid of the unnecessary volatile qualifier.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/ring_buffer.h | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 1bc0b8a..089c536 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -30,12 +30,12 @@
struct hv_ring_buffer {
/* Offset in bytes from the start of ring data below */
- volatile u32 write_index;
+ u32 write_index;
/* Offset in bytes from the start of ring data below */
- volatile u32 read_index;
+ u32 read_index;
- volatile u32 interrupt_mask;
+ u32 interrupt_mask;
/* Pad it to PAGE_SIZE so that data starts on page boundary */
u8 reserved[4084];
@@ -45,7 +45,6 @@ struct hv_ring_buffer {
* vmbus connection also uses this data structure and its data starts
* here, we commented out this field.
*/
- /* volatile u32 InterruptMask; */
/*
* Ring data starts here + RingDataStartOffset
--
1.7.4.1
^ permalink raw reply related
* [PATCH 107/206] Staging: hv: Get rid of the volatile qualifier for a variable in ring_buffer.c
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Access to this variable is already serialized via a spin lock. Get
rid of the unnecessary volatile qualifier.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/ring_buffer.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 2a461ddee..badf52a 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -364,7 +364,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
u32 totalbytes_towrite = 0;
struct scatterlist *sg;
- volatile u32 next_write_location;
+ u32 next_write_location;
u64 prev_indices = 0;
unsigned long flags;
--
1.7.4.1
^ permalink raw reply related
* [PATCH 106/206] Staging: hv: Get rid of the forward declaration of hv_copyto_ringbuffer()
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Get rid of the forward declaration by moving the code around.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/ring_buffer.c | 66 +++++++++++++++----------------------
1 files changed, 27 insertions(+), 39 deletions(-)
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 56521fd..2a461ddee 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -236,14 +236,37 @@ static u32 hv_copyfrom_ringbuffer(
}
-
-static u32
-hv_copyto_ringbuffer(
+/*
+ *
+ * hv_copyto_ringbuffer()
+ *
+ * Helper routine to copy from source to ring buffer.
+ * Assume there is enough room. Handles wrap-around in dest case only!!
+ *
+ */
+static u32 hv_copyto_ringbuffer(
struct hv_ring_buffer_info *ring_info,
u32 start_write_offset,
void *src,
- u32 srclen);
+ u32 srclen)
+{
+ void *ring_buffer = hv_get_ring_buffer(ring_info);
+ u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
+ u32 frag_len;
+
+ /* wrap-around detected! */
+ if (srclen > ring_buffer_size - start_write_offset) {
+ 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);
+ } else
+ memcpy(ring_buffer + start_write_offset, src, srclen);
+ start_write_offset += srclen;
+ start_write_offset %= ring_buffer_size;
+
+ return start_write_offset;
+}
/*
*
@@ -498,38 +521,3 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
return 0;
}
-
-
-/*
- *
- * hv_copyto_ringbuffer()
- *
- * Helper routine to copy from source to ring buffer.
- * Assume there is enough room. Handles wrap-around in dest case only!!
- *
- */
-static u32
-hv_copyto_ringbuffer(
- struct hv_ring_buffer_info *ring_info,
- u32 start_write_offset,
- void *src,
- u32 srclen)
-{
- void *ring_buffer = hv_get_ring_buffer(ring_info);
- u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
- u32 frag_len;
-
- /* wrap-around detected! */
- if (srclen > ring_buffer_size - start_write_offset) {
- 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);
- } else
- memcpy(ring_buffer + start_write_offset, src, srclen);
-
- start_write_offset += srclen;
- start_write_offset %= ring_buffer_size;
-
- return start_write_offset;
-}
-
--
1.7.4.1
^ permalink raw reply related
* [PATCH 105/206] Staging: hv: Get rid of the forward declaration of hv_copyfrom_ringbuffer
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Get rid of the forward declaration by moving code around.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/ring_buffer.c | 83 +++++++++++++++++---------------------
1 files changed, 37 insertions(+), 46 deletions(-)
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 8544516..56521fd 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -199,6 +199,43 @@ void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
}
+/*
+ *
+ * hv_copyfrom_ringbuffer()
+ *
+ * Helper routine to copy to source from ring buffer.
+ * Assume there is enough room. Handles wrap-around in src case only!!
+ *
+ */
+static u32 hv_copyfrom_ringbuffer(
+ struct hv_ring_buffer_info *ring_info,
+ void *dest,
+ u32 destlen,
+ u32 start_read_offset)
+{
+ void *ring_buffer = hv_get_ring_buffer(ring_info);
+ u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
+
+ u32 frag_len;
+
+ /* wrap-around detected at the src */
+ if (destlen > ring_buffer_size - start_read_offset) {
+ frag_len = ring_buffer_size - start_read_offset;
+
+ memcpy(dest, ring_buffer + start_read_offset, frag_len);
+ memcpy(dest + frag_len, ring_buffer, destlen - frag_len);
+ } else
+
+ memcpy(dest, ring_buffer + start_read_offset, destlen);
+
+
+ start_read_offset += destlen;
+ start_read_offset %= ring_buffer_size;
+
+ return start_read_offset;
+}
+
+
static u32
hv_copyto_ringbuffer(
@@ -207,14 +244,6 @@ hv_copyto_ringbuffer(
void *src,
u32 srclen);
-static u32
-hv_copyfrom_ringbuffer(
- struct hv_ring_buffer_info *ring_info,
- void *dest,
- u32 destlen,
- u32 start_read_offset);
-
-
/*
*
@@ -504,41 +533,3 @@ hv_copyto_ringbuffer(
return start_write_offset;
}
-
-/*
- *
- * hv_copyfrom_ringbuffer()
- *
- * Helper routine to copy to source from ring buffer.
- * Assume there is enough room. Handles wrap-around in src case only!!
- *
- */
-static u32
-hv_copyfrom_ringbuffer(
- struct hv_ring_buffer_info *ring_info,
- void *dest,
- u32 destlen,
- u32 start_read_offset)
-{
- void *ring_buffer = hv_get_ring_buffer(ring_info);
- u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
-
- u32 frag_len;
-
- /* wrap-around detected at the src */
- if (destlen > ring_buffer_size - start_read_offset) {
- frag_len = ring_buffer_size - start_read_offset;
-
- memcpy(dest, ring_buffer + start_read_offset, frag_len);
- memcpy(dest + frag_len, ring_buffer, destlen - frag_len);
- } else
-
- memcpy(dest, ring_buffer + start_read_offset, destlen);
-
-
- start_read_offset += destlen;
- start_read_offset %= ring_buffer_size;
-
- return start_read_offset;
-}
-
--
1.7.4.1
^ permalink raw reply related
* [PATCH 104/206] Staging: hv: Cleanup comments in ring_buffer.c
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Cleanup comments in ring_buffer.c
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/ring_buffer.c | 323 +++++++++++++++-----------------------
1 files changed, 129 insertions(+), 194 deletions(-)
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index f4707f8..8544516 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -18,6 +18,7 @@
* Authors:
* Haiyang Zhang <haiyangz@microsoft.com>
* Hank Janssen <hjanssen@microsoft.com>
+ * K. Y. Srinivasan <kys@microsoft.com>
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -35,16 +36,13 @@
#define BYTES_AVAIL_TO_WRITE(r, w, z) ((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w))
-/*++
-
-Name:
- hv_get_ringbuffer_availbytes()
-
-Description:
- Get number of bytes available to read and to write to
- for the specified ring buffer
-
---*/
+/*
+ *
+ * hv_get_ringbuffer_availbytes()
+ *
+ * Get number of bytes available to read and to write to
+ * for the specified ring buffer
+ */
static inline void
hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
u32 *read, u32 *write)
@@ -59,34 +57,26 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
*read = rbi->ring_datasize - *write;
}
-/*++
-
-Name:
- hv_get_next_write_location()
-
-Description:
- Get the next write location for the specified ring buffer
-
---*/
+/*
+ * hv_get_next_write_location()
+ *
+ * Get the next write location for the specified ring buffer
+ *
+ */
static inline u32
hv_get_next_write_location(struct hv_ring_buffer_info *ring_info)
{
u32 next = ring_info->ring_buffer->write_index;
- /* ASSERT(next < ring_info->RingDataSize); */
-
return next;
}
-/*++
-
-Name:
- hv_set_next_write_location()
-
-Description:
- Set the next write location for the specified ring buffer
-
---*/
+/*
+ * hv_set_next_write_location()
+ *
+ * Set the next write location for the specified ring buffer
+ *
+ */
static inline void
hv_set_next_write_location(struct hv_ring_buffer_info *ring_info,
u32 next_write_location)
@@ -94,57 +84,44 @@ hv_set_next_write_location(struct hv_ring_buffer_info *ring_info,
ring_info->ring_buffer->write_index = next_write_location;
}
-/*++
-
-Name:
- hv_get_next_read_location()
-
-Description:
- Get the next read location for the specified ring buffer
-
---*/
+/*
+ * hv_get_next_read_location()
+ *
+ * Get the next read location for the specified ring buffer
+ */
static inline u32
hv_get_next_read_location(struct hv_ring_buffer_info *ring_info)
{
u32 next = ring_info->ring_buffer->read_index;
- /* ASSERT(next < ring_info->RingDataSize); */
-
return next;
}
-/*++
-
-Name:
- hv_get_next_readlocation_withoffset()
-
-Description:
- Get the next read location + offset for the specified ring buffer.
- This allows the caller to skip
-
---*/
+/*
+ * hv_get_next_readlocation_withoffset()
+ *
+ * Get the next read location + offset for the specified ring buffer.
+ * This allows the caller to skip
+ */
static inline u32
hv_get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
u32 offset)
{
u32 next = ring_info->ring_buffer->read_index;
- /* ASSERT(next < ring_info->RingDataSize); */
next += offset;
next %= ring_info->ring_datasize;
return next;
}
-/*++
-
-Name:
- hv_set_next_read_location()
-
-Description:
- Set the next read location for the specified ring buffer
-
---*/
+/*
+ *
+ * hv_set_next_read_location()
+ *
+ * Set the next read location for the specified ring buffer
+ *
+ */
static inline void
hv_set_next_read_location(struct hv_ring_buffer_info *ring_info,
u32 next_read_location)
@@ -153,15 +130,12 @@ hv_set_next_read_location(struct hv_ring_buffer_info *ring_info,
}
-/*++
-
-Name:
- hv_get_ring_buffer()
-
-Description:
- Get the start of the ring buffer
-
---*/
+/*
+ *
+ * hv_get_ring_buffer()
+ *
+ * Get the start of the ring buffer
+ */
static inline void *
hv_get_ring_buffer(struct hv_ring_buffer_info *ring_info)
{
@@ -169,30 +143,25 @@ hv_get_ring_buffer(struct hv_ring_buffer_info *ring_info)
}
-/*++
-
-Name:
- hv_get_ring_buffersize()
-
-Description:
- Get the size of the ring buffer
-
---*/
+/*
+ *
+ * hv_get_ring_buffersize()
+ *
+ * Get the size of the ring buffer
+ */
static inline u32
hv_get_ring_buffersize(struct hv_ring_buffer_info *ring_info)
{
return ring_info->ring_datasize;
}
-/*++
-
-Name:
- hv_get_ring_bufferindices()
-
-Description:
- Get the read and write indices as u64 of the specified ring buffer
-
---*/
+/*
+ *
+ * hv_get_ring_bufferindices()
+ *
+ * Get the read and write indices as u64 of the specified ring buffer
+ *
+ */
static inline u64
hv_get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
{
@@ -200,15 +169,13 @@ hv_get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
}
-/*++
-
-Name:
- hv_dump_ring_info()
-
-Description:
- Dump out to console the ring buffer info
-
---*/
+/*
+ *
+ * hv_dump_ring_info()
+ *
+ * Dump out to console the ring buffer info
+ *
+ */
void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
{
u32 bytes_avail_towrite;
@@ -232,7 +199,6 @@ void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
}
-/* Internal routines */
static u32
hv_copyto_ringbuffer(
@@ -250,15 +216,13 @@ hv_copyfrom_ringbuffer(
-/*++
-
-Name:
- hv_ringbuffer_get_debuginfo()
-
-Description:
- Get various debug metrics for the specified ring buffer
-
---*/
+/*
+ *
+ * hv_ringbuffer_get_debuginfo()
+ *
+ * Get various debug metrics for the specified ring buffer
+ *
+ */
void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info)
{
@@ -282,29 +246,25 @@ void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
}
-/*++
-
-Name:
- hv_get_ringbuffer_interrupt_mask()
-
-Description:
- Get the interrupt mask for the specified ring buffer
-
---*/
+/*
+ *
+ * hv_get_ringbuffer_interrupt_mask()
+ *
+ * Get the interrupt mask for the specified ring buffer
+ *
+ */
u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi)
{
return rbi->ring_buffer->interrupt_mask;
}
-/*++
-
-Name:
- hv_ringbuffer_init()
-
-Description:
- Initialize the ring buffer
-
---*/
+/*
+ *
+ * hv_ringbuffer_init()
+ *
+ *Initialize the ring buffer
+ *
+ */
int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
void *buffer, u32 buflen)
{
@@ -325,28 +285,24 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
return 0;
}
-/*++
-
-Name:
- hv_ringbuffer_cleanup()
-
-Description:
- Cleanup the ring buffer
-
---*/
+/*
+ *
+ * hv_ringbuffer_cleanup()
+ *
+ * Cleanup the ring buffer
+ *
+ */
void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
{
}
-/*++
-
-Name:
- hv_ringbuffer_write()
-
-Description:
- Write to the ring buffer
-
---*/
+/*
+ *
+ * hv_ringbuffer_write()
+ *
+ * Write to the ring buffer
+ *
+ */
int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
struct scatterlist *sglist, u32 sgcount)
{
@@ -373,7 +329,6 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
&bytes_avail_toread,
&bytes_avail_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 */
@@ -408,22 +363,19 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
/* Now, update the write location */
hv_set_next_write_location(outring_info, next_write_location);
- /* Dumpring_info(Outring_info, "AFTER "); */
spin_unlock_irqrestore(&outring_info->ring_lock, flags);
return 0;
}
-/*++
-
-Name:
- hv_ringbuffer_peek()
-
-Description:
- Read without advancing the read index
-
---*/
+/*
+ *
+ * hv_ringbuffer_peek()
+ *
+ * Read without advancing the read index
+ *
+ */
int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
void *Buffer, u32 buflen)
{
@@ -440,11 +392,6 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
/* 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,
- BufferLen); */
spin_unlock_irqrestore(&Inring_info->ring_lock, flags);
@@ -465,15 +412,13 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
}
-/*++
-
-Name:
- hv_ringbuffer_read()
-
-Description:
- Read and advance the read index
-
---*/
+/*
+ *
+ * hv_ringbuffer_read()
+ *
+ * Read and advance the read index
+ *
+ */
int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
u32 buflen, u32 offset)
{
@@ -492,8 +437,6 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
&bytes_avail_toread,
&bytes_avail_towrite);
- /* Dumpring_info(Inring_info, "BEFORE "); */
-
/* Make sure there is something to read */
if (bytes_avail_toread < buflen) {
spin_unlock_irqrestore(&inring_info->ring_lock, flags);
@@ -522,24 +465,20 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
/* Update the read index */
hv_set_next_read_location(inring_info, next_read_location);
- /* Dumpring_info(Inring_info, "AFTER "); */
-
spin_unlock_irqrestore(&inring_info->ring_lock, flags);
return 0;
}
-/*++
-
-Name:
- hv_copyto_ringbuffer()
-
-Description:
- Helper routine to copy from source to ring buffer.
- Assume there is enough room. Handles wrap-around in dest case only!!
-
---*/
+/*
+ *
+ * hv_copyto_ringbuffer()
+ *
+ * Helper routine to copy from source to ring buffer.
+ * Assume there is enough room. Handles wrap-around in dest case only!!
+ *
+ */
static u32
hv_copyto_ringbuffer(
struct hv_ring_buffer_info *ring_info,
@@ -566,16 +505,14 @@ hv_copyto_ringbuffer(
}
-/*++
-
-Name:
- hv_copyfrom_ringbuffer()
-
-Description:
- Helper routine to copy to source from ring buffer.
- Assume there is enough room. Handles wrap-around in src case only!!
-
---*/
+/*
+ *
+ * hv_copyfrom_ringbuffer()
+ *
+ * Helper routine to copy to source from ring buffer.
+ * Assume there is enough room. Handles wrap-around in src case only!!
+ *
+ */
static u32
hv_copyfrom_ringbuffer(
struct hv_ring_buffer_info *ring_info,
@@ -605,5 +542,3 @@ hv_copyfrom_ringbuffer(
return start_read_offset;
}
-
-/* eof */
--
1.7.4.1
^ permalink raw reply related
* [PATCH 103/206] Staging: hv: Rename all static functions in ring_buffer.c
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/ring_buffer.c | 88 +++++++++++++++++++-------------------
1 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 7fbadb1..f4707f8 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -38,7 +38,7 @@
/*++
Name:
- get_ringbuffer_availbytes()
+ hv_get_ringbuffer_availbytes()
Description:
Get number of bytes available to read and to write to
@@ -46,7 +46,7 @@ Description:
--*/
static inline void
-get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
+hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
u32 *read, u32 *write)
{
u32 read_loc, write_loc;
@@ -62,14 +62,14 @@ get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
/*++
Name:
- get_next_write_location()
+ hv_get_next_write_location()
Description:
Get the next write location for the specified ring buffer
--*/
static inline u32
-get_next_write_location(struct hv_ring_buffer_info *ring_info)
+hv_get_next_write_location(struct hv_ring_buffer_info *ring_info)
{
u32 next = ring_info->ring_buffer->write_index;
@@ -81,14 +81,14 @@ get_next_write_location(struct hv_ring_buffer_info *ring_info)
/*++
Name:
- set_next_write_location()
+ hv_set_next_write_location()
Description:
Set the next write location for the specified ring buffer
--*/
static inline void
-set_next_write_location(struct hv_ring_buffer_info *ring_info,
+hv_set_next_write_location(struct hv_ring_buffer_info *ring_info,
u32 next_write_location)
{
ring_info->ring_buffer->write_index = next_write_location;
@@ -97,14 +97,14 @@ set_next_write_location(struct hv_ring_buffer_info *ring_info,
/*++
Name:
- get_next_read_location()
+ hv_get_next_read_location()
Description:
Get the next read location for the specified ring buffer
--*/
static inline u32
-get_next_read_location(struct hv_ring_buffer_info *ring_info)
+hv_get_next_read_location(struct hv_ring_buffer_info *ring_info)
{
u32 next = ring_info->ring_buffer->read_index;
@@ -116,7 +116,7 @@ get_next_read_location(struct hv_ring_buffer_info *ring_info)
/*++
Name:
- get_next_readlocation_withoffset()
+ hv_get_next_readlocation_withoffset()
Description:
Get the next read location + offset for the specified ring buffer.
@@ -124,7 +124,7 @@ Description:
--*/
static inline u32
-get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
+hv_get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
u32 offset)
{
u32 next = ring_info->ring_buffer->read_index;
@@ -139,14 +139,14 @@ get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
/*++
Name:
- set_next_read_location()
+ hv_set_next_read_location()
Description:
Set the next read location for the specified ring buffer
--*/
static inline void
-set_next_read_location(struct hv_ring_buffer_info *ring_info,
+hv_set_next_read_location(struct hv_ring_buffer_info *ring_info,
u32 next_read_location)
{
ring_info->ring_buffer->read_index = next_read_location;
@@ -156,14 +156,14 @@ set_next_read_location(struct hv_ring_buffer_info *ring_info,
/*++
Name:
- get_ring_buffer()
+ hv_get_ring_buffer()
Description:
Get the start of the ring buffer
--*/
static inline void *
-get_ring_buffer(struct hv_ring_buffer_info *ring_info)
+hv_get_ring_buffer(struct hv_ring_buffer_info *ring_info)
{
return (void *)ring_info->ring_buffer->buffer;
}
@@ -172,14 +172,14 @@ get_ring_buffer(struct hv_ring_buffer_info *ring_info)
/*++
Name:
- get_ring_buffersize()
+ hv_get_ring_buffersize()
Description:
Get the size of the ring buffer
--*/
static inline u32
-get_ring_buffersize(struct hv_ring_buffer_info *ring_info)
+hv_get_ring_buffersize(struct hv_ring_buffer_info *ring_info)
{
return ring_info->ring_datasize;
}
@@ -187,14 +187,14 @@ get_ring_buffersize(struct hv_ring_buffer_info *ring_info)
/*++
Name:
- get_ring_bufferindices()
+ hv_get_ring_bufferindices()
Description:
Get the read and write indices as u64 of the specified ring buffer
--*/
static inline u64
-get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
+hv_get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
{
return (u64)ring_info->ring_buffer->write_index << 32;
}
@@ -214,7 +214,7 @@ void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
u32 bytes_avail_towrite;
u32 bytes_avail_toread;
- get_ringbuffer_availbytes(ring_info,
+ hv_get_ringbuffer_availbytes(ring_info,
&bytes_avail_toread,
&bytes_avail_towrite);
@@ -235,14 +235,14 @@ void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
/* Internal routines */
static u32
-copyto_ringbuffer(
+hv_copyto_ringbuffer(
struct hv_ring_buffer_info *ring_info,
u32 start_write_offset,
void *src,
u32 srclen);
static u32
-copyfrom_ringbuffer(
+hv_copyfrom_ringbuffer(
struct hv_ring_buffer_info *ring_info,
void *dest,
u32 destlen,
@@ -266,7 +266,7 @@ void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
u32 bytes_avail_toread;
if (ring_info->ring_buffer) {
- get_ringbuffer_availbytes(ring_info,
+ hv_get_ringbuffer_availbytes(ring_info,
&bytes_avail_toread,
&bytes_avail_towrite);
@@ -369,7 +369,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
spin_lock_irqsave(&outring_info->ring_lock, flags);
- get_ringbuffer_availbytes(outring_info,
+ hv_get_ringbuffer_availbytes(outring_info,
&bytes_avail_toread,
&bytes_avail_towrite);
@@ -384,20 +384,20 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
}
/* Write to the ring buffer */
- next_write_location = get_next_write_location(outring_info);
+ next_write_location = hv_get_next_write_location(outring_info);
for_each_sg(sglist, sg, sgcount, i)
{
- next_write_location = copyto_ringbuffer(outring_info,
+ next_write_location = hv_copyto_ringbuffer(outring_info,
next_write_location,
sg_virt(sg),
sg->length);
}
/* Set previous packet start */
- prev_indices = get_ring_bufferindices(outring_info);
+ prev_indices = hv_get_ring_bufferindices(outring_info);
- next_write_location = copyto_ringbuffer(outring_info,
+ next_write_location = hv_copyto_ringbuffer(outring_info,
next_write_location,
&prev_indices,
sizeof(u64));
@@ -406,7 +406,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
mb();
/* Now, update the write location */
- set_next_write_location(outring_info, next_write_location);
+ hv_set_next_write_location(outring_info, next_write_location);
/* Dumpring_info(Outring_info, "AFTER "); */
@@ -434,7 +434,7 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
spin_lock_irqsave(&Inring_info->ring_lock, flags);
- get_ringbuffer_availbytes(Inring_info,
+ hv_get_ringbuffer_availbytes(Inring_info,
&bytes_avail_toread,
&bytes_avail_towrite);
@@ -452,9 +452,9 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
}
/* Convert to byte offset */
- next_read_location = get_next_read_location(Inring_info);
+ next_read_location = hv_get_next_read_location(Inring_info);
- next_read_location = copyfrom_ringbuffer(Inring_info,
+ next_read_location = hv_copyfrom_ringbuffer(Inring_info,
Buffer,
buflen,
next_read_location);
@@ -488,7 +488,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
spin_lock_irqsave(&inring_info->ring_lock, flags);
- get_ringbuffer_availbytes(inring_info,
+ hv_get_ringbuffer_availbytes(inring_info,
&bytes_avail_toread,
&bytes_avail_towrite);
@@ -502,14 +502,14 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
}
next_read_location =
- get_next_readlocation_withoffset(inring_info, offset);
+ hv_get_next_readlocation_withoffset(inring_info, offset);
- next_read_location = copyfrom_ringbuffer(inring_info,
+ next_read_location = hv_copyfrom_ringbuffer(inring_info,
buffer,
buflen,
next_read_location);
- next_read_location = copyfrom_ringbuffer(inring_info,
+ next_read_location = hv_copyfrom_ringbuffer(inring_info,
&prev_indices,
sizeof(u64),
next_read_location);
@@ -520,7 +520,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
mb();
/* Update the read index */
- set_next_read_location(inring_info, next_read_location);
+ hv_set_next_read_location(inring_info, next_read_location);
/* Dumpring_info(Inring_info, "AFTER "); */
@@ -533,7 +533,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
/*++
Name:
- copyto_ringbuffer()
+ hv_copyto_ringbuffer()
Description:
Helper routine to copy from source to ring buffer.
@@ -541,14 +541,14 @@ Description:
--*/
static u32
-copyto_ringbuffer(
+hv_copyto_ringbuffer(
struct hv_ring_buffer_info *ring_info,
u32 start_write_offset,
void *src,
u32 srclen)
{
- void *ring_buffer = get_ring_buffer(ring_info);
- u32 ring_buffer_size = get_ring_buffersize(ring_info);
+ void *ring_buffer = hv_get_ring_buffer(ring_info);
+ u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
u32 frag_len;
/* wrap-around detected! */
@@ -569,7 +569,7 @@ copyto_ringbuffer(
/*++
Name:
- copyfrom_ringbuffer()
+ hv_copyfrom_ringbuffer()
Description:
Helper routine to copy to source from ring buffer.
@@ -577,14 +577,14 @@ Description:
--*/
static u32
-copyfrom_ringbuffer(
+hv_copyfrom_ringbuffer(
struct hv_ring_buffer_info *ring_info,
void *dest,
u32 destlen,
u32 start_read_offset)
{
- void *ring_buffer = get_ring_buffer(ring_info);
- u32 ring_buffer_size = get_ring_buffersize(ring_info);
+ void *ring_buffer = hv_get_ring_buffer(ring_info);
+ u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
u32 frag_len;
--
1.7.4.1
^ permalink raw reply related
* [PATCH 102/206] Staging: hv: Rename ringbuffer_get_debuginfo
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel.c | 4 ++--
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index be4e004..5fcf9d3 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -162,8 +162,8 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
monitorpage->parameter[monitor_group]
[monitor_offset].connectionid.u.id;
- ringbuffer_get_debuginfo(&channel->inbound, &debuginfo->inbound);
- ringbuffer_get_debuginfo(&channel->outbound, &debuginfo->outbound);
+ hv_ringbuffer_get_debuginfo(&channel->inbound, &debuginfo->inbound);
+ hv_ringbuffer_get_debuginfo(&channel->outbound, &debuginfo->outbound);
}
/*
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index abf0091..7fbadb1 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -253,13 +253,13 @@ copyfrom_ringbuffer(
/*++
Name:
- ringbuffer_get_debuginfo()
+ hv_ringbuffer_get_debuginfo()
Description:
Get various debug metrics for the specified ring buffer
--*/
-void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
+void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info)
{
u32 bytes_avail_towrite;
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 61470a3..1bc0b8a 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -97,7 +97,7 @@ u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);
void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);
-void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
+void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info);
#endif /* _RING_BUFFER_H_ */
--
1.7.4.1
^ permalink raw reply related
* [PATCH 101/206] Staging: hv: Rename dump_ring_info
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel.c | 4 ++--
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 3274b29..be4e004 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -1001,6 +1001,6 @@ void vmbus_ontimer(unsigned long data)
static void dump_vmbus_channel(struct vmbus_channel *channel)
{
DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid);
- dump_ring_info(&channel->outbound, "Outbound ");
- dump_ring_info(&channel->inbound, "Inbound ");
+ hv_dump_ring_info(&channel->outbound, "Outbound ");
+ hv_dump_ring_info(&channel->inbound, "Inbound ");
}
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 013b7a5..abf0091 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -203,13 +203,13 @@ get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
/*++
Name:
- dump_ring_info()
+ hv_dump_ring_info()
Description:
Dump out to console the ring buffer info
--*/
-void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
+void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
{
u32 bytes_avail_towrite;
u32 bytes_avail_toread;
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 6454105..61470a3 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -95,7 +95,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *ring_info,
u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);
-void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);
+void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);
void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 100/206] Staging: hv: Rename get_ringbuffer_interrupt_mask
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel.c | 6 +++---
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 9f8bed2..3274b29 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -721,7 +721,7 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);
/* TODO: We should determine if this is optional */
- if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
+ if (ret == 0 && !hv_get_ringbuffer_interrupt_mask(&channel->outbound))
vmbus_setevent(channel);
return ret;
@@ -786,7 +786,7 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);
/* TODO: We should determine if this is optional */
- if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
+ if (ret == 0 && !hv_get_ringbuffer_interrupt_mask(&channel->outbound))
vmbus_setevent(channel);
return ret;
@@ -851,7 +851,7 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);
/* TODO: We should determine if this is optional */
- if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
+ if (ret == 0 && !hv_get_ringbuffer_interrupt_mask(&channel->outbound))
vmbus_setevent(channel);
return ret;
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 2a05059..013b7a5 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -285,13 +285,13 @@ void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
/*++
Name:
- get_ringbuffer_interrupt_mask()
+ hv_get_ringbuffer_interrupt_mask()
Description:
Get the interrupt mask for the specified ring buffer
--*/
-u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi)
+u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi)
{
return rbi->ring_buffer->interrupt_mask;
}
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 0ebf3be..6454105 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -93,7 +93,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *ring_info,
u32 buflen,
u32 offset);
-u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);
+u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);
void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 099/206] Staging: hv: Rename ringbuffer_read
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel.c | 4 ++--
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index d625517..9f8bed2 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -911,7 +911,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
*requestid = desc.trans_id;
/* Copy over the packet to the user buffer */
- ret = ringbuffer_read(&channel->inbound, buffer, userlen,
+ ret = hv_ringbuffer_read(&channel->inbound, buffer, userlen,
(desc.offset8 << 3));
spin_unlock_irqrestore(&channel->inbound_lock, flags);
@@ -964,7 +964,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,
*requestid = desc.trans_id;
/* Copy over the entire packet to the user buffer */
- ret = ringbuffer_read(&channel->inbound, buffer, packetlen, 0);
+ ret = hv_ringbuffer_read(&channel->inbound, buffer, packetlen, 0);
spin_unlock_irqrestore(&channel->inbound_lock, flags);
return 0;
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index bf04397..2a05059 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -468,13 +468,13 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
/*++
Name:
- ringbuffer_read()
+ hv_ringbuffer_read()
Description:
Read and advance the read index
--*/
-int ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
+int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
u32 buflen, u32 offset)
{
u32 bytes_avail_towrite;
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index c684d97..0ebf3be 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -88,7 +88,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *ring_info,
int hv_ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer,
u32 buflen);
-int ringbuffer_read(struct hv_ring_buffer_info *ring_info,
+int hv_ringbuffer_read(struct hv_ring_buffer_info *ring_info,
void *buffer,
u32 buflen,
u32 offset);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 098/206] Staging: hv: Rename ringbuffer_peek
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
The subject line says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel.c | 4 ++--
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 859771c..d625517 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -885,7 +885,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
spin_lock_irqsave(&channel->inbound_lock, flags);
- ret = ringbuffer_peek(&channel->inbound, &desc,
+ ret = hv_ringbuffer_peek(&channel->inbound, &desc,
sizeof(struct vmpacket_descriptor));
if (ret != 0) {
spin_unlock_irqrestore(&channel->inbound_lock, flags);
@@ -938,7 +938,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,
spin_lock_irqsave(&channel->inbound_lock, flags);
- ret = ringbuffer_peek(&channel->inbound, &desc,
+ ret = hv_ringbuffer_peek(&channel->inbound, &desc,
sizeof(struct vmpacket_descriptor));
if (ret != 0) {
spin_unlock_irqrestore(&channel->inbound_lock, flags);
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 483678c..bf04397 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -418,13 +418,13 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
/*++
Name:
- ringbuffer_peek()
+ hv_ringbuffer_peek()
Description:
Read without advancing the read index
--*/
-int ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
+int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
void *Buffer, u32 buflen)
{
u32 bytes_avail_towrite;
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 5c17288..c684d97 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -85,7 +85,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *ring_info,
struct scatterlist *sglist,
u32 sgcount);
-int ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer,
+int hv_ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer,
u32 buflen);
int ringbuffer_read(struct hv_ring_buffer_info *ring_info,
--
1.7.4.1
^ permalink raw reply related
* [PATCH 097/206] Staging: hv: Rename ringbuffer_write
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Rename ringbuffer_write.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel.c | 6 +++---
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 44b81e8..859771c 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -718,7 +718,7 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
sg_set_buf(&bufferlist[2], &aligned_data,
packetlen_aligned - packetlen);
- ret = ringbuffer_write(&channel->outbound, bufferlist, 3);
+ ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);
/* TODO: We should determine if this is optional */
if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
@@ -783,7 +783,7 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
sg_set_buf(&bufferlist[2], &aligned_data,
packetlen_aligned - packetlen);
- ret = ringbuffer_write(&channel->outbound, bufferlist, 3);
+ ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);
/* TODO: We should determine if this is optional */
if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
@@ -848,7 +848,7 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
sg_set_buf(&bufferlist[2], &aligned_data,
packetlen_aligned - packetlen);
- ret = ringbuffer_write(&channel->outbound, bufferlist, 3);
+ ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3);
/* TODO: We should determine if this is optional */
if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 9bab40c..483678c 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -341,13 +341,13 @@ void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
/*++
Name:
- ringbuffer_write()
+ hv_ringbuffer_write()
Description:
Write to the ring buffer
--*/
-int ringbuffer_write(struct hv_ring_buffer_info *outring_info,
+int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
struct scatterlist *sglist, u32 sgcount)
{
int i = 0;
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 66d9a2d..5c17288 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -81,7 +81,7 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer,
void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);
-int ringbuffer_write(struct hv_ring_buffer_info *ring_info,
+int hv_ringbuffer_write(struct hv_ring_buffer_info *ring_info,
struct scatterlist *sglist,
u32 sgcount);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 096/206] Staging: hv: Rename ringbuffer_cleanup
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Rename ringbuffer_cleanup.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel.c | 8 ++++----
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 43e54b5..44b81e8 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -292,8 +292,8 @@ Cleanup:
return err;
errorout:
- ringbuffer_cleanup(&newchannel->outbound);
- ringbuffer_cleanup(&newchannel->inbound);
+ hv_ringbuffer_cleanup(&newchannel->outbound);
+ hv_ringbuffer_cleanup(&newchannel->inbound);
free_pages((unsigned long)out,
get_order(send_ringbuffer_size + recv_ringbuffer_size));
kfree(openInfo);
@@ -651,8 +651,8 @@ void vmbus_close(struct vmbus_channel *channel)
/* TODO: Send a msg to release the childRelId */
/* Cleanup the ring buffers for this channel */
- ringbuffer_cleanup(&channel->outbound);
- ringbuffer_cleanup(&channel->inbound);
+ hv_ringbuffer_cleanup(&channel->outbound);
+ hv_ringbuffer_cleanup(&channel->inbound);
free_pages((unsigned long)channel->ringbuffer_pages,
get_order(channel->ringbuffer_pagecount * PAGE_SIZE));
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 9653ab5..9bab40c 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -328,13 +328,13 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
/*++
Name:
- ringbuffer_cleanup()
+ hv_ringbuffer_cleanup()
Description:
Cleanup the ring buffer
--*/
-void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
+void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
{
}
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 3c66dc0..66d9a2d 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -79,7 +79,7 @@ struct hv_ring_buffer_debug_info {
int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer,
u32 buflen);
-void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);
+void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);
int ringbuffer_write(struct hv_ring_buffer_info *ring_info,
struct scatterlist *sglist,
--
1.7.4.1
^ permalink raw reply related
* [PATCH 095/206] Staging: hv: Rename the function ringbuffer_init
From: K. Y. Srinivasan @ 2011-05-09 21:56 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1304978288-22999-1-git-send-email-kys@microsoft.com>
Rename the function ringbuffer_init to not pollute the
namespace.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/channel.c | 7 +++++--
drivers/staging/hv/ring_buffer.c | 4 ++--
drivers/staging/hv/ring_buffer.h | 3 ++-
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index b53be58..43e54b5 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -201,13 +201,16 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
newchannel->ringbuffer_pagecount = (send_ringbuffer_size +
recv_ringbuffer_size) >> PAGE_SHIFT;
- ret = ringbuffer_init(&newchannel->outbound, out, send_ringbuffer_size);
+ ret = hv_ringbuffer_init(
+ &newchannel->outbound, out, send_ringbuffer_size);
+
if (ret != 0) {
err = ret;
goto errorout;
}
- ret = ringbuffer_init(&newchannel->inbound, in, recv_ringbuffer_size);
+ ret = hv_ringbuffer_init(
+ &newchannel->inbound, in, recv_ringbuffer_size);
if (ret != 0) {
err = ret;
goto errorout;
diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c
index 66e1b3f..9653ab5 100644
--- a/drivers/staging/hv/ring_buffer.c
+++ b/drivers/staging/hv/ring_buffer.c
@@ -299,13 +299,13 @@ u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi)
/*++
Name:
- ringbuffer_init()
+ hv_ringbuffer_init()
Description:
Initialize the ring buffer
--*/
-int ringbuffer_init(struct hv_ring_buffer_info *ring_info,
+int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
void *buffer, u32 buflen)
{
if (sizeof(struct hv_ring_buffer) != PAGE_SIZE)
diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h
index 7bf20d6..3c66dc0 100644
--- a/drivers/staging/hv/ring_buffer.h
+++ b/drivers/staging/hv/ring_buffer.h
@@ -18,6 +18,7 @@
* Authors:
* Haiyang Zhang <haiyangz@microsoft.com>
* Hank Janssen <hjanssen@microsoft.com>
+ * K. Y. Srinivasan <kys@microsoft.com>
*
*/
@@ -75,7 +76,7 @@ struct hv_ring_buffer_debug_info {
/* Interface */
-int ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer,
+int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer,
u32 buflen);
void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);
--
1.7.4.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox