From 40fb7d0565c80b0409dcf89ca3a3dc8a73e45e1c Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Thu, 3 Apr 2025 18:51:45 +1100 Subject: [PATCH] fix(eBPF): explicitly attach in SKB mode (#8628) It appears that the gVNIC driver in Google Cloud doesn't give us enough headroom to use `bpf_xdp_adjust_head` with a delta of 4 bytes. Currently, we are loading the XDP program with default flags. By loading it explicitly in SKB mode, we should be able to bypass these driver limitations at the expense of some performance (which should still be better than userspace!). Related: https://github.com/GoogleCloudPlatform/compute-virtual-ethernet-linux/issues/70 --- rust/relay/server/src/ebpf/linux.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/relay/server/src/ebpf/linux.rs b/rust/relay/server/src/ebpf/linux.rs index 3c8ddd6ab..3d8e1627f 100644 --- a/rust/relay/server/src/ebpf/linux.rs +++ b/rust/relay/server/src/ebpf/linux.rs @@ -35,7 +35,7 @@ impl Program { .try_into()?; program.load().context("Failed to load program")?; program - .attach(interface, XdpFlags::default()) + .attach(interface, XdpFlags::SKB_MODE) .with_context(|| format!("Failed to attached to interface {interface}"))?; let mut stats = AsyncPerfEventArray::try_from(