]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Drivers: hv: vmbus: Suport an API to send pagebuffers with additional control
authorK. Y. Srinivasan <kys@microsoft.com>
Sat, 28 Feb 2015 19:39:03 +0000 (11:39 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Mar 2015 03:31:47 +0000 (19:31 -0800)
Implement an API for sending pagebuffers that gives more control to the client
in terms of setting the vmbus flags as well as deciding when to
notify the host. This will be useful for enabling batch processing.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/channel.c
include/linux/hyperv.h

index 9b79aca7e565d6fe0d915d00071e9daaca3edd0b..f060d1f7bc991e8f03cecd2c2d703184d3863644 100644 (file)
@@ -636,13 +636,18 @@ int vmbus_sendpacket(struct vmbus_channel *channel, void *buffer,
 EXPORT_SYMBOL(vmbus_sendpacket);
 
 /*
- * vmbus_sendpacket_pagebuffer - Send a range of single-page buffer
- * packets using a GPADL Direct packet type.
+ * vmbus_sendpacket_pagebuffer_ctl - Send a range of single-page buffer
+ * packets using a GPADL Direct packet type. This interface allows you
+ * to control notifying the host. This will be useful for sending
+ * batched data. Also the sender can control the send flags
+ * explicitly.
  */
-int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
+int vmbus_sendpacket_pagebuffer_ctl(struct vmbus_channel *channel,
                                     struct hv_page_buffer pagebuffers[],
                                     u32 pagecount, void *buffer, u32 bufferlen,
-                                    u64 requestid)
+                                    u64 requestid,
+                                    u32 flags,
+                                    bool kick_q)
 {
        int ret;
        int i;
@@ -670,7 +675,7 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
 
        /* Setup the descriptor */
        desc.type = VM_PKT_DATA_USING_GPA_DIRECT;
-       desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
+       desc.flags = flags;
        desc.dataoffset8 = descsize >> 3; /* in 8-bytes grandularity */
        desc.length8 = (u16)(packetlen_aligned >> 3);
        desc.transactionid = requestid;
@@ -691,11 +696,27 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
 
        ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3, &signal);
 
-       if (ret == 0 && signal)
+       if ((ret == 0) && kick_q && signal)
                vmbus_setevent(channel);
 
        return ret;
 }
+
+/*
+ * vmbus_sendpacket_pagebuffer - Send a range of single-page buffer
+ * packets using a GPADL Direct packet type.
+ */
+int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
+                                    struct hv_page_buffer pagebuffers[],
+                                    u32 pagecount, void *buffer, u32 bufferlen,
+                                    u64 requestid)
+{
+       u32 flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
+       return vmbus_sendpacket_pagebuffer_ctl(channel, pagebuffers, pagecount,
+                                              buffer, bufferlen, requestid,
+                                              flags, true);
+
+}
 EXPORT_SYMBOL_GPL(vmbus_sendpacket_pagebuffer);
 
 /*
index 1ca582457076320d852aaf408ee0c69dbe349021..86e1a7a46af3f24514cf80293fade1ff06b1e200 100644 (file)
@@ -874,6 +874,15 @@ extern int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
                                            u32 bufferlen,
                                            u64 requestid);
 
+extern int vmbus_sendpacket_pagebuffer_ctl(struct vmbus_channel *channel,
+                                          struct hv_page_buffer pagebuffers[],
+                                          u32 pagecount,
+                                          void *buffer,
+                                          u32 bufferlen,
+                                          u64 requestid,
+                                          u32 flags,
+                                          bool kick_q);
+
 extern int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
                                        struct hv_multipage_buffer *mpb,
                                        void *buffer,