-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Add Access Point (AP) mode support to siwx91x wifi driver #85906
base: main
Are you sure you want to change the base?
Add Access Point (AP) mode support to siwx91x wifi driver #85906
Conversation
5add5e0
to
d02f00a
Compare
drivers/wifi/siwx91x/siwx91x_wifi.c
Outdated
return SL_WIFI_BANDWIDTH_80MHz; | ||
default: | ||
LOG_ERR("Invalid bandwidth"); | ||
return -EAGAIN; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably -EINVAL
is better suited.
I am not sure LOG_ERR()
is useful (in fact, I don't know what policy we should have for the the logs).
drivers/wifi/siwx91x/siwx91x_wifi.h
Outdated
@@ -14,6 +14,8 @@ | |||
#include "sl_si91x_types.h" | |||
#include "sl_si91x_protocol_types.h" | |||
|
|||
#define SIWX91X_INTERFACE_MASK (0x03) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, SIWX91X_INTERFACE_MASK
is only used in siwx91x_wifi.c
. I am not sure it make sense to expose it in the header file.
d02f00a
to
d610343
Compare
drivers/wifi/siwx91x/siwx91x_wifi.c
Outdated
status = sl_wifi_get_mac_address(SL_WIFI_CLIENT_INTERFACE, &sidev->macaddr); | ||
interface = sl_wifi_get_default_interface(); | ||
status = sl_wifi_get_mac_address(FIELD_GET(SIWX91X_INTERFACE_MASK, interface), | ||
&sidev->macaddr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what case the original code didn't work?
drivers/wifi/siwx91x/siwx91x_wifi.c
Outdated
} | ||
} | ||
|
||
ret = sl_wifi_start_ap(SL_WIFI_AP_2_4GHZ_INTERFACE, &configuration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the reader, it difficult to understand SL_WIFI_AP_2_4GHZ_INTERFACE == SL_WIFI_AP_INTERFACE | SL_WIFI_2_4GHZ_INTERFACE
. I suggest either:
- Replace references to
SL_WIFI_AP_INTERFACE
byFIELD_GET(SIWX91X_INTERFACE_MASK, SL_WIFI_AP_2_4GHZ_INTERFACE)
- Replace reference to
SL_WIFI_AP_2_4GHZ_INTERFACE
bySL_WIFI_AP_INTERFACE | SL_WIFI_2_4GHZ_INTERFACE
drivers/wifi/siwx91x/siwx91x_wifi.c
Outdated
|
||
if (params->security != WIFI_SECURITY_TYPE_NONE) { | ||
ret = sl_net_set_credential(configuration.credential_id, SL_NET_WIFI_PSK, | ||
params->psk, params->psk_length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default_wifi_ap_credential.type == SL_NET_WIFI_PSK
and credentials seems ignored when configuration.security == SL_WIFI_OPEN
. So I think you can call this function unconditionally.
drivers/wifi/siwx91x/siwx91x_wifi.c
Outdated
} | ||
|
||
sl_si91x_set_join_configuration(SL_WIFI_AP_INTERFACE, | ||
SL_SI91X_JOIN_FEAT_MFP_CAPABLE_REQUIRED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think MFP is orthogonal to the authentication scheme. Probably this configuration should done outside of this switch case.
BTW, WPA2-PSK w/o MFP seems legit. Is it a limitation of Wiseconnect?
I also assume configuration.security = SL_WIFI_WPA3
automatically enables MFP? If ye, we could check params->mfp == WIFI_MFP_REQUIRED
.
#include "sl_wifi.h" | ||
#include "sl_net.h" | ||
|
||
#define SIWX91X_INTERFACE_MASK (0x03) | ||
|
||
LOG_MODULE_REGISTER(siwx91x_wifi); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep LOG_MODULE_REGISTER()
just after the includes list.
drivers/wifi/siwx91x/siwx91x_wifi.c
Outdated
strncpy(status->ssid, wlan_info.ssid, WIFI_SSID_MAX_LEN); | ||
status->ssid_len = strlen(status->ssid); | ||
memcpy(status->bssid, wlan_info.mac_address, WIFI_MAC_ADDR_LEN); | ||
status->mfp = WIFI_MFP_REQUIRED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can you be sure?
drivers/wifi/siwx91x/siwx91x_wifi.c
Outdated
memcpy(status->bssid, wlan_info.mac_address, WIFI_MAC_ADDR_LEN); | ||
status->mfp = WIFI_MFP_REQUIRED; | ||
|
||
if (FIELD_GET(SL_WIFI_2_4GHZ_INTERFACE, interface)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SL_WIFI_2_4GHZ_INTERFACE
is not a mask. I would either write:
FIELD_GET(SIWX91X_BAND_MASK, interface) == 1
interface & SL_WIFI_2_4GHZ_INTERFACE
drivers/wifi/siwx91x/siwx91x_wifi.c
Outdated
status->band = WIFI_FREQ_BAND_2_4_GHZ; | ||
} | ||
|
||
if (FIELD_GET(SL_WIFI_CLIENT_INTERFACE, interface)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SL_WIFI_CLIENT_INTERFACE
is not a mask. I suggest FIELD_GET(SIWX91X_INTERFACE_MASK, interface) == SL_WIFI_CLIENT_INTERFACE
.
drivers/wifi/siwx91x/siwx91x_wifi.c
Outdated
|
||
sl_wifi_get_listen_interval(SL_WIFI_CLIENT_INTERFACE, &listen_interval); | ||
status->beacon_interval = listen_interval.listen_interval; | ||
} else if (FIELD_GET(SL_WIFI_AP_INTERFACE, interface)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this condition be true? oper_mode
is always SL_SI91X_CLIENT_MODE
. So, I think interface
never set SL_WIFI_AP_INTERFACE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have added the support to change oper_mode at runtime #85919
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe #85919 should be a part of this current PR.
drivers/wifi/siwx91x/siwx91x_wifi.c
Outdated
sl_wifi_get_listen_interval(SL_WIFI_CLIENT_INTERFACE, &listen_interval); | ||
status->beacon_interval = listen_interval.listen_interval; | ||
} else if (FIELD_GET(SL_WIFI_AP_INTERFACE, interface)) { | ||
sl_wifi_ap_configuration_t conf = { }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ap_cfg
or sl_ap_cfg
or siwx91x_ap_cfg
.
d610343
to
768343b
Compare
768343b
to
d5c66f1
Compare
This commit introduces Access Point (AP) mode support It enables the following AP-related commands: - ap enable: Enable the AP mode. - ap disable: Disable the AP mode. Signed-off-by: Arunmani Alagarsamy <[email protected]>
This commit adds support the following wifi commands: - wifi ap disconnect: Disconnect a specific station from the AP. - wifi ap stations: List connected devices. Signed-off-by: Arunmani Alagarsamy <[email protected]>
This commit adds support for Wi-Fi status and statistics functionalities: - wifi status : Displays the current mode status. - wifi statistics : Provides details on the transmitted and received packet counts. Signed-off-by: Arunmani Alagarsamy <[email protected]>
d5c66f1
to
acff2d2
Compare
This commit enables the device to change its operating mode at runtime by using the wifi command. Signed-off-by: Arunmani Alagarsamy <[email protected]>
acff2d2
to
d5d3c31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 3 first commits depend on drivers: wifi: siwx91x: Add run time opermode
, so you have place it first.
SL_SI91X_TCP_IP_FEAT_BYPASS), | ||
.custom_feature_bit_map = SL_SI91X_CUSTOM_FEAT_EXTENSION_VALID, | ||
.feature_bit_map = SL_SI91X_FEAT_SECURITY_OPEN, | ||
.coex_mode = SL_SI91X_WLAN_ONLY_MODE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you deal with BLE?
I feel this function is in fact shared with Bluetooth and event with Flash driver. Probably it should be located in soc/silabs/silabs_siwx91x/siwg917/nwp_init.c
.
Basic functionalities are included; further enhancements will be added in future PR.