Fix RX offload enablement race condition #972
Merged
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.
Description
We hit a spinxsk crash, and found that was due to frame extensions not being enabled whilst attempting to enable RX checksum offload.
The problem arises when we have 2 XSK sockets bound to the same RX queue.
XSK_A enables checksum offload, the flag IsChecksumOffloadEnabled is set for that RX queue.
The RX queue attaches (frame extensions enabled) then detaches (frame extensions cleared).
XSK_B tries to enable checksum offload again, we see IsChecksumOffloadEnabled is already enabled, and we hit the assert failure for the non-initialized frame extensions.
Note that this transient state is actually valid for RX, and TX never hits this path because we never clear the frame extensions for it unless we delete the entire TX queue.
Also note, XSK_A is barred from ever enabling checksum offloads again due to the check
if (Xsk->Rx.ExtensionFlags.Checksum) { return invalid_device_state }So the underlying RX queue attaching then detaching never was a problem there.Testing
CI
Documentation
NO
Installation
NO