You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
review: move the bridge attach helper beside its caller and pass the lint gate
attachBridgeUp is bridge-specific (IFLA_MASTER is its whole point) and the
network package carried no backend plumbing before it, so it moves unexported
into network/bridge; the two tuning constants TuneTAP shares are exported
instead. The G115 casts carry kernel-issued ifindexes and a guarded MTU, so
they take nolint with reasons. Two-line godocs tightened to one.
// attachBridgeUp enslaves a TAP to the bridge, applies MTU/txqlen/GRO tuning and brings it up in one RTM_SETLINK, paying the node-wide rtnl lock once.
Copy file name to clipboardExpand all lines: network/tap_linux.go
+7-30Lines changed: 7 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -6,20 +6,17 @@ import (
6
6
"fmt"
7
7
8
8
"github.com/vishvananda/netlink"
9
-
"github.com/vishvananda/netlink/nl"
10
-
"golang.org/x/sys/unix"
11
9
)
12
10
13
11
const (
14
-
// tapTxQueueLen absorbs traffic bursts (especially UDP) without dropping; the kernel default of 1000 is too small for VM workloads.
15
-
tapTxQueueLen=10000
12
+
// TAPTxQueueLen absorbs traffic bursts (especially UDP) without dropping; the kernel default of 1000 is too small for VM workloads.
13
+
TAPTxQueueLen=10000
16
14
17
-
// groMaxSize matches the maximum virtio-net segment size so the kernel aggregates inbound packets before CH reads them.
18
-
groMaxSize=65536
15
+
// GROMaxSize matches the maximum virtio-net segment size so the kernel aggregates inbound packets before CH reads them.
16
+
GROMaxSize=65536
19
17
)
20
18
21
19
// CreateTAP adds a multi-queue TAP sized for numQueues virtio-net queues and returns its index, then closes the kernel fds (CH/QEMU reopen it by name).
22
-
// TUNSETIFF carries no index, so netlink resolves one after the ioctl and swallows a failure to; an unresolved index must not reach a caller as valid.
0 commit comments