qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@gmail.com>
To: Jason Wang <jasowang@redhat.com>,
	Vladislav Yaroshchuk <vladislav.yaroshchuk@jetbrains.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	phillip.ennen@gmail.com,
	"qemu Developers" <qemu-devel@nongnu.org>,
	"Cameron Esfahani" <dirty@apple.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Roman Bolshakov" <r.bolshakov@yadro.com>,
	"Alexander Graf" <agraf@csgraf.de>,
	"Phillip Tennen" <phillip@axleos.com>,
	"Roman Bolshakov" <roman@roolebo.dev>,
	"Howard Spoelstra" <hsp.cat7@gmail.com>,
	"Alessio Dionisi" <hello@adns.io>,
	"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [PATCH v15 3/8] net/vmnet: implement shared mode (vmnet-shared)
Date: Tue, 1 Mar 2022 17:21:40 +0900	[thread overview]
Message-ID: <e5302fba-e773-c56d-388f-a3593bacd977@gmail.com> (raw)
In-Reply-To: <CAGmdLqTqcESsiyTMavKZ3U8=5yPtqdq2tunZTH-tfrzwfUMGug@mail.gmail.com>

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	other threads:[~2022-03-01  8:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25 17:13 [PATCH v15 0/8] Add vmnet.framework based network backend Vladislav Yaroshchuk
2022-02-25 17:13 ` [PATCH v15 1/8] net/vmnet: add vmnet dependency and customizable option Vladislav Yaroshchuk
2022-02-25 17:13 ` [PATCH v15 2/8] net/vmnet: add vmnet backends to qapi/net Vladislav Yaroshchuk
2022-02-28 10:07   ` Markus Armbruster
2022-02-28 10:47     ` Vladislav Yaroshchuk
2022-02-25 17:13 ` [PATCH v15 3/8] net/vmnet: implement shared mode (vmnet-shared) Vladislav Yaroshchuk
2022-02-25 17:46   ` Akihiko Odaki
2022-02-26  8:37     ` Vladislav Yaroshchuk
2022-02-26  9:16       ` Akihiko Odaki
2022-02-26 11:33         ` Vladislav Yaroshchuk
2022-02-26 12:26           ` Akihiko Odaki
2022-02-28 11:59             ` Vladislav Yaroshchuk
2022-03-01  5:52               ` Akihiko Odaki
2022-03-01  8:09                 ` Vladislav Yaroshchuk
2022-03-01  8:21                   ` Akihiko Odaki [this message]
2022-03-03 15:43                     ` Vladislav Yaroshchuk
2022-03-03 18:34                       ` Akihiko Odaki
2022-03-04  4:39                         ` Akihiko Odaki
2022-03-04  1:37                       ` Jason Wang
2022-03-04  4:37                         ` Akihiko Odaki
2022-03-07  3:59                           ` Jason Wang
2022-03-07  4:25                             ` Akihiko Odaki
2022-03-07  4:51                               ` Jason Wang
2022-03-07  6:54                                 ` Akihiko Odaki
2022-02-25 17:13 ` [PATCH v15 4/8] net/vmnet: implement host mode (vmnet-host) Vladislav Yaroshchuk
2022-02-25 17:13 ` [PATCH v15 5/8] net/vmnet: implement bridged mode (vmnet-bridged) Vladislav Yaroshchuk
2022-02-25 17:50   ` Akihiko Odaki
2022-02-25 17:14 ` [PATCH v15 6/8] net/vmnet: update qemu-options.hx Vladislav Yaroshchuk
2022-02-25 17:14 ` [PATCH v15 7/8] net/vmnet: update hmp-commands.hx Vladislav Yaroshchuk
2022-02-25 17:14 ` [PATCH v15 8/8] net/vmnet: update MAINTAINERS list Vladislav Yaroshchuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5302fba-e773-c56d-388f-a3593bacd977@gmail.com \
    --to=akihiko.odaki@gmail.com \
    --cc=agraf@csgraf.de \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=dirty@apple.com \
    --cc=eblake@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=hello@adns.io \
    --cc=hsp.cat7@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=phillip.ennen@gmail.com \
    --cc=phillip@axleos.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu_oss@crudebyte.com \
    --cc=r.bolshakov@yadro.com \
    --cc=roman@roolebo.dev \
    --cc=vladislav.yaroshchuk@jetbrains.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).