Skip to content

Create dedicated heap for supplicant #92438

Closed
rado17 wants to merge 2 commits intozephyrproject-rtos:mainfrom
rado17:supplicant_dedicated_heap
Closed

Create dedicated heap for supplicant #92438
rado17 wants to merge 2 commits intozephyrproject-rtos:mainfrom
rado17:supplicant_dedicated_heap

Conversation

@rado17
Copy link
Copy Markdown
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.

@github-actions
Copy link
Copy Markdown

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
@sonarqubecloud
Copy link
Copy Markdown

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
Copy Markdown
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

@krish2718
Copy link
Copy Markdown
Contributor

Moved to #93085

@krish2718 krish2718 closed this Jul 21, 2025
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