scsi: vmbus: Add function to report available ring buffer to write in total ring size percentage

Netvsc has a function to calculate how much ring buffer in percentage is
available to write. This function is also useful for storvsc and other
vmbus devices.

Define a similar function in vmbus to be used by other vmbus devices.

Signed-off-by: Long Li <[email protected]>
Acked-by: David S. Miller <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
This commit is contained in:
Long Li 2018-03-27 17:48:38 -07:00 • committed by Martin K. Petersen
commit 63273cb401
2 changed files with 14 additions and 0 deletions

View file

@ -227,6 +227,8 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
ring_info->ring_buffer->feature_bits.value = 1;
ring_info->ring_size = page_cnt << PAGE_SHIFT;
ring_info->ring_size_div10_reciprocal =
reciprocal_value(ring_info->ring_size / 10);
ring_info->ring_datasize = ring_info->ring_size -
sizeof(struct hv_ring_buffer);