Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions docs/ebpf/guides/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ more.
To follow along with the example, you'll need:

* Linux kernel version 5.7 or later, for bpf_link support
* LLVM 11 or later [^1] (`clang` and `llvm-strip`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

llvm-strip is the actual utility we use in our makefile hence why it is listed here. Its not a mistake.

STRIP ?= llvm-strip-20

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I my intention was apt package name, not program name. I will fix it.

* LLVM 11 or later [^1] (`clang` and `llvm`)
* libbpf headers [^2]
* Linux kernel headers [^3]
* Go compiler version supported by {{ proj }}'s Go module
Expand All @@ -28,7 +28,7 @@ more.
Use `clang --version` to check which version of LLVM you have installed.
Refer to your distribution's package index to finding the right packages to
install, as this tends to vary wildly across distributions. Some
distributions ship `clang` and `llvm-strip` in separate packages.
distributions ship `clang` and `llvm` in separate packages.

[^2]:
For Debian/Ubuntu, you'll typically need `libbpf-dev`. On Fedora, it's
Expand Down Expand Up @@ -214,6 +214,14 @@ standard library here.
`CountPackets`) eBPF program with `eth0`. This returns a {{
godoc('link/Link') }} abstraction.

Note: On virtualized environments or network interfaces whose drivers do not
support native XDP, attaching may fail with "operation not supported".
In such cases, you can use generic mode instead:

Flags: link.XDPGenericMode

Generic mode has lower performance but works on a wider range of interfaces.
Comment on lines +218 to +224
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not entirely sure if we want to encourage the usage of generic mode. XDP driver support for Virtio support exists since v4.10, and veth support since v4.19. A lot of more specialized virtual NICs have gained support in later kernels https://docs.ebpf.io/linux/program-type/BPF_PROG_TYPE_XDP/#driver-support.

So for the purposes of testing a user can always use a veth pair (via a container).

Generic mode has poor test coverage. So in production, when native XDP is not available, users should fallback to tc / BPF_PROG_TYPE_SCHED_CLS programs instead, which have broader capabilities, are better tested, and have comparable performance.

Long story short. I don't think this is advice we want to give people, especially not those that don't know any better.


1. Close the file descriptor of the Program-to-interface association. Note that
this will stop the Program from executing on incoming packets if the Link was
not {{ godoc('link/Link.Pin') }}ed to the bpf file system.
Expand Down