Skip to content

Commit

Permalink
Configure numrxqueues/numtxqueues on veth peer (fixes #536)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexforster authored and aboch committed Jun 3, 2020
1 parent 96dce1c commit 27f2b32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions link_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,12 @@ func (h *Handle) linkModify(link Link, flags int) error {
if base.TxQLen >= 0 {
peer.AddRtAttr(unix.IFLA_TXQLEN, nl.Uint32Attr(uint32(base.TxQLen)))
}
if base.NumTxQueues > 0 {
peer.AddRtAttr(unix.IFLA_NUM_TX_QUEUES, nl.Uint32Attr(uint32(base.NumTxQueues)))
}
if base.NumRxQueues > 0 {
peer.AddRtAttr(unix.IFLA_NUM_RX_QUEUES, nl.Uint32Attr(uint32(base.NumRxQueues)))
}
if base.MTU > 0 {
peer.AddRtAttr(unix.IFLA_MTU, nl.Uint32Attr(uint32(base.MTU)))
}
Expand Down
6 changes: 6 additions & 0 deletions link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ func testLinkAddDel(t *testing.T, link Link) {
if peer.TxQLen != testTxQLen {
t.Fatalf("TxQLen of peer is %d, should be %d", peer.TxQLen, testTxQLen)
}
if peer.NumTxQueues != testTxQueues {
t.Fatalf("NumTxQueues of peer is %d, should be %d", peer.NumTxQueues, testTxQueues)
}
if peer.NumRxQueues != testRxQueues {
t.Fatalf("NumRxQueues of peer is %d, should be %d", peer.NumRxQueues, testRxQueues)
}
if !bytes.Equal(peer.Attrs().HardwareAddr, original.PeerHardwareAddr) {
t.Fatalf("Peer MAC addr is %s, should be %s", peer.Attrs().HardwareAddr, original.PeerHardwareAddr)
}
Expand Down

0 comments on commit 27f2b32

Please sign in to comment.