-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TUN vectorised reads/writes #1145
Conversation
5dff306
to
e84be89
Compare
ad53173
to
db60e1c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo one function that the last commit turned into a simple method chain, so we could think about removing that and calling the underlying function directly. I'm fine with either approach, I just don't want it to be a historical accident if we keep it.
src/tun/iface.go
Outdated
const TUN_OFFSET_BYTES = 80 // sizeof(virtio_net_hdr) | ||
|
||
func (tun *TunAdapter) idealBatchSize() int { | ||
return tun.iface.BatchSize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor point, but now that this is just calling tun.iface.BatchSize()
, we could pretty easily remove this function and call that directly. Unless you think idealBatchSize
helps with readability, I'm pretty in different to this, so I'm fine with leaving it in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
db60e1c
to
36e6831
Compare
This PR updates the Wireguard dependency and updates to use new vectorised reads/writes, which should reduce the number of syscalls and improve performance.
This will only make a difference on Linux as this is the only platform for which the Wireguard TUN library supports vectorised reads/writes. For other platforms, single reads and writes will be performed as usual.