Skip to content

[noup] zephyr: unguard wpa_cli_cmds of CONFIG_WPA_CLI#145

Open
fengming-ye wants to merge 1 commit into
zephyrproject-rtos:mainfrom
nxp-upstream:fix/wpa_cli_unknown_cmds
Open

[noup] zephyr: unguard wpa_cli_cmds of CONFIG_WPA_CLI#145
fengming-ye wants to merge 1 commit into
zephyrproject-rtos:mainfrom
nxp-upstream:fix/wpa_cli_unknown_cmds

Conversation

@fengming-ye

Copy link
Copy Markdown
Contributor

wpa_cli_cmds is the communication way between wifi_mgmt and hostap in zephyr. So many features depends on it. And itself has very low cost.

Remove the CONFIG_WPA_CLI guard of wpa_cli_cmds and keep CONFIG_WPA_CLI to controll cmd_wpa_cli shell commands.

wpa_cli_cmds is the communication way between wifi_mgmt and
hostap in zephyr. So many features depends on it. And itself
has very low cost.

Remove the CONFIG_WPA_CLI guard of wpa_cli_cmds and keep
CONFIG_WPA_CLI to controll cmd_wpa_cli shell commands.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
@krish2718

Copy link
Copy Markdown
Collaborator

and keep CONFIG_WPA_CLI to controll cmd_wpa_cli shell commands.

I don't see this change here? Is this missed?

@fengming-ye

Copy link
Copy Markdown
Contributor Author

and keep CONFIG_WPA_CLI to controll cmd_wpa_cli shell commands.

I don't see this change here? Is this missed?

it is kept unchanged in CMakeLists

@krish2718

Copy link
Copy Markdown
Collaborator

and keep CONFIG_WPA_CLI to controll cmd_wpa_cli shell commands.

I don't see this change here? Is this missed?

it is kept unchanged in CMakeLists

Ah ok, I was confused by the statement, I understand now, you want all commands to be available and only the top shell command to be guarded by the CONFIG_WPA_CLI, thanks.

@krish2718

Copy link
Copy Markdown
Collaborator

And itself has very low cost.

Can you please share the footprint numbers without and with this PR?

@fengming-ye

Copy link
Copy Markdown
Contributor Author

And itself has very low cost.

Can you please share the footprint numbers without and with this PR?

With PR and CONFIG_WPA_CLI disabled
[599/599] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 1191872 B 64 MB 1.78%
RAM: 306256 B 960 KB 31.15%
SMU1: 510 KB 510 KB 100.00%
SMU2: 140 KB 140 KB 100.00%
IDT_LIST: 0 B 32 KB 0.00%

Without PR and CONFIG_WPA_CLI disabled
[599/599] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 1176644 B 64 MB 1.75%
RAM: 306256 B 960 KB 31.15%
SMU1: 510 KB 510 KB 100.00%
SMU2: 140 KB 140 KB 100.00%
IDT_LIST: 0 B 32 KB 0.00%

There is 14KB flash increase due to command help context.

@krish2718 krish2718 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is 14KB flash increase due to command help context.

Thanks for the data. To be precise: that's 1,191,872 − 1,176,644 = 15,228 bytes, or 14.87 KiB — so let's call it ~15KB rather than 14KB.

For context, that's being added to a path that's supposed to be inert when CONFIG_WPA_CLI is disabled. Many of our target platforms (e.g. nRF series) ship with 1MB or less of flash, where 15KB is not a rounding error — it's a meaningful chunk of the available budget, and it's being spent on something the disabled config shouldn't be paying for at all.

The stated goal here ("keep CONFIG_WPA_CLI to control cmd_wpa_cli shell commands") suggests the shell command itself is still gated, but the help/usage strings tied to the wpa_cli_cmds table are apparently being pulled in unconditionally now, which is where this cost is coming from. That's the part I'd push back on: unguarding the command dispatch table to fix the "unknown command" issue shouldn't require unguarding the help text along with it.

I'd like to see a version of this fix where the command structs/dispatch can be unguarded (to solve the actual bug you're fixing), but the help strings stay behind CONFIG_WPA_CLI — e.g. via a separate guarded array, __weak stub, or conditional compilation around just the string tables. If that's not feasible for some reason, I'd want to understand why before accepting a ~15KB unconditional cost across all production builds.

Holding off on merging until we have a version that doesn't carry this cost when the feature is off. Happy to discuss alternatives if there's a constraint here I'm missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants