feat(xdp): add checksum verification on rx path #467
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces checksum verification for IPv4 and UDP in the XDP rx path. It fixes #465
For UDP I utilized the available functions in
xdp-util.h
. As for IP, I followed the example from xdp-project, and I "borrowed" the functions from the Kernel (I don't think this causes any issues in terms of Licensing).Furthermore, since this implies some extra computing per each packet/request, I wanted to measure the performance implications. With a server running on a machine with an Intel i5-9500 and an Intel 10G X550T NIC, at a rate of 1M packets/requests per second, the average CPU usage across all CPU cores went from 11.18% to 11.57%.
For a single client sending synchronous requests, its rate drops from an average of 12360 req/s to 12315 req/s.
If this minor performance hit is an issue, we could perhaps add a compile flag so checksum verification would become optional.