Endianness
The basic rules for endianness follow. Generally speaking numeric fields are in big endian when they come in off the wire, little endian while in the program, and transformed back to big endian on the way back out onto the wire. We refer to this as confused endian.
- All numeric packet field data is big endian when enters and leaves a p4 program.
- All numeric data, including packet fields is little endian inside a p4 program.
- Table keys with the
exact
andrange
type defined over bit types are in little endian. - Table keys with the
lpm
type are in the byte order they appear on the wire.