]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
vmbus: expose hv_begin/end_read
authorStephen Hemminger <stephen@networkplumber.org>
Sun, 12 Feb 2017 06:02:23 +0000 (23:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Feb 2017 18:20:35 +0000 (10:20 -0800)
In order to implement NAPI in netvsc, the driver needs access to
control host interrupt mask.

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

index 6a9b546772189590e08162ab0d56330b1f417684..e15a130de3c911702a564efb2774ca5123ce1005 100644 (file)
@@ -292,10 +292,6 @@ int hv_ringbuffer_read(struct vmbus_channel *channel,
 void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
                            struct hv_ring_buffer_debug_info *debug_info);
 
-void hv_begin_read(struct hv_ring_buffer_info *rbi);
-
-u32 hv_end_read(struct hv_ring_buffer_info *rbi);
-
 /*
  * Maximum channels is determined by the size of the interrupt page
  * which is PAGE_SIZE. 1/2 of PAGE_SIZE is for send endpoint interrupt
index 1a1e70a4514668e2b94df730d1e94fe900c701d6..75c9eefd55b50443cecdae70764d7efe289732ec 100644 (file)
 
 #include "hyperv_vmbus.h"
 
-void hv_begin_read(struct hv_ring_buffer_info *rbi)
-{
-       rbi->ring_buffer->interrupt_mask = 1;
-       virt_mb();
-}
-
-u32 hv_end_read(struct hv_ring_buffer_info *rbi)
-{
-
-       rbi->ring_buffer->interrupt_mask = 0;
-       virt_mb();
-
-       /*
-        * Now check to see if the ring buffer is still empty.
-        * If it is not, we raced and we need to process new
-        * incoming messages.
-        */
-       return hv_get_bytes_to_read(rbi);
-}
-
 /*
  * When we write to the ring buffer, check if the host needs to
  * be signaled. Here is the details of this protocol:
index 466374dbc98fc95fbb2b64682b5e8824676da26c..08eb71a22c1422a43e6fc0225039a5e0c3d25d9f 100644 (file)
@@ -1512,6 +1512,36 @@ init_cached_read_index(struct vmbus_channel *channel)
        rbi->cached_read_index = rbi->ring_buffer->read_index;
 }
 
+/*
+ * Mask off host interrupt callback notifications
+ */
+static inline void hv_begin_read(struct hv_ring_buffer_info *rbi)
+{
+       rbi->ring_buffer->interrupt_mask = 1;
+
+       /* make sure mask update is not reordered */
+       virt_mb();
+}
+
+/*
+ * Re-enable host callback and return number of outstanding bytes
+ */
+static inline u32 hv_end_read(struct hv_ring_buffer_info *rbi)
+{
+
+       rbi->ring_buffer->interrupt_mask = 0;
+
+       /* make sure mask update is not reordered */
+       virt_mb();
+
+       /*
+        * Now check to see if the ring buffer is still empty.
+        * If it is not, we raced and we need to process new
+        * incoming messages.
+        */
+       return hv_get_bytes_to_read(rbi);
+}
+
 /*
  * An API to support in-place processing of incoming VMBUS packets.
  */