Skip to content
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

net: wifi_mgmt: reduce struct wifi_scan_params size #62735

Merged
merged 3 commits into from
Sep 25, 2023
Merged

net: wifi_mgmt: reduce struct wifi_scan_params size #62735

merged 3 commits into from
Sep 25, 2023

Conversation

JordanYates
Copy link
Collaborator

@JordanYates JordanYates commented Sep 16, 2023

These commits reduce the overall size of struct wifi_scan_params in its default configuration from 1412 bytes to 20 bytes.

The only driver I am aware of that implements these advanced scanning functions is the Nordic nRF700x OOT driver.
The two API changes are trivial to integrate into that driver as:

  • ssids is being memcpy'ed to local memory
  • The chan nested array is iterated over to create a linear frequency array

Shouldn't be considered a stable API change as this was introduced since the last release (#60686).

Fixes #62584.

The idea to specify channels as bitmasks was not implemented as (at least in the nRF700x driver) the channels are converted to frequencies. Converting back to frequencies from a packed bitmask would require a lookup table.

jukkar
jukkar previously approved these changes Sep 18, 2023
Copy link
Member

@jukkar jukkar left a comment

Choose a reason for hiding this comment

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

LGTM

krish2718
krish2718 previously approved these changes Sep 18, 2023
@JordanYates
Copy link
Collaborator Author

Dropped the SSID conversion as this cannot be done with the existing override functionality: #62751

jukkar
jukkar previously approved these changes Sep 20, 2023
krish2718
krish2718 previously approved these changes Sep 21, 2023
@carlescufi
Copy link
Member

@JordanYates please rebase

Jordan Yates added 3 commits September 21, 2023 21:29
Zero length arrays are a GNUism not supported by all compilers. If
`zephyr/net/wifi_mgmt.h` is included by an application without WiFi
enabled, ensure array is at least one element long.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Make the maximum number of channels that can be manually scanned
configurable by the application. The previous value of 233 was vastly
overallocating memory as the largest band only contains 60 allocated
channels.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Turn the nested arrays of `scan_params->chan` into a single array.
This adds the requirement to specify the band for each channel, but
eliminates the large amount of dead memory for unused bands. Overall,
this saves 50% of the RAM space for this variable.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
@JordanYates JordanYates dismissed stale reviews from krish2718 and jukkar via eb98b93 September 21, 2023 11:30
@JordanYates
Copy link
Collaborator Author

#63009 contains follow-on work (SSID optimisations and re-adding WIFI_MGMT_FORCED_PASSIVE_SCAN)

@carlescufi carlescufi merged commit b54951b into zephyrproject-rtos:main Sep 25, 2023
19 checks passed
@JordanYates JordanYates deleted the 230916_wifi_scan_size branch September 25, 2023 07:50
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.

wifi_mgmt: struct wifi_scan_params is now very large
6 participants