Commit 15f9c890 authored by Rusty Russell's avatar Rusty Russell

virtio: Use the sg_phys convenience function.

Simple cleanup.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 0ad07ec1
...@@ -99,16 +99,14 @@ static int vring_add_buf(struct virtqueue *_vq, ...@@ -99,16 +99,14 @@ static int vring_add_buf(struct virtqueue *_vq,
head = vq->free_head; head = vq->free_head;
for (i = vq->free_head; out; i = vq->vring.desc[i].next, out--) { for (i = vq->free_head; out; i = vq->vring.desc[i].next, out--) {
vq->vring.desc[i].flags = VRING_DESC_F_NEXT; vq->vring.desc[i].flags = VRING_DESC_F_NEXT;
vq->vring.desc[i].addr = (page_to_pfn(sg_page(sg))<<PAGE_SHIFT) vq->vring.desc[i].addr = sg_phys(sg);
+ sg->offset;
vq->vring.desc[i].len = sg->length; vq->vring.desc[i].len = sg->length;
prev = i; prev = i;
sg++; sg++;
} }
for (; in; i = vq->vring.desc[i].next, in--) { for (; in; i = vq->vring.desc[i].next, in--) {
vq->vring.desc[i].flags = VRING_DESC_F_NEXT|VRING_DESC_F_WRITE; vq->vring.desc[i].flags = VRING_DESC_F_NEXT|VRING_DESC_F_WRITE;
vq->vring.desc[i].addr = (page_to_pfn(sg_page(sg))<<PAGE_SHIFT) vq->vring.desc[i].addr = sg_phys(sg);
+ sg->offset;
vq->vring.desc[i].len = sg->length; vq->vring.desc[i].len = sg->length;
prev = i; prev = i;
sg++; sg++;
......
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