@@ -131,7 +131,7 @@ static inline int virtqueue_add(struct virtqueue *_vq,
struct vring_virtqueue *vq = to_vvq(_vq);
struct scatterlist *sg;
struct vring_desc *desc;
- unsigned int i, n, avail, uninitialized_var(prev);
+ unsigned int i, n, avail, descs_used, uninitialized_var(prev);
int head;
bool indirect;
@@ -179,17 +179,18 @@ static inline int virtqueue_add(struct virtqueue *_vq,
/* Set up rest to use this indirect table. */
i = 0;
- total_sg = 1;
+ descs_used = 1;
indirect = true;
} else {
desc = vq->vring.desc;
i = head;
+ descs_used = total_sg;
indirect = false;
}
- if (vq->vq.num_free < total_sg) {
+ if (vq->vq.num_free < descs_used) {
pr_debug("Can't add buf len %i - avail = %i\n",
- total_sg, vq->vq.num_free);
+ descs_used, vq->vq.num_free);
/* FIXME: for historical reasons, we force a notify here if
* there are outgoing parts to the buffer. Presumably the
* host should service the ring ASAP. */
@@ -200,7 +201,7 @@ static inline int virtqueue_add(struct virtqueue *_vq,
}
/* We're about to use some buffers from the free list. */
- vq->vq.num_free -= total_sg;
+ vq->vq.num_free -= descs_used;
for (n = 0; n < out_sgs; n++) {
for (sg = sgs[n]; sg; sg = sg_next(sg)) {