[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
10.1145/3565475.3569078acmconferencesArticle/Chapter ViewAbstractPublication PagesconextConference Proceedingsconference-collections
research-article

Reducing P4 language's voluminosity using higher-level constructs

Published: 06 December 2022 Publication History

Abstract

Over the last years, P4 has positioned itself as the primary language for data-plane programming. Despite its constant evolution, the P4 language still "suffers" from one significant limitation: the voluminosity of its code. P4 applications easily reach thousands of lines of code, becoming hard to develop, debug, and maintain. The reason is twofold: P4 requires many characters to express individual concepts (verbosity), and it relies on code repetition (lack of parametrization).
Today, P4 users overcome this limitation by relying on templating tools, hand-crafted scripts, and complicated macros. Unfortunately, these methods are not optimal: they make the development process difficult and do not generalize well beyond one codebase.
In this work, we propose reducing the voluminosity of P4 code by introducing higher-level language constructs. We present O4, an extended version of P4, that includes three such constructs: arrays (which group same-type entities together), loops (which reduce simple repetitions), and factories (which enable code parametrization).
We evaluate O4 on several state-of-the-art programs and show how, with respect to P4: (i) it reduces code volumes by up to 80%, (ii) it decreases code verbosity by 44% on average, and (iii) it cuts duplicated code by 60%. We contribute a compiler implementation that provides said benefits with just a 3.5% increase in compilation time.

References

[1]
2007. Jinja Documentation. https://jinja.palletsprojects.com/.
[2]
2020. P4 Language Specifications. https://p4.org/specs/.
[3]
2021. Count-Min Sketch Exercise, P4-Learning (Pulled: 22 September 2022). https://github.com/nsg-ethz/p4-learning/tree/master/exercises/07-Count-Min-Sketch.
[4]
2021. Heavy-Hitter Detection Exercise, P4-Learning (Pulled: 22 September 2022). https://github.com/nsg-ethz/p4-learning/tree/master/exercises/06-Heavy_Hitter_Detector.
[5]
2021. Intel Tofino. https://www.intel.com/content/www/us/en/products/network-io/programmable-ethernet-switch/tofino-series.html.
[6]
2021. Loss Detection Exercise, P4-Learning (Pulled: 22 September 2022). https://github.com/nsg-ethz/p4-learning/tree/master/exercises/11-Packet-Loss-Detection.
[7]
2021. Open Tofino (Pulled: 22 September 2022). https://github.com/barefootnetworks/Open-Tofino.
[8]
2021. P4 Compiler (Pulled: 22 September 2022). https://github.com/p4lang/p4c.
[9]
2021. P4-Learning (Pulled: 22 September 2022). https://github.com/nsg-ethz/p4-learning.
[10]
2021. Racket Language. https://racket-lang.org.
[11]
2022. Abstract Syntax Tree. https://en.wikipedia.org/wiki/Abstract_syntax_tree).
[12]
2022. Arrays in Java. https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html.
[13]
2022. Arrays in Python. https://docs.python.org/3/library/array.html.
[14]
2022. Constructors in Object-Oriented Programming. https://en.wikipedia.org/wiki/Constructor_(object-oriented_programming).
[15]
2022. Control Flow Statements in Java. https://docs.oracle.com/javase/tutorial/java/nutsandbolts/flow.html.
[16]
2022. Control Flow Tools in Python. https://docs.python.org/3/tutorial/controlflow.html.
[17]
2022. In-Place Algorithm. https://en.wikipedia.org/wiki/In-place_algorithm.
[18]
2022. Python Constructors. https://www.javatpoint.com/python-constructors).
[19]
2022. Source Lines of Code. https://en.wikipedia.org/wiki/Source_lines_of_code).
[20]
2022. The Halting Problem. https://en.wikipedia.org/wiki/Halting_problem.
[21]
Alfred V Aho, Ravi Sethi, and Jeffrey D Ullman. 1986. Compilers: Principles, Techniques, and Tools. Addison-Wesley.
[22]
Albert Gran Alcoz, Alexander Dietmüller, and Laurent Vanbever. 2020. SP-PIFO: Approximating Push-in First-out Behaviors Using Strict-priority Queues. In USENIX NSDI. Santa Clara, CA, USA.
[23]
Pat Bosshart, Dan Daly, Glen Gibb, Martin Izzard, Nick McKeown, Jennifer Rexford, Cole Schlesinger, Dan Talayco, Amin Vahdat, George Varghese, et al. 2014. P4: Programming Protocol-independent Packet Processors. (2014).
[24]
Xiaoqi Chen. 2020. Implementing AES Encryption on Programmable Switches via Scrambled Lookup Tables. In ACM SPIN. Virtual Event.
[25]
Xiaoqi Chen, Shir Landau Feibish, Yaron Koral, Jennifer Rexford, Ori Rottenstreich, Steven A Monetti, and Tzuu-Yi Wang. 2019. Fine-Grained Queue Measurement in the Data Plane. In ACM CoNEXT. Orlando, Florida, USA.
[26]
Xiaoqi Chen, Shir Landau-Feibish, Mark Braverman, and Jennifer Rexford. 2020. Beaucoup: Answering Many Network Traffic Queries, One Memory Update At a Time. In ACM SIGCOMM. 226--239.
[27]
Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, Shriram Krishnamurthi, Eli Barzilay, Jay McCarthy, and Sam Tobin-Hochstadt. 2015. The Racket Manifesto. In SNAPL. Asilomar, CA, USA.
[28]
Matthew Flatt and PLT. 2021. The Racket Reference. https://docs.racket-lang.org/reference/index.html.
[29]
Jiaqi Gao, Ennan Zhai, Hongqiang Harry Liu, Rui Miao, Yu Zhou, Bingchuan Tian, Chen Sun, Dennis Cai, Ming Zhang, and Minlan Yu. 2020. Lyra: A Cross-Platform Language and Compiler for Data Plane Programming on Heterogeneous ASICs. In ACM SIGCOMM. Virtual.
[30]
Xiangyu Gao, Taegyun Kim, Michael D Wong, Divya Raghunathan, Aatish Kishan Varma, Pravein Govindan Kannan, Anirudh Sivaraman, Srinivas Narayana, and Aarti Gupta. 2020. Switch code generation using program synthesis. In ACM SIGCOMM. 44--61.
[31]
Xiangyu Gao, Taegyun Kim, Michael D Wong, Divya Raghunathan, Aatish Kishan Varma, Pravein Govindan Kannan, Anirudh Sivaraman, Srinivas Narayana, and Aarti Gupta. 2020. Switch Code Generation Using Program Synthesis. In ACM SIGCOMM. Virtual.
[32]
Albert Gran Alcoz, Martin Strohmeier, Vincent Lenders, and Laurent Vanbever. 2022. Aggregate-Based Congestion Control for Pulse-Wave DDoS Defense. In ACM SIGCOMM. Amsterdam, The Netherlands.
[33]
Arpit Gupta, Rob Harrison, Marco Canini, Nick Feamster, Jennifer Rexford, and Walter Willinger. 2018. Sonata: Query-driven Streaming Network Telemetry. In ACM SIGCOMM. Budapest, Hungary.
[34]
Maurice H Halstead. 1977. Elements of Software Science. Elsevier North-Holland.
[35]
Mary Hogan, Shir Landau-Feibish, Mina Tahmasbi Arashloo, Jennifer Rexford, David Walker, and Rob Harrison. 2020. Elastic Switch Programming with P4All. In ACM HotNets. Virtual.
[36]
Thomas Holterbach, Edgar Costa Molero, Maria Apostolaki, Alberto Dainotti, Stefano Vissicchio, and Laurent Vanbever. 2019. Blink: Fast Connectivity Recovery Entirely in the Data Plane. In USENIX NSDI. Boston, MA, USA.
[37]
Vladimir I Levenshtein et al. 1966. Binary Codes Capable of Correcting Deletions, Insertions, and Reversals. In Doklady Physics. Soviet Union.
[38]
Steve McConnell. 2004. Code Complete. Pearson Education.
[39]
Roland Meier, Petar Tsankov, Vincent Lenders, Laurent Vanbever, and Martin Vechev. 2018. NetHide: Secure and Practical Network Topology Obfuscation. In USENIX Security. Baltimore, MD, USA.
[40]
Rinku Shah, Aniket Shirke, Akash Trehan, Mythili Vutukuru, and Purushottam Kulkarni. 2018. pcube: Primitives for Network Data Plane Programming. In IEEE ICNP. Cambridge, UK.
[41]
Anirudh Sivaraman, Alvin Cheung, Mihai Budiu, Changhoon Kim, Mohammad Alizadeh, Hari Balakrishnan, George Varghese, Nick McKeown, and Steve Licking. 2016. Packet Transactions: High-level Programming for Line-rate Switches. In ACM SIGCOMM. Florianópolis, Brazil.
[42]
John Sonchack, Devon Loehr, Jennifer Rexford, and David Walker. 2021. Lucid: A Language for Control in the Data Plane. In ACM SIGCOMM. Virtual.
[43]
Hardik Soni, Myriana Rifai, Praveen Kumar, Ryan Doenges, and Nate Foster. 2020. Composing Dataplane Programs with μP4. In ACM SIGCOMM. Virtual.
[44]
The P4 Language Consortium. 2021. P4-16 Language Specification. https://p4.org/p4-spec/docs/P4-16-v1.2.2.html.
[45]
Yu Zhou and Jun Bi. 2017. ClickP4: Towards Modular Programming of P4. (2017).

Cited By

View all
  • (2023)PEDDAComputer Networks: The International Journal of Computer and Telecommunications Networking10.1016/j.comnet.2023.109873233:COnline publication date: 1-Sep-2023

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
EuroP4 '22: Proceedings of the 5th International Workshop on P4 in Europe
December 2022
154 pages
ISBN:9781450399357
DOI:10.1145/3565475
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 06 December 2022

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. P4 language
  2. programmable networks
  3. programming languages

Qualifiers

  • Research-article

Conference

CoNEXT '22
Sponsor:

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)59
  • Downloads (Last 6 weeks)11
Reflects downloads up to 11 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2023)PEDDAComputer Networks: The International Journal of Computer and Telecommunications Networking10.1016/j.comnet.2023.109873233:COnline publication date: 1-Sep-2023

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media