Skip to content

Create dedicated heap for supplicant #92438

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rado17
Copy link
Contributor

@rado17 rado17 commented Jul 1, 2025

Create dedicated heap for supplicant operations. Currently, WPA supplicant uses the k_malloc, which is shared across various subsystems, and we cannot enforce a minimum availability. Using a dedicated HEAP that can be pre-allocated solves this by always having necessary memory .
Introduce an option for user to choose between dedicated heap and system heap.

Copy link

github-actions bot commented Jul 1, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hostap zephyrproject-rtos/hostap@bc5d22f (main) zephyrproject-rtos/hostap#74 zephyrproject-rtos/hostap#74/files

DNM label due to: 1 project with PR revision

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-hostap DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Jul 1, 2025
@rado17 rado17 force-pushed the supplicant_dedicated_heap branch from 335be08 to f1e8b0b Compare July 3, 2025 11:36
rado17 added 2 commits July 3, 2025 17:08
Create dedicated heap for supplicant operations and define
the heap size.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
Pull in changes for dedicated heap for supplicant operations.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
@rado17 rado17 force-pushed the supplicant_dedicated_heap branch from f1e8b0b to 67ff9c4 Compare July 3, 2025 11:38
@rado17 rado17 requested a review from MaochenWang1 July 3, 2025 11:39
Copy link

sonarqubecloud bot commented Jul 3, 2025

@jukkar jukkar added this to the v4.3.0 milestone Jul 4, 2025
Comment on lines +27 to +53
config WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP
bool "Use Zephyr kernel heap for Wi-Fi driver"
default y
help
Enable this option to use K_HEAP for memory allocations in supplicant.

if !WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP
config WIFI_NM_WPA_SUPPLICANT_HEAP
int "Dedicated memory pool for wpa_supplicant"
def_int 66560 if WIFI_NM_HOSTAPD_AP
def_int 55000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && WIFI_CREDENTIALS
def_int 48000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
def_int 41808 if WIFI_NM_WPA_SUPPLICANT_AP
# 30K is mandatory, but might need more for long duration use cases
def_int 30000
endif # !WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP

if WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP
config HEAP_MEM_POOL_ADD_SIZE_HOSTAP
def_int 66560 if WIFI_NM_HOSTAPD_AP
def_int 55000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && WIFI_CREDENTIALS
def_int 48000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
def_int 41808 if WIFI_NM_WPA_SUPPLICANT_AP
# 30K is mandatory, but might need more for long duration use cases
def_int 30000
endif # WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can de-duplicate this by something like:

+config WIFI_NM_WPA_SUPPLICANT_HEAP_SIZE
+       int
+       default 66560 if WIFI_NM_HOSTAPD_AP
+       default 55000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && WIFI_CREDENTIALS
+       default 48000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
+       default 41808 if WIFI_NM_WPA_SUPPLICANT_AP
+       # 30K is mandatory, but might need more for long duration use cases
+       default 30000
+
 if !WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP
 config WIFI_NM_WPA_SUPPLICANT_HEAP
        int "Dedicated memory pool for wpa_supplicant"
-       def_int 66560 if WIFI_NM_HOSTAPD_AP
-       def_int 55000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && WIFI_CREDENTIALS
-       def_int 48000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
-       def_int 41808 if WIFI_NM_WPA_SUPPLICANT_AP
-       # 30K is mandatory, but might need more for long duration use cases
-       def_int 30000
+       default WIFI_NM_WPA_SUPPLICANT_HEAP_SIZE
+       help
+         Dedicated memory pool size for wpa_supplicant.
 endif # !WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP
 
 if WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP
 config HEAP_MEM_POOL_ADD_SIZE_HOSTAP
-       def_int 66560 if WIFI_NM_HOSTAPD_AP
-       def_int 55000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && WIFI_CREDENTIALS
-       def_int 48000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
-       def_int 41808 if WIFI_NM_WPA_SUPPLICANT_AP
-       # 30K is mandatory, but might need more for long duration use cases
-       def_int 30000
+       int
+       default WIFI_NM_WPA_SUPPLICANT_HEAP_SIZE
+       help
+         Additional heap size for wpa_supplicant when using global heap.
 endif # WIFI_NM_WPA_SUPPLICANT_GLOBAL_HEAP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Wi-Fi Wi-Fi DNM (manifest) This PR should not be merged (controlled by action-manifest) manifest manifest-hostap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants