mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
xdp: use needs-wakeup flag
This is recommended in the kernel docs: https://www.kernel.org/doc/html/latest/networking/af_xdp.html#xdp-use-need-wakeup-bind-flag PiperOrigin-RevId: 472596449
This commit is contained in:
committed by
gVisor bot
parent
e907aff6ce
commit
ad7b1121d4
+6
-2
@@ -202,11 +202,15 @@ func ReadOnlyFromSocket(sockfd int, ifaceIdx, queueID uint32, opts ReadOnlySocke
|
||||
rxQueue.init(off, opts)
|
||||
|
||||
addr := unix.SockaddrXDP{
|
||||
// XDP_USE_NEED_WAKEUP lets the driver sleep if there is no
|
||||
// work to do. It will need to be woken by poll. It is expected
|
||||
// that this improves performance by preventing the driver from
|
||||
// burning cycles.
|
||||
//
|
||||
// By not setting either XDP_COPY or XDP_ZEROCOPY, we instruct
|
||||
// the kernel to use zerocopy if available and then fallback to
|
||||
// copy mode.
|
||||
// TODO(b/240191988): Look into whether to use XDP_USE_NEED_WAKEUP.
|
||||
Flags: 0,
|
||||
Flags: unix.XDP_USE_NEED_WAKEUP,
|
||||
Ifindex: ifaceIdx,
|
||||
// AF_XDP sockets are per device RX queue, although multiple
|
||||
// sockets on multiple queues (or devices) can share a single
|
||||
|
||||
+5
-2
@@ -31,8 +31,11 @@ must also look at [libbpf itself][libbpf] to understand what's really going on.
|
||||
|
||||
## TODO
|
||||
|
||||
Kernel version < 5.4 has some weird offsets behavior. Just don't run on those
|
||||
machines.
|
||||
- Kernel version < 5.4 has some weird offsets behavior. Just don't run on
|
||||
those machines.
|
||||
- Implement SHARED, although it looks like we usually run with only 1
|
||||
dispatcher.
|
||||
- Add a -redirect $fromdev $todev option in order to test fast path.
|
||||
|
||||
[af_xdp_tutorial]: https://github.com/xdp-project/xdp-tutorial/tree/master/advanced03-AF_XDP
|
||||
[libbpf]: https://github.com/torvalds/linux/tree/master/tools/testing/selftests/bpf/xsk.c
|
||||
|
||||
Reference in New Issue
Block a user