On Thu, Oct 27, 2011 at 10:02 AM, Mark Wu <wu...@linux.vnet.ibm.com> wrote: > Now queue flushing and sent callback could be invoked even on delivery > failure. We add a checking of receiver's return value to avoid this > case. > > Signed-off-by: Mark Wu <wu...@linux.vnet.ibm.com> > --- > net/queue.c | 12 +++++++----- > 1 files changed, 7 insertions(+), 5 deletions(-)
What problem are you trying to fix? > @@ -251,7 +253,7 @@ void qemu_net_queue_flush(NetQueue *queue) > break; > } > > - if (packet->sent_cb) { > + if (ret > 0 && packet->sent_cb) { > packet->sent_cb(packet->sender, ret); This looks wrong. ret is passed as an argument to the callback. You are skipping the callback on error and not giving it a chance to see negative ret. Looking at virtio_net_tx_complete() this causes a virtqueue element leak. Stefan