[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/4] dataplane: change vring API to use VirtQueu
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 3/4] dataplane: change vring API to use VirtQueueElement |
Date: |
Thu, 05 Dec 2013 11:34:28 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9 |
Il 05/12/2013 10:24, Stefan Hajnoczi ha scritto:
>> >
>> > That's what already happens actually. vring_push has
>> >
>> >
>> > + g_slice_free(VirtQueueElement, elem);
>> > +
>> > /* Don't touch vring if a fatal error occurred */
>> > if (vring->broken) {
>> > return;
>> >
>> > in this patch and
>> >
>> > + for (i = 0; i < elem->out_num; i++) {
>> > + vring_unmap(elem->out_sg[i].iov_base, false);
>> > + }
>> > +
>> > + for (i = 0; i < elem->in_num; i++) {
>> > + vring_unmap(elem->in_sg[i].iov_base, true);
>> > + }
>> >
>> > g_slice_free(VirtQueueElement, elem);
>> >
>> > in the next one.
>> >
>> > Though I admit vring_push isn't such a great name and API. I can add
>> > instead a vring_free_element function. Do you think vring_push should
>> > call it, or should the caller do that?
> I think vring_push() should free the VirtQueueElement.
>
> We just need to expose vring_free_element() so that handle_notify() can
> call it without pushing bogus buffers back to the guest.
It's not pushing back bogus buffer, see the "if (vring->broken)" above.
But if you prefer handle_notify() to call vring_free_element(), I can
of course do that.
Paolo