search for: tun_get_socket

Displaying 20 results from an estimated 35 matches for "tun_get_socket".

2009 Nov 02
1
[PATCHv6 1/3] tun: export underlying socket
...object from tun file. Returns error unless file is + * attached to a device. The returned object works like a packet socket, it + * can be used for sock_sendmsg/sock_recvmsg. The caller is responsible for + * holding a reference to the file for as long as the socket is in use. */ +struct socket *tun_get_socket(struct file *file) +{ + struct tun_struct *tun; + if (file->f_op != &tun_fops) + return ERR_PTR(-EINVAL); + tun = tun_get(file); + if (!tun) + return ERR_PTR(-EBADFD); + tun_put(tun); + return &tun->socket; +} +EXPORT_SYMBOL_GPL(tun_get_socket); + module_init(tun_init); module_exi...
2009 Nov 02
1
[PATCHv6 1/3] tun: export underlying socket
...object from tun file. Returns error unless file is + * attached to a device. The returned object works like a packet socket, it + * can be used for sock_sendmsg/sock_recvmsg. The caller is responsible for + * holding a reference to the file for as long as the socket is in use. */ +struct socket *tun_get_socket(struct file *file) +{ + struct tun_struct *tun; + if (file->f_op != &tun_fops) + return ERR_PTR(-EINVAL); + tun = tun_get(file); + if (!tun) + return ERR_PTR(-EBADFD); + tun_put(tun); + return &tun->socket; +} +EXPORT_SYMBOL_GPL(tun_get_socket); + module_init(tun_init); module_exi...
2009 Nov 04
0
[PATCHv8 1/3] tun: export underlying socket
...object from tun file. Returns error unless file is + * attached to a device. The returned object works like a packet socket, it + * can be used for sock_sendmsg/sock_recvmsg. The caller is responsible for + * holding a reference to the file for as long as the socket is in use. */ +struct socket *tun_get_socket(struct file *file) +{ + struct tun_struct *tun; + if (file->f_op != &tun_fops) + return ERR_PTR(-EINVAL); + tun = tun_get(file); + if (!tun) + return ERR_PTR(-EBADFD); + tun_put(tun); + return &tun->socket; +} +EXPORT_SYMBOL_GPL(tun_get_socket); + module_init(tun_init); module_exi...
2009 Nov 04
0
[PATCHv8 1/3] tun: export underlying socket
...object from tun file. Returns error unless file is + * attached to a device. The returned object works like a packet socket, it + * can be used for sock_sendmsg/sock_recvmsg. The caller is responsible for + * holding a reference to the file for as long as the socket is in use. */ +struct socket *tun_get_socket(struct file *file) +{ + struct tun_struct *tun; + if (file->f_op != &tun_fops) + return ERR_PTR(-EINVAL); + tun = tun_get(file); + if (!tun) + return ERR_PTR(-EBADFD); + tun_put(tun); + return &tun->socket; +} +EXPORT_SYMBOL_GPL(tun_get_socket); + module_init(tun_init); module_exi...
2009 Nov 03
1
[PATCHv7 1/3] tun: export underlying socket
...object from tun file. Returns error unless file is + * attached to a device. The returned object works like a packet socket, it + * can be used for sock_sendmsg/sock_recvmsg. The caller is responsible for + * holding a reference to the file for as long as the socket is in use. */ +struct socket *tun_get_socket(struct file *file) +{ + struct tun_struct *tun; + if (file->f_op != &tun_fops) + return ERR_PTR(-EINVAL); + tun = tun_get(file); + if (!tun) + return ERR_PTR(-EBADFD); + tun_put(tun); + return &tun->socket; +} +EXPORT_SYMBOL_GPL(tun_get_socket); + module_init(tun_init); module_exi...
2009 Nov 03
1
[PATCHv7 1/3] tun: export underlying socket
...object from tun file. Returns error unless file is + * attached to a device. The returned object works like a packet socket, it + * can be used for sock_sendmsg/sock_recvmsg. The caller is responsible for + * holding a reference to the file for as long as the socket is in use. */ +struct socket *tun_get_socket(struct file *file) +{ + struct tun_struct *tun; + if (file->f_op != &tun_fops) + return ERR_PTR(-EINVAL); + tun = tun_get(file); + if (!tun) + return ERR_PTR(-EBADFD); + tun_put(tun); + return &tun->socket; +} +EXPORT_SYMBOL_GPL(tun_get_socket); + module_init(tun_init); module_exi...
2023 May 05
0
[PATCH] vhost_net: Use fdget() and fdput()
...> > static struct socket *get_tap_socket(int fd) > { > - struct file *file = fget(fd); > + struct fd f = fdget(fd); > struct socket *sock; > > - if (!file) > + if (!f.file) > return ERR_PTR(-EBADF); > - sock = tun_get_socket(file); > + sock = tun_get_socket(f.file); > if (!IS_ERR(sock)) > return sock; > - sock = tap_get_socket(file); > + sock = tap_get_socket(f.file); > if (IS_ERR(sock)) > - fput(file); > + fdput(f); &...
2023 May 05
0
[PATCH] vhost_net: Use fdget() and fdput()
...t;> - struct file *file = fget(fd); > >> + struct fd f = fdget(fd); > >> struct socket *sock; > >> > >> - if (!file) > >> + if (!f.file) > >> return ERR_PTR(-EBADF); > >> - sock = tun_get_socket(file); > >> + sock = tun_get_socket(f.file); > >> if (!IS_ERR(sock)) > >> return sock; > >> - sock = tap_get_socket(file); > >> + sock = tap_get_socket(f.file); > >> if (IS_ERR(sock)) > >&g...
2023 May 11
0
[PATCH] vhost_net: Use fdget() and fdput()
...t ptr_ring *get_tap_ptr_ring(struct file *file) > > static struct socket *get_tap_socket(int fd) > { > - struct file *file = fget(fd); > + struct fd f = fdget(fd); > struct socket *sock; > > - if (!file) > + if (!f.file) > return ERR_PTR(-EBADF); > - sock = tun_get_socket(file); > + sock = tun_get_socket(f.file); > if (!IS_ERR(sock)) > return sock; > - sock = tap_get_socket(file); > + sock = tap_get_socket(f.file); > if (IS_ERR(sock)) > - fput(file); > + fdput(f); > return sock; NAK. For the same reason why the sockfd_lookup()...
2013 Mar 13
1
vhost questions.
...o a tun device you can make it call an arbitrary pointer though). It would be better for us to create the skb, and have a special interface to inject it directly. This way we can handle the UIO_MAXIOV limit ourselves (eg. by not doing zero copy on such stupid cases). 6) By calling tun_get_socket() and macvtap_get_socket() we are forcing those modules to load. We should use symbol_get() to avoid this. In short, this code is a mess. Assuming we can't just break the API, we've got a long process ahead of us to get it into shape :( Thanks, Rusty.
2013 Mar 13
1
vhost questions.
...o a tun device you can make it call an arbitrary pointer though). It would be better for us to create the skb, and have a special interface to inject it directly. This way we can handle the UIO_MAXIOV limit ourselves (eg. by not doing zero copy on such stupid cases). 6) By calling tun_get_socket() and macvtap_get_socket() we are forcing those modules to load. We should use symbol_get() to avoid this. In short, this code is a mess. Assuming we can't just break the API, we've got a long process ahead of us to get it into shape :( Thanks, Rusty.
2017 Mar 21
12
[PATCH net-next 0/8] vhost-net rx batching
Hi all: This series tries to implement rx batching for vhost-net. This is done by batching the dequeuing from skb_array which was exported by underlayer socket and pass the sbk back through msg_control to finish userspace copying. Tests shows at most 19% improvment on rx pps. Please review. Thanks Jason Wang (8): ptr_ring: introduce batch dequeuing skb_array: introduce batch dequeuing
2017 Mar 21
12
[PATCH net-next 0/8] vhost-net rx batching
Hi all: This series tries to implement rx batching for vhost-net. This is done by batching the dequeuing from skb_array which was exported by underlayer socket and pass the sbk back through msg_control to finish userspace copying. Tests shows at most 19% improvment on rx pps. Please review. Thanks Jason Wang (8): ptr_ring: introduce batch dequeuing skb_array: introduce batch dequeuing
2018 Sep 06
1
[PATCH net-next 08/11] tun: switch to new type of msg_control
..._PTR 2 Looks like TUN_MSG_PTR should be pushed out to a follow-up patch? > +struct tun_msg_ctl { > + int type; > + void *ptr; > +}; > + type actually includes a size. Why not two short fields then? > #if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE) > struct socket *tun_get_socket(struct file *); > struct ptr_ring *tun_get_tx_ring(struct file *file); > -- > 2.17.1
2010 May 23
0
error in loading vhost_net module
...irtualization-->Host Kernel Accelerator for virtio net' as >> a module, it got built but after installing and rebooting, i couldn't see the >> module when typed lsmod. So i tried to manually insert the module and got the >> following error 'vhost_net: Unknown symbol tun_get_socket'. So could you please >> help me getting this to work. Also could you please tell me which mailing list >> should i post my queries about vhost_net so that others who are facing the same >> problem can be benifitted. Thank you very much... >> >> Thanks, >> Ba...
2010 May 23
0
error in loading vhost_net module
...irtualization-->Host Kernel Accelerator for virtio net' as >> a module, it got built but after installing and rebooting, i couldn't see the >> module when typed lsmod. So i tried to manually insert the module and got the >> following error 'vhost_net: Unknown symbol tun_get_socket'. So could you please >> help me getting this to work. Also could you please tell me which mailing list >> should i post my queries about vhost_net so that others who are facing the same >> problem can be benifitted. Thank you very much... >> >> Thanks, >> Ba...
2018 Sep 06
0
[PATCH net-next 08/11] tun: switch to new type of msg_control
...a46dced1f38 100644 --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h @@ -19,6 +19,13 @@ #define TUN_XDP_FLAG 0x1UL +#define TUN_MSG_UBUF 1 +#define TUN_MSG_PTR 2 +struct tun_msg_ctl { + int type; + void *ptr; +}; + #if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE) struct socket *tun_get_socket(struct file *); struct ptr_ring *tun_get_tx_ring(struct file *file); -- 2.17.1
2011 Aug 12
11
[net-next RFC PATCH 0/7] multiqueue support for tun/tap
As multi-queue nics were commonly used for high-end servers, current single queue based tap can not satisfy the requirement of scaling guest network performance as the numbers of vcpus increase. So the following series implements multiple queue support in tun/tap. In order to take advantages of this, a multi-queue capable driver and qemu were also needed. I just rebase the latest version of
2011 Aug 12
11
[net-next RFC PATCH 0/7] multiqueue support for tun/tap
As multi-queue nics were commonly used for high-end servers, current single queue based tap can not satisfy the requirement of scaling guest network performance as the numbers of vcpus increase. So the following series implements multiple queue support in tun/tap. In order to take advantages of this, a multi-queue capable driver and qemu were also needed. I just rebase the latest version of
2009 Nov 09
3
[PATCHv9 3/3] vhost_net: a kernel-level virtio server
...(uaddr.sa.sll_family != AF_PACKET) { + r = -EPFNOSUPPORT; + goto err; + } + return sock; +err: + fput(sock->file); + return ERR_PTR(r); +} + +static struct socket *get_tun_socket(int fd) +{ + struct file *file = fget(fd); + struct socket *sock; + if (!file) + return ERR_PTR(-EBADF); + sock = tun_get_socket(file); + if (IS_ERR(sock)) + fput(file); + return sock; +} + +static struct socket *get_socket(int fd) +{ + struct socket *sock; + if (fd == -1) + return NULL; + sock = get_raw_socket(fd); + if (!IS_ERR(sock)) + return sock; + sock = get_tun_socket(fd); + if (!IS_ERR(sock)) + return sock; + ret...