netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arseniy Krasnov <oxffffaa@gmail.com>
To: Bobby Eshleman <bobbyeshleman@gmail.com>
Cc: Bobby Eshleman <bobby.eshleman@bytedance.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	Bryan Tan <bryantan@vmware.com>, Vishnu Dasa <vdasa@vmware.com>,
	VMware PV-Drivers Reviewers <pv-drivers@vmware.com>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Simon Horman <simon.horman@corigine.com>,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hyperv@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH RFC net-next v5 13/14] virtio/vsock: implement datagram support
Date: Thu, 27 Jul 2023 11:09:21 +0300	[thread overview]
Message-ID: <f04d2aa5-32d8-cdc4-3b51-f15b0f42a1e8@gmail.com> (raw)
In-Reply-To: <ZMFetBpO0OdzXtnK@bullseye>



On 26.07.2023 20:58, Bobby Eshleman wrote:
> On Sat, Jul 22, 2023 at 11:45:29AM +0300, Arseniy Krasnov wrote:
>>
>>
>> On 19.07.2023 03:50, Bobby Eshleman wrote:
>>> This commit implements datagram support for virtio/vsock by teaching
>>> virtio to use the general virtio transport ->dgram_addr_init() function
>>> and implementation a new version of ->dgram_allow().
>>>
>>> Additionally, it drops virtio_transport_dgram_allow() as an exported
>>> symbol because it is no longer used in other transports.
>>>
>>> Signed-off-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
>>> ---
>>>  include/linux/virtio_vsock.h            |  1 -
>>>  net/vmw_vsock/virtio_transport.c        | 24 +++++++++++++++++++++++-
>>>  net/vmw_vsock/virtio_transport_common.c |  6 ------
>>>  3 files changed, 23 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
>>> index b3856b8a42b3..d0a4f08b12c1 100644
>>> --- a/include/linux/virtio_vsock.h
>>> +++ b/include/linux/virtio_vsock.h
>>> @@ -211,7 +211,6 @@ void virtio_transport_notify_buffer_size(struct vsock_sock *vsk, u64 *val);
>>>  u64 virtio_transport_stream_rcvhiwat(struct vsock_sock *vsk);
>>>  bool virtio_transport_stream_is_active(struct vsock_sock *vsk);
>>>  bool virtio_transport_stream_allow(u32 cid, u32 port);
>>> -bool virtio_transport_dgram_allow(u32 cid, u32 port);
>>>  void virtio_transport_dgram_addr_init(struct sk_buff *skb,
>>>  				      struct sockaddr_vm *addr);
>>>  
>>> diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
>>> index ac2126c7dac5..713718861bd4 100644
>>> --- a/net/vmw_vsock/virtio_transport.c
>>> +++ b/net/vmw_vsock/virtio_transport.c
>>> @@ -63,6 +63,7 @@ struct virtio_vsock {
>>>  
>>>  	u32 guest_cid;
>>>  	bool seqpacket_allow;
>>> +	bool dgram_allow;
>>>  };
>>>  
>>>  static u32 virtio_transport_get_local_cid(void)
>>> @@ -413,6 +414,7 @@ static void virtio_vsock_rx_done(struct virtqueue *vq)
>>>  	queue_work(virtio_vsock_workqueue, &vsock->rx_work);
>>>  }
>>>  
>>> +static bool virtio_transport_dgram_allow(u32 cid, u32 port);
>>
>> May be add body here? Without prototyping? Same for loopback and vhost.
>>
> 
> Sounds okay with me, but this seems to go against the pattern
> established by seqpacket. Any reason why?

Stefano Garzarella <sgarzare@redhat.com> commented my patch with the same approach:

https://lore.kernel.org/netdev/lex6l5suez7azhirt22lidndtjomkbagfbpvvi5p7c2t7klzas@4l2qly7at37c/

Thanks, Arseniy


> 
>>>  static bool virtio_transport_seqpacket_allow(u32 remote_cid);
>>>  
>>>  static struct virtio_transport virtio_transport = {
>>> @@ -430,6 +432,7 @@ static struct virtio_transport virtio_transport = {
>>>  
>>>  		.dgram_enqueue            = virtio_transport_dgram_enqueue,
>>>  		.dgram_allow              = virtio_transport_dgram_allow,
>>> +		.dgram_addr_init          = virtio_transport_dgram_addr_init,
>>>  
>>>  		.stream_dequeue           = virtio_transport_stream_dequeue,
>>>  		.stream_enqueue           = virtio_transport_stream_enqueue,
>>> @@ -462,6 +465,21 @@ static struct virtio_transport virtio_transport = {
>>>  	.send_pkt = virtio_transport_send_pkt,
>>>  };
>>>  
>>> +static bool virtio_transport_dgram_allow(u32 cid, u32 port)
>>> +{
>>> +	struct virtio_vsock *vsock;
>>> +	bool dgram_allow;
>>> +
>>> +	dgram_allow = false;
>>> +	rcu_read_lock();
>>> +	vsock = rcu_dereference(the_virtio_vsock);
>>> +	if (vsock)
>>> +		dgram_allow = vsock->dgram_allow;
>>> +	rcu_read_unlock();
>>> +
>>> +	return dgram_allow;
>>> +}
>>> +
>>>  static bool virtio_transport_seqpacket_allow(u32 remote_cid)
>>>  {
>>>  	struct virtio_vsock *vsock;
>>> @@ -655,6 +673,9 @@ static int virtio_vsock_probe(struct virtio_device *vdev)
>>>  	if (virtio_has_feature(vdev, VIRTIO_VSOCK_F_SEQPACKET))
>>>  		vsock->seqpacket_allow = true;
>>>  
>>> +	if (virtio_has_feature(vdev, VIRTIO_VSOCK_F_DGRAM))
>>> +		vsock->dgram_allow = true;
>>> +
>>>  	vdev->priv = vsock;
>>>  
>>>  	ret = virtio_vsock_vqs_init(vsock);
>>> @@ -747,7 +768,8 @@ static struct virtio_device_id id_table[] = {
>>>  };
>>>  
>>>  static unsigned int features[] = {
>>> -	VIRTIO_VSOCK_F_SEQPACKET
>>> +	VIRTIO_VSOCK_F_SEQPACKET,
>>> +	VIRTIO_VSOCK_F_DGRAM
>>>  };
>>>  
>>>  static struct virtio_driver virtio_vsock_driver = {
>>> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
>>> index 96118e258097..77898f5325cd 100644
>>> --- a/net/vmw_vsock/virtio_transport_common.c
>>> +++ b/net/vmw_vsock/virtio_transport_common.c
>>> @@ -783,12 +783,6 @@ bool virtio_transport_stream_allow(u32 cid, u32 port)
>>>  }
>>>  EXPORT_SYMBOL_GPL(virtio_transport_stream_allow);
>>>  
>>> -bool virtio_transport_dgram_allow(u32 cid, u32 port)
>>> -{
>>> -	return false;
>>> -}
>>> -EXPORT_SYMBOL_GPL(virtio_transport_dgram_allow);
>>> -
>>>  int virtio_transport_connect(struct vsock_sock *vsk)
>>>  {
>>>  	struct virtio_vsock_pkt_info info = {
>>>
>>
>> Thanks, Arseniy
> 
> Thanks,
> Bobby

  reply	other threads:[~2023-07-27  8:10 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19  0:50 [PATCH RFC net-next v5 00/14] virtio/vsock: support datagrams Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 01/14] af_vsock: generalize vsock_dgram_recvmsg() to all transports Bobby Eshleman
2023-07-24 18:11   ` Arseniy Krasnov
2023-07-26 18:21     ` Bobby Eshleman
2023-07-27  7:53       ` Arseniy Krasnov
2023-07-19  0:50 ` [PATCH RFC net-next v5 02/14] af_vsock: refactor transport lookup code Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 03/14] af_vsock: support multi-transport datagrams Bobby Eshleman
2023-07-22 21:53   ` Arseniy Krasnov
2023-08-02 22:24     ` Bobby Eshleman
2023-08-03  0:53       ` Bobby Eshleman
2023-08-03 12:42         ` Stefano Garzarella
2023-08-03 18:58           ` Bobby Eshleman
2023-08-04 14:11             ` Stefano Garzarella
2023-08-04 17:01               ` Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 04/14] af_vsock: generalize bind table functions Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 05/14] af_vsock: use a separate dgram bind table Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 06/14] virtio/vsock: add VIRTIO_VSOCK_TYPE_DGRAM Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 07/14] virtio/vsock: add common datagram send path Bobby Eshleman
2023-07-22  8:16   ` Arseniy Krasnov
2023-07-26 17:08     ` Bobby Eshleman
2023-07-27  7:57       ` Arseniy Krasnov
2023-08-02 20:08         ` Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 08/14] af_vsock: add vsock_find_bound_dgram_socket() Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 09/14] virtio/vsock: add common datagram recv path Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 10/14] virtio/vsock: add VIRTIO_VSOCK_F_DGRAM feature bit Bobby Eshleman
2023-07-26 18:38   ` Michael S. Tsirkin
2023-07-27  7:48     ` Stefano Garzarella
2023-08-01  4:30       ` Bobby Eshleman
2023-08-01 16:04         ` Stefano Garzarella
2023-07-19  0:50 ` [PATCH RFC net-next v5 11/14] vhost/vsock: implement datagram support Bobby Eshleman
2023-07-22  8:42   ` Arseniy Krasnov
2023-07-26 17:55     ` Bobby Eshleman
2023-07-27  8:00       ` Arseniy Krasnov
2023-08-02 21:23         ` Bobby Eshleman
2023-08-04 13:16           ` Arseniy Krasnov
2023-07-27  8:04       ` Arseniy Krasnov
2023-07-26 18:40   ` Michael S. Tsirkin
2023-08-01  4:26     ` Bobby Eshleman
2023-08-02 19:28     ` Bobby Eshleman
2023-08-12  8:01       ` Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 12/14] vsock/loopback: " Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 13/14] virtio/vsock: " Bobby Eshleman
2023-07-22  8:45   ` Arseniy Krasnov
2023-07-26 17:58     ` Bobby Eshleman
2023-07-27  8:09       ` Arseniy Krasnov [this message]
2023-08-01  4:14         ` [PATCH RFC net-next v5 13/14] virtio/vsock: implement datagram supporty Bobby Eshleman
2023-07-19  0:50 ` [PATCH RFC net-next v5 14/14] test/vsock: add vsock dgram tests Bobby Eshleman
2023-07-22  8:51 ` [PATCH RFC net-next v5 00/14] virtio/vsock: support datagrams Arseniy Krasnov
2023-07-26 18:02 ` Bobby Eshleman
2023-07-27  7:51 ` Michael S. Tsirkin
2023-08-01  5:30   ` Bobby Eshleman

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=f04d2aa5-32d8-cdc4-3b51-f15b0f42a1e8@gmail.com \
    --to=oxffffaa@gmail.com \
    --cc=bobby.eshleman@bytedance.com \
    --cc=bobbyeshleman@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=bryantan@vmware.com \
    --cc=dan.carpenter@linaro.org \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=edumazet@google.com \
    --cc=haiyangz@microsoft.com \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pv-drivers@vmware.com \
    --cc=sgarzare@redhat.com \
    --cc=simon.horman@corigine.com \
    --cc=stefanha@redhat.com \
    --cc=vdasa@vmware.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wei.liu@kernel.org \
    --cc=xuanzhuo@linux.alibaba.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).