[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1473737481-21939-1-git-send-email-longli@exchange.microsoft.com>
Date: Mon, 12 Sep 2016 20:31:21 -0700
From: Long Li <longli@...hange.microsoft.com>
To: "K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>
Cc: devel@...uxdriverproject.org, linux-kernel@...r.kernel.org,
Long Li <longli@...rosoft.com>
Subject: [PATCH] hv: do not lose pending heartbeat vmbus packets
From: Long Li <longli@...rosoft.com>
The host keeps sending heartbeat packets independent of guest responding to them. In some situations, there might be multiple heartbeat packets pending in the ring buffer. Don't lose them, read them all.
Signed-off-by: Long Li <longli@...rosoft.com>
---
drivers/hv/hv_util.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index d5acaa2..9dc6372 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -283,10 +283,14 @@ static void heartbeat_onchannelcallback(void *context)
u8 *hbeat_txf_buf = util_heartbeat.recv_buffer;
struct icmsg_negotiate *negop = NULL;
- vmbus_recvpacket(channel, hbeat_txf_buf,
- PAGE_SIZE, &recvlen, &requestid);
+ while (1) {
+
+ vmbus_recvpacket(channel, hbeat_txf_buf,
+ PAGE_SIZE, &recvlen, &requestid);
+
+ if (!recvlen)
+ break;
- if (recvlen > 0) {
icmsghdrp = (struct icmsg_hdr *)&hbeat_txf_buf[
sizeof(struct vmbuspipe_hdr)];
--
1.8.5.6
Powered by blists - more mailing lists