@@ -138,10 +138,15 @@ int nxp_wifi_wlan_event_callback(enum wlan_event_reason reason, void *data)
138
138
LOG_ERR ("WLAN: initialization failed" );
139
139
break ;
140
140
case WLAN_REASON_AUTH_SUCCESS :
141
+ #ifndef CONFIG_WIFI_NM_WPA_SUPPLICANT
142
+ net_if_dormant_off (g_mlan .netif );
143
+ #endif
141
144
LOG_DBG ("WLAN: authenticated to nxp_wlan_network" );
142
145
break ;
143
146
case WLAN_REASON_ASSOC_SUCCESS :
147
+ #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT
144
148
net_if_dormant_off (g_mlan .netif );
149
+ #endif
145
150
LOG_DBG ("WLAN: associated to nxp_wlan_network" );
146
151
break ;
147
152
case WLAN_REASON_SUCCESS :
@@ -186,22 +191,22 @@ int nxp_wifi_wlan_event_callback(enum wlan_event_reason reason, void *data)
186
191
wifi_mgmt_raise_connect_result_event (g_mlan .netif , 0 );
187
192
break ;
188
193
case WLAN_REASON_CONNECT_FAILED :
189
- net_eth_carrier_off (g_mlan .netif );
194
+ net_if_dormant_on (g_mlan .netif );
190
195
LOG_WRN ("WLAN: connect failed" );
191
196
break ;
192
197
case WLAN_REASON_NETWORK_NOT_FOUND :
193
- net_eth_carrier_off (g_mlan .netif );
198
+ net_if_dormant_on (g_mlan .netif );
194
199
LOG_WRN ("WLAN: nxp_wlan_network not found" );
195
200
break ;
196
201
case WLAN_REASON_NETWORK_AUTH_FAILED :
197
- net_eth_carrier_off (g_mlan .netif );
198
202
LOG_WRN ("WLAN: nxp_wlan_network authentication failed" );
199
203
auth_fail ++ ;
200
204
if (auth_fail >= 3 ) {
201
205
LOG_WRN ("Authentication Failed. Disconnecting ... " );
202
206
wlan_disconnect ();
203
207
auth_fail = 0 ;
204
208
}
209
+ net_if_dormant_on (g_mlan .netif );
205
210
break ;
206
211
case WLAN_REASON_ADDRESS_SUCCESS :
207
212
LOG_DBG ("wlan_network mgr: DHCP new lease" );
@@ -210,7 +215,7 @@ int nxp_wifi_wlan_event_callback(enum wlan_event_reason reason, void *data)
210
215
LOG_WRN ("failed to obtain an IP address" );
211
216
break ;
212
217
case WLAN_REASON_USER_DISCONNECT :
213
- net_eth_carrier_off (g_mlan .netif );
218
+ net_if_dormant_on (g_mlan .netif );
214
219
LOG_DBG ("disconnected" );
215
220
auth_fail = 0 ;
216
221
s_nxp_wifi_StaConnected = false;
@@ -438,6 +443,7 @@ static int nxp_wifi_start_ap(const struct device *dev, struct wifi_connect_req_p
438
443
int status = NXP_WIFI_RET_SUCCESS ;
439
444
int ret ;
440
445
struct interface * if_handle = (struct interface * )& g_uap ;
446
+ struct ipv4_config * ap_addr4 = & nxp_wlan_network .ip .ipv4 ;
441
447
442
448
if (if_handle -> state .interface != WLAN_BSS_TYPE_UAP ) {
443
449
LOG_ERR ("Wi-Fi not in uAP mode" );
@@ -512,6 +518,17 @@ static int nxp_wifi_start_ap(const struct device *dev, struct wifi_connect_req_p
512
518
wlan_uap_set_hidden_ssid (params -> ignore_broadcast_ssid );
513
519
}
514
520
521
+ if (net_addr_pton (AF_INET , CONFIG_NXP_WIFI_SOFTAP_IP_ADDRESS , & ap_addr4 -> address ) < 0 ) {
522
+ LOG_ERR ("Invalid CONFIG_NXP_WIFI_SOFTAP_IP_ADDRESS" );
523
+ return - ENOENT ;
524
+ }
525
+ ap_addr4 -> gw = ap_addr4 -> address ;
526
+
527
+ if (net_addr_pton (AF_INET , CONFIG_NXP_WIFI_SOFTAP_IP_MASK , & ap_addr4 -> netmask ) < 0 ) {
528
+ LOG_ERR ("Invalid CONFIG_NXP_WIFI_SOFTAP_IP_MASK" );
529
+ return - ENOENT ;
530
+ }
531
+
515
532
ret = wlan_add_network (& nxp_wlan_network );
516
533
if (ret != WM_SUCCESS ) {
517
534
status = NXP_WIFI_RET_FAIL ;
@@ -961,6 +978,65 @@ static inline enum wifi_security_type nxp_wifi_security_type(enum wlan_security_
961
978
}
962
979
}
963
980
981
+ #ifdef CONFIG_NXP_WIFI_SOFTAP_SUPPORT
982
+ static int nxp_wifi_uap_status (const struct device * dev , struct wifi_iface_status * status )
983
+ {
984
+ enum wlan_connection_state connection_state = WLAN_DISCONNECTED ;
985
+ struct interface * if_handle = (struct interface * )& g_uap ;
986
+
987
+ wlan_get_uap_connection_state (& connection_state );
988
+
989
+ if (connection_state == WLAN_UAP_STARTED ) {
990
+
991
+ if (!wlan_get_current_uap_network (& nxp_wlan_network )) {
992
+ strncpy (status -> ssid , nxp_wlan_network .ssid , WIFI_SSID_MAX_LEN );
993
+ status -> ssid [WIFI_SSID_MAX_LEN - 1 ] = 0 ;
994
+ status -> ssid_len = strlen (status -> ssid );
995
+
996
+ memcpy (status -> bssid , nxp_wlan_network .bssid , WIFI_MAC_ADDR_LEN );
997
+
998
+ status -> rssi = nxp_wlan_network .rssi ;
999
+
1000
+ status -> channel = nxp_wlan_network .channel ;
1001
+
1002
+ status -> beacon_interval = nxp_wlan_network .beacon_period ;
1003
+
1004
+ status -> dtim_period = nxp_wlan_network .dtim_period ;
1005
+
1006
+ if (if_handle -> state .interface == WLAN_BSS_TYPE_STA ) {
1007
+ status -> iface_mode = WIFI_MODE_INFRA ;
1008
+ } else if (if_handle -> state .interface == WLAN_BSS_TYPE_UAP ) {
1009
+ status -> iface_mode = WIFI_MODE_AP ;
1010
+ }
1011
+
1012
+ #ifdef CONFIG_NXP_WIFI_11AX
1013
+ if (nxp_wlan_network .dot11ax ) {
1014
+ status -> link_mode = WIFI_6 ;
1015
+ }
1016
+ #endif
1017
+ #ifdef CONFIG_NXP_WIFI_11AC
1018
+ else if (nxp_wlan_network .dot11ac ) {
1019
+ status -> link_mode = WIFI_5 ;
1020
+ }
1021
+ #endif
1022
+ else if (nxp_wlan_network .dot11n ) {
1023
+ status -> link_mode = WIFI_4 ;
1024
+ } else {
1025
+ status -> link_mode = WIFI_3 ;
1026
+ }
1027
+
1028
+ status -> band = nxp_wlan_network .channel > 14 ? WIFI_FREQ_BAND_5_GHZ
1029
+ : WIFI_FREQ_BAND_2_4_GHZ ;
1030
+ status -> security = nxp_wifi_security_type (nxp_wlan_network .security .type );
1031
+ status -> mfp = nxp_wlan_network .security .mfpr ? WIFI_MFP_REQUIRED :
1032
+ (nxp_wlan_network .security .mfpc ? WIFI_MFP_OPTIONAL : 0 );
1033
+ }
1034
+ }
1035
+
1036
+ return 0 ;
1037
+ }
1038
+ #endif
1039
+
964
1040
static int nxp_wifi_status (const struct device * dev , struct wifi_iface_status * status )
965
1041
{
966
1042
enum wlan_connection_state connection_state = WLAN_DISCONNECTED ;
@@ -1767,7 +1843,7 @@ NET_DEVICE_INIT_INSTANCE(wifi_nxp_sta, "ml", 0, nxp_wifi_dev_init, PM_DEVICE_DT_
1767
1843
static const struct wifi_mgmt_ops nxp_wifi_uap_mgmt = {
1768
1844
.ap_enable = nxp_wifi_start_ap ,
1769
1845
.ap_disable = nxp_wifi_stop_ap ,
1770
- .iface_status = nxp_wifi_status ,
1846
+ .iface_status = nxp_wifi_uap_status ,
1771
1847
#if defined(CONFIG_NET_STATISTICS_WIFI )
1772
1848
.get_stats = nxp_wifi_stats ,
1773
1849
#endif
0 commit comments