Commit ae6935ed authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Greg Kroah-Hartman

vmbus: split ring buffer allocation from open

The UIO driver needs the ring buffer to be persistent(reused)
across open/close. Split the allocation and setup of ring buffer
out of vmbus_open. For normal usage vmbus_open/vmbus_close there
are no changes; only impacts uio_hv_generic which needs to keep
ring buffer memory and reuse when application restarts.
Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 52a42c2a
This diff is collapsed.
...@@ -241,6 +241,7 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, ...@@ -241,6 +241,7 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info) void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
{ {
vunmap(ring_info->ring_buffer); vunmap(ring_info->ring_buffer);
ring_info->ring_buffer = NULL;
} }
/* Write to the ring buffer. */ /* Write to the ring buffer. */
......
...@@ -741,6 +741,7 @@ struct vmbus_channel { ...@@ -741,6 +741,7 @@ struct vmbus_channel {
/* Allocated memory for ring buffer */ /* Allocated memory for ring buffer */
struct page *ringbuffer_page; struct page *ringbuffer_page;
u32 ringbuffer_pagecount; u32 ringbuffer_pagecount;
u32 ringbuffer_send_offset;
struct hv_ring_buffer_info outbound; /* send to parent */ struct hv_ring_buffer_info outbound; /* send to parent */
struct hv_ring_buffer_info inbound; /* receive from parent */ struct hv_ring_buffer_info inbound; /* receive from parent */
...@@ -1021,6 +1022,14 @@ struct vmbus_packet_mpb_array { ...@@ -1021,6 +1022,14 @@ struct vmbus_packet_mpb_array {
struct hv_mpb_array range; struct hv_mpb_array range;
} __packed; } __packed;
int vmbus_alloc_ring(struct vmbus_channel *channel,
u32 send_size, u32 recv_size);
void vmbus_free_ring(struct vmbus_channel *channel);
int vmbus_connect_ring(struct vmbus_channel *channel,
void (*onchannel_callback)(void *context),
void *context);
int vmbus_disconnect_ring(struct vmbus_channel *channel);
extern int vmbus_open(struct vmbus_channel *channel, extern int vmbus_open(struct vmbus_channel *channel,
u32 send_ringbuffersize, u32 send_ringbuffersize,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment