On Mon, Feb 12, 2018 at 09:16:27PM +0800, Jason Wang wrote:



On 2018???01???29??? 22:11, Jens Freimann wrote:
+/* Cleanup from completed transmits. */
+static void
+virtio_xmit_cleanup(struct virtqueue *vq)
+{
+       uint16_t idx;
+       uint16_t size = vq->vq_nentries;
+       struct vring_desc_1_1 *desc = vq->vq_ring.desc_1_1;
+
+       idx = vq->vq_used_cons_idx & (size - 1);
+       while (desc_is_used(&desc[idx]) &&
+              vq->vq_free_cnt < size) {
+               while (desc[idx].flags & VRING_DESC_F_NEXT) {
+                       vq->vq_free_cnt++;
+                       idx = ++vq->vq_used_cons_idx & (size - 1);
+               }
+               vq->vq_free_cnt++;
+               idx = ++vq->vq_used_cons_idx & (size - 1);
+       }
+}

This looks like a violation of the spec. In 2.6.6 Next Flag: Descriptor Chaining. It said:

"VIRTQ_DESC_F_NEXT is reserved in used descriptors, and should be ignored by drivers."

I think you are right. I will rework this bit.

(Looking at the device implementation, it was in fact an in order device which is said to be no in the cover).

Looking into this as well.

Thanks for the review!

regards,
Jens

Reply via email to