Overview
Programming Protocol-Independent Packet Processors (P4) is an open-source language for programming the data plane on networking devices. P4Runtime is an API for controlling the data plane on devices defined in a P4 program. The P4 language and P4Runtime specification are maintained at p4.org.
The SR Linux eXtensible Data Path (XDP) is not programmed in P4. However, SR Linux is packaged with a fixed P4 program that provides support for marking packets for trapping to a P4Runtime client via PacketIn messages, and transmitting packets from the P4Runtime client to an interface on the device via PacketOut messages. The following fields can be used to mark frames for extraction:
- VLAN ID
- Ethertype
- TTL
This could for example be used to redirect traceroute packets with TTL=0, TTL=1, or TTL=2 to a P4runtime client, so they can be enriched with information that is not visible to the device for the following ACL rules:
-
TTL=0, IPv4 (ethertype 0x0800)
-
TTL=1, IPv4 (ethertype 0x0800)
-
TTL=2, IPv4 (ethertype 0x0800)
-
TTL=0, IPv6 (ethertype 0x86DD)
-
TTL=1, IPv6 (ethertype 0x86DD)
-
TTL=2, IPv6 (ethertype 0x86DD)
Another use case is to use a free ethertype to allow the P4Runtime client to transmit and receive packets on all internal links on all devices in a network as a means of topology discovery.
To accommodate these use cases, the SR Linux runs a grpc_server
service that
provides the interface between P4Runtime clients and SR
Linux.
SR Linux p4rt service
SR Linux supports packet input/output to P4Runtime clients through a
grpc_server
service named p4rt
. This
grpc_server
process exposes instances of P4Runtime RPCs that
P4Runtime clients can connect to, with mandatory arbitration to elect a single P4Runtime
client as the primary (see P4Runtime client arbitration).
Instead of running multiple processes, SR Linux runs a single process with multiple sockets.
See Configuring SR Linux for P4Runtime for information about configuring
the p4rt
grpc_server
service.