Abstract
The P4 language and programmable switch hardware, like the Intel Tofino, have made it possible for network engineers to write new programs that customize operation of computer networks, thereby improving performance, fault-tolerance, energy use, and security. Unfortunately, possible does not mean easy—there are many implicit constraints that programmers must obey if they wish their programs to compile to specialized networking hardware. In particular, all computations on the same switch must access data structures in a consistent order, or it will not be possible to lay that data out along the switch’s packet-processing pipeline. In this paper, we define Lucid 2.0, a new language and type system that guarantees programs access data in a consistent order and hence are pipeline-safe. Lucid 2.0 builds on top of the original Lucid language, which is also pipeline-safe, but lacks the features needed for modular construction of data structure libraries. Hence, Lucid 2.0 adds (1) polymorphism and ordering constraints for code reuse; (2) abstract, hierarchical pipeline locations and data types to support information hiding; (3) compile-time constructors, vectors and loops to allow for construction of flexible data structures; and (4) type inference to lessen the burden of program annotations. We develop the meta-theory of Lucid 2.0, prove soundness, and show how to encode constraint checking as an SMT problem. We demonstrate the utility of Lucid 2.0 by developing a suite of useful networking libraries and applications that exploit our new language features, including Bloom filters, sketches, cuckoo hash tables, distributed firewalls, DNS reflection defenses, network address translators (NATs) and a probabilistic traffic monitoring service.
Supplemental Material
Available for Download
This is a version of the POPL22 paper "Safe, Modular Packet Pipeline Programming" which contains appendices detailing the full formal definition of the language and type system, as well as proofs of language properties and soundness.
- Mohammad Alizadeh, Tom Edsall, Sarang Dharmapurikar, Ramanan Vaidyanathan, Kevin Chu, Andy Fingerhut, The Vinh Lam, Francis Matus, Rong Pan, Navindra Yadav, and George Varghese. 2014. CONGA: distributed congestion-aware load balancing for datacenters. In ACM SIGCOMM. 503–514. https://doi.org/10.1145/2740070.2626316 Google Scholar
Digital Library
- Carolyn Jane Anderson, Nate Foster, Arjun Guha, Jean-Baptiste Jeannin, Dexter Kozen, Cole Schlesinger, and David Walker. 2014. NetKAT: Semantic Foundations for Networks. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. 113–126. https://doi.org/10.1145/2578855.2535862 Google Scholar
Digital Library
- Mario Baldi. 2020. Pensando Announces P4-programmable Platform and Joins P4 Community. https://opennetworking.org/news-and-events/blog/pensando-announces-p4-programmable-platform-and-joins-p4-community/.Google Scholar
- Pat Bosshart, Dan Daly, Glen Gibb, Martin Izzard, Nick McKeown, Jennifer Rexford, Cole Schlesinger, Dan Talayco, Amin Vahdat, George Varghese, and David Walker. 2014. P4: Programming protocol-independent packet processors. ACM SIGCOMM Computer Communication Review, 44, 3 (2014), 87–95. https://doi.org/10.1145/2656877.2656890 Google Scholar
Digital Library
- Pat Bosshart, Glen Gibb, Hun-Seok Kim, George Varghese, Nick McKeown, Martin Izzard, Fernando Mujica, and Mark Horowitz. 2013. Forwarding metamorphosis: Fast programmable match-action processing in hardware for SDN. In ACM SIGCOMM. 99–110. https://doi.org/10.1145/2486001.2486011 Google Scholar
Digital Library
- Aaron R. Bradley, Zohar Manna, and Henny B. Sipma. 2006. What’s Decidable About Arrays? In Verification, Model Checking, and Abstract Interpretation, E. Allen Emerson and Kedar S. Namjoshi (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg. 427–442. isbn:978-3-540-31622-0 https://doi.org/10.1007/11609773_28 Google Scholar
Digital Library
- Leonardo de Moura and Nikolaj Bjørner. 2008. Z3: An Efficient SMT Solver. In Tools and Algorithms for the Construction and Analysis of Systems, C. R. Ramakrishnan and Jakob Rehof (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg. 337–340. isbn:978-3-540-78800-3 https://doi.org/10.5555/1792734.1792766Google Scholar
Digital Library
- Rob DeLine and Manuel Fahndrich. 1999. Natural deduction for intuitionistic non-commutative linear logic. In International Conference on Typed Lambda Calculi and Applications. https://doi.org/10.1016/S1571-0661(04)80088-4 Google Scholar
Cross Ref
- Carl Ebeling, Darren C. Cronquist, and Paul Franklin. 1996. RaPiD - Reconfigurable Pipelined Datapath. In Proceedings of the 6th International Workshop on Field-Programmable Logic, Smart Applications, New Paradigms and Compilers (FPL ’96). Springer-Verlag, Berlin, Heidelberg. 126–135. isbn:3540617302 https://doi.org/10.5555/647923.741212Google Scholar
Digital Library
- Nate Foster, Rob Harrison, Michael J. Freedman, Christopher Monsanto, Jennifer Rexford, Alec Story, and David Walker. 2011. Frenetic: A Network Programming Language. In ACM International Conference on Functional Programming. 279–291. https://doi.org/10.1145/2034574.2034812 Google Scholar
Digital Library
- 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. 435–450. https://doi.org/10.1145/3387514.3405879 Google Scholar
Digital Library
- 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. https://doi.org/10.1145/3387514.3405852 Google Scholar
Digital Library
- David K. Gifford and John M. Lucassen. 1986. Integrating Functional and Imperative Programming. In Proceedings of the 1986 ACM Conference on LISP and Functional Programming (LFP ’86). Association for Computing Machinery, New York, NY, USA. 28–38. isbn:0897912004 https://doi.org/10.1145/319838.319848 Google Scholar
Digital Library
- Jean-Yves Girard. 1987. Linear Logic. Theor. Comput. Sci., 50, 1 (1987), Jan., 1–102. issn:0304-3975 https://doi.org/10.1016/0304-3975(87)90045-4 Google Scholar
Digital Library
- Mary Hogan, Shir Landau-Feibish, Mina Tahmasbi Arashloo, Jennifer Rexford, David Walker, and Rob Harrison. 2020. Elastic Switch Programming with P4All. In ACM SIGCOMM HotNets Networks. 168–174. https://doi.org/10.1145/3422604.3425933 Google Scholar
Digital Library
- Kuo-Feng Hsu, Ryan Beckett, Ang Chen, Jennifer Rexford, and David Walker. 2020. Contra: A programmable system for performance-aware routing. In USENIX Symposium on Networked Systems Design and Implementation. 701–721.Google Scholar
- Atsushi Igarashi and Naoki Kobayashi. 2005. Resource Usage Analysis. ACM Trans. Program. Lang. Syst., 27, 2 (2005), March, 264–313. issn:0164-0925 https://doi.org/10.1145/1057387.1057390 Google Scholar
Digital Library
- Intel. 2020. Intel Tofino 2. https://www.intel.com/content/www/us/en/products/network-io/programmable-ethernet-switch/tofino-2-series.html.Google Scholar
- Vimalkumar Jeyakumar, Mohammad Alizadeh, Yilong Geng, Changhoon Kim, and David Mazières. 2014. Millions of Little Minions: Using Packets for Low Latency Network Programming and Visibility. SIGCOMM Comput. Commun. Rev., 44, 4 (2014), Aug., 3–14. issn:0146-4833 https://doi.org/10.1145/2740070.2626292 Google Scholar
Digital Library
- Mohan Kalkunte. 2019. Broadcom’s new Trident 4 and Jericho 2 switch devices offer programmability at scale. https://www.broadcom.com/blog/trident4-and-jericho2-offer-programmability-at-scale.Google Scholar
- Naga Katta, Mukesh Hira, Changhoon Kim, Anirudh Sivaraman, and Jennifer Rexford. 2016. Hula: Scalable load balancing using programmable data planes. In ACM SIGCOMM Symposium on SDN Research. 1–12. https://doi.org/10.1145/2890955.2890968 Google Scholar
Digital Library
- Zaoxing Liu, Hun Namkung, Georgios Nikolaidis, Jeongkeun Lee, Changhoon Kim, Xin Jin, Vladimir Braverman, Minlan Yu, and Vyas Sekar. 2021. Jaqen: A High-Performance Switch-Native Approach for Detecting and Mitigating Volumetric DDoS Attacks with Programmable Switches. In USENIX Security Symposium.Google Scholar
- Robin Milner. 1978. A theory of type polymorphism in programming. J. Comput. System Sci., 17, 3 (1978), 348–375. issn:0022-0000 https://doi.org/10.1016/0022-0000(78)90014-4 Google Scholar
Cross Ref
- Tim Nelson, Andrew D. Ferguson, Michael J.G. Scheer, and Shriram Krishnamurthi. 2014. Tierless Programming and Reasoning for Software-Defined Networks. In USENIX Networked Systems Design and Implementation. 519–531. https://doi.org/10.5555/2616448.2616496Google Scholar
- Jeff Polakow and Frank Pfenning. 1999. Natural Deduction for Intuitionistic Non-communicative Linear Logic. In Typed Lambda Calculi and Applications, 4th International Conference, TLCA’99, L’Aquila, Italy, April 7-9, 1999, Proceedings, Jean-Yves Girard (Ed.) (Lecture Notes in Computer Science, Vol. 1581). Springer, 295–309. https://doi.org/10.1016/S1571-0661(04)80088-4 Google Scholar
Cross Ref
- Jeff Polakow and Frank Pfenning. 1999. Natural deduction for intuitionistic non-commutative linear logic. In International Conference on Typed Lambda Calculi and Applications. https://doi.org/10.1016/S1571-0661(04)80088-4 Google Scholar
Cross Ref
- J. Polokow and Frank Pfenning. 1999. Relating Natural Deduction and Sequent Calculus for Intuitionistic Non-Commutative Linear Logic. In Fifteenth Conference on Mathematical Foundations of Progamming Semantics, MFPS 1999, Tulane University, New Orleans, LA, USA, April 28 - May 1, 1999, Stephen D. Brookes, Achim Jung, Michael W. Mislove, and Andre Scedrov (Eds.) (Electronic Notes in Theoretical Computer Science, Vol. 20). Elsevier, 449–466. https://doi.org/10.1016/S1571-0661(04)80088-4 Google Scholar
Cross Ref
- Joshua Reich, Christopher Monsanto, Nate Foster, Jennifer Rexford, and David Walker. 2013. Modular sdn programming with pyretic. Technical Reprot of USENIX, 30.Google Scholar
- Cole Schlesinger, Michael Greenberg, and David Walker. 2014. Concurrent NetCore: From Policies to Pipelines. In ACM International Conference on Functional Programming. 11–24. https://doi.org/10.1145/2692915.2628157 Google Scholar
Digital Library
- Rinku Shah, Vikas Kumar, Mythili Vutukuru, and Purushottam Kulkarni. 2020. TurboEPC: Leveraging Dataplane Programmability to Accelerate the Mobile Packet Core. In ACM Symposium on SDN Research. 83–95. https://doi.org/10.1145/3373360.3380839 Google Scholar
Digital Library
- 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. 15–28. https://doi.org/10.1145/2934872.2934900 Google Scholar
Digital Library
- John Sonchack, Devon Loehr, Jennifer Rexford, and David Walker. 2021. Lucid: A Language for Control in the Data Plane. In Proceedings of the 2021 ACM SIGCOMM 2021 Conference (SIGCOMM ’21). Association for Computing Machinery, New York, NY, USA. 731–747. isbn:9781450383837 https://doi.org/10.1145/3452296.3472903 Google Scholar
Digital Library
- John Sonchack, Oliver Michel, Adam J Aviv, Eric Keller, and Jonathan M Smith. 2018. Scaling hardware accelerated network monitoring to concurrent and dynamic queries with *Flow. In USENIX Annual Technical Conference. 823–835. https://doi.org/10.5555/3277355.3277435Google Scholar
- Mads Tofte and Lars Birkedal. 1998. A Region Inference Algorithm. ACM Trans. Program. Lang. Syst., 20, 4 (1998), July, 724–767. issn:0164-0925 https://doi.org/10.1145/291891.291894 Google Scholar
Digital Library
- Mads Tofte and Jean-Pierre Talpin. 1997. Region-Based Memory Management. Inf. Comput., 132, 2 (1997), Feb., 109–176. issn:0890-5401 https://doi.org/10.1006/inco.1996.2613 Google Scholar
Digital Library
- Andreas Voellmy, Junchang Wang, Y Richard Yang, Bryan Ford, and Paul Hudak. 2013. Maple: Simplifying SDN programming using algorithmic policies. In ACM SIGCOMM. 87–98. https://doi.org/10.1145/2534169.2486030 Google Scholar
Digital Library
- David Walker. 2005. Advanced Topics in Types and Programming Languages. The MIT Press, 3–44.Google Scholar
Index Terms
Safe, modular packet pipeline programming
Recommendations
Type-safe run-time polytypic programming
Polytypic programming is a way of defining type-indexed operations, such as map, fold and zip, based on type information. Run-time polytypic programming allows that type information to be dynamically computed – this support is essential in modern ...
Making legacy Fortran code type safe through automated program transformation
AbstractFortran is still widely used in scientific computing, and a very large corpus of legacy as well as new code is written in FORTRAN 77. In general this code is not type safe, so that incorrect programs can compile without errors. In this paper, we ...
A compiler and run-time system for network programming languages
POPL '12: Proceedings of the 39th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesSoftware-defined networks (SDNs) are a new kind of network architecture in which a controller machine manages a distributed collection of switches by instructing them to install or uninstall packet-forwarding rules and report traffic statistics. The ...






Comments