linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Andra Paraschiv <andraprs@amazon.com>
Cc: netdev <netdev@vger.kernel.org>,
	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>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>
Subject: Re: [PATCH net-next v2 3/4] af_vsock: Set VMADDR_FLAG_TO_HOST flag on the receive path
Date: Mon, 7 Dec 2020 10:59:54 +0100	[thread overview]
Message-ID: <20201207095954.5gvp557xnulvledx@steredhat> (raw)
In-Reply-To: <20201204170235.84387-4-andraprs@amazon.com>

On Fri, Dec 04, 2020 at 07:02:34PM +0200, Andra Paraschiv wrote:
>The vsock flags can be set during the connect() setup logic, when
>initializing the vsock address data structure variable. Then the vsock
>transport is assigned, also considering this flags field.
>
>The vsock transport is also assigned on the (listen) receive path. The
>flags field needs to be set considering the use case.
>
>Set the value of the vsock flags of the remote address to the one
>targeted for packets forwarding to the host, if the following conditions
>are met:
>
>* The source CID of the packet is higher than VMADDR_CID_HOST.
>* The destination CID of the packet is higher than VMADDR_CID_HOST.
>
>Changelog
>
>v1 -> v2
>
>* Set the vsock flag on the receive path in the vsock transport
>  assignment logic.
>* Use bitwise operator for the vsock flag setup.
>* Use the updated "VMADDR_FLAG_TO_HOST" flag naming.
>
>Signed-off-by: Andra Paraschiv <andraprs@amazon.com>
>---
> net/vmw_vsock/af_vsock.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

>
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index d10916ab45267..83d035eab0b05 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -431,6 +431,18 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
> 	unsigned int remote_cid = vsk->remote_addr.svm_cid;
> 	int ret;
>
>+	/* If the packet is coming with the source and destination CIDs higher
>+	 * than VMADDR_CID_HOST, then a vsock channel where all the packets are
>+	 * forwarded to the host should be established. Then the host will
>+	 * need to forward the packets to the guest.
>+	 *
>+	 * The flag is set on the (listen) receive path (psk is not NULL). On
>+	 * the connect path the flag can be set by the user space application.
>+	 */
>+	if (psk && vsk->local_addr.svm_cid > VMADDR_CID_HOST &&
>+	    vsk->remote_addr.svm_cid > VMADDR_CID_HOST)
>+		vsk->remote_addr.svm_flags |= VMADDR_FLAG_TO_HOST;
>+
> 	switch (sk->sk_type) {
> 	case SOCK_DGRAM:
> 		new_transport = transport_dgram;
>-- 
>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.
>


  reply	other threads:[~2020-12-07 10:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 17:02 [PATCH net-next v2 0/4] vsock: Add flags field in the vsock address Andra Paraschiv
2020-12-04 17:02 ` [PATCH net-next v2 1/4] vm_sockets: Include flags field in the vsock address data structure Andra Paraschiv
2020-12-07  9:59   ` Stefano Garzarella
2020-12-07 19:25     ` Paraschiv, Andra-Irina
2020-12-07 21:29   ` Jakub Kicinski
2020-12-08 18:23     ` Paraschiv, Andra-Irina
2020-12-08 18:42       ` Jakub Kicinski
2020-12-09 10:48         ` Stefano Garzarella
2020-12-09 15:17           ` Paraschiv, Andra-Irina
2020-12-09 17:30             ` Jakub Kicinski
2020-12-10 15:29               ` Paraschiv, Andra-Irina
2020-12-04 17:02 ` [PATCH net-next v2 2/4] vm_sockets: Add VMADDR_FLAG_TO_HOST vsock flag Andra Paraschiv
2020-12-07  9:59   ` Stefano Garzarella
2020-12-07 19:45     ` Paraschiv, Andra-Irina
2020-12-04 17:02 ` [PATCH net-next v2 3/4] af_vsock: Set VMADDR_FLAG_TO_HOST flag on the receive path Andra Paraschiv
2020-12-07  9:59   ` Stefano Garzarella [this message]
2020-12-04 17:02 ` [PATCH net-next v2 4/4] af_vsock: Assign the vsock transport considering the vsock address flags Andra Paraschiv
2020-12-07 10:00   ` Stefano Garzarella
2020-12-07 19:51     ` Paraschiv, Andra-Irina
2020-12-07 10:05 ` [PATCH net-next v2 0/4] vsock: Add flags field in the vsock address Stefano Garzarella
2020-12-07 19: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=20201207095954.5gvp557xnulvledx@steredhat \
    --to=sgarzare@redhat.com \
    --cc=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=stefanha@redhat.com \
    --cc=vkuznets@redhat.com \
    --subject='Re: [PATCH net-next v2 3/4] af_vsock: Set VMADDR_FLAG_TO_HOST flag on the receive path' \
    /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

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).