From: Gerd Hoffmann <kraxel@redhat.com>
To: acking@vmware.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, pv-drivers@vmware.com,
gregkh@linuxfoundation.org, davem@davemloft.net
Subject: Re: [PATCH 1/1] VSOCK: Introduce VM Sockets
Date: Mon, 28 Jan 2013 13:25:22 +0100 [thread overview]
Message-ID: <51066E32.2000209@redhat.com> (raw)
In-Reply-To: <1359135470-30677-2-git-send-email-acking@vmware.com>
Hi,
> diff --git a/net/vmw_vsock/Kconfig b/net/vmw_vsock/Kconfig
> new file mode 100644
> index 0000000..95e2568
> --- /dev/null
> +++ b/net/vmw_vsock/Kconfig
> @@ -0,0 +1,14 @@
> +#
> +# Vsock protocol
> +#
> +
> +config VMWARE_VSOCK
> + tristate "Virtual Socket protocol"
> + depends on VMWARE_VMCI
I guess this is temporary? Cover letter says *mostly* separated ...
> +vmw_vsock-y += af_vsock.o vmci_transport.o vmci_transport_notify.o \
> + vmci_transport_notify_qstate.o vsock_addr.o
Likewise, I expect with the final version vmci_transport is a separate
module (or moves into the vmci driver), correct?
> +static long vsock_dev_do_ioctl(struct file *filp,
> + unsigned int cmd, void __user *ptr)
> +{
> + static const u16 parts[4] = VSOCK_DRIVER_VERSION_PARTS;
> + u32 __user *p = ptr;
> + int retval = 0;
> + u32 version;
> +
> + switch (cmd) {
> + case IOCTL_VMCI_SOCKETS_VERSION:
> + version = VMCI_SOCKETS_MAKE_VERSION(parts);
> + if (put_user(version, p) != 0)
> + retval = -EFAULT;
> + break;
Still needed?
> + case IOCTL_VMCI_SOCKETS_GET_AF_VALUE:
> + if (put_user(AF_VSOCK, p) != 0)
> + retval = -EFAULT;
> +
> + break;
That can go away, with the upstream merge vsock will get a fixed AF_VSOCK.
> + case IOCTL_VMCI_SOCKETS_GET_LOCAL_CID:
> + if (put_user(vmci_get_context_id(), p) != 0)
> + retval = -EFAULT;
What is this?
> +static int __init vsock_init(void)
> +{
> + int err;
> +
> + vsock_init_tables();
> +
> + err = misc_register(&vsock_device);
> + if (err) {
> + pr_err("Failed to register misc device\n");
> + return -ENOENT;
> + }
> +
> + err = vmci_transport_register(&transport);
> + if (err) {
> + pr_err("Cannot register with VMCI device\n");
> + goto err_misc_deregister;
> + }
Hmm? There should be a vsock_(un)register_transport which the vmci
transport code can call (and likewise virtio transport some day).
> +struct vsock_sock {
> + /* sk must be the first member. */
> + struct sock sk;
> + struct sockaddr_vm local_addr;
> + struct sockaddr_vm remote_addr;
> + /* The rest is transport-specific: this is the stuff we need to pull
> + * out to make it work with something other than VMCI.
> + */
> + struct {
> + /* For DGRAMs. */
> + struct vmci_handle dg_handle;
Yep, should be a pointer where transports can hook in their private data.
> +/**** TRANSPORT ****/
> +
> +struct vsock_transport {
> + void (*init)(struct vsock_sock *, struct vsock_sock *);
> + void (*destruct)(struct vsock_sock *);
> + void (*release)(struct vsock_sock *);
> + int (*connect)(struct vsock_sock *);
> + int (*bind_dgram)(struct vsock_sock *, struct sockaddr_vm *);
> + int (*send_dgram)(struct vsock_sock *, struct sockaddr_vm *,
> + struct iovec *, size_t len);
> + ssize_t (*recv_stream)(struct vsock_sock *, struct iovec *,
> + size_t len, int flags);
> + ssize_t (*send_stream)(struct vsock_sock *, struct iovec *,
> + size_t len);
> + s64 (*stream_has_data)(struct vsock_sock *);
> + s64 (*stream_has_space)(struct vsock_sock *);
> + int (*send_shutdown)(struct sock *sk, int mode);
> + void (*unregister)(void);
> +};
So that is the interface transports have to implement. Looks reasonable
to me. Some documentation would be nice, although most of it is
self-explaining.
Where is recv_dgram?
Also why bind_dgram? I guess binding stream sockets doesn't make sense
for the vsock family?
I'd make the naming a bit more consistent, some stream callbacks are
prefixed and some postfixed with "stream".
I'd also name send_shutdown just shutdown (same name the system call has).
What does unregister?
cheers,
Gerd
next prev parent reply other threads:[~2013-01-28 12:25 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 17:37 [PATCH 0/1] VM Sockets for Linux upstreaming acking
2013-01-25 17:37 ` [PATCH 1/1] VSOCK: Introduce VM Sockets acking
2013-01-25 23:59 ` Neil Horman
2013-01-26 0:15 ` [Pv-drivers] " Dmitry Torokhov
2013-01-26 0:22 ` Greg KH
2013-01-26 18:41 ` Neil Horman
2013-01-28 12:25 ` Gerd Hoffmann [this message]
2013-01-31 22:06 ` Andy King
2013-02-01 8:12 ` Gerd Hoffmann
2013-02-04 23:41 ` Andy King
-- strict thread matches above, loose matches on Subject: below --
2013-02-04 23:26 [PATCH 0/1] VM Sockets for Linux upstreaming Andy King
2013-02-04 23:26 ` [PATCH 1/1] VSOCK: Introduce VM Sockets Andy King
2013-02-07 0:23 [PATCH 0/1] VM Sockets for Linux upstreaming Andy King
2013-02-07 0:23 ` [PATCH 1/1] VSOCK: Introduce VM Sockets Andy King
2013-02-11 14:22 ` Gerd Hoffmann
2013-02-12 15:21 ` Andy King
2013-02-13 11:06 ` Gerd Hoffmann
2013-02-14 3:20 ` Andy King
2013-02-14 9:28 ` Gerd Hoffmann
2013-02-12 10:58 ` Gerd Hoffmann
2013-02-13 3:23 ` Andy King
2013-02-13 12:44 ` Gerd Hoffmann
2013-02-14 3:07 ` Andy King
2013-02-18 16:56 ` Andy King
2013-02-14 11:05 ` Gerd Hoffmann
2013-02-18 17:07 ` Andy King
2013-02-19 8:45 ` Gerd Hoffmann
2013-02-14 20:18 ` Sasha Levin
2013-02-18 17:09 ` Andy King
2013-02-15 10:32 ` Gerd Hoffmann
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=51066E32.2000209@redhat.com \
--to=kraxel@redhat.com \
--cc=acking@vmware.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pv-drivers@vmware.com \
--cc=virtualization@lists.linux-foundation.org \
/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).