an early look at p4 for software networking

26 June 2017 2:00 PM (igalia | networking | p4 | compilers | snabb | vpp)

Happy midsummer, hackfriends!

As you know at work we have been trying to find ways to apply compilers technology to the networking space. We will compile high-level configurations into low-level network processing graphs, search algorithms into lookup routines optimized for the target data structures, packet filters into code ready to be further trace-compiled, or hash functions into parallel AVX2 code.

On one side, we try to provide fast implementations of existing "languages"; on the other side we can't help but try out new co-designed domain-specific languages that can be expressive and run fast. As an example, with pfmatch we extended pflang, the tcpdump language, with a more match-action kind of semantics. It worked fine but the embedding between pfmatch and the host language could have been more smooth; in the end the abstractions it offers don't really apply to what we have needed to build. For a long time we have been wondering if indeed there is a better domain-specific programming language to apply to the networking domain.

P4 claims to be this language, and I think it's worth a look. P4's goal is be able to define switches and other networking equipment in software, with the specific goal that they would like to be able for P4 programs to be synthesized to ASICs, or installed in the FPGA of a "Smart NIC", or compiled to CPUs. It's a wide target domain and the silicon-bakery side of things definitely constrains what is possible. Indeed P4 explicitly disclaims any ambition to be a general-purpose programming language. Still, I think they manage to achieve an admirable balance between declarative programming and transparent low-level compilability.

The best, most current intro to P4 out there is probably Vladimir Gurevich's slides from last month's P4 "developer day" in California. I think it does a good job linking the language's syntax and semantics with how they are intended to be applied to the target domain. For a more PL-friendly and abstract introduction, the P416 specification is a true delight.

Like I said, at work we build software switches and other network functions, and our target is commodity hardware. We write most of our work in Snabb, a powerful network toolkit built on LuaJIT, though we are branching out now to VPP/ as well, just to broaden the offering a bit. Generally we try to build solutions that don't have any dependencies other than a commodity Xeon server and a commodity NIC like Intel's 82599. So how could P4 help us in what we're doing?

My first thought in this regard was that if there is a library of P4 building blocks out there, that it would be really convenient to be able to incorporate a functional block written in P4 within the graph of a Snabb program. For example, if we have an IPFIX collector written in Snabb (and we do!), it would be cool to stick that in the middle of a P4 traffic conditioner.

(Immediately I run into the problem that I am straining my mind to think of a network function that we wouldn't rather just write in Snabb -- something valuable enough that we wouldn't want to "own" it and instead we would import someone else's black box into our data-plane. Maybe this interesting in-network key-value cache counts? But I digress, let's assume that something exists here.)

One question is, why bother doing P4 in software? I can understand that if you have 1Tbps ports that you definitely need custom silicon pushing your packets around. You would like to be able to program that silicon, so P4 looks to be a compelling step forward. But if your needs are satisfied with 40Gbps ports and you have chosen a software networking solution for its low cost, low lock-in, high flexibility, and sufficient performance -- well does P4 buy you something?

Right now it would seem that the answer is "no". A Cisco group wrote a custom P4 compiler to VPP, which is architecturally pretty much the same as Snabb, and they had to do some work to get the performance within a couple percent of the hand-coded application. The only win I can see is if people start building up libraries of reusable P4 components that can be linked together -- but the language itself currently doesn't support any more global composition primitive than #include (yes, it uses CPP :).

Additionally, at least as things are now, it doesn't seem that there's a library of reusable, open source P4 components out there to take advantage of. If this changes, I'll have to have another look. And of course it's worth keeping an eye on what kinds of cool things people are building :)

Thanks to Luke Gorrie for conversations leading to this blog post. All opinions and errors mine, of course!

83 responses

  1. Paul Johnson says:

    Thanks for sharing this nice resource. It's really interesting. Keep up the good work and keep updating the same.

  2. hack facebook account says:

    In touch with their friends while some have had the luck use Facebook as a way for them to reach their the facebook site.

  3. read more here says:

    That's great news for developers, P4 looks very interesting. I will try to take a look at some tutorials whenever I have the time. Programming is a great way to improve your memory, I recommended it to many people.

  4. xbox live membership says:

    Thank you

  5. run 3 says:

    Thank you for sharing this nice resource. It's really interesting. Keep up the good work and keep updating the same.

  6. best law essay writer says:

    Your ability to write is amazing. an awesome article ought to include all relevant statistics for the subject in a gentle way in order that readers can get your thought off without problems. In this text, you arranged all your thoughts in a nice way. I'm really inspired with this. I like to ship your website to get top subjects to examine. nearly have all your posts, and this one is satisfactory. this newsletter defined the thoughts in a thrilling way. keep the same first-rate in the rest of the posts, that's the nice issue I've from your articles.

  7. assignment experts says:

    This flexibility conceivably brings about cost-effectiveness, enabling systems administration organizations to purchase equipment segments specifically from unique makes, without depending on an outsider. Chip providers in their turn would prefer not to miss the prepare and put into help of P4 to remain in the game.

  8. Full Essay Help UK says:

    Software-defined networking is an engineering implying to be dynamic, reasonable, manageable, cost-effective, and adaptable, trying to be appropriate for the high-transmission capacity, dynamic nature of the present applications. SDN structures decouple organize control and sending capacities

  9. Pay Someone To Write My Essay says:

    This is a nice book to celebrate learning to read. It has a positive attitude. However, it failed to hold the interest of my 5-year-old and it's moved to the bottom of our book pile

  10. amazon gift card codes for shopping says:

    Free amazon gift cards.

  11. windows 10 updates says:

    P4 is a great software. You won't be disappointed when using it.

  12. Assignment help says:

    Get best assignment help.

  13. Assignment Help says:

    Looking for someone write my assignment here are Expert Allassignmenthelp well efficient and capable of creating unique assignments for students .Assignment Help is a term which is best for students help, they can easily get help for their assignments online.

  14. cinema box says:

    Thanks my friend this is great and fantastic topic also is helpful i love this weblog so much.

  15. toshiba satellite drivers says:

    That's great news for developers, P4 looks very interesting. I will try to take a look at some tutorials whenever I have the time. Programming is a great way to improve your memory, I recommended it to many people.

  16. mega downloader says:

    That's great news for developers, P4 looks very interesting. I will try to take a look at some tutorials whenever I have the time. Programming is a great way to improve your memory, I recommended it to many people.

  17. Ida Wallace says:

    Glad to find here quality piece of content on software networking which are really helpful guidance for IT learners. Keep sharing.


  18. Yap Sody says:

    If you are confused that how to sell tickets online checkout yapsody

  19. Yap Sody says:

    Websites that charge their users a listing fee when they want to sell tickets online means that consumers and visitors to the website will deem the listing to sell tickets online is more trustworthy which brings along more potential buyers.

  20. check us out says:

    I appreciate the content of this article , it explain more details of information, this is so cool! Keep it up!

  21. Assignment Writing says:

    This Is Really A Great Stuff For Sharing. Keep It Up .Thanks For Sharing.

  22. says:

    If you are one of those who struggle with comparison and contrast essay writing, today is your happiest day! is a perfect solution for all the students who need academic assistance because our reputation speaks for itself. We guarantee excellent quality for the affordable price.

  23. Sprinkler Repair Miami says:

    I enjoyed reading your articles. This is truly a great read for me.

  24. flea control says:

    Thanks for sharing! I enjoyed reading this article.

  25. Ludo Game says:

    Ludo Game is a very interesting game and so many new features in new ludo games, you can try to ludo game and enjoy the new features of Ludo games.

  26. Academic Paper Format says:

    Thanks for sharing! Want to know more about academic paper format? When you use accepted formatting standards in an academic paper it shows you understands the customary practices of the academic community. This is, therefore, a great way of boosting your own academic credentials and credibility.

  27. Top writing service says:

    Writing research papers can be a challenge to most students, especially where the lecturer expects a well-polished research paper from the student. So, if you want to have the best life and not to put aside all the fun and activity in it, take a chance to have every opportunity right now.

  28. wings io says:

    Hi there, I found your blog via Google while searching for such kinda informative post and your post looks very interesting for me

  29. Brielle Luna says:

    Every company should have write ups like this. This is

  30. sign in says:

    Hi there, I found your site by the use of Google while looking for a comparable topic, your website came up, it appears to be like good. I've bookmarked it in my google bookmarks.
    Hi there, just was aware of your weblog thru Google, and located that it is really informative. I am gonna watch out for brussels. I will be grateful in case you proceed this in future. A lot of folks will probably be benefited out of your writing. Cheers!

  31. 192.168.l.l says:

    Awesome blog. I enjoyed reading your articles.

  32. Cassandra D. Everhart says:

    This is utterly surprising! Ran'D Shine - Magician in Philadelphia

  33. Seek Aid says:

    Seek Aid is the platform that allows you to support a cause of your choice from the NGOs that have been evaluated for transparency and credibility. Seek Aid is the World’s largest and trustworthy giving platform for donors.

  34. bilalseo says:

    hey there if you are interested in website or app development Hivemind

  35. buy discussion board post says:

    You would like to be able to program that silicon, so P4 looks to be a compelling step forward. But if your needs are satisfied with 40Gbps ports and you have chosen a software networking solution for its low cost

  36. First Copy Pen India says:

    Having read this I believed it was extremely enlightening. I appreciate you finding the time and effort to put this short article together.
    I once again find myself personally spending a lot of time both reading and commenting. But so what, it was still worth it!

  37. website builder says:

    yep, bit old but still interesting content here

  38. 192.168.l.l says:

    I'm really impressed about the info you provide in your articles. I must say am highly overwhelmed by your whole story. It's not easy to get such quality information online nowadays. I look forward to staying here for a long time.

  39. Buy Certificate says:

    Great Information,It Has Lot For Stuff Which Is Informative.I Will Share The Post With My Friends.

  40. alexabliss says:

    This is additionally a generally excellent post which I truly appreciate perusing. It isn't regular that I have the likelihood to see something like


  41. happy wheels says:

    Welcome back to one of the world’s most intense mazes. Will you reach each one of the checkpoints in this epic action game? You’ll need to watch out for everything from moving platforms to bottomless pits!

  42. dissertation help says:

    An early look for the Software Networking.. What a great extent you have raised this. :D

  43. Cassandra D. Everhart says:

    Generally I don’t read post on blogs, but I would like to say that this write-up very forced me to try and do it! custom car Orlando

  44. arman malick says:

    Katch International is delighted to be supporting the launch of Lewis Hamilton's first plant-based sustainable burger chain,
    Neat Burger, with our next-level global PR, project management and integrated communications services At Katch, we pride ourselves on being...
    Social media and Communications Agency in Dubai

  45. <a href="">google</a> says:


  46. First copy watches india says:

    Thank you for sharing

  47. chrisgail says:

    This is very good news for developers of p4. I will also download this software then I will share with you about its result.

  48. chrisgail says:

    This is very good news for developers of p4. I will also download this software then I will share with you about its result.Masters dissertation writing service

  49. says:

    Something to know about software networking.

  50. white widow seeds says:

    This strong indica helps patients to gain some mental peace and unwind from a stressful day. This strain's aroma is bright and buttery, exhibiting sweet notes from both its parents.

  51. atari breakout says:

    Your article content is being very much interested, I am very impressed with your post. I hope to receive more great posts.

  52. cbd oil says:

    Calyx OG (also known as Calyx OG #3) is a balanced 50/50 hybrid from Calyx Garden. Dark Horse Genetics bred this strain from OG Kush and Strawberry Diesel, and its heritage can be found in its diesel aroma with sweet undertones.

  53. says:

    This article has a lot of useful information in it that I think Im' going to use.

  54. life coach hawaii says:

    Can't wait to see more

  55. first copy mens watches online says:

    really intresting basic deep knowlledge in software networking for p4

  56. radofirstcopy says:

    amazing content

  57. arman says:

    We offer all Executive Cars on Rent for
    Daily, Weekly and Monthly Bases Bahria Town Rawalpindi / Islamabad Contact Us for rent a car islamabadrent a car islamabad

  58. MLA style citation generator says:

    You are mighty proud of that essay you finally championed last night. With editing and proofreading done to perfection, what stands in the way of your securing an A+ on your essay? Yeah, you guessed it right. The last hurdle to overcome before you can turn in the best essay you have written in ages is the task of creating a list of references in MLA style.
    The digital era has automated the entire process. Hence we present the finest MLA Referencing and Citation Generator that lets you customise your list instantly. And you know what the best part is? MLA Referencing generator is absolutely free at

  59. ps5 release date says:

    Your share is the great knowledge I have gathered, you are an important person I admire, thank you

  60. best astrologer says:

    This site is excellent and so is how the subject matter was explained. I also like some of the comments too. Waiting for the next post.

  61. gradesfixer reviews says:

    I 'm an A student because of your assistance!
    Thank you for saving me during difficult times and helping me maintain my present GPA standing. More gradesfixer reviews here.

  62. trustmypaper reddit says:

    I usually use Reddit when I want to learn more about the issue. However, I noticed that even Reddit is not almighty. For example, I was looking for feedback on TrustMyPaper, but couldn't find at least one on Reddit. It seems that nobody even created trustmypaper reddit topic yet. Unbelievable!

  63. Study help says:

    Anyone can write a couple of lines on a random topic. However, making complete assignments arbitrarily, without any preparation on a topic, is tough. And that is when students need professional study helpers to guide them. Visit if you need study supporter in Malaysia and get rid of the dilemmas of preparing assignments.

    Here’s how our veteran writers put their best foot forward to craft assignments-

    Researchers include updated ideas for every topic which seems tricky to you. We have solutions readily available for you. Our in-house researchers are well-versed with the day-to-day industry occurrences and accumulate those in the assignments. Need study expert? Consider us as the most trusted source for getting information rich assignments.
    Our writers curate papers from scratch to ensure zero repetition and plagiarism. If you need online study material helpers who can draft papers and ensure the best grades against it, we are the one-stop destination for that. We have hired only native and PhD-qualified assignment writers in our team to ensure services to those who need study writer online.
    In-house proofreaders and editors confirm technical flawlessness of the assignment that our writers have made. Hurried assignment preparation may have left some loose ends in the assignment. However, with editors and proofreaders in our team providing study help, remain assured of complete flawlessness in the paper. From rectifying contextual flaws to ensuring grammatically accurate papers, you can expect all with just one click.

  64. lottoalotto says:

    LOTTO PLUS 2 is exactly the same as LOTTO, but gives the player a third chance to win.

  65. online Astrology predictions says:

    Get best future predictions related to Marriage, love life, Career or Health over call, chat, query or report. With Astrogurutips you can get the best online astrology services in the comfort of your home. astrology prediction tips

  66. RailsCarma says:

    RailsCarma offers end-to-end Ruby on Rails development services.

  67. best astrologers on call says:

    Thanks, you guys that is a great explanation. keep up the good work in your granite blog.

  68. sudhama says:

    ntresting to know deep knowledge in software networking

  69. International law assignmenthelp says:

    Are you looking for Do my International Law assignment services? Well, in that case, you have to take advantage of the expertise of our International Law Assignment Writers. International law, also called public international law or the law of nations, is a set of laws, benchmarks, and standards accepted in connection with nations. Moreover, international laws are set up to negotiate strictly with problems that would personally affect countries, on the whole, moderately targeting on the authority of the distinctive citizens that reside in those nations. An important part of international law is cited as consent-based governance. The meaning of this citation is that the state is not bound to put up with the laws except that it has given its approval to the particular scheme of action. However, many such attributes are not at all consent-based but are still pursued by the countries.

  70. Assignment Help says:

    We suggest you give longer cutoff times to each assignment however are equipped for finishing your assignment inside 24 hours. We don't exploit the real cutoff time referenced in the prerequisites and guarantee that our specialists additionally have an equivalent methodology. We don't unveil the real accommodation cutoff time of our understudies to the specialists related by us. It is done so as to dispose of postponement in conveyance of assignments driving the understudies to miss his genuine cutoff time or to be punished for delay. This is accomplished by having a group of topic specialists set up who have significant experience, exceptionally qualified and have satisfactory pragmatic experience which enormously decreases the time expected to attempt research accordingly taking into consideration assignments to be set up on critical premise.

  71. Talk to astrologer online says:

    Love marriage is quite common now. However still sometimes problems occur in love marriages due to parents disapproval, societal norms, etc. Below is the answer for the combination of love marriage in astrology.

  72. painters in quincy ma says:

    This is my first time hearing this software networking. I want to learn more about it and hoping you post more topic soon.

  73. Tattoo Artist Kolkata says:

    thank you for this!!!!

  74. 2bhk flats in thakurpukur says:

    You have written an amazing article!!!1

  75. Wedding Events In Kolkata says:

    It's really an interesting one. Keep writing!!!

  76. Talk to strangers says:

    Talkokay is a wonderful online voice chat app. With Talkokay free voice chatting app, you can have a voice chat with millions of people and have a voice talk with talented or humorous people from different countries at any time anywhere. Talkokay has a great number of interesting features more than just audio calling app. This is a free audio calling app that will enable you to make friends from all over the world in less than 30 seconds.

  77. Cabinet Refinishing says:

    Thanks for this info! We at Project Paint appreciate your efforts!

  78. Home Repair Longmont says:

    Content is King!

  79. Home Repair Longmont says:

    Content is King!

  80. Laura Barr says:

    The dawn of software defined networking (SDN) ushered in an era of disaggregation of the networking control plane from the data plane; management of the network was no longer bound to the networking hardware it ran on.

  81. Allindiawatches says:

    I’m really happy to say it was an interesting post to read. I learned new information from your article, you are doing a great job. Replica Watches In India

  82. jaw and chin enhancements says:

    Artificial fragrances are designed to cover up the smell of other chemicals used in traditional health and beauty products.

  83. jaw and chin enhancements says:

    Artificial fragrances are designed to cover up the smell of other chemicals used in traditional health and beauty products.

Leave a Reply