Sat, Oct 29, 2016 at 04:49:03PM CEST, kubak...@wp.pl wrote: >On Sat, 29 Oct 2016 09:53:28 +0200, Jiri Pirko wrote: >> Hi all. >> >> The network world is divided into 2 general types of hw: >> 1) network ASICs - network specific silicon, containing things like TCAM >> These ASICs are suitable to be programmed by P4. >> 2) network processors - basically a general purpose CPUs >> These processors are suitable to be programmed by eBPF. >> >> I believe that by now, the most people came to a conclusion that it is >> very difficult to handle both types by either P4 or eBPF. And since >> eBPF is part of the kernel, I would like to introduce P4 into kernel >> as well. Here's a plan: >> >> 1) Define P4 intermediate representation >> I cannot imagine loading P4 program (c-like syntax text file) into >> kernel as is. That means that as the first step, we need find some >> intermediate representation. I can imagine someting in a form of AST, >> call it "p4ast". I don't really know how to do this exactly though, >> it's just an idea. >> >> In the end there would be a userspace precompiler for this: >> $ makep4ast example.p4 example.ast > >Maybe stating the obvious, but IMHO defining the IR is the hardest part. >eBPF *is* the IR, we can compile C, P4 or even JIT Lua to eBPF. The >AST/IR for switch pipelines should allow for similar flexibility. >Looser coupling would also protect us from changes in spec of the high >level language.
Agreed. I agree with you point this would be nice to have it done in a generic way. However, I'm not aware of any other language similar to p4.