Introduction / p4 language on top of Snabb

195 views
Skip to first unread message

Eric S. Bullington

unread,
Feb 25, 2016, 10:19:55 AM2/25/16
to Snabb Switch development
Hi, I'm Eric, a developer from South Carolina, USA.  I do web and mobile development to pay the bills but over the past year I've developed a keen side interest in NFV and SDN.  I've been watching Snabb with interest from the side for a while, so I thought I'd go ahead and introduce myself.

At the moment, I'm starting work on an implementation of the p4 language that I hope to run on top of Snabb.  For those unfamiliar, p4 is more or less a new(ish) DSL created to program packet forwarding applications (it does so on a networking protocol-independent basis).

At this point, I'm just working on a parser and lexer for p4 in Lua (lpeg for lexing combined with pratt parser).  However, I have started conceptually mapping p4 language features to Snabb, and based on my very early assessment, I'm hopeful this approach will prove fruitful.

I realize that Lua scripting will always be Snabb's preferred way to program apps (and I'm a big Lua fan of old).  But I'm also really impressed with how easy the p4 language could make it to program traditional switch and router applications.  In any case, it's a fun side project for me.

Regardless of how my personal Snabb-related project turns out, I'm very impressed with Snabb and look forward to watching the project ecosystem grow.

Thanks,

Eric

Katerina Barone-Adesi

unread,
Feb 25, 2016, 2:20:32 PM2/25/16
to snabb...@googlegroups.com
Welcome, Eric.

I've not looked at p4, but my team did something similar with
libpcap's filter language, and found Snabb to be a great substrate.

Best regards, Kat

Eric S. Bullington

unread,
Feb 26, 2016, 4:52:15 AM2/26/16
to Snabb Switch development
Thanks, Kat.  I was reading earlier today your and Andy Wingo's presentation on Snabb and your lwAFTR project at FOSDEM.  Lots of excellent practical info and tips in there that will be useful for me, particularly with respect to fully exploiting L3 cache.  

Aaron Glenn

unread,
Mar 7, 2016, 5:04:46 AM3/7/16
to Snabb Switch development


On Thursday, February 25, 2016 at 4:19:55 PM UTC+1, Eric S. Bullington wrote:

At the moment, I'm starting work on an implementation of the p4 language that I hope to run on top of Snabb.  For those unfamiliar, p4 is more or less a new(ish) DSL created to program packet forwarding applications (it does so on a networking protocol-independent basis).


I've been toying with the idea since I came across P4 not quite a year ago. Do you have a repository interested folks can follow along with (and maybe, perhaps, contribute to)?

Eric S. Bullington

unread,
Mar 9, 2016, 11:25:53 AM3/9/16
to snabb...@googlegroups.com
Hi Aaron, yes I do have a tiny bit I've started on up on a repository:
https://github.com/esbullington/snabbp4 All I have now is a working
lexer and parser for the full p4 language (version 1.1: working
release). There are plenty of unit tests, but I'm sure there are
still bugs (not yet a lot of p4 v1.1 code to test out at this point,
most existing p4 code is v1.0 which has some significant differences).

I've also started some work on type checking that I hope to have up soon.

I've been unable to work on the project for the past week because of
work and family obligations, but hope to return to it in the coming
days.

Eric


On Mon, Mar 7, 2016 at 5:04 AM, Aaron Glenn <aag...@gmail.com> wrote:
>
>
<snip>

Luke Gorrie

unread,
Mar 10, 2016, 12:21:30 AM3/10/16
to snabb...@googlegroups.com
On 25 February 2016 at 16:19, Eric S. Bullington <eric.s.b...@gmail.com> wrote:
I realize that Lua scripting will always be Snabb's preferred way to program apps

This is basically true but note that we are nailing down the ABI a little better now in order to support writing apps in assembler. The notion is that certain apps can have really insane performance requirements, for example to hash-dispatch 100G of traffic on one core, and you would want to write these at the lowest level of abstraction available.

This should also make things more accessible to other programming languages like P4.

(I don't know much about P4. I will be curious to look at some side-by-side examples of P4 compared with Lua and C one day. I am not sure whether P4 will be easier to write, being a special purpose tool, or hardware to write, having to accommodate special-purpose hardware.)


Eric S. Bullington

unread,
Mar 11, 2016, 9:11:42 AM3/11/16
to snabb...@googlegroups.com
Very interesting. I just saw this braindump on Snabb and ABIs:
https://github.com/SnabbCo/snabbswitch/issues/774 I agree -- as one
example, C's ABI is a big reason why it's become so successful as a
programming language.

This would be a very interesting development, please let me know if I
can help on this front.
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Snabb Switch development" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/snabb-devel/GkWONJcuF4E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> snabb-devel...@googlegroups.com.
> To post to this group, send email to snabb...@googlegroups.com.
> Visit this group at https://groups.google.com/group/snabb-devel.

Eric S. Bullington

unread,
Mar 11, 2016, 9:18:58 AM3/11/16
to snabb...@googlegroups.com
To correct myself, and with apologies for double-posting, C's ABI
isn't universal but rather platform-specific. Still, I think even
having a platform-specific ABI has allowed C to interface with other
languages to an extent C++ cannot, which cemented C's central
position.

On Fri, Mar 11, 2016 at 9:11 AM, Eric S. Bullington

贺鹏

unread,
May 14, 2016, 10:44:59 PM5/14/16
to Snabb Switch development
Hi, just be curious, how is your P4 project going?

I am also thinking about a similar project to compile P4 programs into a high performance software switch. 
I think the way P4 describe and define the dataplane provides the possibilities of specialization dataplane for 
high performance while still keeps the programmability. I even believe that it is possible that P4toDPDK or your P4onSnabb can have 
higher performance than a hardwired implementation like Open vSwitch in some specific scenarios. 

I am currently studying the code in P4lang.org, and try to use their code base. 

在 2016年2月25日星期四 UTC+8下午11:19:55,Eric S. Bullington写道:
Reply all
Reply to author
Forward
0 new messages