aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-12-30 10:25:57 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-12-29 17:55:57 -0500
commit5f0d1d7f2286c8a02dab69f5f0bd51681fab161e (patch)
tree8989451d6a60ee9f1bae144fba042b91ce6b21a1
parent480daab42c4dd74b3c07031ddf9031251c530c77 (diff)
virtio: rename 'pagesize' arg to vring_init/vring_size
It's really the alignment desired for consumer/producer separation; historically this x86 pagesize, but with PowerPC it'll still be x86 pagesize. And in theory lguest could choose a different value. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--include/linux/virtio_ring.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index c4a598fb3826..01bf3124e312 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -83,7 +83,7 @@ struct vring {
83 * __u16 avail_idx; 83 * __u16 avail_idx;
84 * __u16 available[num]; 84 * __u16 available[num];
85 * 85 *
86 * // Padding to the next page boundary. 86 * // Padding to the next align boundary.
87 * char pad[]; 87 * char pad[];
88 * 88 *
89 * // A ring of used descriptor heads with free-running index. 89 * // A ring of used descriptor heads with free-running index.
@@ -93,19 +93,19 @@ struct vring {
93 * }; 93 * };
94 */ 94 */
95static inline void vring_init(struct vring *vr, unsigned int num, void *p, 95static inline void vring_init(struct vring *vr, unsigned int num, void *p,
96 unsigned long pagesize) 96 unsigned long align)
97{ 97{
98 vr->num = num; 98 vr->num = num;
99 vr->desc = p; 99 vr->desc = p;
100 vr->avail = p + num*sizeof(struct vring_desc); 100 vr->avail = p + num*sizeof(struct vring_desc);
101 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + pagesize-1) 101 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + align-1)
102 & ~(pagesize - 1)); 102 & ~(align - 1));
103} 103}
104 104
105static inline unsigned vring_size(unsigned int num, unsigned long pagesize) 105static inline unsigned vring_size(unsigned int num, unsigned long align)
106{ 106{
107 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) 107 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
108 + pagesize - 1) & ~(pagesize - 1)) 108 + align - 1) & ~(align - 1))
109 + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num; 109 + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num;
110} 110}
111 111