qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v15 3/8] net/vmnet: implement shared mode (vmnet-shared)


From: Akihiko Odaki
Subject: Re: [PATCH v15 3/8] net/vmnet: implement shared mode (vmnet-shared)
Date: Tue, 1 Mar 2022 17:21:40 +0900
User-agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 2022/03/01 17:09, Vladislav Yaroshchuk wrote:
     > Not sure that only one field is enough, cause
     > we may have two states on bh execution start:
     > 1. There are packets in vmnet buffer s->packets_buf
     >      that were rejected by qemu_send_async and waiting
     >      to be sent. If this happens, we should complete sending
     >      these waiting packets with qemu_send_async firstly,
     >      and after that we should call vmnet_read to get
     >      new ones and send them to QEMU;
     > 2. There are no packets in s->packets_buf to be sent to
     >      qemu, we only need to get new packets from vmnet
     >      with vmnet_read and send them to QEMU

    In case 1, you should just keep calling qemu_send_packet_async.
    Actually
    qemu_send_packet_async adds the packet to its internal queue and calls
    the callback when it is consumed.


I'm not sure we can keep calling qemu_send_packet_async,
because as docs from net/queue.c says:

/* [...]
  * If a sent callback is provided to send(), the caller must handle a
  * zero return from the delivery handler by not sending any more packets
  * until we have invoked the callback. Only in that case will we queue
  * the packet.
  *
  * If a sent callback isn't provided, we just drop the packet to avoid
  * unbounded queueing.
  */

So after we did vmnet_read and read N packets
into temporary s->packets_buf, we begin calling
qemu_send_packet_async. If it returns 0 - it says
"no more packets until sent_cb called please".
At this moment we have N packets in s->packets_buf
and already queued K < N of them. But, packets K..N
are not queued and keep waiting for sent_cb to be sent
with qemu_send_packet_async.
Thus when sent_cb called, we should finish
our transfer of packets K..N from s->packets_buf
to qemu calling qemu_send_packet_async.
I meant this.

I missed the comment. The description is contradicting with the actual code; qemu_net_queue_send_iov appends the packet to the queue whenever it cannot send one immediately.

Jason Wang, I saw you are in the MAINTAINERS for net/. Can you tell if calling qemu_send_packet_async is allowed after it returns 0?

Regards,
Akihiko Odaki



reply via email to

[Prev in Thread] Current Thread [Next in Thread]