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

tuntap: Add multiqueue support #293

Merged
merged 1 commit into from
Nov 14, 2017
Merged

Conversation

mcastelino
Copy link
Contributor

Add multi queue support to tuntap without breaking legacy users
of tuntap.

Signed-off-by: Manohar Castelino manohar.r.castelino@intel.com

link_linux.go Outdated
_, _, _ = unix.Syscall(unix.SYS_IOCTL, fds[0].Fd(), uintptr(unix.TUNSETPERSIST), 0)
cleanupFds(fds)
}
return err
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we can successfully set the master interface, then we return here, without storing the list of opened fds into tuntap.Fds. Is it intentional ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aboch that is a bug. I will fix this and update the PR.

link_linux.go Outdated
if err != nil {
_, _, _ = unix.Syscall(unix.SYS_IOCTL, fds[0].Fd(), uintptr(unix.TUNSETPERSIST), 0)
cleanupFds(fds)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Now we will not report this error to the caller. Is this the expected behavior ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aboch that should also be fixed now... sorry about that.

Add multi queue support to tuntap without breaking legacy users
of tuntap.

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
return fmt.Errorf("Tuntap IOCTL TUNSETIFF failed, errno %v", errno)

for i := 0; i < queues; i++ {
localReq := req
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really need this extra variable localReq ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are sending it down as an unsafe pointer later. So it was just a way to ensure that we started with a clean slate each time around

unix.Syscall(unix.SYS_IOCTL, file.Fd(), uintptr(unix.TUNSETIFF), uintptr(unsafe.Pointer(&localReq)))

Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought kernel would just read from that structure, but I see it does actually write to it in case of error
copy_to_user(argp, &ifr, ifreq_len)) in __tun_chr_ioctl().

Given ifReq member types, localReq := req will indeed create a deep copy of req.

@aboch
Copy link
Collaborator

aboch commented Nov 14, 2017

LGTM

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