diff options
Diffstat (limited to 'include/linux/hyperv.h')
| -rw-r--r-- | include/linux/hyperv.h | 12 |
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 { | |||
| 120 | struct hv_ring_buffer_info { | 121 | struct 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 | ||
| 159 | static 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. |
