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

drivers: wifi: siwx91x: Add AP configuration enhancements and hidden SSID support #87570

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ArunmaniAlagarsamy2710
Copy link
Contributor

@ArunmaniAlagarsamy2710 ArunmaniAlagarsamy2710 commented Mar 24, 2025

This PR introduces enhancements to the siwx91x Wi-Fi driver, including support for configuring AP settings, hidden SSID functionality, and validation checks for interface state.

@ArunmaniAlagarsamy2710 ArunmaniAlagarsamy2710 force-pushed the add/ap_config branch 3 times, most recently from b8fcd2e to caac617 Compare March 25, 2025 14:16
@ArunmaniAlagarsamy2710 ArunmaniAlagarsamy2710 changed the title drivers: wifi: siwx91x: Add support for AP settings drivers: wifi: siwx91x: Add AP configuration enhancements and hidden SSID support Mar 25, 2025
@ArunmaniAlagarsamy2710
Copy link
Contributor Author

Rebased to resolve the conflicts

Copy link
Collaborator

@jerome-pouiller jerome-pouiller left a comment

Choose a reason for hiding this comment

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

Just a couple of questions. Otherwise, it looks fine.

return -ENOTSUP;
}

/*FIXME siwx91x_ap_cfg.channel.channel = SL_WIFI_BAND_2_4GHZ */
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand this FIXME. SL_WIFI_BAND_2_4GHZ does not make sense for siwx91x_ap_cfg.channel.channel. Do you mean siwx91x_ap_cfg.channel.band ?

}

if (sidev->state == WIFI_STATE_COMPLETED) {
return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you know what the API expect if ap_enable() is called twice with different parameters?

Copy link
Contributor Author

@ArunmaniAlagarsamy2710 ArunmaniAlagarsamy2710 Apr 9, 2025

Choose a reason for hiding this comment

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

Removed this change for now. We'll raise a separate PR to handle ap_enable with different parameters


siwx91x_ap_cfg.channel.bandwidth = SL_WIFI_BANDWIDTH_20MHz;

if ((params->ssid_length == 0) || (params->ssid_length > WIFI_SSID_MAX_LEN)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Parentheses are useless in this expression.

int ret;

if (sidev->state == WIFI_STATE_COMPLETED) {
return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you know what the API expect if connect() is called twice with different parameters?

Copy link
Contributor Author

@ArunmaniAlagarsamy2710 ArunmaniAlagarsamy2710 Apr 9, 2025

Choose a reason for hiding this comment

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

Removed this change for now. We'll raise a separate PR to handle connect() with different parameters

uint8_t oper_mode;
bool hidden_ssid;
uint8_t max_num_sta;
} siwx91x_boot_config_feature_t;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unless you plan to add more parameters, I am not sure we need to introduce this struct. You can pass the 3 parameters to siwx91x_nwp_mode_switch().

return -ENOTSUP;
}

siwx91x_ap_cfg.channel.bandwidth = SL_WIFI_BANDWIDTH_20MHz;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this field is not set during the structure initialisation as the other ones?

@@ -303,7 +314,8 @@ static int siwx91x_connect(const struct device *dev, struct wifi_connect_req_par
wifi_config.ssid.length = params->ssid_length,
memcpy(wifi_config.ssid.value, params->ssid, params->ssid_length);

ret = sl_wifi_connect(SL_WIFI_CLIENT_INTERFACE, &wifi_config, 0);
interface = sl_wifi_get_default_interface();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sometime interface is initialized declaration, sometime later in the code. Is it possible to uniformize that?

return -EINVAL;
status = siwx91x_get_nwp_config(oper_mode, hidden_ssid, max_num_sta, &nwp_config);
if (status < 0) {
return status;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you create a specific commit for the change SL_SI91X_CLIENT_MODE/SL_SI91X_ACCESS_POINT_MODE -> WIFI_STA_MODE/WIFI_AP_MODE.

if (max_num_sta > AP_MAX_NUM_STA) {
LOG_ERR("Exceeded maximum supported stations (%d)", AP_MAX_NUM_STA);
return -EINVAL;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Group the short paths at the start of the function:

if (wifi_oper_mode == WIFI_AP_MODE && max_num_sta > AP_MAX_NUM_STA)
    return -EINVAL;

LOG_MODULE_REGISTER(siwx91x_nwp);

int siwg91x_get_nwp_config(int wifi_oper_mode, sl_wifi_device_configuration_t *get_config)
int siwx91x_get_nwp_config(uint8_t wifi_oper_mode, bool hidden_ssid, uint8_t max_num_sta,
sl_wifi_device_configuration_t *get_config)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Usually, the returned arguments are placed first in the list of arguments. Rationale, it mimics the usual code:

  memcpy(destination, source, ..);
  destination = source;

}

break;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the purpose of a such design? why do you want to introduce a level of indirection rather than declaring two functions?

This patch introduces validation checks to ensure Wi-Fi commands are
executed only when the device is in a valid operational mode.

- Restricts command execution if the device is not in an appropriate mode
- Prevents reconfiguring the device when it is already in an active state

Signed-off-by: Arunmani Alagarsamy <arunmani.a@silabs.com>
Replaced SL_SI91X_CLIENT_MODE and SL_SI91X_ACCESS_POINT_MODE with
WIFI_STA_MODE and WIFI_AP_MODE, respectively, for AP configuration
command intergration.

Signed-off-by: Arunmani Alagarsamy <arunmani.a@silabs.com>
This patch adds support for configuring AP. It enables setting
key parameters before AP mode is enabled.

- Adds support for configuring client maximum inactivity timeout.
- Adds support for bandwidth, It supports 20MHZ only.
- Adds support for setting the maximum number of clients and
  hidden SSID mode by rebooting the NWP device.

Signed-off-by: Arunmani Alagarsamy <arunmani.a@silabs.com>
@ArunmaniAlagarsamy2710
Copy link
Contributor Author

Rebased to resolve conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants