Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: network: Use multiqueue flag only when appropriate
Browse files Browse the repository at this point in the history
The multiqueue flag associated with the TUNTAP network device cannot
be used if the number of queues indicates 0. When 0, this means the
multiqueue is not supported, and we cannot use the according flag.

Fixes #1051

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
  • Loading branch information
Sebastien Boeuf committed Dec 18, 2018
1 parent 5d91edd commit 0f1fde4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion virtcontainers/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,15 @@ func createLink(netHandle *netlink.Handle, name string, expectedLink netlink.Lin
MulticastSnooping: expectedLink.(*netlink.Bridge).MulticastSnooping,
}
case (&netlink.Tuntap{}).Type():
flags := netlink.TUNTAP_VNET_HDR
if queues > 0 {
flags |= netlink.TUNTAP_MULTI_QUEUE_DEFAULTS
}
newLink = &netlink.Tuntap{
LinkAttrs: netlink.LinkAttrs{Name: name},
Mode: netlink.TUNTAP_MODE_TAP,
Queues: queues,
Flags: netlink.TUNTAP_MULTI_QUEUE_DEFAULTS | netlink.TUNTAP_VNET_HDR,
Flags: flags,
}
case (&netlink.Macvtap{}).Type():
qlen := expectedLink.Attrs().TxQLen
Expand Down

0 comments on commit 0f1fde4

Please sign in to comment.