public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HV: properly delay KVP packets when negotiation is in progress
@ 2017-03-16 19:51 Long Li
  2017-03-16 20:06 ` Joshua R. Poulson
  2017-03-17 16:15 ` Vitaly Kuznetsov
  0 siblings, 2 replies; 5+ messages in thread
From: Long Li @ 2017-03-16 19:51 UTC (permalink / raw)
  To: KY Srinivasan, Haiyang Zhang, Stephen Hemminger
  Cc: devel@linuxdriverproject.org, linux-kernel@vger.kernel.org

The host may send multiple KVP packets before the negotiation with daemon
is finished. We need to keep those packets in ring buffer until the daemon
is negotiated and connected.

This patch is based on the work of Nick Meier <Nick.Meier@microsoft.com>

Signed-off-by: Long Li <longli@microsoft.com>
---
 drivers/hv/hv_kvp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
index de26371..b9f928d 100644
--- a/drivers/hv/hv_kvp.c
+++ b/drivers/hv/hv_kvp.c
@@ -628,16 +628,17 @@ void hv_kvp_onchannelcallback(void *context)
 		     NEGO_IN_PROGRESS,
 		     NEGO_FINISHED} host_negotiatied = NEGO_NOT_STARTED;
 
-	if (host_negotiatied == NEGO_NOT_STARTED &&
-	    kvp_transaction.state < HVUTIL_READY) {
+	if (kvp_transaction.state < HVUTIL_READY) {
 		/*
 		 * If userspace daemon is not connected and host is asking
 		 * us to negotiate we need to delay to not lose messages.
 		 * This is important for Failover IP setting.
 		 */
-		host_negotiatied = NEGO_IN_PROGRESS;
-		schedule_delayed_work(&kvp_host_handshake_work,
+		if (host_negotiatied == NEGO_NOT_STARTED) {
+			host_negotiatied = NEGO_IN_PROGRESS;
+			schedule_delayed_work(&kvp_host_handshake_work,
 				      HV_UTIL_NEGO_TIMEOUT * HZ);
+		}
 		return;
 	}
 	if (kvp_transaction.state > HVUTIL_READY)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-20 23:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-16 19:51 [PATCH] HV: properly delay KVP packets when negotiation is in progress Long Li
2017-03-16 20:06 ` Joshua R. Poulson
2017-03-17 16:15 ` Vitaly Kuznetsov
2017-03-20  2:49   ` Long Li
2017-03-20 22:44     ` Long Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox