Drivers: hv: Implement routines for read side signaling optimization

Implement functions that will support read-side signaling optimization.
By having the reader indicate the start of the "read" operation and the
"end" of the read operation we can more efficiently handle the signaling
protocol: while the read is in progress, there is no need for the "writer"
to signal the "reader" as new items are put on the read queue.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
K. Y. Srinivasan
2012-12-01 06:46:32 -08:00
committed by Greg Kroah-Hartman
parent 0bffd25ce9
commit 6fdf3b2143
2 changed files with 28 additions and 0 deletions

View File

@@ -29,6 +29,30 @@
#include "hyperv_vmbus.h"
void hv_begin_read(struct hv_ring_buffer_info *rbi)
{
rbi->ring_buffer->interrupt_mask = 1;
smp_mb();
}
u32 hv_end_read(struct hv_ring_buffer_info *rbi)
{
u32 read;
u32 write;
rbi->ring_buffer->interrupt_mask = 0;
smp_mb();
/*
* Now check to see if the ring buffer is still empty.
* If it is not, we raced and we need to process new
* incoming messages.
*/
hv_get_ringbuffer_availbytes(rbi, &read, &write);
return read;
}
/*
* hv_get_next_write_location()