mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
fdbased: Vectorized write for packet; relax writev syscall filter.
Now it calls pkt.Data.ToView() when writing the packet. This may require copying when the packet is large, which puts the worse case in an even worse situation. This sent out in a separate preparation change as it requires syscall filter changes. This change will be followed by the change for the adoption of the new PacketHeader API. PiperOrigin-RevId: 321447003
This commit is contained in:
@@ -22,6 +22,7 @@ go_library(
|
||||
"//pkg/context",
|
||||
"//pkg/fdnotifier",
|
||||
"//pkg/fspath",
|
||||
"//pkg/iovec",
|
||||
"//pkg/log",
|
||||
"//pkg/refs",
|
||||
"//pkg/safemem",
|
||||
|
||||
@@ -17,13 +17,10 @@ package host
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/iovec"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
)
|
||||
|
||||
// maxIovs is the maximum number of iovecs to pass to the host.
|
||||
var maxIovs = linux.UIO_MAXIOV
|
||||
|
||||
// copyToMulti copies as many bytes from src to dst as possible.
|
||||
func copyToMulti(dst [][]byte, src []byte) {
|
||||
for _, d := range dst {
|
||||
@@ -74,7 +71,7 @@ func buildIovec(bufs [][]byte, maxlen int64, truncate bool) (length int64, iovec
|
||||
}
|
||||
}
|
||||
|
||||
if iovsRequired > maxIovs {
|
||||
if iovsRequired > iovec.MaxIovs {
|
||||
// The kernel will reject our call if we pass this many iovs.
|
||||
// Use a single intermediate buffer instead.
|
||||
b := make([]byte, stopLen)
|
||||
|
||||
Reference in New Issue
Block a user