diff options
-rw-r--r-- | drivers/hv/channel.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index fddd3b5e59a9..54da66dc7d16 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c | |||
@@ -611,7 +611,19 @@ int vmbus_sendpacket_ctl(struct vmbus_channel *channel, void *buffer, | |||
611 | 611 | ||
612 | ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3, &signal); | 612 | ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3, &signal); |
613 | 613 | ||
614 | if ((ret == 0) && kick_q && signal) | 614 | /* |
615 | * Signalling the host is conditional on many factors: | ||
616 | * 1. The ring state changed from being empty to non-empty. | ||
617 | * This is tracked by the variable "signal". | ||
618 | * 2. The variable kick_q tracks if more data will be placed | ||
619 | * on the ring. We will not signal if more data is | ||
620 | * to be placed. | ||
621 | * | ||
622 | * If we cannot write to the ring-buffer; signal the host | ||
623 | * even if we may not have written anything. This is a rare | ||
624 | * enough condition that it should not matter. | ||
625 | */ | ||
626 | if (((ret == 0) && kick_q && signal) || (ret)) | ||
615 | vmbus_setevent(channel); | 627 | vmbus_setevent(channel); |
616 | 628 | ||
617 | return ret; | 629 | return ret; |
@@ -702,7 +714,19 @@ int vmbus_sendpacket_pagebuffer_ctl(struct vmbus_channel *channel, | |||
702 | 714 | ||
703 | ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3, &signal); | 715 | ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3, &signal); |
704 | 716 | ||
705 | if ((ret == 0) && kick_q && signal) | 717 | /* |
718 | * Signalling the host is conditional on many factors: | ||
719 | * 1. The ring state changed from being empty to non-empty. | ||
720 | * This is tracked by the variable "signal". | ||
721 | * 2. The variable kick_q tracks if more data will be placed | ||
722 | * on the ring. We will not signal if more data is | ||
723 | * to be placed. | ||
724 | * | ||
725 | * If we cannot write to the ring-buffer; signal the host | ||
726 | * even if we may not have written anything. This is a rare | ||
727 | * enough condition that it should not matter. | ||
728 | */ | ||
729 | if (((ret == 0) && kick_q && signal) || (ret)) | ||
706 | vmbus_setevent(channel); | 730 | vmbus_setevent(channel); |
707 | 731 | ||
708 | return ret; | 732 | return ret; |