drivers: wifi: nxp: change the dormant state
1) After the wifi driver successfully connects to the AP,
the dormant state should be set to OFF.
Once a deauth/disassoc frame is received or link lost occurs,
the dormant state should be set to ON.
2) Enable CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO and CONFIG_NET_CONTEXT_PRIORITY
to push high priority packets directly to network driver.
Signed-off-by: Gang Li <gang.li_1@nxp.com>
diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c
index 6dccf43..0bcf943 100644
--- a/drivers/wifi/nxp/nxp_wifi_drv.c
+++ b/drivers/wifi/nxp/nxp_wifi_drv.c
@@ -138,9 +138,12 @@
LOG_ERR("WLAN: initialization failed");
break;
case WLAN_REASON_AUTH_SUCCESS:
- net_eth_carrier_on(g_mlan.netif);
LOG_DBG("WLAN: authenticated to nxp_wlan_network");
break;
+ case WLAN_REASON_ASSOC_SUCCESS:
+ net_if_dormant_off(g_mlan.netif);
+ LOG_DBG("WLAN: associated to nxp_wlan_network");
+ break;
case WLAN_REASON_SUCCESS:
LOG_DBG("WLAN: connected to nxp_wlan_network");
#ifndef CONFIG_WIFI_NM_WPA_SUPPLICANT
@@ -214,9 +217,13 @@
wifi_mgmt_raise_disconnect_result_event(g_mlan.netif, 0);
break;
case WLAN_REASON_LINK_LOST:
- net_eth_carrier_off(g_mlan.netif);
+ net_if_dormant_on(g_mlan.netif);
LOG_WRN("WLAN: link lost");
break;
+ case WLAN_REASON_DISCONNECTED:
+ net_if_dormant_on(g_mlan.netif);
+ LOG_DBG("WLAN: deauth leaving");
+ break;
case WLAN_REASON_CHAN_SWITCH:
LOG_DBG("WLAN: channel switch");
break;
@@ -408,6 +415,12 @@
s_nxp_wifi_State = NXP_WIFI_STARTED;
+ /* Initialize device as dormant */
+ net_if_dormant_on(g_mlan.netif);
+
+ /* L1 network layer (physical layer) is up */
+ net_eth_carrier_on(g_mlan.netif);
+
return 0;
}
diff --git a/samples/net/wifi/boards/rd_rw612_bga.conf b/samples/net/wifi/boards/rd_rw612_bga.conf
index a16edec..585701a 100644
--- a/samples/net/wifi/boards/rd_rw612_bga.conf
+++ b/samples/net/wifi/boards/rd_rw612_bga.conf
@@ -65,6 +65,8 @@
CONFIG_NET_TC_RX_THREAD_BASE_PRIO=3
CONFIG_ZPERF_WORK_Q_THREAD_PRIORITY=3
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