On Wed, Apr 7, 2021 at 2:51 AM Jorgen Hansen <jhansen@xxxxxxxxxx> wrote:
> On 6 Apr 2021, at 20:31, Jiang Wang <jiang.wang@xxxxxxxxxxxxx> wrote:
>
> From: "jiang.wang" <jiang.wang@xxxxxxxxxxxxx>
>
> Currently, only VMCI supports dgram sockets. To supported
> nested VM use case, this patch removes transport_dgram and
> uses transport_g2h and transport_h2g for dgram too.
Could you provide some background for introducing this change - are you
looking at introducing datagrams for a different transport? VMCI datagrams
already support the nested use case,
Yes, I am trying to introduce datagram for virtio transport. I wrote a
spec patch for
virtio dgram support and also a code patch, but the code patch is still WIP.
When I wrote this commit message, I was thinking nested VM is the same as
multiple transport support. But now, I realize they are different.
Nested VMs may use
the same virtualization layer(KVM on KVM), or different virtualization layers
(KVM on ESXi). Thanks for letting me know that VMCI already supported nested
use cases. I think you mean VMCI on VMCI, right?
but if we need to support multiple datagramI see.
transports we need to rework how we administer port assignment for datagrams.
One specific issue is that the vmci transport won’t receive any datagrams for a
port unless the datagram socket has already been assigned the vmci transport
and the port bound to the underlying VMCI device (see below for more details).
> The transport is assgined when sending every packet and
> receiving every packet on dgram sockets.
Is the intent that the same datagram socket can be used for sending packets both
In the host to guest, and the guest to directions?
Nope. One datagram socket will only send packets to one direction, either to the
host or to the guest. My above description is wrong. When sending packets, the
transport is assigned with the first packet (with auto_bind).
The problem is when receiving packets. The listener can bind to the
VMADDR_CID_ANY
address. Then it is unclear which transport we should use. For stream
sockets, there will be a new socket for each connection, and transport
can be decided
at that time. For datagram sockets, I am not sure how to handle that.
For VMCI, does the same transport can be used for both receiving from
host and from
the guest?
For virtio, the h2g and g2h transports are different,, so we have to choose
one of them. My original thought is to wait until the first packet arrives.
Another idea is that we always bind to host addr and use h2g
transport because I think that might
be more common. If a listener wants to recv packets from the host, then it
should bind to the guest addr instead of CID_ANY.
Any other suggestions?