Skip to content
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

Merged
merged 4 commits into from
Jul 20, 2024
Merged

TUN vectorised reads/writes #1145

merged 4 commits into from
Jul 20, 2024

Conversation

neilalexander
Copy link
Member

@neilalexander neilalexander commented May 31, 2024

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.

@neilalexander neilalexander marked this pull request as ready for review July 17, 2024 16:59
Copy link
Member

@Arceliar Arceliar left a 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()
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@neilalexander neilalexander merged commit 02d92ff into develop Jul 20, 2024
28 checks passed
@neilalexander neilalexander deleted the neil/vectorised branch July 20, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants