staging: hv: Convert camel cased functions in ring_buffer.c to lower cases
staging: hv: Convert camel cased functions in ring_buffer.c to lower cases Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Hank Janssen <hjanssen@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Родитель
fc8c72ebfa
Коммит
1ac586445d
|
@ -155,8 +155,8 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
|
||||||
monitorpage->parameter[monitor_group]
|
monitorpage->parameter[monitor_group]
|
||||||
[monitor_offset].connectionid.u.id;
|
[monitor_offset].connectionid.u.id;
|
||||||
|
|
||||||
RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound);
|
ringbuffer_get_debuginfo(&channel->inbound, &debuginfo->inbound);
|
||||||
RingBufferGetDebugInfo(&channel->outbound, &debuginfo->outbound);
|
ringbuffer_get_debuginfo(&channel->outbound, &debuginfo->outbound);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -193,13 +193,13 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
|
||||||
newchannel->ringbuffer_pagecount = (send_ringbuffer_size +
|
newchannel->ringbuffer_pagecount = (send_ringbuffer_size +
|
||||||
recv_ringbuffer_size) >> PAGE_SHIFT;
|
recv_ringbuffer_size) >> PAGE_SHIFT;
|
||||||
|
|
||||||
ret = RingBufferInit(&newchannel->outbound, out, send_ringbuffer_size);
|
ret = ringbuffer_init(&newchannel->outbound, out, send_ringbuffer_size);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
err = ret;
|
err = ret;
|
||||||
goto errorout;
|
goto errorout;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = RingBufferInit(&newchannel->inbound, in, recv_ringbuffer_size);
|
ret = ringbuffer_init(&newchannel->inbound, in, recv_ringbuffer_size);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
err = ret;
|
err = ret;
|
||||||
goto errorout;
|
goto errorout;
|
||||||
|
@ -298,8 +298,8 @@ Cleanup:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
errorout:
|
errorout:
|
||||||
RingBufferCleanup(&newchannel->outbound);
|
ringbuffer_cleanup(&newchannel->outbound);
|
||||||
RingBufferCleanup(&newchannel->inbound);
|
ringbuffer_cleanup(&newchannel->inbound);
|
||||||
osd_page_free(out, (send_ringbuffer_size + recv_ringbuffer_size)
|
osd_page_free(out, (send_ringbuffer_size + recv_ringbuffer_size)
|
||||||
>> PAGE_SHIFT);
|
>> PAGE_SHIFT);
|
||||||
kfree(openInfo);
|
kfree(openInfo);
|
||||||
|
@ -683,8 +683,8 @@ void vmbus_close(struct vmbus_channel *channel)
|
||||||
/* TODO: Send a msg to release the childRelId */
|
/* TODO: Send a msg to release the childRelId */
|
||||||
|
|
||||||
/* Cleanup the ring buffers for this channel */
|
/* Cleanup the ring buffers for this channel */
|
||||||
RingBufferCleanup(&channel->outbound);
|
ringbuffer_cleanup(&channel->outbound);
|
||||||
RingBufferCleanup(&channel->inbound);
|
ringbuffer_cleanup(&channel->inbound);
|
||||||
|
|
||||||
osd_page_free(channel->ringbuffer_pages, channel->ringbuffer_pagecount);
|
osd_page_free(channel->ringbuffer_pages, channel->ringbuffer_pagecount);
|
||||||
|
|
||||||
|
@ -752,10 +752,10 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
|
||||||
sg_set_buf(&bufferlist[2], &aligned_data,
|
sg_set_buf(&bufferlist[2], &aligned_data,
|
||||||
packetlen_aligned - packetlen);
|
packetlen_aligned - packetlen);
|
||||||
|
|
||||||
ret = RingBufferWrite(&channel->outbound, bufferlist, 3);
|
ret = ringbuffer_write(&channel->outbound, bufferlist, 3);
|
||||||
|
|
||||||
/* TODO: We should determine if this is optional */
|
/* TODO: We should determine if this is optional */
|
||||||
if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound))
|
if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
|
||||||
vmbus_setevent(channel);
|
vmbus_setevent(channel);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -817,10 +817,10 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
|
||||||
sg_set_buf(&bufferlist[2], &aligned_data,
|
sg_set_buf(&bufferlist[2], &aligned_data,
|
||||||
packetlen_aligned - packetlen);
|
packetlen_aligned - packetlen);
|
||||||
|
|
||||||
ret = RingBufferWrite(&channel->outbound, bufferlist, 3);
|
ret = ringbuffer_write(&channel->outbound, bufferlist, 3);
|
||||||
|
|
||||||
/* TODO: We should determine if this is optional */
|
/* TODO: We should determine if this is optional */
|
||||||
if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound))
|
if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
|
||||||
vmbus_setevent(channel);
|
vmbus_setevent(channel);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -886,10 +886,10 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
|
||||||
sg_set_buf(&bufferlist[2], &aligned_data,
|
sg_set_buf(&bufferlist[2], &aligned_data,
|
||||||
packetlen_aligned - packetlen);
|
packetlen_aligned - packetlen);
|
||||||
|
|
||||||
ret = RingBufferWrite(&channel->outbound, bufferlist, 3);
|
ret = ringbuffer_write(&channel->outbound, bufferlist, 3);
|
||||||
|
|
||||||
/* TODO: We should determine if this is optional */
|
/* TODO: We should determine if this is optional */
|
||||||
if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound))
|
if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound))
|
||||||
vmbus_setevent(channel);
|
vmbus_setevent(channel);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -923,7 +923,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
|
||||||
|
|
||||||
spin_lock_irqsave(&channel->inbound_lock, flags);
|
spin_lock_irqsave(&channel->inbound_lock, flags);
|
||||||
|
|
||||||
ret = RingBufferPeek(&channel->inbound, &desc,
|
ret = ringbuffer_peek(&channel->inbound, &desc,
|
||||||
sizeof(struct vmpacket_descriptor));
|
sizeof(struct vmpacket_descriptor));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
spin_unlock_irqrestore(&channel->inbound_lock, flags);
|
spin_unlock_irqrestore(&channel->inbound_lock, flags);
|
||||||
|
@ -956,7 +956,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
|
||||||
*requestid = desc.TransactionId;
|
*requestid = desc.TransactionId;
|
||||||
|
|
||||||
/* Copy over the packet to the user buffer */
|
/* Copy over the packet to the user buffer */
|
||||||
ret = RingBufferRead(&channel->inbound, buffer, userlen,
|
ret = ringbuffer_read(&channel->inbound, buffer, userlen,
|
||||||
(desc.DataOffset8 << 3));
|
(desc.DataOffset8 << 3));
|
||||||
|
|
||||||
spin_unlock_irqrestore(&channel->inbound_lock, flags);
|
spin_unlock_irqrestore(&channel->inbound_lock, flags);
|
||||||
|
@ -983,7 +983,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,
|
||||||
|
|
||||||
spin_lock_irqsave(&channel->inbound_lock, flags);
|
spin_lock_irqsave(&channel->inbound_lock, flags);
|
||||||
|
|
||||||
ret = RingBufferPeek(&channel->inbound, &desc,
|
ret = ringbuffer_peek(&channel->inbound, &desc,
|
||||||
sizeof(struct vmpacket_descriptor));
|
sizeof(struct vmpacket_descriptor));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
spin_unlock_irqrestore(&channel->inbound_lock, flags);
|
spin_unlock_irqrestore(&channel->inbound_lock, flags);
|
||||||
|
@ -1015,7 +1015,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,
|
||||||
*requestid = desc.TransactionId;
|
*requestid = desc.TransactionId;
|
||||||
|
|
||||||
/* Copy over the entire packet to the user buffer */
|
/* Copy over the entire packet to the user buffer */
|
||||||
ret = RingBufferRead(&channel->inbound, buffer, packetlen, 0);
|
ret = ringbuffer_read(&channel->inbound, buffer, packetlen, 0);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&channel->inbound_lock, flags);
|
spin_unlock_irqrestore(&channel->inbound_lock, flags);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1052,6 +1052,6 @@ void vmbus_ontimer(unsigned long data)
|
||||||
static void dump_vmbus_channel(struct vmbus_channel *channel)
|
static void dump_vmbus_channel(struct vmbus_channel *channel)
|
||||||
{
|
{
|
||||||
DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid);
|
DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid);
|
||||||
Dumpring_info(&channel->outbound, "Outbound ");
|
dump_ring_info(&channel->outbound, "Outbound ");
|
||||||
Dumpring_info(&channel->inbound, "Inbound ");
|
dump_ring_info(&channel->inbound, "Inbound ");
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
GetRingBufferAvailBytes()
|
get_ringbuffer_availbytes()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Get number of bytes available to read and to write to
|
Get number of bytes available to read and to write to
|
||||||
|
@ -46,7 +46,8 @@ Description:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
static inline void
|
static inline void
|
||||||
GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write)
|
get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
|
||||||
|
u32 *read, u32 *write)
|
||||||
{
|
{
|
||||||
u32 read_loc, write_loc;
|
u32 read_loc, write_loc;
|
||||||
|
|
||||||
|
@ -61,14 +62,14 @@ GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
GetNextWriteLocation()
|
get_next_write_location()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Get the next write location for the specified ring buffer
|
Get the next write location for the specified ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
static inline u32
|
static inline u32
|
||||||
GetNextWriteLocation(struct hv_ring_buffer_info *ring_info)
|
get_next_write_location(struct hv_ring_buffer_info *ring_info)
|
||||||
{
|
{
|
||||||
u32 next = ring_info->ring_buffer->write_index;
|
u32 next = ring_info->ring_buffer->write_index;
|
||||||
|
|
||||||
|
@ -80,14 +81,14 @@ GetNextWriteLocation(struct hv_ring_buffer_info *ring_info)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
SetNextWriteLocation()
|
set_next_write_location()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Set the next write location for the specified ring buffer
|
Set the next write location for the specified ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
static inline void
|
static inline void
|
||||||
SetNextWriteLocation(struct hv_ring_buffer_info *ring_info,
|
set_next_write_location(struct hv_ring_buffer_info *ring_info,
|
||||||
u32 next_write_location)
|
u32 next_write_location)
|
||||||
{
|
{
|
||||||
ring_info->ring_buffer->write_index = next_write_location;
|
ring_info->ring_buffer->write_index = next_write_location;
|
||||||
|
@ -96,14 +97,14 @@ SetNextWriteLocation(struct hv_ring_buffer_info *ring_info,
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
GetNextReadLocation()
|
get_next_read_location()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Get the next read location for the specified ring buffer
|
Get the next read location for the specified ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
static inline u32
|
static inline u32
|
||||||
GetNextReadLocation(struct hv_ring_buffer_info *ring_info)
|
get_next_read_location(struct hv_ring_buffer_info *ring_info)
|
||||||
{
|
{
|
||||||
u32 next = ring_info->ring_buffer->read_index;
|
u32 next = ring_info->ring_buffer->read_index;
|
||||||
|
|
||||||
|
@ -115,7 +116,7 @@ GetNextReadLocation(struct hv_ring_buffer_info *ring_info)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
GetNextReadLocationWithOffset()
|
get_next_readlocation_withoffset()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Get the next read location + offset for the specified ring buffer.
|
Get the next read location + offset for the specified ring buffer.
|
||||||
|
@ -123,7 +124,8 @@ Description:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
static inline u32
|
static inline u32
|
||||||
GetNextReadLocationWithOffset(struct hv_ring_buffer_info *ring_info, u32 offset)
|
get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
|
||||||
|
u32 offset)
|
||||||
{
|
{
|
||||||
u32 next = ring_info->ring_buffer->read_index;
|
u32 next = ring_info->ring_buffer->read_index;
|
||||||
|
|
||||||
|
@ -137,14 +139,14 @@ GetNextReadLocationWithOffset(struct hv_ring_buffer_info *ring_info, u32 offset)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
SetNextReadLocation()
|
set_next_read_location()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Set the next read location for the specified ring buffer
|
Set the next read location for the specified ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
static inline void
|
static inline void
|
||||||
SetNextReadLocation(struct hv_ring_buffer_info *ring_info,
|
set_next_read_location(struct hv_ring_buffer_info *ring_info,
|
||||||
u32 next_read_location)
|
u32 next_read_location)
|
||||||
{
|
{
|
||||||
ring_info->ring_buffer->read_index = next_read_location;
|
ring_info->ring_buffer->read_index = next_read_location;
|
||||||
|
@ -154,14 +156,14 @@ SetNextReadLocation(struct hv_ring_buffer_info *ring_info,
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
GetRingBuffer()
|
get_ring_buffer()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Get the start of the ring buffer
|
Get the start of the ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
static inline void *
|
static inline void *
|
||||||
GetRingBuffer(struct hv_ring_buffer_info *ring_info)
|
get_ring_buffer(struct hv_ring_buffer_info *ring_info)
|
||||||
{
|
{
|
||||||
return (void *)ring_info->ring_buffer->buffer;
|
return (void *)ring_info->ring_buffer->buffer;
|
||||||
}
|
}
|
||||||
|
@ -170,14 +172,14 @@ GetRingBuffer(struct hv_ring_buffer_info *ring_info)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
GetRingBufferSize()
|
get_ring_buffersize()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Get the size of the ring buffer
|
Get the size of the ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
static inline u32
|
static inline u32
|
||||||
GetRingBufferSize(struct hv_ring_buffer_info *ring_info)
|
get_ring_buffersize(struct hv_ring_buffer_info *ring_info)
|
||||||
{
|
{
|
||||||
return ring_info->ring_datasize;
|
return ring_info->ring_datasize;
|
||||||
}
|
}
|
||||||
|
@ -185,14 +187,14 @@ GetRingBufferSize(struct hv_ring_buffer_info *ring_info)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
GetRingBufferIndices()
|
get_ring_bufferindices()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Get the read and write indices as u64 of the specified ring buffer
|
Get the read and write indices as u64 of the specified ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
static inline u64
|
static inline u64
|
||||||
GetRingBufferIndices(struct hv_ring_buffer_info *ring_info)
|
get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
|
||||||
{
|
{
|
||||||
return (u64)ring_info->ring_buffer->write_index << 32;
|
return (u64)ring_info->ring_buffer->write_index << 32;
|
||||||
}
|
}
|
||||||
|
@ -201,18 +203,18 @@ GetRingBufferIndices(struct hv_ring_buffer_info *ring_info)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
Dumpring_info()
|
dump_ring_info()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Dump out to console the ring buffer info
|
Dump out to console the ring buffer info
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
|
void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
|
||||||
{
|
{
|
||||||
u32 bytes_avail_towrite;
|
u32 bytes_avail_towrite;
|
||||||
u32 bytes_avail_toread;
|
u32 bytes_avail_toread;
|
||||||
|
|
||||||
GetRingBufferAvailBytes(ring_info,
|
get_ringbuffer_availbytes(ring_info,
|
||||||
&bytes_avail_toread,
|
&bytes_avail_toread,
|
||||||
&bytes_avail_towrite);
|
&bytes_avail_towrite);
|
||||||
|
|
||||||
|
@ -233,14 +235,14 @@ void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
|
||||||
/* Internal routines */
|
/* Internal routines */
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
CopyToRingBuffer(
|
copyto_ringbuffer(
|
||||||
struct hv_ring_buffer_info *ring_info,
|
struct hv_ring_buffer_info *ring_info,
|
||||||
u32 start_write_offset,
|
u32 start_write_offset,
|
||||||
void *src,
|
void *src,
|
||||||
u32 srclen);
|
u32 srclen);
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
CopyFromRingBuffer(
|
copyfrom_ringbuffer(
|
||||||
struct hv_ring_buffer_info *ring_info,
|
struct hv_ring_buffer_info *ring_info,
|
||||||
void *dest,
|
void *dest,
|
||||||
u32 destlen,
|
u32 destlen,
|
||||||
|
@ -251,20 +253,20 @@ CopyFromRingBuffer(
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
RingBufferGetDebugInfo()
|
ringbuffer_get_debuginfo()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Get various debug metrics for the specified ring buffer
|
Get various debug metrics for the specified ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info,
|
void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
|
||||||
struct hv_ring_buffer_debug_info *debug_info)
|
struct hv_ring_buffer_debug_info *debug_info)
|
||||||
{
|
{
|
||||||
u32 bytes_avail_towrite;
|
u32 bytes_avail_towrite;
|
||||||
u32 bytes_avail_toread;
|
u32 bytes_avail_toread;
|
||||||
|
|
||||||
if (ring_info->ring_buffer) {
|
if (ring_info->ring_buffer) {
|
||||||
GetRingBufferAvailBytes(ring_info,
|
get_ringbuffer_availbytes(ring_info,
|
||||||
&bytes_avail_toread,
|
&bytes_avail_toread,
|
||||||
&bytes_avail_towrite);
|
&bytes_avail_towrite);
|
||||||
|
|
||||||
|
@ -283,13 +285,13 @@ void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info,
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
GetRingBufferInterruptMask()
|
get_ringbuffer_interrupt_mask()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Get the interrupt mask for the specified ring buffer
|
Get the interrupt mask for the specified ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi)
|
u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi)
|
||||||
{
|
{
|
||||||
return rbi->ring_buffer->interrupt_mask;
|
return rbi->ring_buffer->interrupt_mask;
|
||||||
}
|
}
|
||||||
|
@ -297,13 +299,13 @@ u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
RingBufferInit()
|
ringbuffer_init()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Initialize the ring buffer
|
Initialize the ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
int RingBufferInit(struct hv_ring_buffer_info *ring_info,
|
int ringbuffer_init(struct hv_ring_buffer_info *ring_info,
|
||||||
void *buffer, u32 buflen)
|
void *buffer, u32 buflen)
|
||||||
{
|
{
|
||||||
if (sizeof(struct hv_ring_buffer) != PAGE_SIZE)
|
if (sizeof(struct hv_ring_buffer) != PAGE_SIZE)
|
||||||
|
@ -326,26 +328,26 @@ int RingBufferInit(struct hv_ring_buffer_info *ring_info,
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
RingBufferCleanup()
|
ringbuffer_cleanup()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Cleanup the ring buffer
|
Cleanup the ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
void RingBufferCleanup(struct hv_ring_buffer_info *ring_info)
|
void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
RingBufferWrite()
|
ringbuffer_write()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Write to the ring buffer
|
Write to the ring buffer
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
int RingBufferWrite(struct hv_ring_buffer_info *outring_info,
|
int ringbuffer_write(struct hv_ring_buffer_info *outring_info,
|
||||||
struct scatterlist *sglist, u32 sgcount)
|
struct scatterlist *sglist, u32 sgcount)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -367,7 +369,7 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info,
|
||||||
|
|
||||||
spin_lock_irqsave(&outring_info->ring_lock, flags);
|
spin_lock_irqsave(&outring_info->ring_lock, flags);
|
||||||
|
|
||||||
GetRingBufferAvailBytes(outring_info,
|
get_ringbuffer_availbytes(outring_info,
|
||||||
&bytes_avail_toread,
|
&bytes_avail_toread,
|
||||||
&bytes_avail_towrite);
|
&bytes_avail_towrite);
|
||||||
|
|
||||||
|
@ -390,20 +392,20 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write to the ring buffer */
|
/* Write to the ring buffer */
|
||||||
next_write_location = GetNextWriteLocation(outring_info);
|
next_write_location = get_next_write_location(outring_info);
|
||||||
|
|
||||||
for_each_sg(sglist, sg, sgcount, i)
|
for_each_sg(sglist, sg, sgcount, i)
|
||||||
{
|
{
|
||||||
next_write_location = CopyToRingBuffer(outring_info,
|
next_write_location = copyto_ringbuffer(outring_info,
|
||||||
next_write_location,
|
next_write_location,
|
||||||
sg_virt(sg),
|
sg_virt(sg),
|
||||||
sg->length);
|
sg->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set previous packet start */
|
/* Set previous packet start */
|
||||||
prev_indices = GetRingBufferIndices(outring_info);
|
prev_indices = get_ring_bufferindices(outring_info);
|
||||||
|
|
||||||
next_write_location = CopyToRingBuffer(outring_info,
|
next_write_location = copyto_ringbuffer(outring_info,
|
||||||
next_write_location,
|
next_write_location,
|
||||||
&prev_indices,
|
&prev_indices,
|
||||||
sizeof(u64));
|
sizeof(u64));
|
||||||
|
@ -412,7 +414,7 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info,
|
||||||
mb();
|
mb();
|
||||||
|
|
||||||
/* Now, update the write location */
|
/* Now, update the write location */
|
||||||
SetNextWriteLocation(outring_info, next_write_location);
|
set_next_write_location(outring_info, next_write_location);
|
||||||
|
|
||||||
/* Dumpring_info(Outring_info, "AFTER "); */
|
/* Dumpring_info(Outring_info, "AFTER "); */
|
||||||
|
|
||||||
|
@ -424,13 +426,13 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info,
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
RingBufferPeek()
|
ringbuffer_peek()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Read without advancing the read index
|
Read without advancing the read index
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
int RingBufferPeek(struct hv_ring_buffer_info *Inring_info,
|
int ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
|
||||||
void *Buffer, u32 buflen)
|
void *Buffer, u32 buflen)
|
||||||
{
|
{
|
||||||
u32 bytes_avail_towrite;
|
u32 bytes_avail_towrite;
|
||||||
|
@ -440,7 +442,7 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info,
|
||||||
|
|
||||||
spin_lock_irqsave(&Inring_info->ring_lock, flags);
|
spin_lock_irqsave(&Inring_info->ring_lock, flags);
|
||||||
|
|
||||||
GetRingBufferAvailBytes(Inring_info,
|
get_ringbuffer_availbytes(Inring_info,
|
||||||
&bytes_avail_toread,
|
&bytes_avail_toread,
|
||||||
&bytes_avail_towrite);
|
&bytes_avail_towrite);
|
||||||
|
|
||||||
|
@ -458,9 +460,9 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert to byte offset */
|
/* Convert to byte offset */
|
||||||
next_read_location = GetNextReadLocation(Inring_info);
|
next_read_location = get_next_read_location(Inring_info);
|
||||||
|
|
||||||
next_read_location = CopyFromRingBuffer(Inring_info,
|
next_read_location = copyfrom_ringbuffer(Inring_info,
|
||||||
Buffer,
|
Buffer,
|
||||||
buflen,
|
buflen,
|
||||||
next_read_location);
|
next_read_location);
|
||||||
|
@ -474,13 +476,13 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info,
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
RingBufferRead()
|
ringbuffer_read()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Read and advance the read index
|
Read and advance the read index
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer,
|
int ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
|
||||||
u32 buflen, u32 offset)
|
u32 buflen, u32 offset)
|
||||||
{
|
{
|
||||||
u32 bytes_avail_towrite;
|
u32 bytes_avail_towrite;
|
||||||
|
@ -494,7 +496,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer,
|
||||||
|
|
||||||
spin_lock_irqsave(&inring_info->ring_lock, flags);
|
spin_lock_irqsave(&inring_info->ring_lock, flags);
|
||||||
|
|
||||||
GetRingBufferAvailBytes(inring_info,
|
get_ringbuffer_availbytes(inring_info,
|
||||||
&bytes_avail_toread,
|
&bytes_avail_toread,
|
||||||
&bytes_avail_towrite);
|
&bytes_avail_towrite);
|
||||||
|
|
||||||
|
@ -515,14 +517,15 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
next_read_location = GetNextReadLocationWithOffset(inring_info, offset);
|
next_read_location =
|
||||||
|
get_next_readlocation_withoffset(inring_info, offset);
|
||||||
|
|
||||||
next_read_location = CopyFromRingBuffer(inring_info,
|
next_read_location = copyfrom_ringbuffer(inring_info,
|
||||||
buffer,
|
buffer,
|
||||||
buflen,
|
buflen,
|
||||||
next_read_location);
|
next_read_location);
|
||||||
|
|
||||||
next_read_location = CopyFromRingBuffer(inring_info,
|
next_read_location = copyfrom_ringbuffer(inring_info,
|
||||||
&prev_indices,
|
&prev_indices,
|
||||||
sizeof(u64),
|
sizeof(u64),
|
||||||
next_read_location);
|
next_read_location);
|
||||||
|
@ -533,7 +536,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer,
|
||||||
mb();
|
mb();
|
||||||
|
|
||||||
/* Update the read index */
|
/* Update the read index */
|
||||||
SetNextReadLocation(inring_info, next_read_location);
|
set_next_read_location(inring_info, next_read_location);
|
||||||
|
|
||||||
/* Dumpring_info(Inring_info, "AFTER "); */
|
/* Dumpring_info(Inring_info, "AFTER "); */
|
||||||
|
|
||||||
|
@ -546,7 +549,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer,
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
CopyToRingBuffer()
|
copyto_ringbuffer()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Helper routine to copy from source to ring buffer.
|
Helper routine to copy from source to ring buffer.
|
||||||
|
@ -554,14 +557,14 @@ Description:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
static u32
|
static u32
|
||||||
CopyToRingBuffer(
|
copyto_ringbuffer(
|
||||||
struct hv_ring_buffer_info *ring_info,
|
struct hv_ring_buffer_info *ring_info,
|
||||||
u32 start_write_offset,
|
u32 start_write_offset,
|
||||||
void *src,
|
void *src,
|
||||||
u32 srclen)
|
u32 srclen)
|
||||||
{
|
{
|
||||||
void *ring_buffer = GetRingBuffer(ring_info);
|
void *ring_buffer = get_ring_buffer(ring_info);
|
||||||
u32 ring_buffer_size = GetRingBufferSize(ring_info);
|
u32 ring_buffer_size = get_ring_buffersize(ring_info);
|
||||||
u32 frag_len;
|
u32 frag_len;
|
||||||
|
|
||||||
/* wrap-around detected! */
|
/* wrap-around detected! */
|
||||||
|
@ -584,7 +587,7 @@ CopyToRingBuffer(
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
CopyFromRingBuffer()
|
copyfrom_ringbuffer()
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Helper routine to copy to source from ring buffer.
|
Helper routine to copy to source from ring buffer.
|
||||||
|
@ -592,14 +595,14 @@ Description:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
static u32
|
static u32
|
||||||
CopyFromRingBuffer(
|
copyfrom_ringbuffer(
|
||||||
struct hv_ring_buffer_info *ring_info,
|
struct hv_ring_buffer_info *ring_info,
|
||||||
void *dest,
|
void *dest,
|
||||||
u32 destlen,
|
u32 destlen,
|
||||||
u32 start_read_offset)
|
u32 start_read_offset)
|
||||||
{
|
{
|
||||||
void *ring_buffer = GetRingBuffer(ring_info);
|
void *ring_buffer = get_ring_buffer(ring_info);
|
||||||
u32 ring_buffer_size = GetRingBufferSize(ring_info);
|
u32 ring_buffer_size = get_ring_buffersize(ring_info);
|
||||||
|
|
||||||
u32 frag_len;
|
u32 frag_len;
|
||||||
|
|
||||||
|
|
|
@ -75,28 +75,28 @@ struct hv_ring_buffer_debug_info {
|
||||||
/* Interface */
|
/* Interface */
|
||||||
|
|
||||||
|
|
||||||
int RingBufferInit(struct hv_ring_buffer_info *ring_info, void *buffer,
|
int ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer,
|
||||||
u32 buflen);
|
u32 buflen);
|
||||||
|
|
||||||
void RingBufferCleanup(struct hv_ring_buffer_info *ring_info);
|
void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);
|
||||||
|
|
||||||
int RingBufferWrite(struct hv_ring_buffer_info *ring_info,
|
int ringbuffer_write(struct hv_ring_buffer_info *ring_info,
|
||||||
struct scatterlist *sglist,
|
struct scatterlist *sglist,
|
||||||
u32 sgcount);
|
u32 sgcount);
|
||||||
|
|
||||||
int RingBufferPeek(struct hv_ring_buffer_info *ring_info, void *buffer,
|
int ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer,
|
||||||
u32 buflen);
|
u32 buflen);
|
||||||
|
|
||||||
int RingBufferRead(struct hv_ring_buffer_info *ring_info,
|
int ringbuffer_read(struct hv_ring_buffer_info *ring_info,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
u32 buflen,
|
u32 buflen,
|
||||||
u32 offset);
|
u32 offset);
|
||||||
|
|
||||||
u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *ring_info);
|
u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);
|
||||||
|
|
||||||
void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix);
|
void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix);
|
||||||
|
|
||||||
void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info,
|
void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
|
||||||
struct hv_ring_buffer_debug_info *debug_info);
|
struct hv_ring_buffer_debug_info *debug_info);
|
||||||
|
|
||||||
#endif /* _RING_BUFFER_H_ */
|
#endif /* _RING_BUFFER_H_ */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче