Ethernet frames

When you execute the first simple example, you will receive Ethernet frames, which are displayed as hexadecimal values on the left and ASCII characters on the right. An Ethernet frame is a unit of data (PDU, protocol data unit) of the data link layer (layer 2). [source].

DPDK Ethernet frames

The Ethernet frame for DPDK consists of:

  1. [6 Bytes] destination MAC address
  2. [6 Bytes] source MAC address
  3. [2 Bytes] EtherType
  4. Payload: IP packet (of type IPv4) [source]
    1. [1 Byte]
      1. [4 Bit] Version (in IPv4 always 4)
      2. [4 Bit] Size of this IPv4 header measured in words (with 1 word = 4 byte, from the 32-bit area). Smallest possible value is 5, aka the header has a size of 20 bytes.
    2. [1 Byte] DSCP and ECN, currently not important.
    3. [2 Byte] length of header + payload
    4. [2 Byte] Identification field
    5. [2 Byte] used for IP fragmentation. [source]
    6. [1 Byte] Time to live (TTL)
    7. [1 Byte] the protocol encapsulated in the IP packet
    8. [2 Byte] header checksum
    9. [4 Byte] source IPv4 address
    10. [4 Byte] destination IPv4 address
    11. Payload: UDP datagram
      1. [2 Byte] source port
      2. [2 Byte] destination port
      3. [2 Byte] length of the UPD datagram (header + payload)
      4. [2 Byte] checksum
        • is calculated for the header and data, so it can indicate corruption in both
        • relatively weak, since its only 16 bit, so many possible errors can not be noticed
        • in our case it is 0, which means that it was not even computed, so the receiver also doesn't have to check it
      5. Payload: The data that we want to send

Nice to know: The actual Ethernet packet on the physical layer (layer 1) starts with 7 alternating 1 and 0 bits (starting with a 1) which allows the receiver to synchronize its clock with the sender. It follows the SFD (starter frame delimiter) which is a 1 (instead of a 0, so the alternating pattern is broken) which indicates that now the Ethernet frame starts. Following the Ethernet packet comes an interpacket gap (IPG), [source] during which no information may be transmitted. This is used to allow the receiver to process the package. Ethernet stipulates a minimum IPG.

ARP Ethernet Frames

This is not directly relevant to DPDK, but nice to know, because you will also receive random ARP (Address Resolution Protocol) packets. [source] ARP is a protocol that is used if a host knows the IP address (layer 3, network layer) of another host, but needs to find out its MAC address (layer 2, data link layer), in order to send Ethernet frames (layer 2) to it. The mapping can then be stored in an ARP cache for future use.

ARP Ethernet Frames consist of:

  1. [6 Bytes] destination MAC address
  2. [6 Bytes] source MAC address
  3. [2 Bytes] EtherType
  4. Payload: ARP packet
    1. [2 Byte] Hardware Type HTYPE
    2. [2 Byte] Protocol Type PTYPE
    3. [1 Byte] Hardware Length HLEN
    4. [1 Byte] Protocol Length PLEN
    5. [2 Byte] Operation OPER
    6. [6 Byte] sender MAC address
    7. [4 Byte] sender IP address
    8. [6 Byte] receiver MAC address
    9. [4 Byte] receiver IP address