diff options
-rw-r--r-- | drivers/staging/hv/channel_mgmt.h | 4 | ||||
-rw-r--r-- | drivers/staging/hv/ring_buffer.c | 45 | ||||
-rw-r--r-- | drivers/staging/hv/ring_buffer.h | 23 |
3 files changed, 37 insertions, 35 deletions
diff --git a/drivers/staging/hv/channel_mgmt.h b/drivers/staging/hv/channel_mgmt.h index cf7f1d205c13..f969267895be 100644 --- a/drivers/staging/hv/channel_mgmt.h +++ b/drivers/staging/hv/channel_mgmt.h @@ -247,8 +247,8 @@ struct vmbus_channel { /* Allocated memory for ring buffer */ void *RingBufferPages; u32 RingBufferPageCount; - RING_BUFFER_INFO Outbound; /* send to parent */ - RING_BUFFER_INFO Inbound; /* receive from parent */ + struct hv_ring_buffer_info Outbound; /* send to parent */ + struct hv_ring_buffer_info Inbound; /* receive from parent */ spinlock_t inbound_lock; struct workqueue_struct *ControlWQ; diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c index ac8cb69147c4..f4efe7feee94 100644 --- a/drivers/staging/hv/ring_buffer.c +++ b/drivers/staging/hv/ring_buffer.c @@ -46,7 +46,7 @@ Description: --*/ static inline void -GetRingBufferAvailBytes(RING_BUFFER_INFO *rbi, u32 *read, u32 *write) +GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write) { u32 read_loc, write_loc; @@ -68,7 +68,7 @@ Description: --*/ static inline u32 -GetNextWriteLocation(RING_BUFFER_INFO *RingInfo) +GetNextWriteLocation(struct hv_ring_buffer_info *RingInfo) { u32 next = RingInfo->RingBuffer->WriteIndex; @@ -87,7 +87,8 @@ Description: --*/ static inline void -SetNextWriteLocation(RING_BUFFER_INFO *RingInfo, u32 NextWriteLocation) +SetNextWriteLocation(struct hv_ring_buffer_info *RingInfo, + u32 NextWriteLocation) { RingInfo->RingBuffer->WriteIndex = NextWriteLocation; } @@ -102,7 +103,7 @@ Description: --*/ static inline u32 -GetNextReadLocation(RING_BUFFER_INFO *RingInfo) +GetNextReadLocation(struct hv_ring_buffer_info *RingInfo) { u32 next = RingInfo->RingBuffer->ReadIndex; @@ -122,7 +123,7 @@ Description: --*/ static inline u32 -GetNextReadLocationWithOffset(RING_BUFFER_INFO *RingInfo, u32 Offset) +GetNextReadLocationWithOffset(struct hv_ring_buffer_info *RingInfo, u32 Offset) { u32 next = RingInfo->RingBuffer->ReadIndex; @@ -143,7 +144,7 @@ Description: --*/ static inline void -SetNextReadLocation(RING_BUFFER_INFO *RingInfo, u32 NextReadLocation) +SetNextReadLocation(struct hv_ring_buffer_info *RingInfo, u32 NextReadLocation) { RingInfo->RingBuffer->ReadIndex = NextReadLocation; } @@ -159,7 +160,7 @@ Description: --*/ static inline void * -GetRingBuffer(RING_BUFFER_INFO *RingInfo) +GetRingBuffer(struct hv_ring_buffer_info *RingInfo) { return (void *)RingInfo->RingBuffer->Buffer; } @@ -175,7 +176,7 @@ Description: --*/ static inline u32 -GetRingBufferSize(RING_BUFFER_INFO *RingInfo) +GetRingBufferSize(struct hv_ring_buffer_info *RingInfo) { return RingInfo->RingDataSize; } @@ -190,7 +191,7 @@ Description: --*/ static inline u64 -GetRingBufferIndices(RING_BUFFER_INFO *RingInfo) +GetRingBufferIndices(struct hv_ring_buffer_info *RingInfo) { return ((u64)RingInfo->RingBuffer->WriteIndex << 32) || RingInfo->RingBuffer->ReadIndex; @@ -206,7 +207,7 @@ Description: Dump out to console the ring buffer info --*/ -void DumpRingInfo(RING_BUFFER_INFO *RingInfo, char *Prefix) +void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix) { u32 bytesAvailToWrite; u32 bytesAvailToRead; @@ -233,14 +234,14 @@ void DumpRingInfo(RING_BUFFER_INFO *RingInfo, char *Prefix) static u32 CopyToRingBuffer( - RING_BUFFER_INFO *RingInfo, + struct hv_ring_buffer_info *RingInfo, u32 StartWriteOffset, void *Src, u32 SrcLen); static u32 CopyFromRingBuffer( - RING_BUFFER_INFO *RingInfo, + struct hv_ring_buffer_info *RingInfo, void *Dest, u32 DestLen, u32 StartReadOffset); @@ -256,7 +257,7 @@ Description: Get various debug metrics for the specified ring buffer --*/ -void RingBufferGetDebugInfo(RING_BUFFER_INFO *RingInfo, +void RingBufferGetDebugInfo(struct hv_ring_buffer_info *RingInfo, struct hv_ring_buffer_debug_info *debug_info) { u32 bytesAvailToWrite; @@ -285,7 +286,7 @@ Description: Get the interrupt mask for the specified ring buffer --*/ -u32 GetRingBufferInterruptMask(RING_BUFFER_INFO *rbi) +u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi) { return rbi->RingBuffer->InterruptMask; } @@ -299,12 +300,12 @@ Description: Initialize the ring buffer --*/ -int RingBufferInit(RING_BUFFER_INFO *RingInfo, void *Buffer, u32 BufferLen) +int RingBufferInit(struct hv_ring_buffer_info *RingInfo, void *Buffer, u32 BufferLen) { if (sizeof(RING_BUFFER) != PAGE_SIZE) return -EINVAL; - memset(RingInfo, 0, sizeof(RING_BUFFER_INFO)); + memset(RingInfo, 0, sizeof(struct hv_ring_buffer_info)); RingInfo->RingBuffer = (RING_BUFFER *)Buffer; RingInfo->RingBuffer->ReadIndex = RingInfo->RingBuffer->WriteIndex = 0; @@ -326,7 +327,7 @@ Description: Cleanup the ring buffer --*/ -void RingBufferCleanup(RING_BUFFER_INFO *RingInfo) +void RingBufferCleanup(struct hv_ring_buffer_info *RingInfo) { } @@ -339,7 +340,7 @@ Description: Write to the ring buffer --*/ -int RingBufferWrite(RING_BUFFER_INFO *OutRingInfo, +int RingBufferWrite(struct hv_ring_buffer_info *OutRingInfo, struct scatterlist *sglist, u32 sgcount) { int i = 0; @@ -424,7 +425,7 @@ Description: Read without advancing the read index --*/ -int RingBufferPeek(RING_BUFFER_INFO *InRingInfo, void *Buffer, u32 BufferLen) +int RingBufferPeek(struct hv_ring_buffer_info *InRingInfo, void *Buffer, u32 BufferLen) { u32 bytesAvailToWrite; u32 bytesAvailToRead; @@ -473,7 +474,7 @@ Description: Read and advance the read index --*/ -int RingBufferRead(RING_BUFFER_INFO *InRingInfo, void *Buffer, +int RingBufferRead(struct hv_ring_buffer_info *InRingInfo, void *Buffer, u32 BufferLen, u32 Offset) { u32 bytesAvailToWrite; @@ -548,7 +549,7 @@ Description: --*/ static u32 CopyToRingBuffer( - RING_BUFFER_INFO *RingInfo, + struct hv_ring_buffer_info *RingInfo, u32 StartWriteOffset, void *Src, u32 SrcLen) @@ -586,7 +587,7 @@ Description: --*/ static u32 CopyFromRingBuffer( - RING_BUFFER_INFO *RingInfo, + struct hv_ring_buffer_info *RingInfo, void *Dest, u32 DestLen, u32 StartReadOffset) diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h index 64a6989ec0a5..2d941f3eab0c 100644 --- a/drivers/staging/hv/ring_buffer.h +++ b/drivers/staging/hv/ring_buffer.h @@ -53,15 +53,14 @@ typedef struct _RING_BUFFER { u8 Buffer[0]; } __attribute__((packed)) RING_BUFFER; -typedef struct _RING_BUFFER_INFO { +struct hv_ring_buffer_info { RING_BUFFER *RingBuffer; u32 RingSize; /* Include the shared header */ spinlock_t ring_lock; u32 RingDataSize; /* < ringSize */ u32 RingDataStartOffset; - -} RING_BUFFER_INFO; +}; struct hv_ring_buffer_debug_info { u32 CurrentInterruptMask; @@ -76,26 +75,28 @@ struct hv_ring_buffer_debug_info { /* Interface */ -int RingBufferInit(RING_BUFFER_INFO *RingInfo, void *Buffer, u32 BufferLen); +int RingBufferInit(struct hv_ring_buffer_info *RingInfo, void *Buffer, + u32 BufferLen); -void RingBufferCleanup(RING_BUFFER_INFO *RingInfo); +void RingBufferCleanup(struct hv_ring_buffer_info *RingInfo); -int RingBufferWrite(RING_BUFFER_INFO *RingInfo, +int RingBufferWrite(struct hv_ring_buffer_info *RingInfo, struct scatterlist *sglist, u32 sgcount); -int RingBufferPeek(RING_BUFFER_INFO *RingInfo, void *Buffer, u32 BufferLen); +int RingBufferPeek(struct hv_ring_buffer_info *RingInfo, void *Buffer, + u32 BufferLen); -int RingBufferRead(RING_BUFFER_INFO *RingInfo, +int RingBufferRead(struct hv_ring_buffer_info *RingInfo, void *Buffer, u32 BufferLen, u32 Offset); -u32 GetRingBufferInterruptMask(RING_BUFFER_INFO *RingInfo); +u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *RingInfo); -void DumpRingInfo(RING_BUFFER_INFO *RingInfo, char *Prefix); +void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix); -void RingBufferGetDebugInfo(RING_BUFFER_INFO *RingInfo, +void RingBufferGetDebugInfo(struct hv_ring_buffer_info *RingInfo, struct hv_ring_buffer_debug_info *debug_info); #endif /* _RING_BUFFER_H_ */ |