From abb12a3234212241ced35ec275ece0824910cb52 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 15 Jun 2023 01:15:16 +0530 Subject: [PATCH 1/5] manifest: sdk-zephyr: Pull in Native Wi-Fi support Zephyr Wi-Fi now has two flavours: native and offloaded. Signed-off-by: Chaitanya Tata --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 512d0e94a47..819b63a37e3 100644 --- a/west.yml +++ b/west.yml @@ -59,7 +59,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: 743f99947369088ecba6820a720ede8054893866 + revision: 52222dc79450304fe4a32e5e0e77b9a460a93a86 import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above From b7a64a31f9e1feb89cd1b7b3df95275be00db1ae Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 15 Jun 2023 01:15:48 +0530 Subject: [PATCH 2/5] manifest: sdk-hostap: Pull in Native Wi-Fi support WPA supplicant now registers as a Native Wi-Fi stack to Zephyr. Signed-off-by: Chaitanya Tata --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 819b63a37e3..59d42204ad8 100644 --- a/west.yml +++ b/west.yml @@ -110,7 +110,7 @@ manifest: - name: hostap repo-path: sdk-hostap path: modules/lib/hostap - revision: 2040db89deb39ab164827799a2090caf2bd9c4ec + revision: 8e2e758b0296e0f6e8a2261884dca15da37d96a8 userdata: ncs: upstream-url: https://w1.fi/cgit/hostap/ From 532bca66aa03659de12092681d72951217ede4a6 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 14 Jun 2023 21:41:24 +0530 Subject: [PATCH 3/5] drivers: wifi: Register as a Wi-Fi device Tell the networking stack that this is a Native Wi-Fi device. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrf700x/zephyr/src/zephyr_net_if.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/wifi/nrf700x/zephyr/src/zephyr_net_if.c b/drivers/wifi/nrf700x/zephyr/src/zephyr_net_if.c index 6a216205da5..182534b27f9 100644 --- a/drivers/wifi/nrf700x/zephyr/src/zephyr_net_if.c +++ b/drivers/wifi/nrf700x/zephyr/src/zephyr_net_if.c @@ -268,6 +268,7 @@ void wifi_nrf_if_init_zep(struct net_if *iface) struct wifi_nrf_ctx_zep *rpu_ctx_zep = NULL; struct wifi_nrf_fmac_dev_ctx *fmac_dev_ctx = NULL; bool fmac_dev_added = false; + struct ethernet_context *eth_ctx = net_if_l2_data(iface); if (!iface) { LOG_ERR("%s: Invalid parameters\n", @@ -369,6 +370,7 @@ void wifi_nrf_if_init_zep(struct net_if *iface) } } + eth_ctx->eth_if_type = L2_ETH_IF_TYPE_WIFI; ethernet_init(iface); net_eth_carrier_on(iface); net_if_dormant_on(iface); From f5f46e5ee2e144df1dc8dc43136b54237249d55a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 14 Jun 2023 21:42:32 +0530 Subject: [PATCH 4/5] drivers: wifi: Move to new Wi-Fi data structure The Wi-Fi ops now are separated in to their own structure. Signed-off-by: Chaitanya Tata --- .../nrf700x/zephyr/src/zephyr_fmac_main.c | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/wifi/nrf700x/zephyr/src/zephyr_fmac_main.c b/drivers/wifi/nrf700x/zephyr/src/zephyr_fmac_main.c index 111a20a8a3a..98a19be915e 100644 --- a/drivers/wifi/nrf700x/zephyr/src/zephyr_fmac_main.c +++ b/drivers/wifi/nrf700x/zephyr/src/zephyr_fmac_main.c @@ -508,6 +508,19 @@ static int wifi_nrf_drv_main_zep(const struct device *dev) } #ifndef CONFIG_NRF700X_RADIO_TEST + +static struct wifi_mgmt_ops wifi_nrf_mgmt_ops = { + .scan = wifi_nrf_disp_scan_zep, +#ifdef CONFIG_NET_STATISTICS_WIFI + .get_stats = wifi_nrf_stats_get, +#endif /* CONFIG_NET_STATISTICS_WIFI */ + .set_power_save = wifi_nrf_set_power_save, + .set_twt = wifi_nrf_set_twt, + .reg_domain = wifi_nrf_reg_domain, + .get_power_save_config = wifi_nrf_get_power_save_config, +}; + + static const struct net_wifi_mgmt_offload wifi_offload_ops = { .wifi_iface.iface_api.init = wifi_nrf_if_init_zep, .wifi_iface.start = wifi_nrf_if_start_zep, @@ -518,14 +531,7 @@ static const struct net_wifi_mgmt_offload wifi_offload_ops = { #ifdef CONFIG_NET_STATISTICS_ETHERNET .wifi_iface.get_stats = wifi_nrf_eth_stats_get, #endif /* CONFIG_NET_STATISTICS_ETHERNET */ - .scan = wifi_nrf_disp_scan_zep, -#ifdef CONFIG_NET_STATISTICS_WIFI - .get_stats = wifi_nrf_stats_get, -#endif /* CONFIG_NET_STATISTICS_WIFI */ - .set_power_save = wifi_nrf_set_power_save, - .set_twt = wifi_nrf_set_twt, - .reg_domain = wifi_nrf_reg_domain, - .get_power_save_config = wifi_nrf_get_power_save_config, + .wifi_mgmt_api = &wifi_nrf_mgmt_ops, }; #ifdef CONFIG_WPA_SUPP From 2975a7986b0c5410de2e323a384a77b3699b48c2 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 4 Jul 2023 13:47:18 +0530 Subject: [PATCH 5/5] drivers: wifi: Fix the build failure The prototype has changed in Zephyr, this commit only fixes the build failure, doesn't implement the feature, it will be done in a separate commit. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrf700x/zephyr/inc/zephyr_wifi_mgmt.h | 3 ++- drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_mgmt.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/wifi/nrf700x/zephyr/inc/zephyr_wifi_mgmt.h b/drivers/wifi/nrf700x/zephyr/inc/zephyr_wifi_mgmt.h index 2f377af2c73..e597a3ce0f2 100644 --- a/drivers/wifi/nrf700x/zephyr/inc/zephyr_wifi_mgmt.h +++ b/drivers/wifi/nrf700x/zephyr/inc/zephyr_wifi_mgmt.h @@ -23,7 +23,8 @@ struct twt_interval_float { unsigned char exponent; }; -int wifi_nrf_disp_scan_zep(const struct device *dev, scan_result_cb_t cb); +int wifi_nrf_disp_scan_zep(const struct device *dev, struct wifi_scan_params *params, + scan_result_cb_t cb); enum wifi_nrf_status wifi_nrf_disp_scan_res_get_zep(struct wifi_nrf_vif_ctx_zep *vif_ctx_zep); diff --git a/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_mgmt.c b/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_mgmt.c index 293c8257c1a..3f385e40a19 100644 --- a/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_mgmt.c +++ b/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_mgmt.c @@ -74,7 +74,7 @@ void wifi_nrf_scan_timeout_work(struct k_work *work) vif_ctx_zep->scan_in_progress = false; } -int wifi_nrf_disp_scan_zep(const struct device *dev, +int wifi_nrf_disp_scan_zep(const struct device *dev, struct wifi_scan_params *params, scan_result_cb_t cb) { enum wifi_nrf_status status = WIFI_NRF_STATUS_FAIL;