Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: lib: zperf: improve UDP RX throughput #87185

Merged

Conversation

MaochenWang1
Copy link
Collaborator

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.

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.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
@MaochenWang1 MaochenWang1 force-pushed the main_mc_improve_zperf_udp_rx branch from f2c4402 to 53cc30a Compare March 17, 2025 08:14
@kartben
Copy link
Collaborator

kartben commented Mar 17, 2025

@kartben kartben merged commit cb65dfb into zephyrproject-rtos:main Mar 19, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants