Skip to content

Commit

Permalink
Remove GSOMaxSize
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Dec 15, 2023
1 parent b967c6f commit 0e13875
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion tun.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type Options struct {
Inet6Address []netip.Prefix
MTU uint32
GSO bool
GSOMaxSize uint32
AutoRoute bool
StrictRoute bool
Inet4RouteAddress []netip.Prefix
Expand Down
4 changes: 2 additions & 2 deletions tun_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (t *NativeTun) BatchSize() int {
if !t.gsoEnabled {
return 1
}
batchSize := int(t.options.GSOMaxSize/t.options.MTU) * 2
batchSize := int(gsoMaxSize/t.options.MTU) * 2
if batchSize > idealBatchSize {
batchSize = idealBatchSize
}
Expand Down Expand Up @@ -266,7 +266,7 @@ func (t *NativeTun) configure(tunLink netlink.Link) error {
return E.Cause(os.NewSyscallError("TUNSETOFFLOAD", err), "enable offload")
}
t.gsoEnabled = true
t.gsoBuffer = make([]byte, virtioNetHdrLen+int(t.options.GSOMaxSize))
t.gsoBuffer = make([]byte, virtioNetHdrLen+int(gsoMaxSize))
t.tcp4GROTable = newTCPGROTable()
t.tcp6GROTable = newTCPGROTable()
}
Expand Down
1 change: 0 additions & 1 deletion tun_linux_gvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ func (t *NativeTun) NewEndpoint() (stack.LinkEndpoint, error) {
return fdbased.New(&fdbased.Options{
FDs: []int{t.tunFd},
MTU: t.options.MTU,
GSOMaxSize: t.options.GSOMaxSize,
RXChecksumOffload: true,
})
}
Expand Down
1 change: 1 addition & 0 deletions tun_linux_offload.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
)

const (
gsoMaxSize = 65536
tcpFlagsOffset = 13
idealBatchSize = 128
)
Expand Down

0 comments on commit 0e13875

Please sign in to comment.