From 6d4909f2f84b377f06720c775bce7cb8d6949078 Mon Sep 17 00:00:00 2001 From: Morihisa Momona Date: Mon, 27 May 2024 14:28:52 +0900 Subject: [PATCH 1/4] wifi: airoc: FIX connection to AP with open security STA fails to connect AP, of which security is open. Signed-off-by: Morihisa Momona --- drivers/wifi/infineon/airoc_wifi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/wifi/infineon/airoc_wifi.c b/drivers/wifi/infineon/airoc_wifi.c index e3d8e6a3c7d3b..55066f38c1bed 100644 --- a/drivers/wifi/infineon/airoc_wifi.c +++ b/drivers/wifi/infineon/airoc_wifi.c @@ -502,7 +502,7 @@ static int airoc_mgmt_connect(const struct device *dev, struct wifi_connect_req_ goto error; } - if (usr_result.security == 0) { + if (usr_result.security == WHD_SECURITY_UNKNOWN) { ret = -EAGAIN; LOG_ERR("Could not scan device"); goto error; From c5db656d2e2b29b9222d9ef511b9358c6784a1aa Mon Sep 17 00:00:00 2001 From: Morihisa Momona Date: Mon, 27 May 2024 08:32:29 +0300 Subject: [PATCH 2/4] wifi: airoc: FIX Security modes of SoftAP Updated security modes verification in ap_enable. SoftAP supports following modes: - No security (WHD\_SECURITY\_OPEN) - WPA2-PSK security (WHD_SECURITY_WPA2_AES_PSK) - WPA3-SAE security (WHD_SECURITY_WPA3_SAE) Signed-off-by: Morihisa Momona --- drivers/wifi/infineon/airoc_wifi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/wifi/infineon/airoc_wifi.c b/drivers/wifi/infineon/airoc_wifi.c index 55066f38c1bed..bc606c3527539 100644 --- a/drivers/wifi/infineon/airoc_wifi.c +++ b/drivers/wifi/infineon/airoc_wifi.c @@ -620,10 +620,18 @@ static int airoc_mgmt_ap_enable(const struct device *dev, struct wifi_connect_re params->channel); } - if (params->psk_length == 0) { + switch (params->security) { + case WIFI_SECURITY_TYPE_NONE: security = WHD_SECURITY_OPEN; - } else { + break; + case WIFI_SECURITY_TYPE_PSK: security = WHD_SECURITY_WPA2_AES_PSK; + break; + case WIFI_SECURITY_TYPE_SAE: + security = WHD_SECURITY_WPA3_SAE; + break; + default: + goto error; } if (whd_wifi_init_ap(airoc_ap_if, &ssid, security, (const uint8_t *)params->psk, From 453f125f46d2b55fbe479a51e8ac35a1c553c9c8 Mon Sep 17 00:00:00 2001 From: Morihisa Momona Date: Mon, 27 May 2024 14:33:59 +0900 Subject: [PATCH 3/4] wifi: airoc: FIX interface up (in softap) When creating softap, interface is not recognized as up. Signed-off-by: Morihisa Momona --- drivers/wifi/infineon/airoc_wifi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/wifi/infineon/airoc_wifi.c b/drivers/wifi/infineon/airoc_wifi.c index bc606c3527539..d551928bb5f83 100644 --- a/drivers/wifi/infineon/airoc_wifi.c +++ b/drivers/wifi/infineon/airoc_wifi.c @@ -658,6 +658,7 @@ static int airoc_mgmt_ap_enable(const struct device *dev, struct wifi_connect_re data->is_ap_up = true; airoc_if = airoc_ap_if; + net_if_dormant_off(data->iface); error: k_sem_give(&data->sema_common); @@ -703,6 +704,7 @@ static int airoc_mgmt_ap_disable(const struct device *dev) if (whd_ret == CY_RSLT_SUCCESS) { data->is_ap_up = false; airoc_if = airoc_sta_if; + net_if_dormant_on(data->iface); } else { LOG_ERR("Can't stop wifi ap: %u", whd_ret); } From 8c77c33cd31060f1d8c0bcfbc00ec1c155641a81 Mon Sep 17 00:00:00 2001 From: Morihisa Momona Date: Mon, 27 May 2024 14:37:42 +0900 Subject: [PATCH 4/4] wifi: airoc: join/leave of multicast address Add the support of join and leave of multicast address group. Signed-off-by: Morihisa Momona --- drivers/wifi/infineon/airoc_wifi.c | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/wifi/infineon/airoc_wifi.c b/drivers/wifi/infineon/airoc_wifi.c index d551928bb5f83..70db2935d51aa 100644 --- a/drivers/wifi/infineon/airoc_wifi.c +++ b/drivers/wifi/infineon/airoc_wifi.c @@ -363,6 +363,37 @@ static void airoc_wifi_network_process_ethernet_data(whd_interface_t interface, } } +static enum ethernet_hw_caps airoc_get_capabilities(const struct device *dev) +{ + ARG_UNUSED(dev); + + return ETHERNET_HW_FILTERING; +} + +static int airoc_set_config(const struct device *dev, + enum ethernet_config_type type, + const struct ethernet_config *config) +{ + ARG_UNUSED(dev); + whd_mac_t whd_mac_addr; + + switch (type) { + case ETHERNET_CONFIG_TYPE_FILTER: + for (int i = 0; i < WHD_ETHER_ADDR_LEN; i++) { + whd_mac_addr.octet[i] = config->filter.mac_address.addr[i]; + } + if (config->filter.set) { + whd_wifi_register_multicast_address(airoc_if, &whd_mac_addr); + } else { + whd_wifi_unregister_multicast_address(airoc_if, &whd_mac_addr); + } + return 0; + default: + break; + } + return -ENOTSUP; +} + static void *link_events_handler(whd_interface_t ifp, const whd_event_header_t *event_header, const uint8_t *event_data, void *handler_user_data) { @@ -779,6 +810,8 @@ static const struct wifi_mgmt_ops airoc_wifi_mgmt = { static const struct net_wifi_mgmt_offload airoc_api = { .wifi_iface.iface_api.init = airoc_mgmt_init, .wifi_iface.send = airoc_mgmt_send, + .wifi_iface.get_capabilities = airoc_get_capabilities, + .wifi_iface.set_config = airoc_set_config, .wifi_mgmt_api = &airoc_wifi_mgmt, };