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

Enable generation of pointer variables by eBPF CodeGenInspector #3131

Merged
merged 1 commit into from
Mar 15, 2022

Conversation

osinstom
Copy link
Contributor

@osinstom osinstom commented Mar 15, 2022

This PR enables emitting eBPF fields as pointer variables by eBPF CodeGenInspector. So far, CodeGenInspector assumes that eBPF fields (e.g. Headers) are on-stack variables. With this change, we can decide whether to access fields' member via . or ->.

A use case for this change is PSA implementation for eBPF backend. PSA-eBPF uses BPF array map to store the Headers structure, instead of an on-stack variable, to avoid BPF stack size limit, see the discussion here vmware-archive/p4c-xdp#43. Using BPF array map to store large piece of data (parsed headers) is a common approach used also by Cilium/Calico eBPF datapaths. We've observed almost no impact on performance when using BPF array map.

Note that ebpf_model.p4 is not affected by this change, because useAsPointerVariable is never called for any eBPF field generated for eBPF model.

This PR is one from the series of PRs bringing the support for the PSA model to eBPF backend. The goal is to shrink the "main PR" with the full implementation of PSA for eBPF to facilitate review.

Co-authored-by: Mateusz Kossakowski [email protected]
Co-authored-by: Jan Palimąka [email protected]

Co-authored-by: Mateusz Kossakowski <[email protected]>
Co-authored-by: Jan Palimąka <[email protected]>
@mihaibudiu mihaibudiu merged commit 319cb3e into p4lang:main Mar 15, 2022
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.

2 participants