ROFL-pipeline  v0.6.0dev

Endianness clarifications

Endianness of packet's header values, matches and actions:

The rofl-pipeline library is designed to work with packet header values in a specially aligned Network Byte Order (NBO).

The reason for that lays in improving the performance of accessing those values in the packet headers. The spirit is to minimize the operations necessary to access those values(e.g. avoid unnecessary shifts). For this reason all the packet header values remain in NBO. The values that do not fill a standard type (u8, u16, u32 and u64) are stored in the lower part of the memory and properly masked.

This alignment is kept internally in the library. The functions to initialize (constructors) entry matches and actions must provide the values in Host Byte Order(HBO) always. Special getter functions return the HBO representation for convenience (e.g. of1x_get_match_value16(), of1x_get_match_mask8() or of1x_get_packet_action_field64()) Nevertheless the interface for accessing the packet header values (rofl/datapath/pipeline/platform/packet.h), part of the Software Packet Processing (pp) APIs, uses this special alignment for the performance reasons already mentioned.

Following you may find a detailed explanation of them:

All the matches, actions and other values that do not external to packet (port_in, port_phy_in, metadata, queue and packet length) are kept in Host Byte Order(HBO).

For the rest of the values that are extracted (get) or modified (set) on packet headers, Network Byte Order is used. The non complete values have an special alignment explained here: