Skip to content

Remove socketpair in hostap to save memory #90317

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 6 commits into
base: main
Choose a base branch
from

Conversation

jukkar
Copy link
Member

@jukkar jukkar commented May 22, 2025

Replace wifi event mechanism by k_fifo. Earlier we had socketpair to pass wifi event information from wpa_supplicant side to zephyr adaption layer. This is now replaced by k_fifo to save some RAM.

This is still WIP and is missing AP mode support.

Copy link

github-actions bot commented May 22, 2025

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

Name Old Revision New Revision Diff
hostap zephyrproject-rtos/hostap@8412f4b (main) zephyrproject-rtos/hostap#86 zephyrproject-rtos/hostap#86/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 May 22, 2025
jukkar added 2 commits May 23, 2025 14:53
Add MSG_ZEROCOPY socket flag definition so that it can
be used in the code. No real functionality for supporting
zerocopy via this flag is provided by this commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Remove Kconfig dependency to socketpair related options
as the hostap now uses k_fifo to pass information between
different threads.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
@jukkar jukkar changed the title [WIP] Remove socketpair in hostap to save memory Remove socketpair in hostap to save memory May 23, 2025
@jukkar jukkar force-pushed the devel/remove-socketpair-in-hostap branch from 37f990d to 15b13be Compare May 23, 2025 12:41
@jukkar jukkar marked this pull request as ready for review May 23, 2025 12:41
@github-actions github-actions bot added area: Networking area: POSIX POSIX API Library area: Sockets Networking sockets labels May 23, 2025
@jukkar
Copy link
Member Author

jukkar commented May 23, 2025

  • Updated hostap repo with hostapd (AP) support

@github-actions github-actions bot added the area: Wi-Fi Wi-Fi label May 23, 2025
@github-actions github-actions bot requested review from cfriedt, pdgendt, ssharks and ycsin May 23, 2025 12:42
@jukkar jukkar assigned krish2718 and unassigned rlubos May 23, 2025
@jukkar
Copy link
Member Author

jukkar commented May 23, 2025

See information about memory savings in zephyrproject-rtos/hostap#86

@jukkar jukkar added the DNM This PR should not be merged (Do Not Merge) label May 23, 2025
@jukkar
Copy link
Member Author

jukkar commented May 23, 2025

Needs more testing and review so adding DNM label.

cfriedt
cfriedt previously approved these changes May 24, 2025
Copy link
Member

@cfriedt cfriedt left a comment

Choose a reason for hiding this comment

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

That's some really fantastic memory savings!

Earlier we had socketpair to pass wifi event information from
wpa_supplicant side to zephyr adaption layer. This is now replaced
by k_fifo to save some RAM.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
jukkar added 3 commits May 26, 2025 17:57
Create "wifi mem" command that can show how the heap memory
is being used in hostap. The command is available if
CONFIG_WIFI_NM_WPA_SUPPLICANT_DEBUG_ALLOC is enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This is a temporary config to avoid allocation issues until
the culprit is found. Some heap usage is not freed properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure to use k_fifo for IPC in hostap to save memory.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
@jukkar jukkar force-pushed the devel/remove-socketpair-in-hostap branch from 636e8df to ba7a5c8 Compare May 26, 2025 15:25
Copy link

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

Successfully merging this pull request may close these issues.

4 participants