-
Notifications
You must be signed in to change notification settings - Fork 472
Open
Labels
ebpfTopics related to the eBPF back endTopics related to the eBPF back endgood-first-issueAn issue that could be solved by someone new to the code base.An issue that could be solved by someone new to the code base.p4tcTopics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run.Topics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run.
Description
In the eBPF backend, if the user attempts to write an emit inside an if statement in the deparser's apply block, the generated code is semantically different from the original. For example the following snippet:
control IngressDeparserImpl(packet_out packet,
out empty_t clone_i2e_meta,
out empty_t resubmit_meta,
out empty_t normal_meta,
inout headers hdr,
in metadata meta,
in psa_ingress_output_metadata_t istd)
{
apply {
if (meta.mymd == 0) {
packet.emit(hdr.ethernet);
}
packet.emit(hdr.ipv4);
}
}
Will generate and empty if statement:
if (meta->mymd == 0) {
; }
and completely ignore the emit for the ethernet header
Below is the link to a tarball which has both the P4 program used to reproduce the issue and the generated C eBPF file that will illustrate the bug:
emit-bug.tar.gz
The command used to compile was:
./p4c-ebpf --arch psa emit-bug.p4 -o emit-bug.c
I compiled p4c with commit 8273608
Metadata
Metadata
Assignees
Labels
ebpfTopics related to the eBPF back endTopics related to the eBPF back endgood-first-issueAn issue that could be solved by someone new to the code base.An issue that could be solved by someone new to the code base.p4tcTopics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run.Topics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run.