Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipvlan: use github.com/cilium/ebpf to create map and load program #14043

Merged
merged 6 commits into from
Nov 18, 2020

Conversation

tklauser
Copy link
Member

Reviewable by commit, see individual commit messages for details.

@tklauser tklauser added sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. release-note/misc This PR makes changes that have no direct user impact. labels Nov 16, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.10.0 Nov 16, 2020
@tklauser
Copy link
Member Author

test-me-please

@tklauser
Copy link
Member Author

test-me-please

This will also pull in github.com/google/go-cmp v0.5.2

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This commit introduces a test to verify the tail call map program is
unchanged during refactoring by successive commits.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This makes it easier to understand what the eBPF program does. In commit
7bfe015 ("cilium, ipvlan: add initial endpoint ipvlan support") the
loaded program was described as:

    [...] The program we load to cls_bpf is doing: load BPF map fd into
    register R2, load 0 into register R3, (R1 has implicit skb already),
    and do a tail call into the map. Fall-through is just exiting with
    TC_ACT_OK. [...]

Using TestEntryProgInstructions introduced in the previous commit it can
be verified that the emitted instructions are in fact the same.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This allows to drop the local copy of bpfAttrProg and the magic numbers
for prog type and the bpf() syscall commands. Instead it leverages the
cilium ebpf lib to load the eBPF program.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Use the github.com/cilium/ebpf library to create the tail call map and
load the corresponding program. This allows to drop local definitions of
various BPF types as well as a lot of direct interaction with the bpf()
syscall.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
@tklauser
Copy link
Member Author

Rebased after #14056 was merged.

@tklauser
Copy link
Member Author

test-me-please

@tklauser tklauser marked this pull request as ready for review November 18, 2020 11:54
@tklauser tklauser requested review from a team November 18, 2020 11:54
@tklauser tklauser requested a review from a team as a code owner November 18, 2020 11:54
Copy link
Member

@jibi jibi left a comment

Choose a reason for hiding this comment

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

great to see we are starting to move towards using cilium/ebpf 🔥🔥

Copy link
Member

@nathanjsweet nathanjsweet left a comment

Choose a reason for hiding this comment

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

Ditto on moving to cilium/ebpf

@nathanjsweet nathanjsweet merged commit b323eca into master Nov 18, 2020
@nathanjsweet nathanjsweet deleted the pr/tklauser/ipvlan-ebpf-lib branch November 18, 2020 17:05
@joestringer
Copy link
Member

QQ, what kind of validation have we done on this? When I grep for ipvlan under test/, I see no entries so I'm not sure the CI would point out any potential impact from these changes.

@tklauser
Copy link
Member Author

QQ, what kind of validation have we done on this? When I grep for ipvlan under test/, I see no entries so I'm not sure the CI would point out any potential impact from these changes.

I was wrongly assuming that this is covered by the docker-based runtime tests, sorry about that. I'll run the IPVLAN-based Networking GSG to verify this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact. sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

7 participants