summaryrefslogtreecommitdiffhomepage
path: root/tun
diff options
context:
space:
mode:
Diffstat (limited to 'tun')
-rw-r--r--tun/tcp_offload_linux.go6
-rw-r--r--tun/tcp_offload_linux_test.go4
-rw-r--r--tun/tun_linux.go6
3 files changed, 8 insertions, 8 deletions
diff --git a/tun/tcp_offload_linux.go b/tun/tcp_offload_linux.go
index f3ffa75..a040e6f 100644
--- a/tun/tcp_offload_linux.go
+++ b/tun/tcp_offload_linux.go
@@ -72,11 +72,11 @@ type tcpGROTable struct {
func newTCPGROTable() *tcpGROTable {
t := &tcpGROTable{
- itemsByFlow: make(map[flowKey][]tcpGROItem, conn.DefaultBatchSize),
- itemsPool: make([][]tcpGROItem, conn.DefaultBatchSize),
+ itemsByFlow: make(map[flowKey][]tcpGROItem, conn.IdealBatchSize),
+ itemsPool: make([][]tcpGROItem, conn.IdealBatchSize),
}
for i := range t.itemsPool {
- t.itemsPool[i] = make([]tcpGROItem, 0, conn.DefaultBatchSize)
+ t.itemsPool[i] = make([]tcpGROItem, 0, conn.IdealBatchSize)
}
return t
}
diff --git a/tun/tcp_offload_linux_test.go b/tun/tcp_offload_linux_test.go
index 7fa0777..11f9e53 100644
--- a/tun/tcp_offload_linux_test.go
+++ b/tun/tcp_offload_linux_test.go
@@ -125,8 +125,8 @@ func Test_handleVirtioRead(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- out := make([][]byte, conn.DefaultBatchSize)
- sizes := make([]int, conn.DefaultBatchSize)
+ out := make([][]byte, conn.IdealBatchSize)
+ sizes := make([]int, conn.IdealBatchSize)
for i := range out {
out[i] = make([]byte, 65535)
}
diff --git a/tun/tun_linux.go b/tun/tun_linux.go
index d56e3c1..88ed979 100644
--- a/tun/tun_linux.go
+++ b/tun/tun_linux.go
@@ -524,7 +524,7 @@ func (tun *NativeTun) initFromFlags(name string) error {
return
}
tun.vnetHdr = true
- tun.batchSize = conn.DefaultBatchSize
+ tun.batchSize = conn.IdealBatchSize
} else {
tun.batchSize = 1
}
@@ -577,7 +577,7 @@ func CreateTUNFromFile(file *os.File, mtu int) (Device, error) {
statusListenersShutdown: make(chan struct{}),
tcp4GROTable: newTCPGROTable(),
tcp6GROTable: newTCPGROTable(),
- toWrite: make([]int, 0, conn.DefaultBatchSize),
+ toWrite: make([]int, 0, conn.IdealBatchSize),
}
name, err := tun.Name()
@@ -633,7 +633,7 @@ func CreateUnmonitoredTUNFromFD(fd int) (Device, string, error) {
errors: make(chan error, 5),
tcp4GROTable: newTCPGROTable(),
tcp6GROTable: newTCPGROTable(),
- toWrite: make([]int, 0, conn.DefaultBatchSize),
+ toWrite: make([]int, 0, conn.IdealBatchSize),
}
name, err := tun.Name()
if err != nil {