[P4-dev] Packet manipulation with P4_16 and eBPF

Mihai Budiu mbudiu at vmware.com
Fri Aug 4 13:25:48 EDT 2017

This is a complicated topic. Today in the linux kernel eBPF by itself cannot do any forwarding; it could only by working in tandem with another kernel subsystem, such as TC. This architecture only defines a packet filter.

If you want more than filtering, you can take a look at the p4c-xdp project: https://github.com/vmware/p4c-xdp, which also compiles to ebpf. Apparently Linux 4.13 allows XDP to also perform forwarding, so it may be possible to do forwarding solely using ebpf, if you have a new kernel.

This project is an early prototype. Moreover, currently the code generated by this compiler is often too complicated for the ebpf verifier.

Mihai Budiu

From: P4-dev [mailto:p4-dev-bounces at lists.p4.org] On Behalf Of Ulmen, Tanja
Sent: Friday, August 4, 2017 5:14 AM
To: p4-dev at lists.p4.org
Subject: [P4-dev] Packet manipulation with P4_16 and eBPF


is it possible to change packets using P4_16 and eBPF? If I understand it correctly it is only possible to work with the ebpf_model.p4 that is a pure packet filter that only accepts or rejects packets. If I try to compile a P4_16 program to eBPF that includes some packet manipulation and deparsing I get different errors:

"error: Expected toplevel package package XY to have 2 parameters"

If I try to create a new package model with parser, pipe and deparser.

"error: Expected control block to have exactly 2 parameters"
If I try to circumvent the new package model by including the emit calls in the control part, because then I have the Parsed_packet, packet_out and OutControl as parameters.

Thus, the ebpf compiler backend only accepts the ebpf_model.p4 right? Or is there a way to implement such a behavior by using P4_16 and eBPF?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170804/9eae6136/attachment-0002.html>

More information about the P4-dev mailing list