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 4 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.

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@cf27000 (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 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!

@jukkar jukkar force-pushed the devel/remove-socketpair-in-hostap branch from 636e8df to ba7a5c8 Compare May 26, 2025 15:25
@jukkar jukkar force-pushed the devel/remove-socketpair-in-hostap branch from ba7a5c8 to 099179d Compare June 3, 2025 07:31
@jukkar jukkar removed the DNM This PR should not be merged (Do Not Merge) label Jun 3, 2025
@github-actions github-actions bot added the area: Samples Samples label Jun 5, 2025
@github-actions github-actions bot requested a review from kartben June 5, 2025 07:05
cfriedt
cfriedt previously approved these changes Jun 5, 2025
@jukkar jukkar force-pushed the devel/remove-socketpair-in-hostap branch from e3f730b to cb11687 Compare June 6, 2025 15:04
@github-actions github-actions bot added the area: Base OS Base OS Library (lib/os) label Jun 6, 2025
@github-actions github-actions bot requested review from andyross and dcpleung June 6, 2025 15:05
@jukkar jukkar force-pushed the devel/remove-socketpair-in-hostap branch from cb11687 to e0805fa Compare June 9, 2025 06:30
krish2718
krish2718 previously approved these changes Jun 9, 2025
@jukkar
Copy link
Member Author

jukkar commented Jun 9, 2025

@MaochenWang1 can you take a look to changes too. I have used frdm-rw612 when testing this and everything seems to work ok, but if you have some automated test system, it would be nice to get results from it too.

cfriedt
cfriedt previously approved these changes Jun 10, 2025
@MaochenWang1
Copy link
Collaborator

@MaochenWang1 can you take a look to changes too. I have used frdm-rw612 when testing this and everything seems to work ok, but if you have some automated test system, it would be nice to get results from it too.

Hi @jukkar thanks for your work.
But I test the TOT of upstream with your change on RW612 (also apply #89294 to fix build error), the STA connection to OPEN/WPA3 AP is not successful,
For OPEN mode, it seems DHCP is not triggered.
image
For WPA3 mode, the 4-way handshake is not successful, as DUT didn't send 2/4 key.
image

I also tried the image without your change, STA connection to OPEN/WPA3 AP is Okay.

My build cmd:
west build -p always -b rd_rw612_bga samples/net/wifi/shell -DEXTRA_CONF_FILE="nxp/overlay_rw612.conf nxp/overlay_hostap_rw612.conf"

Did you verify the connection on Frdm_RW612 board?

@jukkar
Copy link
Member Author

jukkar commented Jun 10, 2025

I could connect to WPA2 and WPA3 AP without issues using frdm_rw612 board.

west build -p -d ~/zephyrproject/build/wifi-shell \
  ~/zephyrproject/zephyr/samples/net/wifi/shell/ -b frdm_rw612 -S wifi-ip -- \
 -DCONFIG_NET_DHCPV4=y -DCONFIG_NET_CONFIG_SETTINGS=n -DCONFIG_NET_HOSTNAME_ENABLE=y

I did not had #89294 applied. My hal_nxp is at e0b43431640a565b4500c58fc5e1aaebec2f463d

@carlescufi
Copy link
Member

@MaochenWang1 please review

jukkar added 4 commits June 25, 2025 10:24
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 <[email protected]>
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 <[email protected]>
Make sure to use k_fifo for IPC in hostap to save memory.

Signed-off-by: Jukka Rissanen <[email protected]>
hostap needs more eventfd to function so set a proper default value.

Signed-off-by: Jukka Rissanen <[email protected]>
@jukkar jukkar dismissed stale reviews from cfriedt and krish2718 via 28ee112 June 25, 2025 07:24
@jukkar jukkar force-pushed the devel/remove-socketpair-in-hostap branch from e0805fa to 28ee112 Compare June 25, 2025 07:24
@jukkar
Copy link
Member Author

jukkar commented Jun 25, 2025

  • No code changes, rebased to latest main to get rid of merge conflict in west.yml

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Base OS Base OS Library (lib/os) area: Build System area: Networking area: POSIX POSIX API Library area: Samples Samples area: Sockets Networking sockets 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.

6 participants