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

Add Digest extern to PSA/eBPF backend #3164

Merged
merged 3 commits into from
Apr 6, 2022

Conversation

osinstom
Copy link
Contributor

@osinstom osinstom commented Apr 1, 2022

This PR adds support for Digest extern to PSA/eBPF backend.

Digests are implemented using BPF_MAP_TYPE_QUEUE. An eBPF program generates a Digest by calling bpf_map_push_elem. A user space application can get a Digest by calling psabpf-ctl digest get pipe or bpf_map_lookup_and_delete_elem C API.

This is another PR from series implementing PSA support for eBPF backend.

Co-authored-by: Mateusz Kossakowski <mateusz.kossakowski@orange.com>
Co-authored-by: Jan Palimąka <jan.palimaka@orange.com>

Digests are intended to carry a small piece of user-defined data from the data plane to a control plane.
The PSA-eBPF compiler translates each Digest instance into `BPF_MAP_TYPE_QUEUE` that implements a FIFO queue.
If a deparser triggers the `pack()` method, an eBPF program inserts data defined for a Digest into the BPF queue map using `bpf_map_push_elem`.
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps you can add a link to the relevant section in the psa specification

### Digest

Digests are intended to carry a small piece of user-defined data from the data plane to a control plane.
The PSA-eBPF compiler translates each Digest instance into `BPF_MAP_TYPE_QUEUE` that implements a FIFO queue.
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you have a separate table to keep them strongly typed, instead of one table with a union?
This will lose the relative ordering of digests between different tables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For a single Digest instance, there is a separate BPF map of type BPF_MAP_TYPE_QUEUE. No unions, etc. Just a straightforward mapping.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is no requirement in PSA that data plane -> controller ordering must be maintained across different instances of Digest externs.

backends/ebpf/psa/ebpfPsaDeparser.cpp Show resolved Hide resolved
this->visit(p4Control->body);
}

return false;
}

void ConvertToEBPFDeparserPSA::findDigests(const IR::P4Control *p4Control) {
// Digests are only at ingress
Copy link
Contributor

Choose a reason for hiding this comment

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

That's why you should probably give an error if you find one in egress.
I would check this later.
Also, perhaps this field should not be called "type"; we already have many types.

@osinstom
Copy link
Contributor Author

osinstom commented Apr 6, 2022

@mbudiu-vmw what about this one? I've addressed/answered your review.

@mihaibudiu mihaibudiu merged commit dea6e49 into p4lang:main Apr 6, 2022
@mihaibudiu
Copy link
Contributor

As you can see, lately I have a lot of reviews to do, so I appreciate if you actively tell me when you are done.
This way I don't have to poll everything myself, and also I don't review stuff which isn't ready.

@osinstom
Copy link
Contributor Author

osinstom commented Apr 6, 2022

Got it and understood, I'll be pinging you when I'm done with addressing a review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants