Rate This Document
Findability
Accuracy
Completeness
Readability

Optimizing TCP checksum

Principles

The TCP checksum is an end-to-end checksum, which is calculated by the sender and then verified by the receiver. The purpose is to discover any changes to the TCP header and data between the sender and the receiver. If the receiver detects a checksum error, the TCP segment is directly discarded.

Generally, the TCP checksum is implemented by the kernel network driver. In versions earlier than 5.6, the TCP checksum is implemented using common algorithms.

Some NIC drivers support the TCP checksum function. You can run the ethtool -k NIC name | grep checksumming command to check whether an NIC driver supports the TCP checksum function.

If the NIC driver does not support TCP checksum and the CPU usage of the do_csum function is too high in kernel mode, you can modify the kernel by integrating the checksum optimization algorithm to improve performance.

Figure 1 shows the hotspot functions when the CPU usage of do_csum is too high during network communication.

Figure 1 Hotspot functions

Modification Method

You can improve the performance of a kernel earlier than 5.6 by integrating checksum optimization algorithm patch. After the modification, recompile the kernel.