netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andra Paraschiv <andraprs@amazon.com>
To: netdev <netdev@vger.kernel.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	David Duncan <davdunc@amazon.com>,
	Dexuan Cui <decui@microsoft.com>, Alexander Graf <graf@amazon.de>,
	Jorgen Hansen <jhansen@vmware.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Andra Paraschiv <andraprs@amazon.com>
Subject: [PATCH net-next v3 2/4] vm_sockets: Add VMADDR_FLAG_TO_HOST vsock flag
Date: Fri, 11 Dec 2020 12:32:39 +0200	[thread overview]
Message-ID: <20201211103241.17751-3-andraprs@amazon.com> (raw)
In-Reply-To: <20201211103241.17751-1-andraprs@amazon.com>

Add VMADDR_FLAG_TO_HOST vsock flag that is used to setup a vsock
connection where all the packets are forwarded to the host.

Then, using this type of vsock channel, vsock communication between
sibling VMs can be built on top of it.

Changelog

v2 -> v3

* Update comments to mention when the flag is set in the connect and
  listen paths.

v1 -> v2

* New patch in v2, it was split from the first patch in the series.
* Remove the default value for the vsock flags field.
* Update the naming for the vsock flag to "VMADDR_FLAG_TO_HOST".

Signed-off-by: Andra Paraschiv <andraprs@amazon.com>
---
 include/uapi/linux/vm_sockets.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/include/uapi/linux/vm_sockets.h b/include/uapi/linux/vm_sockets.h
index 619f8e9d55ca4..c99ed29602345 100644
--- a/include/uapi/linux/vm_sockets.h
+++ b/include/uapi/linux/vm_sockets.h
@@ -114,6 +114,26 @@
 
 #define VMADDR_CID_HOST 2
 
+/* The current default use case for the vsock channel is the following:
+ * local vsock communication between guest and host and nested VMs setup.
+ * In addition to this, implicitly, the vsock packets are forwarded to the host
+ * if no host->guest vsock transport is set.
+ *
+ * Set this flag value in the sockaddr_vm corresponding field if the vsock
+ * packets need to be always forwarded to the host. Using this behavior,
+ * vsock communication between sibling VMs can be setup.
+ *
+ * This way can explicitly distinguish between vsock channels created for
+ * different use cases, such as nested VMs (or local communication between
+ * guest and host) and sibling VMs.
+ *
+ * The flag can be set in the connect logic in the user space application flow.
+ * In the listen logic (from kernel space) the flag is set on the remote peer
+ * address. This happens for an incoming connection when it is routed from the
+ * host and comes from the guest (local CID and remote CID > VMADDR_CID_HOST).
+ */
+#define VMADDR_FLAG_TO_HOST 0x0001
+
 /* Invalid vSockets version. */
 
 #define VM_SOCKETS_INVALID_VERSION -1U
-- 
2.20.1 (Apple Git-117)




Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.


  parent reply	other threads:[~2020-12-11 10:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11 10:32 [PATCH net-next v3 0/4] vsock: Add flags field in the vsock address Andra Paraschiv
2020-12-11 10:32 ` [PATCH net-next v3 1/4] vm_sockets: Add flags field in the vsock address data structure Andra Paraschiv
2020-12-11 15:21   ` Stefano Garzarella
2020-12-11 10:32 ` Andra Paraschiv [this message]
2020-12-11 15:21   ` [PATCH net-next v3 2/4] vm_sockets: Add VMADDR_FLAG_TO_HOST vsock flag Stefano Garzarella
2020-12-11 10:32 ` [PATCH net-next v3 3/4] af_vsock: Set VMADDR_FLAG_TO_HOST flag on the receive path Andra Paraschiv
2020-12-11 10:32 ` [PATCH net-next v3 4/4] af_vsock: Assign the vsock transport considering the vsock address flags Andra Paraschiv
2020-12-11 15:24 ` [PATCH net-next v3 0/4] vsock: Add flags field in the vsock address Stefano Garzarella
2020-12-11 17:46   ` Paraschiv, Andra-Irina
2020-12-12 17:16   ` Jakub Kicinski
2020-12-14  8:13     ` Stefano Garzarella
2020-12-14 16:18       ` Paraschiv, Andra-Irina

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=20201211103241.17751-3-andraprs@amazon.com \
    --to=andraprs@amazon.com \
    --cc=davdunc@amazon.com \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=graf@amazon.de \
    --cc=jhansen@vmware.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=vkuznets@redhat.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).