aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2016-11-06 16:14:18 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-07 04:01:18 -0500
commit3372592a140db69fd63837e81f048ab4abf8111e (patch)
treee98a51a7fcedba1a35564466daf3a59bc0af80b0 /drivers
parent1f6ee4e7d83586c8b10bd4f2f4346353d04ce884 (diff)
Drivers: hv: vmbus: On the read path cleanup the logic to interrupt the host
Signal the host when we determine the host is to be signaled - on th read path. The currrent code determines the need to signal in the ringbuffer code and actually issues the signal elsewhere. This can result in the host viewing this interrupt as spurious since the host may also poll the channel. Make the necessary adjustments. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hv/channel.c11
-rw-r--r--drivers/hv/hyperv_vmbus.h4
-rw-r--r--drivers/hv/ring_buffer.c7
3 files changed, 8 insertions, 14 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 8a8148f7b842..5fb4c6d9209b 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -879,16 +879,9 @@ __vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
879 u32 bufferlen, u32 *buffer_actual_len, u64 *requestid, 879 u32 bufferlen, u32 *buffer_actual_len, u64 *requestid,
880 bool raw) 880 bool raw)
881{ 881{
882 int ret; 882 return hv_ringbuffer_read(channel, buffer, bufferlen,
883 bool signal = false; 883 buffer_actual_len, requestid, raw);
884
885 ret = hv_ringbuffer_read(&channel->inbound, buffer, bufferlen,
886 buffer_actual_len, requestid, &signal, raw);
887 884
888 if (signal)
889 vmbus_setevent(channel);
890
891 return ret;
892} 885}
893 886
894int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, 887int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 2d42ebe2af6c..0675b395ce5c 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -532,9 +532,9 @@ int hv_ringbuffer_write(struct vmbus_channel *channel,
532 u32 kv_count, bool lock, 532 u32 kv_count, bool lock,
533 bool kick_q); 533 bool kick_q);
534 534
535int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, 535int hv_ringbuffer_read(struct vmbus_channel *channel,
536 void *buffer, u32 buflen, u32 *buffer_actual_len, 536 void *buffer, u32 buflen, u32 *buffer_actual_len,
537 u64 *requestid, bool *signal, bool raw); 537 u64 *requestid, bool raw);
538 538
539void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, 539void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
540 struct hv_ring_buffer_debug_info *debug_info); 540 struct hv_ring_buffer_debug_info *debug_info);
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 4af71306d0ff..cd49cb17eb7f 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -353,9 +353,9 @@ int hv_ringbuffer_write(struct vmbus_channel *channel,
353 return 0; 353 return 0;
354} 354}
355 355
356int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, 356int hv_ringbuffer_read(struct vmbus_channel *channel,
357 void *buffer, u32 buflen, u32 *buffer_actual_len, 357 void *buffer, u32 buflen, u32 *buffer_actual_len,
358 u64 *requestid, bool *signal, bool raw) 358 u64 *requestid, bool raw)
359{ 359{
360 u32 bytes_avail_toread; 360 u32 bytes_avail_toread;
361 u32 next_read_location = 0; 361 u32 next_read_location = 0;
@@ -364,6 +364,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info,
364 u32 offset; 364 u32 offset;
365 u32 packetlen; 365 u32 packetlen;
366 int ret = 0; 366 int ret = 0;
367 struct hv_ring_buffer_info *inring_info = &channel->inbound;
367 368
368 if (buflen <= 0) 369 if (buflen <= 0)
369 return -EINVAL; 370 return -EINVAL;
@@ -421,7 +422,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info,
421 /* Update the read index */ 422 /* Update the read index */
422 hv_set_next_read_location(inring_info, next_read_location); 423 hv_set_next_read_location(inring_info, next_read_location);
423 424
424 *signal = hv_need_to_signal_on_read(inring_info); 425 hv_signal_on_read(channel);
425 426
426 return ret; 427 return ret;
427} 428}