THE LINUX FOUNDATION PROJECTS
Blog

From Four Years to Four Days? GenAI and Data Plane Programmability

By November 30, 2026No Comments

Contributed by: Anoud Alshnakat, Salvatore Signorello, and Tomasz Osiński

GenAI and P4 (Data Plane Programmability)

One of the main promises of P4 and data plane programmability was a shorter time to market. Traditionally, packet processing was hard-wired in silicon, so every new protocol meant waiting for a new generation of chips. Even then, each vendor’s Application-Specific Integrated Circuit (ASIC) came with its own SDK, typically a C/C++ library, forcing programmers to manually handle low-level tasks such as memory allocation. By turning new protocols into programmable software, P4 reduced network development cycles from years to mere months as programmable hardware became available.

P4 streamlines network development through high-level hardware abstractions and automated compilation. However, building production-grade P4 pipelines still requires teams of experts fluent in both network and software engineering.

Today, GenAI is accelerating software development at an unprecedented pace. Coding agents promise to shorten the development cycle yet again, and we believe data plane programmability could benefit from this trend, but let’s not simply get carried away by the hype. In this article, we take an unbiased look at how GenAI can boost P4 and data plane programmability even further and where it still falls short.

Where GenAI helps today

Our thesis is simple. GenAI speeds up the big part of data plane development: writing a functionally correct and well-tested program quickly. This will lower the barrier to entry, hopefully expand the P4 developer community, and drive the language’s evolution. The hard part will be ensuring the program is resource-optimized for a given hardware target and meets line-rate performance. 

Code generation: accelerating from specification to prototype

When VXLAN needed to be added to fixed-function switches, it took roughly four years for it to roll out in new hardware. P4 reduced this to months, as a new protocol became a matter of writing software rather than taping out a new chip. With GenAI, the time shrunk yet again. A fully featured prototype of a data plane program can now be implemented in days, not months. An engineer can hand an RFC to a coding agent and get back a working P4 implementation of the protocol, ready to be tested and refined.

What makes this possible is not just the language model itself, but the agentic loop around it. A modern coding agent doesn’t simply write code and stop. It reads the specification, writes the P4 program, compiles it with p4c, runs it on the BMv2 software switch, executes the tests, reads the failures, and iterates until the tests pass. The compiler and the simulator act as teachers: every error message and every failed test is feedback the agent uses to correct itself. This loop partially compensates for the limited amount of P4 code that models have seen during training, a problem we return to later in this post. Domain knowledge no longer has to come only from training: it can be provided as context, such as specifications, architecture files and agent skills, or through tools that the agent can call.

Test generation: covering the corner cases

Protocol specifications are broad and full of corner cases. Analyzing all of them and writing proper data-plane tests has always been time-consuming, so in practice many corner cases were never tested. GenAI changes this workflow. You can give the full specification, for example, an RFC, to an agent and ask it to generate PTF tests that systematically cover the cases described in the text, including those nobody previously had time to write. LLM-based test generation is already used in industry, for example, Meta’s TestGen-LLM for improving unit test coverage.

Testing in the P4 ecosystem benefits uniquely from a hybrid approach. While LLMs can reliably produce valid tests with high code coverage, they often struggle to determine the correct expected output independently and to write tests that actually reveal bugs. Instead, LLM-generated PTF tests can be combined with existing tools such as P4Testgen, which derive test cases and their expected outputs directly from the program’s semantics. The two are complementary: the LLM brings an understanding of what the specification intends, while tools like P4Testgen check the target against the program.

Language evolution: driving wider adoption

Can GenAI help P4 and other data plane languages achieve wider adoption? History shows that languages succeed for reasons beyond their syntax. Python became dominant partly thanks to deep learning libraries. Rust is one of the fastest-growing languages, thanks to its memory and data safety combined with modern tooling and a great developer experience. Today, GenAI assistance is becoming part of that developer experience, and languages that work well with coding agents gain a real advantage.

For P4, this is an opportunity. So far, the main barrier to adoption has been the need for rare experts at the intersection of networking and software engineering. GenAI lowers this barrier: a network engineer with limited programming experience, or a software engineer new to packet processing, can now be productive with P4 much faster, with an agent explaining the language, the architecture, and the compiler errors along the way. More developers means more P4 code, more use cases and, ultimately, a healthier ecosystem.

Where it falls short

GenAI is not equally helpful for every programming language. As Paul Jansen, CEO of TIOBE, explained: “The reason is that AI models are trained to help engineers in popular languages because there is sufficient data available. If a programming language is not used often, there is insufficient data available and AI can’t be of any good help, which is a reason to refrain from using such a language.”

For a domain-specific language like P4, this concern is very real. Compared with Python or C, there is little public P4 code, and even less of it is production-grade. Research on code generation shows that medium-size models only handle a specialized language well when they are specifically trained or fine-tuned for it, and combined with chain-of-thought or few-shot prompting. There are already studies applying this approach to P4. Their results are promising, but for now, generating P4 code with LLMs remains a process heavily conditioned by available data and human intervention. A fine-tuned model is only as good as the programs it was trained on, and for data plane programs, that corpus is still small.

The second challenge is hardware diversity and the lack of public-domain knowledge about them. A P4 program is only useful if it matches the architecture, externs, and resource limits of the chip it will run on: the number of pipeline stages, header-vector space, TCAM and SRAM capacity, and recirculation bandwidth. Those constraints differ across Tofino and X2 switches, IPUs and DPUs, FPGAs and eBPF, and across the architectures they expose (v1model, TNA, PSA, PNA). Models trained on one of them routinely mix architectures, invent externs that don’t exist on the given target, or emit code that is functionally correct, but simply don’t fit. Much of the knowledge needed to avoid that sits in vendor documentation under NDA, where models can’t learn it. More public training data could help, but the best practices and know-how have to come from the hardware vendors themselves.

These are real challenges, but we believe they aren’t the whole story. 

What makes P4 an unusually good target for GenAI

Compared with a general-purpose language like C or Python, P4 is deliberately constrained. A P4 program has no general-purpose memory and no heap, a bounded amount of processing budget per packet, an explicit parser state machine, and a pipeline of match-action tables. This makes it a good use case for GenAI. A smaller language means fewer ways for a model to go wrong. More importantly, the programs are far easier to analyze automatically, so mistakes are much easier to catch.

P4 also has the tools to do that analysis. Years of academic and industry work have given it something few niche languages have: a compiler with a strict type checker (p4c), a reference software switch (BMv2), a test oracle that derives expected outputs from the program itself (P4Testgen), formal semantics (Petr4, HOL4P4), and even tools that test the compilers (Gauntlet, which has found nearly a hundred compiler bugs and now runs in p4c’s continuous integration). Together, these give an agent a loop in which every step answers concrete questions like “does this program compile?” or “is Packet A indeed forwarded via port B?”. What makes these questions useful is that they have objective answers, and each comes from a different tool. p4c answers the first one in seconds, rejecting syntax errors, type errors, and architecture violations with messages precise enough for the agent to act upon. Questions about behavior are answered by running the program. The LLM writes tests from the specification, encoding its reading of the intent; BMv2 executes the program on real packets, and P4Testgen or executable HOL4P4 computes what it actually does across its paths. Wherever the two disagree, the agent has found either a bug or a misreading of the specification. It fixes the code or the test and runs the loop again, and if it can’t resolve the conflict, it asks a human. For the few properties where testing isn’t enough, such as guaranteeing that no packet can ever bypass an access control list, formal verification can provide a proof.

The division of labor is the point. LLMs are good at intent and tools are good at facts, so neither has to be perfect as long as each checks the other.

Some questions, however, lie outside the loop. The loop can tell you whether packet A leaves through port B, but not whether the program fits on a given chip or runs at line rate. That still takes the target’s own compiler and, often, an expert. And if the model misreads the specification in both the code and the tests, the loop will happily confirm the mistake, so someone who understands the intended behavior still has to own the tests. Target-specific know-how, such as what is legal on an architecture or which idioms compile efficiently, can be packaged as agent skills. But that knowledge has to come from somewhere, which brings us back to the hardware vendors.

Within those limits, the payoff is real. Network engineers, operators, service providers, and protocol designers know exactly what their data plane should do, but most have never been fluent in P4. They bring the intent. GenAI turns it into code. And P4 (with its tools) makes that code verifiable.

Why the P4 community must step up

GenAI has made writing software dramatically faster, but hardware doesn’t follow the same curve. As Pat Gelsinger, former CEO of Intel, recently put it, “Silicon still takes quarters to manufacture, no matter how fast we design.” 

A new protocol feature can now be prototyped in days, yet a fixed-function chip would still need years to support it. This is why we believe the future of networking is programmable. Programmable switches such as Tofino or X2 and programmable NICs (e.g., AMD Pensando, Intel IPUs) move innovation from silicon into software, which is exactly where GenAI is accelerating it. Data plane programmability is what lets the network keep pace with the rest of the software world.

But programmable hardware and GenAI alone won’t get us there. Looking ahead, we see a few areas where the P4 community needs to invest.

The first is the toolchain itself. Compilers, behavioral models, test generators, and verification tools are what turn plausible-looking GenAI output into correct data plane programs. The faster and clearer their feedback is, the more effectively coding agents can iterate on their own, so every improvement in compiler diagnostics or test environments now pays off twice: for human developers and for their AI assistants.

The second is data. Models are only as good as the examples they learn from, and today there are few high-quality P4 programs out there. A shared, well-curated collection of specification-compliant and formally verified data plane programs, published under clear licenses, would help on several fronts at once. It could serve as training data for models, as reference material for coding agents, and as a benchmark for measuring how well GenAI tools actually perform.

Third, hardware vendors have a key role to play. As we saw earlier, the knowledge needed to write efficient code for a specific chip, such as its architecture details, resource constraints, and coding idioms, is largely not public, so general-purpose models can’t learn it. By publishing curated agent skills together with the behavioral models and compilers that validate the generated programs, vendors can close the gap between a program that compiles on a software switch and one that runs at line rate on real hardware.

Finally, there’s something we already have that we shouldn’t lose: precise protocol specifications. RFCs and 3GPP specifications, with their normative MUST and SHOULD language and their careful treatment of corner cases, turn out to be excellent input for LLMs. They allow an agent to generate both the implementation and its tests from a single source of truth, and that rigor is worth preserving.

Whether the “four days” in our title becomes reality depends on how well the community meets these challenges.