From: Guus Sliepen <guus@tinc-vpn•org>
To: netdev@vger•kernel.org
Subject: Best way to reduce system call overhead for tun device I/O?
Date: Wed, 30 Mar 2016 00:40:43 +0200 [thread overview]
Message-ID: <20160329224043.GY3784@sliepen.org> (raw)
I'm trying to reduce system call overhead when reading/writing to/from a
tun device in userspace. For sockets, one can use sendmmsg()/recvmmsg(),
but a tun fd is not a socket fd, so this doesn't work. I'm see several
options to allow userspace to read/write multiple packets with one
syscall:
- Implement a TX/RX ring buffer that is mmap()ed, like with AF_PACKET
sockets.
- Implement a ioctl() to emulate sendmmsg()/recvmmsg().
- Add a flag that can be set using TUNSETIFF that makes regular
read()/write() calls handle multiple packets in one go.
- Expose a socket fd to userspace, so regular sendmmsg()/recvmmsg() can
be used. There is tun_get_socket() which is used internally in the
kernel, but this is not exposed to userspace, and doesn't look trivial
to do either.
What would be the right way to do this?
--
Met vriendelijke groet / with kind regards,
Guus Sliepen <guus@tinc-vpn•org>
next reply other threads:[~2016-03-29 22:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-29 22:40 Guus Sliepen [this message]
2016-03-31 21:18 ` Best way to reduce system call overhead for tun device I/O? Tom Herbert
2016-03-31 21:20 ` David Miller
2016-03-31 22:28 ` Guus Sliepen
2016-03-31 23:39 ` Stephen Hemminger
2016-04-03 23:03 ` Willem de Bruijn
2016-04-04 14:40 ` Guus Sliepen
-- strict thread matches above, loose matches on Subject: below --
2016-04-04 13:35 ValdikSS
2016-04-04 17:28 ` Stephen Hemminger
[not found] <57026C8F.8050406@valdikss.org.ru>
2016-04-04 14:31 ` Guus Sliepen
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=20160329224043.GY3784@sliepen.org \
--to=guus@tinc-vpn$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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