aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hyperv.h
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2018-08-20 12:05:17 -0400
committerJiri Kosina <jkosina@suse.cz>2018-08-20 12:05:17 -0400
commit415d2b3392d7a80903e0f97f051201aa02bf20e9 (patch)
tree47492d2386a0e7f00ef645313cb44ae4960b7e7e /include/linux/hyperv.h
parent4f65245f2d178b9cba48350620d76faa4a098841 (diff)
parentb8e759b8f6dab1c473c30ac12709095d0b81078e (diff)
Merge branch 'for-4.19/cougar' into for-linus
New device support for hid-cougar
Diffstat (limited to 'include/linux/hyperv.h')
-rw-r--r--include/linux/hyperv.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 11b5612dc066..3a3012f57be4 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -35,6 +35,7 @@
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/mod_devicetable.h> 36#include <linux/mod_devicetable.h>
37#include <linux/interrupt.h> 37#include <linux/interrupt.h>
38#include <linux/reciprocal_div.h>
38 39
39#define MAX_PAGE_BUFFER_COUNT 32 40#define MAX_PAGE_BUFFER_COUNT 32
40#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */ 41#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
@@ -120,6 +121,7 @@ struct hv_ring_buffer {
120struct hv_ring_buffer_info { 121struct hv_ring_buffer_info {
121 struct hv_ring_buffer *ring_buffer; 122 struct hv_ring_buffer *ring_buffer;
122 u32 ring_size; /* Include the shared header */ 123 u32 ring_size; /* Include the shared header */
124 struct reciprocal_value ring_size_div10_reciprocal;
123 spinlock_t ring_lock; 125 spinlock_t ring_lock;
124 126
125 u32 ring_datasize; /* < ring_size */ 127 u32 ring_datasize; /* < ring_size */
@@ -154,6 +156,16 @@ static inline u32 hv_get_bytes_to_write(const struct hv_ring_buffer_info *rbi)
154 return write; 156 return write;
155} 157}
156 158
159static inline u32 hv_get_avail_to_write_percent(
160 const struct hv_ring_buffer_info *rbi)
161{
162 u32 avail_write = hv_get_bytes_to_write(rbi);
163
164 return reciprocal_divide(
165 (avail_write << 3) + (avail_write << 1),
166 rbi->ring_size_div10_reciprocal);
167}
168
157/* 169/*
158 * VMBUS version is 32 bit entity broken up into 170 * VMBUS version is 32 bit entity broken up into
159 * two 16 bit quantities: major_number. minor_number. 171 * two 16 bit quantities: major_number. minor_number.