search for: get_local_cid

Displaying 20 results from an estimated 58 matches for "get_local_cid".

2019 Sep 27
0
[RFC PATCH 11/13] vsock: add 'transport_hg' to handle g2h\h2g transports
...else + if (!vsk->transport) + vsk->transport = transport_hg; + } else { vsk->transport = transport_g2h; + } break; default: return -ESOCKTNOSUPPORT; @@ -423,7 +428,7 @@ static bool vsock_find_cid(unsigned int cid) if (transport_g2h && cid == transport_g2h->get_local_cid()) return true; - if (transport_h2g && cid == VMADDR_CID_HOST) + if ((transport_h2g || transport_hg) && cid == VMADDR_CID_HOST) return true; return false; @@ -1997,6 +2002,8 @@ static long vsock_dev_do_ioctl(struct file *filp, cid = transport_g2h->get_local_cid();...
2019 Sep 27
0
[RFC PATCH 12/13] vsock: prevent transport modules unloading
.../vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -387,6 +387,7 @@ static bool vhost_vsock_more_replies(struct vhost_vsock *vsock) static struct virtio_transport vhost_transport = { .transport = { .features = VSOCK_TRANSPORT_F_H2G, + .module = THIS_MODULE, .get_local_cid = vhost_transport_get_local_cid, diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h index 2a081d19e20d..f10fa918bf23 100644 --- a/include/net/af_vsock.h +++ b/include/net/af_vsock.h @@ -100,6 +100,7 @@ struct vsock_transport_send_notify_data { struct vsock_transport { ui...
2019 Sep 27
29
[RFC PATCH 00/13] vsock: add multi-transports support
...V that I didn't break anything even without nested VMs? I'll try to setup a Windows host where to test the nested VMs. Thanks in advance for your comments and suggestions, Stefano Stefano Garzarella (13): vsock/vmci: remove unused VSOCK_DEFAULT_CONNECT_TIMEOUT vsock: remove vm_sockets_get_local_cid() vsock: remove include/linux/vm_sockets.h file vsock: add 'transport' member in the struct vsock_sock vsock/virtio: add transport parameter to the virtio_transport_reset_no_sock() vsock: add 'struct vsock_sock *' param to vsock_core_get_transport() vsock: handle buffe...
2019 Sep 27
29
[RFC PATCH 00/13] vsock: add multi-transports support
...V that I didn't break anything even without nested VMs? I'll try to setup a Windows host where to test the nested VMs. Thanks in advance for your comments and suggestions, Stefano Stefano Garzarella (13): vsock/vmci: remove unused VSOCK_DEFAULT_CONNECT_TIMEOUT vsock: remove vm_sockets_get_local_cid() vsock: remove include/linux/vm_sockets.h file vsock: add 'transport' member in the struct vsock_sock vsock/virtio: add transport parameter to the virtio_transport_reset_no_sock() vsock: add 'struct vsock_sock *' param to vsock_core_get_transport() vsock: handle buffe...
2019 Sep 27
0
[RFC PATCH 10/13] vsock: add multi-transports support
...f022748..375af01a5b64 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -386,6 +386,8 @@ static bool vhost_vsock_more_replies(struct vhost_vsock *vsock) static struct virtio_transport vhost_transport = { .transport = { + .features = VSOCK_TRANSPORT_F_H2G, + .get_local_cid = vhost_transport_get_local_cid, .init = virtio_transport_do_socket_init, @@ -831,7 +833,7 @@ static int __init vhost_vsock_init(void) { int ret; - ret = vsock_core_init(&vhost_transport.transport); + ret = vsock_core_register(&vhost_transport.transp...
2019 Sep 27
0
[RFC PATCH 02/13] vsock: remove vm_sockets_get_local_cid()
vm_sockets_get_local_cid() is only used in virtio_transport_common.c. We can replace it calling the virtio_transport_get_ops() and using the get_local_cid() callback registered by the transport. Signed-off-by: Stefano Garzarella <sgarzare at redhat.com> --- include/linux/vm_sockets.h | 2 -- net/vmw_v...
2019 Oct 23
0
[PATCH net-next 02/14] vsock: remove vm_sockets_get_local_cid()
vm_sockets_get_local_cid() is only used in virtio_transport_common.c. We can replace it calling the virtio_transport_get_ops() and using the get_local_cid() callback registered by the transport. Reviewed-by: Stefan Hajnoczi <stefanha at redhat.com> Signed-off-by: Stefano Garzarella <sgarzare at redhat.com> ---...
2019 Nov 14
15
[PATCH net-next v2 00/15] vsock: add multi-transports support
...://patchwork.ozlabs.org/cover/1168442/ v1: https://patchwork.ozlabs.org/cover/1181986/ v1 -> v2: - Patch 11: + vmci_transport: sent reset when vsock_assign_transport() fails [Jorgen] + fixed loopback in the guests, checking if the remote_addr is the same of transport_g2h->get_local_cid() + virtio_transport_common: updated space available while creating the new child socket during a connection request - Patch 12: + removed 'features' variable in vmci_transport_init() [Stefan] + added a flag to register only once the host [Jorgen] - Added patch 15 to refus...
2019 Oct 23
0
[PATCH net-next 13/14] vsock: prevent transport modules unloading
...ndex b235f4bbe8ea..fdda9ec625ad 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -386,6 +386,8 @@ static bool vhost_vsock_more_replies(struct vhost_vsock *vsock) static struct virtio_transport vhost_transport = { .transport = { + .module = THIS_MODULE, + .get_local_cid = vhost_transport_get_local_cid, .init = virtio_transport_do_socket_init, diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h index 27a3463e4892..269e2f034789 100644 --- a/include/net/af_vsock.h +++ b/include/net/af_vsock.h @@ -100,6 +100,8 @@ struct vso...
2019 Sep 27
0
[RFC PATCH 04/13] vsock: add 'transport' member in the struct vsock_sock
...c int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr) @@ -536,7 +538,7 @@ static int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr) * like AF_INET prevents binding to a non-local IP address (in most * cases), we only allow binding to the local CID. */ - cid = transport->get_local_cid(); + cid = vsk->transport->get_local_cid(); if (addr->svm_cid != cid && addr->svm_cid != VMADDR_CID_ANY) return -EADDRNOTAVAIL; @@ -586,6 +588,7 @@ struct sock *__vsock_create(struct net *net, sk->sk_type = type; vsk = vsock_sk(sk); + vsk->transport = transpo...
2019 Oct 23
0
[PATCH net-next 04/14] vsock: add 'transport' member in the struct vsock_sock
...c int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr) @@ -536,7 +538,7 @@ static int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr) * like AF_INET prevents binding to a non-local IP address (in most * cases), we only allow binding to the local CID. */ - cid = transport->get_local_cid(); + cid = vsk->transport->get_local_cid(); if (addr->svm_cid != cid && addr->svm_cid != VMADDR_CID_ANY) return -EADDRNOTAVAIL; @@ -586,6 +588,7 @@ struct sock *__vsock_create(struct net *net, sk->sk_type = type; vsk = vsock_sk(sk); + vsk->transport = transpo...
2019 Oct 23
33
[PATCH net-next 00/14] vsock: add multi-transports support
...sport[L1,L2]) and with VMware (L0) + KVM (L1) (vmci-transport [L0,L1], vhost-transport [L1], virtio-transport[L2]). Dexuan successfully tested the RFC series on HyperV with a Linux guest. Stefano Garzarella (14): vsock/vmci: remove unused VSOCK_DEFAULT_CONNECT_TIMEOUT vsock: remove vm_sockets_get_local_cid() vsock: remove include/linux/vm_sockets.h file vsock: add 'transport' member in the struct vsock_sock vsock/virtio: add transport parameter to the virtio_transport_reset_no_sock() vsock: add 'struct vsock_sock *' param to vsock_core_get_transport() vsock: handle buffe...
2019 Oct 23
33
[PATCH net-next 00/14] vsock: add multi-transports support
...sport[L1,L2]) and with VMware (L0) + KVM (L1) (vmci-transport [L0,L1], vhost-transport [L1], virtio-transport[L2]). Dexuan successfully tested the RFC series on HyperV with a Linux guest. Stefano Garzarella (14): vsock/vmci: remove unused VSOCK_DEFAULT_CONNECT_TIMEOUT vsock: remove vm_sockets_get_local_cid() vsock: remove include/linux/vm_sockets.h file vsock: add 'transport' member in the struct vsock_sock vsock/virtio: add transport parameter to the virtio_transport_reset_no_sock() vsock: add 'struct vsock_sock *' param to vsock_core_get_transport() vsock: handle buffe...
2019 Oct 23
0
[PATCH net-next 11/14] vsock: add multi-transports support
...ruct(vsk); + } + + if (!new_transport) + return -ENODEV; + + vsk->transport = new_transport; + + return vsk->transport->init(vsk, psk); +} +EXPORT_SYMBOL_GPL(vsock_assign_transport); + +static bool vsock_find_cid(unsigned int cid) +{ + if (transport_g2h && cid == transport_g2h->get_local_cid()) + return true; + + if (transport_h2g && cid == VMADDR_CID_HOST) + return true; + + return false; +} + static struct sock *vsock_dequeue_accept(struct sock *listener) { struct vsock_sock *vlistener; @@ -414,6 +474,9 @@ static int vsock_send_shutdown(struct sock *sk, int mode) { s...
2019 Sep 27
0
[RFC PATCH 06/13] vsock: add 'struct vsock_sock *' param to vsock_core_get_transport()
..._core_get_transport(vsk); return container_of(t, struct virtio_transport, transport); } @@ -168,7 +169,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, struct virtio_vsock_pkt *pkt; u32 pkt_len = info->pkt_len; - src_cid = virtio_transport_get_ops()->transport.get_local_cid(); + src_cid = virtio_transport_get_ops(vsk)->transport.get_local_cid(); src_port = vsk->local_addr.svm_port; if (!info->remote_cid) { dst_cid = vsk->remote_addr.svm_cid; @@ -201,7 +202,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, virtio_transport_in...
2019 Nov 21
1
[PATCH net-next 5/6] vsock: use local transport when it is loaded
...9 +436,10 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk) > new_transport = transport_dgram; > break; > case SOCK_STREAM: > - if (remote_cid <= VMADDR_CID_HOST || > - (transport_g2h && > - remote_cid == transport_g2h->get_local_cid())) > + if (vsock_use_local_transport(remote_cid)) > + new_transport = transport_local; > + else if (remote_cid == VMADDR_CID_HOST || > + remote_cid == VMADDR_CID_HYPERVISOR) > new_transport = transport_g2h; > else > new_transport = transport_h2g; We used to...
2019 Oct 23
0
[PATCH net-next 06/14] vsock: add 'struct vsock_sock *' param to vsock_core_get_transport()
..._core_get_transport(vsk); return container_of(t, struct virtio_transport, transport); } @@ -168,7 +169,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, struct virtio_vsock_pkt *pkt; u32 pkt_len = info->pkt_len; - src_cid = virtio_transport_get_ops()->transport.get_local_cid(); + src_cid = virtio_transport_get_ops(vsk)->transport.get_local_cid(); src_port = vsk->local_addr.svm_port; if (!info->remote_cid) { dst_cid = vsk->remote_addr.svm_cid; @@ -201,7 +202,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, virtio_transport_in...
2019 Dec 13
3
[PATCH net 0/2] vsock/virtio: fix null-pointer dereference and related precautions
This series mainly solves a possible null-pointer dereference in virtio_transport_recv_listen() introduced with the multi-transport support [PATCH 1]. PATCH 2 adds a WARN_ON check for the same potential issue and a returned error in the virtio_transport_send_pkt_info() function to avoid crashing the kernel. Stefano Garzarella (2): vsock/virtio: fix null-pointer dereference in
2019 Oct 30
1
[PATCH net-next 07/14] vsock: handle buffer_size sockopts in the core
...)(struct vsock_sock *, u64); > - void (*set_max_buffer_size)(struct vsock_sock *, u64); > - u64 (*get_buffer_size)(struct vsock_sock *); > - u64 (*get_min_buffer_size)(struct vsock_sock *); > - u64 (*get_max_buffer_size)(struct vsock_sock *); > - > /* Addressing. */ > u32 (*get_local_cid)(void); > }; > diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index > eaea159006c8..90ac46ea12ef 100644 > --- a/net/vmw_vsock/af_vsock.c > +++ b/net/vmw_vsock/af_vsock.c > @@ -126,6 +126,10 @@ static struct proto vsock_proto = { > */ > #define VSOCK_DEF...
2019 Dec 10
7
[PATCH net-next v2 0/6] vsock: add local transport support
v2: - style fixes [Dave] - removed RCU sync and changed 'the_vsock_loopback' in a global static variable [Stefan] - use G2H transport when local transport is not loaded and remote cid is VMADDR_CID_LOCAL [Stefan] - rebased on net-next v1: https://patchwork.kernel.org/cover/11251735/ This series introduces a new transport (vsock_loopback) to handle local communication. This