Full TCP/UDP Checksum Offload in Hardware - 7.2 English

AXI 1G/2.5G Ethernet Subsystem Product Guide (PG138)

Document ID
PG138
Release Date
2023-11-15
Version
7.2 English

When using TCP or UDP Ethernet protocols, data integrity is maintained by calculating and verifying checksum values over the TCP and UDP frame data. Normally this checksum functionality is handled by the protocol stack software which can be relatively slow and uses a significant amount of the processor for large frames at high Ethernet data rates.

An alternative is to offload the transmit checksum generation and receive checksum verification in hardware. This is possible by including full checksum offloading in the AXI Ethernet Subsystem using parameters. Including the full checksum offload functions are a trade-off between using more FPGA resources and getting higher Ethernet performance while freeing up the processor for other functions.

Full checksum offloading is supported for Ethernet II and Sub-Network Access Protocol (SNAP) frame formats. The frame formats must use the IPv4 Internet Protocol and transport data through TCP or UDP. Each frame format can support a single 32-bit VLAN tag (the TPID must equal 0x8100). Example diagrams of these frame formats are shown in the following figures in this section. In these figures, the conditions shown in redare used by the hardware to determine if the TCP/UDP checksum and/or the IPv4 Header checksum is calculated.

It is possible for the IPv4 Header checksum to be calculated even though the TCP/UDP checksum is not calculated. This can occur if the frame is Ethernet II or SNAP with an IPv4 Header that is five words in length, the IP flags are set to 0, and the fragment offset is set to 0 (the protocol field can be set to something other than TCP or UDP). However, for the TCP or UDP checksum to be calculated, the IPv4 Header checksum must be calculated with the protocol field set to 0x6 for TCP or 0x11 for UDP.

The following figure shows an Ethernet II frame with IPv4 and TCP. The following conditions must be met for the IPv4 Header checksum and TCP checksum to be calculated:

  • Type = 0x0800
  • Version – 0x4
  • Header Length = 0x5
  • IP Flag MF = 0b0
  • Fragment Offset = 0b0000000000000
  • Protocol = 0x06

If Protocol /= 0x06, but the rest of the conditions are met, only the IPv4 Header checksum is calculated.

Figure 1. Ethernet II Frame with IPv4 and TCP

The following figure shows a VLAN Ethernet II frame with IPv4 and TCP. The following conditions must be met for the IPv4 Header checksum and TCP checksum to be calculated:

  • VLAN TPID = 0x8100
  • Type = 0x0800
  • Version – 0x4
  • Header Length = 0x5
  • IP Flag MF = 0b0
  • Fragment Offset = 0b0000000000000
  • Protocol = 0x06

If Protocol /= 0x06, but the rest of the conditions are met, only the IPv4 Header checksum is calculated.

Figure 2. VLAN Ethernet II Frame with IPv4 and TCP

The following figure shows an Ethernet II frame with IPv4 and UDP. The following conditions must be met for the IPv4 Header checksum and UDP checksum to be calculated:

  • Version – 0x4
  • Header Length = 0x5
  • IP Flag MF = 0b0
  • Fragment Offset = 0b0000000000000
  • Protocol = 0x11

If Protocol /= 0x11, but the rest of the conditions are met, only the IPv4 Header checksum is calculated.

Figure 3. Ethernet II Frame with IPv4 and UDP

The following figure shows a VLAN Ethernet II frame with IPv4 and UDP. The following conditions must be met for the IPv4 Header checksum and UDP checksum to be calculated:

  • VLAN TPID = 0x8100
  • Version – 0x4
  • Header Length = 0x5
  • IP Flag MF = 0b0
  • Fragment Offset = 0b0000000000000
  • Protocol = 0x11

If Protocol /= 0x11, but the rest of the conditions are met, only the IPv4 Header checksum is calculated.

Figure 4. VLAN Ethernet II Frame with IPv4 and UDP

The following figure shows a SNAP frame with IPv4 and TCP. The following conditions must be met for the IPv4 Header checksum and TCP checksum to be calculated.

  • Length ≤ 0x0600
  • DSAP = 0xAA
  • SSAP = 0xAA
  • Control = 0x03
  • OIU – 0x000000
  • Type = 0x0800
  • Version – 0x4
  • Header Length = 0x5
  • IP Flag MF = 0b0
  • Fragment Offset = 0b0000000000000
  • Protocol = 0x06

If Protocol /= 0x06, but the rest of the conditions are met, only the IPv4 Header checksum is calculated.

Figure 5. SNAP Frame with IPv4 and TCP

The following figure shows a VLAN SNAP frame with IPv4 and TCP. The following conditions must be met for the IPv4 Header checksum and TCP checksum to be calculated:

  • VLAN TPID = 0x8100
  • Length ≤ 0x0600
  • DSAP = 0xAA
  • SSAP = 0xAA
  • Control = 0x03
  • OIU – 0x000000
  • Type = 0x0800
  • Version – 0x4
  • Header Length = 0x5
  • IP Flag MF = 0b0
  • Fragment Offset = 0b0000000000000
  • Protocol = 0x06

If Protocol /= 0x06, but the rest of the conditions are met, only the IPv4 Header checksum is calculated.

Figure 6. VLAN SNAP Frame with IPv4 and TCP

The following figure shows a SNAP frame with IPv4 and UDP. The following conditions must be met for the IPv4 Header checksum and UDP checksum to be calculated:

  • Length ≤ 0x0600
  • DSAP = 0xAA
  • SSAP = 0xAA
  • Control = 0x03
  • OIU – 0x000000
  • Type = 0x0800
  • Version – 0x4
  • Header Length = 0x5
  • IP Flag MF =0b0
  • Fragment Offset =0b0000000000000
  • Protocol = 0x11

If Protocol /= 0x11, but the rest of the conditions are met, only the IPv4 Header checksum is calculated.

Figure 7. SNAP Frame with IPv4 and UDP

The following figure shows a VLAN SNAP frame with IPv4 and UDP. The following conditions must be met for the IPv4 Header checksum and UDP checksum to be calculated:

  • VLAN TPID = 0x8100
  • Length ≤ 0x0600
  • DSAP = 0xAA
  • SSAP = 0xAA
  • Control = 0x03
  • OIU – 0x000000
  • Type = 0x0800
  • Version – 0x4
  • Header Length = 0x5
  • IP Flag MF = 0b0
  • Fragment Offset = 0b0000000000000
  • Protocol = 0x11

If Protocol /= 0x11, but the rest of the conditions are met, only the IPv4 Header checksum is calculated.

Figure 8. VLAN SNAP Frame with IPv4 and UDP

If an Ethernet II frame with protocol information is less than 60 bytes, the transmitter pads the frame with zeros until it is 60 bytes. Because the Ethernet II frame populates the Type/Length field with Type information (0x0800), instead of a Length information, the subsystem receive logic is incapable of stripping off any padded bytes. As a result, the receiver reports the length of all transmitter padded packets to be 60 bytes in length.