gvisor icon indicating copy to clipboard operation
gvisor copied to clipboard

alternatives to readv() and writev() when the file descriptor is a TUN device

Open Lanius-collaris opened this issue 1 year ago • 3 comments

Description

I want to find a faster PacketDispatchMode supported by TUN device.

Is this feature related to a specific bug?

No response

Do you have a specific solution in mind?

io_uring or Linux AIO

Lanius-collaris avatar Oct 22 '24 06:10 Lanius-collaris

There's sendmmsg/recvmmsg and PACKET_MMAP. io_uring would be interesting -- we haven't explored that and I'm not sure how it would perform.

kevinGC avatar Oct 22 '24 17:10 kevinGC

But TUN device doesn't support sendmmsg/recvmmsg.

Lanius-collaris avatar Oct 23 '24 09:10 Lanius-collaris

In some cases, calling readv() on a TUN device can be replaced with calling recvmmsg() on a packet socket, calling writev() on a TUN device can be replaced with calling sendmmsg() on a packet socket (send packets to the loopback interface). If the file descriptor is TUN or TAP, can gvisor handle and generate virtioNetHdr?

Lanius-collaris avatar Mar 18 '25 03:03 Lanius-collaris