Skip to content

wifi: nrf_wifi: net_if: allocate memory before mutex #88783

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

Merged
merged 2 commits into from
Apr 22, 2025

Conversation

JordanYates
Copy link
Collaborator

@JordanYates JordanYates commented Apr 18, 2025

Allocate the memory in nrf_wifi_if_send before taking the nrf70 global mutex. This prevents the function from deadlocking the application if attempting to send under memory-pressure, since many of the memory release paths also happen under the global mutex.

Solves one of the deadlock paths from #88781

Also corrects the nRF70 data heap size in samples/net/zperf for nRF70 devices using a non-nRF54L host. A smaller heap size was incorrectly applied for all nRF70 applications, not just those that end up with NRF_WIFI_ZERO_COPY_TX enabled.

@JordanYates JordanYates force-pushed the 250418_nrf_alloc_under_lock branch 2 times, most recently from 961f834 to c522ab7 Compare April 18, 2025 12:08
krish2718
krish2718 previously approved these changes Apr 18, 2025
Allocate the memory in `nrf_wifi_if_send` *before* taking the nrf70
global mutex. This prevents the function from deadlocking the
application if attempting to send under memory-pressure, since many of
the memory release paths also happen under the global mutex.

Signed-off-by: Jordan Yates <[email protected]>
Commit e33d9ee incorrectly stated that:
 > Now that nRF70 by default uses zero-copy fine-tune the configuration
   to get optimal memory while getting peak throughputs.

This is incorrect since `NRF_WIFI_ZERO_COPY_TX` is only enabled by
default for the nRF54L series. Update the data heap size so that the
smaller value is only used when `NRF_WIFI_ZERO_COPY_TX` is enabled.

Signed-off-by: Jordan Yates <[email protected]>
@kartben kartben merged commit 80f7124 into zephyrproject-rtos:main Apr 22, 2025
25 checks passed
@JordanYates JordanYates deleted the 250418_nrf_alloc_under_lock branch April 22, 2025 08:01
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.

6 participants