Skip to content

NumRxQueues/NumTxQueues is not configured on veth peer #536

@alexforster

Description

@alexforster

It does not appear possible to correctly configure the number of rx/tx queues on a veth pair.

When creating a veth pair like so:

link := nl.Veth{
	LinkAttrs: nl.LinkAttrs{
		Name:  "outer0",
		NumRxQueues: 16,
		NumTxQueues: 16,
	},
	PeerName: "inner0",
}

I would expect the outcome to be equivalent to the following ip command:

ip link add outer0 numrxqueues 16 numtxqueues 16 type veth peer inner0 numrxqueues 16 numtxqueues 16

However, this library actually performs the equivalent of the following ip command:

ip link add outer0 numrxqueues 16 numtxqueues 16 type veth peer inner0

The problem seems to be here, where the NumRxQueues/NumTxQueues attributes are not applied to the veth peer interface:

netlink/link_linux.go

Lines 1277 to 1290 in 5f2fc86

case *Veth:
data := linkInfo.AddRtAttr(nl.IFLA_INFO_DATA, nil)
peer := data.AddRtAttr(nl.VETH_INFO_PEER, nil)
nl.NewIfInfomsgChild(peer, unix.AF_UNSPEC)
peer.AddRtAttr(unix.IFLA_IFNAME, nl.ZeroTerminated(link.PeerName))
if base.TxQLen >= 0 {
peer.AddRtAttr(unix.IFLA_TXQLEN, nl.Uint32Attr(uint32(base.TxQLen)))
}
if base.MTU > 0 {
peer.AddRtAttr(unix.IFLA_MTU, nl.Uint32Attr(uint32(base.MTU)))
}
if link.PeerHardwareAddr != nil {
peer.AddRtAttr(unix.IFLA_ADDRESS, []byte(link.PeerHardwareAddr))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions