net: lib: zperf: improve UDP RX throughput #87185
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.
The original flow of socket_service thread handling the Zperf UDP RX packets is: zsock_poll() polls all sockets for events, if ctx->recv_q of Zperf is not empty, it will call trigger_work() -> udp_recv_data() -> zsock_recvfrom() to read only one UDP packet from ctx->recv_q, then go back to zsock_poll() and run the same process again, which is inefficient.
The alternative solution is, in udp_recv_data(), it should exhaust all the packets in the current ctx->recv_q, and then go back to zsock_poll() to run the same process again.
In our Wi-Fi test case, for WPA3 security mode of 5GHz, the STA UDP RX throughput can be improved from 91.48 Mbps to 99.87 Mbps, the SAP UDP RX throughput can be improved from 85.97 Mbps to 96.00 Mbps.