From 76397986da6c6e170f8a714825c83b71f43a35df Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 15:31:33 -0500 Subject: [PATCH 1/8] hostap: fix missing stray parenthesis in conditional Fix a missing stray parenthesis in the conditional within the supplicant implementation, which was causing a build error for WiFi samples Signed-off-by: Daniel DeGrasse --- modules/hostap/src/supp_main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hostap/src/supp_main.h b/modules/hostap/src/supp_main.h index e80ced0343184..b28869c2bd3bb 100644 --- a/modules/hostap/src/supp_main.h +++ b/modules/hostap/src/supp_main.h @@ -15,7 +15,7 @@ !defined(CONFIG_EAP_PSK) && !defined(CONFIG_EAP_PAX) && \ !defined(CONFIG_EAP_SAKE) && !defined(CONFIG_EAP_GPSK) && \ !defined(CONFIG_EAP_PWD) && !defined(CONFIG_EAP_EKE) && \ - !defined(CONFIG_EAP_IKEV2 && !defined(CONFIG_EAP_GTC) + !defined(CONFIG_EAP_IKEV2) && !defined(CONFIG_EAP_GTC) #error "At least one of the following EAP methods need to be defined \ CONFIG_EAP_TLS \ CONFIG_EAP_TTLS \ From bb3a5a3ebefc42d3261da86a21aac0f8b869d7f2 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 15:39:00 -0500 Subject: [PATCH 2/8] modules: hostap: remove ap_bandwidth API ap_bandwidth API implementation is not complete. Remove the structure definition and implementation from the NXP WiFi driver to fix a build error. Signed-off-by: Daniel DeGrasse --- drivers/wifi/nxp/nxp_wifi_drv.c | 43 --------------------------------- modules/hostap/src/supp_main.c | 1 - 2 files changed, 44 deletions(-) diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c index e14bebb033db8..4efa3ffcdff57 100644 --- a/drivers/wifi/nxp/nxp_wifi_drv.c +++ b/drivers/wifi/nxp/nxp_wifi_drv.c @@ -769,47 +769,6 @@ static int nxp_wifi_version(const struct device *dev, struct wifi_version *param return 0; } -static int nxp_wifi_ap_bandwidth(const struct device *dev, struct wifi_ap_params *params) -{ - int status = NXP_WIFI_RET_SUCCESS; - int ret = WM_SUCCESS; - struct interface *if_handle = (struct interface *)dev->data; - - if (if_handle->state.interface != WLAN_BSS_TYPE_UAP) { - LOG_ERR("Wi-Fi not in uAP mode"); - return -EIO; - } - - if (s_nxp_wifi_State != NXP_WIFI_STARTED) { - status = NXP_WIFI_RET_NOT_READY; - } - - if (status == NXP_WIFI_RET_SUCCESS) { - - if (params->oper == WIFI_MGMT_SET) { - - ret = wlan_uap_set_bandwidth(params->bandwidth); - - if (ret != WM_SUCCESS) { - status = NXP_WIFI_RET_FAIL; - } - } else { - ret = wlan_uap_get_bandwidth(¶ms->bandwidth); - - if (ret != WM_SUCCESS) { - status = NXP_WIFI_RET_FAIL; - } - } - } - - if (status != NXP_WIFI_RET_SUCCESS) { - LOG_ERR("Failed to get/set Wi-Fi AP bandwidth"); - return -EAGAIN; - } - - return 0; -} - static int nxp_wifi_connect(const struct device *dev, struct wifi_connect_req_params *params) { int status = NXP_WIFI_RET_SUCCESS; @@ -1758,7 +1717,6 @@ static const struct wifi_mgmt_ops nxp_wifi_sta_mgmt = { .reg_domain = nxp_wifi_reg_domain, #ifdef CONFIG_NXP_WIFI_SOFTAP_SUPPORT .ap_enable = nxp_wifi_start_ap, - .ap_bandwidth = nxp_wifi_ap_bandwidth, .ap_disable = nxp_wifi_stop_ap, #endif .iface_status = nxp_wifi_status, @@ -1838,7 +1796,6 @@ static const struct wifi_mgmt_ops nxp_wifi_uap_mgmt = { .set_power_save = nxp_wifi_power_save, .get_power_save_config = nxp_wifi_get_power_save, .set_btwt = nxp_wifi_set_btwt, - .ap_bandwidth = nxp_wifi_ap_bandwidth, .ap_config_params = nxp_wifi_ap_config_params, }; diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index b47b322e2aa3a..14ee8e11dafe3 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -98,7 +98,6 @@ static const struct wifi_mgmt_ops mgmt_ap_ops = { .ap_enable = supplicant_ap_enable, .ap_disable = supplicant_ap_disable, .ap_sta_disconnect = supplicant_ap_sta_disconnect, - .ap_bandwidth = supplicant_ap_bandwidth, .iface_status = supplicant_ap_status, #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP .dpp_dispatch = hapd_dpp_dispatch, From 995e8615827402530fce29b796d30b62cf294892 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 15:40:33 -0500 Subject: [PATCH 3/8] modules: hostap: remove set_btwt API set_btwt API implementation is not complete. Remove the structure definition and implementation from the NXP WiFi driver to fix a build error. Signed-off-by: Daniel DeGrasse --- drivers/wifi/nxp/nxp_wifi_drv.c | 20 -------------------- modules/hostap/src/supp_main.c | 1 - 2 files changed, 21 deletions(-) diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c index 4efa3ffcdff57..dd044b8bb8a65 100644 --- a/drivers/wifi/nxp/nxp_wifi_drv.c +++ b/drivers/wifi/nxp/nxp_wifi_drv.c @@ -1421,25 +1421,6 @@ static int nxp_wifi_set_twt(const struct device *dev, struct wifi_twt_params *pa return ret; } -static int nxp_wifi_set_btwt(const struct device *dev, struct wifi_twt_params *params) -{ - wlan_btwt_config_t btwt_config; - int ret = -1; - - btwt_config.action = 1; - btwt_config.sub_id = params->btwt.sub_id; - btwt_config.nominal_wake = params->btwt.nominal_wake; - btwt_config.max_sta_support = params->btwt.max_sta_support; - btwt_config.twt_mantissa = params->btwt.twt_interval; - btwt_config.twt_offset = params->btwt.twt_offset; - btwt_config.twt_exponent = params->btwt.twt_exponent; - btwt_config.sp_gap = params->btwt.sp_gap; - - ret = wlan_set_btwt_cfg(&btwt_config); - - return ret; -} - static void nxp_wifi_sta_init(struct net_if *iface) { const struct device *dev = net_if_get_device(iface); @@ -1795,7 +1776,6 @@ static const struct wifi_mgmt_ops nxp_wifi_uap_mgmt = { #endif .set_power_save = nxp_wifi_power_save, .get_power_save_config = nxp_wifi_get_power_save, - .set_btwt = nxp_wifi_set_btwt, .ap_config_params = nxp_wifi_ap_config_params, }; diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 14ee8e11dafe3..826e15e9d8d3d 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -94,7 +94,6 @@ DEFINE_WIFI_NM_INSTANCE(wifi_supplicant, &mgmt_ops); #ifdef CONFIG_WIFI_NM_HOSTAPD_AP static const struct wifi_mgmt_ops mgmt_ap_ops = { - .set_btwt = supplicant_set_btwt, .ap_enable = supplicant_ap_enable, .ap_disable = supplicant_ap_disable, .ap_sta_disconnect = supplicant_ap_sta_disconnect, From 451d99a5e72a923ea879dc506ebf4ddd2adaa0d5 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 15:41:09 -0500 Subject: [PATCH 4/8] drivers: wifi: nxp: remove non-existent TWT fields Remove references to TWT fields that did not exist, to resolve a build error. Signed-off-by: Daniel DeGrasse --- drivers/wifi/nxp/nxp_wifi_drv.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c index dd044b8bb8a65..3dd714f7d9d94 100644 --- a/drivers/wifi/nxp/nxp_wifi_drv.c +++ b/drivers/wifi/nxp/nxp_wifi_drv.c @@ -1402,12 +1402,10 @@ static int nxp_wifi_set_twt(const struct device *dev, struct wifi_twt_params *pa twt_setup_conf.implicit = params->setup.implicit; twt_setup_conf.announced = params->setup.announce; twt_setup_conf.trigger_enabled = params->setup.trigger; - twt_setup_conf.twt_info_disabled = params->setup.twt_info_disable; twt_setup_conf.negotiation_type = params->negotiation_type; twt_setup_conf.twt_wakeup_duration = params->setup.twt_wake_interval; twt_setup_conf.flow_identifier = params->flow_id; twt_setup_conf.hard_constraint = 1; - twt_setup_conf.twt_exponent = params->setup.exponent; twt_setup_conf.twt_mantissa = params->setup.twt_interval; twt_setup_conf.twt_request = params->setup.responder; ret = wlan_set_twt_setup_cfg(&twt_setup_conf); From 633869c8fd88667fc835adebf74c5cd3f5be8913 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 16:52:35 -0500 Subject: [PATCH 5/8] samples: net: wifi: disable WIFI_NM_WPA_SUPPLICANT_WPS Disable support for WIFI_NM_WPA_SUPPLICANT_WPS, as it is currently causing a link failure within hostap Signed-off-by: Daniel DeGrasse --- samples/net/wifi/boards/rd_rw612_bga.conf | 32 ----------------------- 1 file changed, 32 deletions(-) diff --git a/samples/net/wifi/boards/rd_rw612_bga.conf b/samples/net/wifi/boards/rd_rw612_bga.conf index d6435e874b77e..ba24138eb52aa 100644 --- a/samples/net/wifi/boards/rd_rw612_bga.conf +++ b/samples/net/wifi/boards/rd_rw612_bga.conf @@ -75,33 +75,6 @@ CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO=3 CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO=y CONFIG_NET_CONTEXT_PRIORITY=y -CONFIG_WIFI_NM_WPA_SUPPLICANT=y -CONFIG_WIFI_NM_WPA_SUPPLICANT_CLI=y -CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ALT=y -CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE=y -CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP=y -CONFIG_WIFI_NM_WPA_SUPPLICANT_EAPOL=y -CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA=y -CONFIG_WIFI_NM_WPA_SUPPLICANT_INF_MON=n -CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES=2 -CONFIG_SAE_PWE_EARLY_EXIT=y -CONFIG_WIFI_NM_HOSTAPD_AP=y -CONFIG_WIFI_NM_WPA_SUPPLICANT_WPS=y - -# Enable mbedtls -CONFIG_MBEDTLS=y -CONFIG_MBEDTLS_BUILTIN=y -CONFIG_MBEDTLS_USER_CONFIG_ENABLE=y -CONFIG_MBEDTLS_USER_CONFIG_FILE="wpa_supp_els_pkc_mbedtls_config.h" -CONFIG_MBEDTLS_HAVE_TIME_DATE=y - -# Include els_pkc in build -CONFIG_ENTROPY_GENERATOR=y -CONFIG_MBEDTLS_PSA_CRYPTO_C=y -CONFIG_MBEDTLS_ENTROPY_C=y -CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y -CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=8192 - # power management CONFIG_PM=y CONFIG_PM_DEVICE=y @@ -116,8 +89,6 @@ CONFIG_NET_MGMT_EVENT_STACK_SIZE=4608 CONFIG_NET_TCP_WORKQ_STACK_SIZE=2048 CONFIG_MAIN_STACK_SIZE=4096 CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE=4096 -CONFIG_WIFI_NM_WPA_SUPPLICANT_WQ_STACK_SIZE=12288 -CONFIG_WIFI_NM_WPA_SUPPLICANT_THREAD_STACK_SIZE=12288 # optimization level # refer to Kconfig.zephyr for Optimizations Level @@ -152,7 +123,4 @@ CONFIG_NET_STATISTICS_USER_API=y # comment out for -O0 CONFIG_CODE_DATA_RELOCATION_SRAM=y #CONFIG_WIFI_NM_WPA_SUPPLICANT_DEBUG_LEVEL=2 -CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF=y -CONFIG_WIFI_NM_WPA_SUPPLICANT_WQ_PRIO=3 -CONFIG_WIFI_NM_WPA_SUPPLICANT_PRIO=3 CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=80000 From b11f155fa7ad3ffe4a2109d3994e52ee487b7851 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 15:29:58 -0500 Subject: [PATCH 6/8] drivers: wifi: nxp: add CONFIG_NXP_WIFI_BUILD_ONLY_MODE for CI testing Add CONFIG_NXP_WIFI_BUILD_ONLY_MODE, which allows the NXP WiFi driver to be built without a binary blob. The built application will not be functional, but this enables continuous integration to run upstream. Update NXP HAL manifest to include changes needed to WiFi driver for this support. Signed-off-by: Daniel DeGrasse --- drivers/wifi/nxp/Kconfig.nxp | 7 +++++++ west.yml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/wifi/nxp/Kconfig.nxp b/drivers/wifi/nxp/Kconfig.nxp index b3172e1b1b0ae..04828cd5e34c0 100644 --- a/drivers/wifi/nxp/Kconfig.nxp +++ b/drivers/wifi/nxp/Kconfig.nxp @@ -20,6 +20,13 @@ module = WIFI_NXP config WIFI_MGMT_SCAN_CHAN_MAX_MANUAL default 50 +config NXP_WIFI_BUILD_ONLY_MODE + bool "Build only mode (do not link wireless binary blob)" + help + Skip linking the binary blob into the Wi-Fi build. This will + not result in a functional application, but allows the Wi-Fi + driver to be built without binary blobs + config NXP_WIFI_CUSTOM bool "Custom NXP Wi-Fi part" help diff --git a/west.yml b/west.yml index a20edb3c48779..a8d44382c9a4c 100644 --- a/west.yml +++ b/west.yml @@ -198,7 +198,7 @@ manifest: groups: - hal - name: hal_nxp - revision: 4597b16cfedf5553cb155151e65eb994d5d0ef25 + revision: pull/454/head path: modules/hal/nxp groups: - hal From e0cd876bceb7f6a0cab216962ff36afe0a49a6db Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 15:44:03 -0500 Subject: [PATCH 7/8] samples: net: wifi: add support for building NXP WiFi Add support for building NXP WiFi. Since the driver typically requires binary blobs, enable CONFIG_NXP_WIFI_BUILD_ONLY_MODE for this testcase. Signed-off-by: Daniel DeGrasse --- samples/net/wifi/sample.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/samples/net/wifi/sample.yaml b/samples/net/wifi/sample.yaml index 828e4b4c8967d..2c14ef6fce1cd 100644 --- a/samples/net/wifi/sample.yaml +++ b/samples/net/wifi/sample.yaml @@ -68,3 +68,9 @@ tests: - thingy53/nrf5340/cpuapp integration_platforms: - thingy53/nrf5340/cpuapp + sample.net.wifi.nxp_wifi: + extra_args: + - CONFIG_NXP_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - frdm_rw612 + - rd_rw612_bga From 3ded799a9e88b9c6a74e83d974e3d7055d6ddb40 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 17:03:52 -0500 Subject: [PATCH 8/8] drivers: wifi: nxp: remove unused nxp_wifi_uap_status function Remove unused function `nxp_wifi_uap_status`. Signed-off-by: Daniel DeGrasse --- drivers/wifi/nxp/nxp_wifi_drv.c | 62 --------------------------------- 1 file changed, 62 deletions(-) diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c index 3dd714f7d9d94..71041c3360ea9 100644 --- a/drivers/wifi/nxp/nxp_wifi_drv.c +++ b/drivers/wifi/nxp/nxp_wifi_drv.c @@ -917,68 +917,6 @@ static inline enum wifi_security_type nxp_wifi_security_type(enum wlan_security_ } } -#ifndef CONFIG_WIFI_NM_WPA_SUPPLICANT -static int nxp_wifi_uap_status(const struct device *dev, struct wifi_iface_status *status) -{ - enum wlan_connection_state connection_state = WLAN_DISCONNECTED; - struct interface *if_handle = (struct interface *)&g_uap; - - wlan_get_uap_connection_state(&connection_state); - - if (connection_state == WLAN_UAP_STARTED) { - - if (!wlan_get_current_uap_network(&nxp_wlan_network)) { - strncpy(status->ssid, nxp_wlan_network.ssid, WIFI_SSID_MAX_LEN); - status->ssid[WIFI_SSID_MAX_LEN - 1] = 0; - status->ssid_len = strlen(status->ssid); - - memcpy(status->bssid, nxp_wlan_network.bssid, WIFI_MAC_ADDR_LEN); - - status->rssi = nxp_wlan_network.rssi; - - status->channel = nxp_wlan_network.channel; - - status->beacon_interval = nxp_wlan_network.beacon_period; - - status->dtim_period = nxp_wlan_network.dtim_period; - - if (if_handle->state.interface == WLAN_BSS_TYPE_STA) { - status->iface_mode = WIFI_MODE_INFRA; - } -#ifdef CONFIG_NXP_WIFI_SOFTAP_SUPPORT - else if (if_handle->state.interface == WLAN_BSS_TYPE_UAP) { - status->iface_mode = WIFI_MODE_AP; - } -#endif - -#ifdef CONFIG_NXP_WIFI_11AX - if (nxp_wlan_network.dot11ax) { - status->link_mode = WIFI_6; - } -#endif -#ifdef CONFIG_NXP_WIFI_11AC - else if (nxp_wlan_network.dot11ac) { - status->link_mode = WIFI_5; - } -#endif - else if (nxp_wlan_network.dot11n) { - status->link_mode = WIFI_4; - } else { - status->link_mode = WIFI_3; - } - - status->band = nxp_wlan_network.channel > 14 ? WIFI_FREQ_BAND_5_GHZ - : WIFI_FREQ_BAND_2_4_GHZ; - status->security = nxp_wifi_security_type(nxp_wlan_network.security.type); - status->mfp = nxp_wlan_network.security.mfpr ? WIFI_MFP_REQUIRED : - (nxp_wlan_network.security.mfpc ? WIFI_MFP_OPTIONAL : 0); - } - } - - return 0; -} -#endif - static int nxp_wifi_status(const struct device *dev, struct wifi_iface_status *status) { enum wlan_connection_state connection_state = WLAN_DISCONNECTED;