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
This commit is contained in:
Thomas Eizinger
2025-04-03 18:51:45 +11:00
committed by GitHub
parent 8c55c2a46a
commit 40fb7d0565

View File

@@ -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(