Skip to content

Commit

Permalink
drivers: wifi: nxp: fix soft AP auto start
Browse files Browse the repository at this point in the history
Fix soft AP net iface auto up after init.
Set dormant off/on when soft AP start/stop, to align with STA.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
  • Loading branch information
fengming-ye committed Oct 25, 2024
1 parent 9dbae73 commit 272d037
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/wifi/nxp/nxp_wifi_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ int nxp_wifi_wlan_event_callback(enum wlan_event_reason reason, void *data)
break;
#ifdef CONFIG_NXP_WIFI_SOFTAP_SUPPORT
case WLAN_REASON_UAP_SUCCESS:
net_eth_carrier_on(g_uap.netif);
LOG_DBG("WLAN: UAP Started");
#ifndef CONFIG_WIFI_NM_HOSTAPD_AP
ret = wlan_get_current_uap_network_ssid(uap_ssid);
Expand All @@ -252,7 +251,7 @@ int nxp_wifi_wlan_event_callback(enum wlan_event_reason reason, void *data)
return 0;
}
net_if_ipv4_set_netmask_by_addr(g_uap.netif, &dhcps_addr4, &netmask_addr);
net_if_up(g_uap.netif);
net_if_dormant_off(g_uap.netif);

if (net_addr_pton(AF_INET, CONFIG_NXP_WIFI_SOFTAP_IP_BASE, &base_addr) < 0) {
LOG_ERR("Invalid CONFIG_NXP_WIFI_SOFTAP_IP_BASE");
Expand Down Expand Up @@ -312,7 +311,7 @@ int nxp_wifi_wlan_event_callback(enum wlan_event_reason reason, void *data)
LOG_DBG("%d", disassoc_resp->reason_code);
break;
case WLAN_REASON_UAP_STOPPED:
net_eth_carrier_off(g_uap.netif);
net_if_dormant_on(g_uap.netif);
LOG_DBG("WLAN: UAP Stopped");

net_dhcpv4_server_stop(g_uap.netif);
Expand Down Expand Up @@ -421,6 +420,14 @@ static int nxp_wifi_wlan_start(void)
/* L1 network layer (physical layer) is up */
net_eth_carrier_on(g_mlan.netif);

#ifdef CONFIG_NXP_WIFI_SOFTAP_SUPPORT
/* Initialize device as dormant */
net_if_dormant_on(g_uap.netif);

/* L1 network layer (physical layer) is up */
net_eth_carrier_on(g_uap.netif);
#endif

return 0;
}

Expand Down

0 comments on commit 272d037

Please sign in to comment.