Data Plane Programming with P4

Created

Why Program the Data Plane?

Benefits of data plane programmability:

  • new features (add new protocols)
  • reduce complexity (remove unused protocols, which is a leading cause of bugs)
  • efficient use of resources (flexible use of tables)
  • greater visibility (new diagnostic technologies, telemetry (gather data), etc.)
  • SW style development (rapid design cycle, fast innovation, fix data plane bugs in the field)
  • you can keep your ideas

think programming rather than a protocol. programming the network rather than using the different protocols.

The P4_16 Data Plane Model

  • P4 defines the tables
  • the control plane fills out those tables

every time you want to define table, you need to define:

  • key
  • action
  • set size of the table
  • default action

Parsers

P4 parsers are state machines that transition between states:

  • e.g.,
    • start: transitions to parse
    • parse: extract ethernet. transition based on the ethernet.type. if ipv4 transition to parse_ipv4, else accept
    • parse_ipv4: it extracts the ipv4 and then it transitions to accept

no division / modulo because hard to do in hardware.

  • would delay the packets because it would use a lot of cycles. therefore not worth it

research: what should / shouldn't be programmable

Tables

A table specifies what data to match on and match kind. specifies the possible actions.

  • specifies the number of table properties (size ,default action, static entrie)
  • tables can have one or more entries (rules) which come from the control plane.

hdr.ipv4.dstAddr: exact means an exact match (no ternary matching).

Define the actions first, then the table, then call apply() on it in the control block.