|
@@ -25,6 +25,7 @@
|
|
|
#include <linux/kernel.h>
|
|
|
#include <linux/sched.h>
|
|
|
#include <linux/wait.h>
|
|
|
+#include <linux/delay.h>
|
|
|
#include <linux/mm.h>
|
|
|
#include <linux/slab.h>
|
|
|
#include <linux/vmalloc.h>
|
|
@@ -268,10 +269,25 @@ void vmbus_on_event(unsigned long data)
|
|
|
int vmbus_post_msg(void *buffer, size_t buflen)
|
|
|
{
|
|
|
union hv_connection_id conn_id;
|
|
|
+ int ret = 0;
|
|
|
+ int retries = 0;
|
|
|
|
|
|
conn_id.asu32 = 0;
|
|
|
conn_id.u.id = VMBUS_MESSAGE_CONNECTION_ID;
|
|
|
- return hv_post_message(conn_id, 1, buffer, buflen);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * hv_post_message() can have transient failures because of
|
|
|
+ * insufficient resources. Retry the operation a couple of
|
|
|
+ * times before giving up.
|
|
|
+ */
|
|
|
+ while (retries < 3) {
|
|
|
+ ret = hv_post_message(conn_id, 1, buffer, buflen);
|
|
|
+ if (ret != HV_STATUS_INSUFFICIENT_BUFFERS)
|
|
|
+ return ret;
|
|
|
+ retries++;
|
|
|
+ msleep(100);
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
/*
|