Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249545
b: refs/heads/master
c: 2b8a912
h: refs/heads/master
i:
  249543: a51158f
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed May 11, 2011
1 parent cb4ec3a commit 22fb5ca
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a75b61d528906fc6bf94226be2cce87e31cd18ff
refs/heads/master: 2b8a912ef2713a7f000baad2dbb9ac6f64575d4a
88 changes: 44 additions & 44 deletions trunk/drivers/staging/hv/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
/*++
Name:
get_ringbuffer_availbytes()
hv_get_ringbuffer_availbytes()
Description:
Get number of bytes available to read and to write to
for the specified ring buffer
--*/
static inline void
get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
u32 *read, u32 *write)
{
u32 read_loc, write_loc;
Expand All @@ -62,14 +62,14 @@ get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
/*++
Name:
get_next_write_location()
hv_get_next_write_location()
Description:
Get the next write location for the specified ring buffer
--*/
static inline u32
get_next_write_location(struct hv_ring_buffer_info *ring_info)
hv_get_next_write_location(struct hv_ring_buffer_info *ring_info)
{
u32 next = ring_info->ring_buffer->write_index;

Expand All @@ -81,14 +81,14 @@ get_next_write_location(struct hv_ring_buffer_info *ring_info)
/*++
Name:
set_next_write_location()
hv_set_next_write_location()
Description:
Set the next write location for the specified ring buffer
--*/
static inline void
set_next_write_location(struct hv_ring_buffer_info *ring_info,
hv_set_next_write_location(struct hv_ring_buffer_info *ring_info,
u32 next_write_location)
{
ring_info->ring_buffer->write_index = next_write_location;
Expand All @@ -97,14 +97,14 @@ set_next_write_location(struct hv_ring_buffer_info *ring_info,
/*++
Name:
get_next_read_location()
hv_get_next_read_location()
Description:
Get the next read location for the specified ring buffer
--*/
static inline u32
get_next_read_location(struct hv_ring_buffer_info *ring_info)
hv_get_next_read_location(struct hv_ring_buffer_info *ring_info)
{
u32 next = ring_info->ring_buffer->read_index;

Expand All @@ -116,15 +116,15 @@ get_next_read_location(struct hv_ring_buffer_info *ring_info)
/*++
Name:
get_next_readlocation_withoffset()
hv_get_next_readlocation_withoffset()
Description:
Get the next read location + offset for the specified ring buffer.
This allows the caller to skip
--*/
static inline u32
get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
hv_get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
u32 offset)
{
u32 next = ring_info->ring_buffer->read_index;
Expand All @@ -139,14 +139,14 @@ get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info,
/*++
Name:
set_next_read_location()
hv_set_next_read_location()
Description:
Set the next read location for the specified ring buffer
--*/
static inline void
set_next_read_location(struct hv_ring_buffer_info *ring_info,
hv_set_next_read_location(struct hv_ring_buffer_info *ring_info,
u32 next_read_location)
{
ring_info->ring_buffer->read_index = next_read_location;
Expand All @@ -156,14 +156,14 @@ set_next_read_location(struct hv_ring_buffer_info *ring_info,
/*++
Name:
get_ring_buffer()
hv_get_ring_buffer()
Description:
Get the start of the ring buffer
--*/
static inline void *
get_ring_buffer(struct hv_ring_buffer_info *ring_info)
hv_get_ring_buffer(struct hv_ring_buffer_info *ring_info)
{
return (void *)ring_info->ring_buffer->buffer;
}
Expand All @@ -172,29 +172,29 @@ get_ring_buffer(struct hv_ring_buffer_info *ring_info)
/*++
Name:
get_ring_buffersize()
hv_get_ring_buffersize()
Description:
Get the size of the ring buffer
--*/
static inline u32
get_ring_buffersize(struct hv_ring_buffer_info *ring_info)
hv_get_ring_buffersize(struct hv_ring_buffer_info *ring_info)
{
return ring_info->ring_datasize;
}

/*++
Name:
get_ring_bufferindices()
hv_get_ring_bufferindices()
Description:
Get the read and write indices as u64 of the specified ring buffer
--*/
static inline u64
get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
hv_get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
{
return (u64)ring_info->ring_buffer->write_index << 32;
}
Expand All @@ -214,7 +214,7 @@ void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
u32 bytes_avail_towrite;
u32 bytes_avail_toread;

get_ringbuffer_availbytes(ring_info,
hv_get_ringbuffer_availbytes(ring_info,
&bytes_avail_toread,
&bytes_avail_towrite);

Expand All @@ -235,14 +235,14 @@ void hv_dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix)
/* Internal routines */

static u32
copyto_ringbuffer(
hv_copyto_ringbuffer(
struct hv_ring_buffer_info *ring_info,
u32 start_write_offset,
void *src,
u32 srclen);

static u32
copyfrom_ringbuffer(
hv_copyfrom_ringbuffer(
struct hv_ring_buffer_info *ring_info,
void *dest,
u32 destlen,
Expand All @@ -266,7 +266,7 @@ void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
u32 bytes_avail_toread;

if (ring_info->ring_buffer) {
get_ringbuffer_availbytes(ring_info,
hv_get_ringbuffer_availbytes(ring_info,
&bytes_avail_toread,
&bytes_avail_towrite);

Expand Down Expand Up @@ -369,7 +369,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,

spin_lock_irqsave(&outring_info->ring_lock, flags);

get_ringbuffer_availbytes(outring_info,
hv_get_ringbuffer_availbytes(outring_info,
&bytes_avail_toread,
&bytes_avail_towrite);

Expand All @@ -384,20 +384,20 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
}

/* Write to the ring buffer */
next_write_location = get_next_write_location(outring_info);
next_write_location = hv_get_next_write_location(outring_info);

for_each_sg(sglist, sg, sgcount, i)
{
next_write_location = copyto_ringbuffer(outring_info,
next_write_location = hv_copyto_ringbuffer(outring_info,
next_write_location,
sg_virt(sg),
sg->length);
}

/* Set previous packet start */
prev_indices = get_ring_bufferindices(outring_info);
prev_indices = hv_get_ring_bufferindices(outring_info);

next_write_location = copyto_ringbuffer(outring_info,
next_write_location = hv_copyto_ringbuffer(outring_info,
next_write_location,
&prev_indices,
sizeof(u64));
Expand All @@ -406,7 +406,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
mb();

/* Now, update the write location */
set_next_write_location(outring_info, next_write_location);
hv_set_next_write_location(outring_info, next_write_location);

/* Dumpring_info(Outring_info, "AFTER "); */

Expand Down Expand Up @@ -434,7 +434,7 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,

spin_lock_irqsave(&Inring_info->ring_lock, flags);

get_ringbuffer_availbytes(Inring_info,
hv_get_ringbuffer_availbytes(Inring_info,
&bytes_avail_toread,
&bytes_avail_towrite);

Expand All @@ -452,9 +452,9 @@ int hv_ringbuffer_peek(struct hv_ring_buffer_info *Inring_info,
}

/* Convert to byte offset */
next_read_location = get_next_read_location(Inring_info);
next_read_location = hv_get_next_read_location(Inring_info);

next_read_location = copyfrom_ringbuffer(Inring_info,
next_read_location = hv_copyfrom_ringbuffer(Inring_info,
Buffer,
buflen,
next_read_location);
Expand Down Expand Up @@ -488,7 +488,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,

spin_lock_irqsave(&inring_info->ring_lock, flags);

get_ringbuffer_availbytes(inring_info,
hv_get_ringbuffer_availbytes(inring_info,
&bytes_avail_toread,
&bytes_avail_towrite);

Expand All @@ -502,14 +502,14 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
}

next_read_location =
get_next_readlocation_withoffset(inring_info, offset);
hv_get_next_readlocation_withoffset(inring_info, offset);

next_read_location = copyfrom_ringbuffer(inring_info,
next_read_location = hv_copyfrom_ringbuffer(inring_info,
buffer,
buflen,
next_read_location);

next_read_location = copyfrom_ringbuffer(inring_info,
next_read_location = hv_copyfrom_ringbuffer(inring_info,
&prev_indices,
sizeof(u64),
next_read_location);
Expand All @@ -520,7 +520,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
mb();

/* Update the read index */
set_next_read_location(inring_info, next_read_location);
hv_set_next_read_location(inring_info, next_read_location);

/* Dumpring_info(Inring_info, "AFTER "); */

Expand All @@ -533,22 +533,22 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
/*++
Name:
copyto_ringbuffer()
hv_copyto_ringbuffer()
Description:
Helper routine to copy from source to ring buffer.
Assume there is enough room. Handles wrap-around in dest case only!!
--*/
static u32
copyto_ringbuffer(
hv_copyto_ringbuffer(
struct hv_ring_buffer_info *ring_info,
u32 start_write_offset,
void *src,
u32 srclen)
{
void *ring_buffer = get_ring_buffer(ring_info);
u32 ring_buffer_size = get_ring_buffersize(ring_info);
void *ring_buffer = hv_get_ring_buffer(ring_info);
u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
u32 frag_len;

/* wrap-around detected! */
Expand All @@ -569,22 +569,22 @@ copyto_ringbuffer(
/*++
Name:
copyfrom_ringbuffer()
hv_copyfrom_ringbuffer()
Description:
Helper routine to copy to source from ring buffer.
Assume there is enough room. Handles wrap-around in src case only!!
--*/
static u32
copyfrom_ringbuffer(
hv_copyfrom_ringbuffer(
struct hv_ring_buffer_info *ring_info,
void *dest,
u32 destlen,
u32 start_read_offset)
{
void *ring_buffer = get_ring_buffer(ring_info);
u32 ring_buffer_size = get_ring_buffersize(ring_info);
void *ring_buffer = hv_get_ring_buffer(ring_info);
u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);

u32 frag_len;

Expand Down

0 comments on commit 22fb5ca

Please sign in to comment.