@@ -55,6 +55,9 @@ static struct k_event s_nxp_wifi_SyncEvent;
55
55
static struct nxp_wifi_dev nxp_wifi0 ; /* static instance */
56
56
57
57
static struct wlan_network nxp_wlan_network ;
58
+ #ifdef CONFIG_NXP_WIFI_SOFTAP_SUPPORT
59
+ static struct wlan_network nxp_wlan_uap_network ;
60
+ #endif
58
61
59
62
#ifndef CONFIG_WIFI_NM_HOSTAPD_AP
60
63
static char uap_ssid [IEEEtypes_SSID_SIZE + 1 ];
@@ -278,18 +281,18 @@ int nxp_wifi_wlan_event_callback(enum wlan_event_reason reason, void *data)
278
281
LOG_DBG ("Associated with Soft AP" );
279
282
break ;
280
283
case WLAN_REASON_UAP_CLIENT_CONN :
281
- wlan_get_current_uap_network (& nxp_wlan_network );
284
+ wlan_get_current_uap_network (& nxp_wlan_uap_network );
282
285
#ifdef CONFIG_NXP_WIFI_11AX
283
- if (nxp_wlan_network .dot11ax ) {
286
+ if (nxp_wlan_uap_network .dot11ax ) {
284
287
ap_sta_info .link_mode = WIFI_6 ;
285
288
} else
286
289
#endif
287
290
#ifdef CONFIG_NXP_WIFI_11AC
288
- if (nxp_wlan_network .dot11ac ) {
291
+ if (nxp_wlan_uap_network .dot11ac ) {
289
292
ap_sta_info .link_mode = WIFI_5 ;
290
293
} else
291
294
#endif
292
- if (nxp_wlan_network .dot11n ) {
295
+ if (nxp_wlan_uap_network .dot11n ) {
293
296
ap_sta_info .link_mode = WIFI_4 ;
294
297
} else {
295
298
ap_sta_info .link_mode = WIFI_3 ;
@@ -443,7 +446,7 @@ static int nxp_wifi_start_ap(const struct device *dev, struct wifi_connect_req_p
443
446
int status = NXP_WIFI_RET_SUCCESS ;
444
447
int ret ;
445
448
struct interface * if_handle = (struct interface * )& g_uap ;
446
- struct ipv4_config * ap_addr4 = & nxp_wlan_network .ip .ipv4 ;
449
+ struct ipv4_config * ap_addr4 = & nxp_wlan_uap_network .ip .ipv4 ;
447
450
448
451
if (if_handle -> state .interface != WLAN_BSS_TYPE_UAP ) {
449
452
LOG_ERR ("Wi-Fi not in uAP mode" );
@@ -461,48 +464,48 @@ static int nxp_wifi_start_ap(const struct device *dev, struct wifi_connect_req_p
461
464
}
462
465
463
466
if (status == NXP_WIFI_RET_SUCCESS ) {
464
- wlan_remove_network (nxp_wlan_network .name );
467
+ wlan_remove_network (nxp_wlan_uap_network .name );
465
468
466
- wlan_initialize_uap_network (& nxp_wlan_network );
469
+ wlan_initialize_uap_network (& nxp_wlan_uap_network );
467
470
468
- memcpy (nxp_wlan_network .name , NXP_WIFI_UAP_NETWORK_NAME ,
471
+ memcpy (nxp_wlan_uap_network .name , NXP_WIFI_UAP_NETWORK_NAME ,
469
472
strlen (NXP_WIFI_UAP_NETWORK_NAME ));
470
473
471
- memcpy (nxp_wlan_network .ssid , params -> ssid , params -> ssid_length );
474
+ memcpy (nxp_wlan_uap_network .ssid , params -> ssid , params -> ssid_length );
472
475
473
476
if (params -> channel == WIFI_CHANNEL_ANY ) {
474
- nxp_wlan_network .channel = 0 ;
477
+ nxp_wlan_uap_network .channel = 0 ;
475
478
} else {
476
- nxp_wlan_network .channel = params -> channel ;
479
+ nxp_wlan_uap_network .channel = params -> channel ;
477
480
}
478
481
479
482
if (params -> mfp == WIFI_MFP_REQUIRED ) {
480
- nxp_wlan_network .security .mfpc = true;
481
- nxp_wlan_network .security .mfpr = true;
483
+ nxp_wlan_uap_network .security .mfpc = true;
484
+ nxp_wlan_uap_network .security .mfpr = true;
482
485
} else if (params -> mfp == WIFI_MFP_OPTIONAL ) {
483
- nxp_wlan_network .security .mfpc = true;
484
- nxp_wlan_network .security .mfpr = false;
486
+ nxp_wlan_uap_network .security .mfpc = true;
487
+ nxp_wlan_uap_network .security .mfpr = false;
485
488
}
486
489
487
490
if (params -> security == WIFI_SECURITY_TYPE_NONE ) {
488
- nxp_wlan_network .security .type = WLAN_SECURITY_NONE ;
491
+ nxp_wlan_uap_network .security .type = WLAN_SECURITY_NONE ;
489
492
} else if (params -> security == WIFI_SECURITY_TYPE_PSK ) {
490
- nxp_wlan_network .security .type = WLAN_SECURITY_WPA2 ;
491
- nxp_wlan_network .security .psk_len = params -> psk_length ;
492
- strncpy (nxp_wlan_network .security .psk , params -> psk , params -> psk_length );
493
+ nxp_wlan_uap_network .security .type = WLAN_SECURITY_WPA2 ;
494
+ nxp_wlan_uap_network .security .psk_len = params -> psk_length ;
495
+ strncpy (nxp_wlan_uap_network .security .psk , params -> psk , params -> psk_length );
493
496
}
494
497
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT
495
498
else if (params -> security == WIFI_SECURITY_TYPE_PSK_SHA256 ) {
496
- nxp_wlan_network .security .type = WLAN_SECURITY_WPA2 ;
497
- nxp_wlan_network .security .key_mgmt |= WLAN_KEY_MGMT_PSK_SHA256 ;
498
- nxp_wlan_network .security .psk_len = params -> psk_length ;
499
- strncpy (nxp_wlan_network .security .psk , params -> psk , params -> psk_length );
499
+ nxp_wlan_uap_network .security .type = WLAN_SECURITY_WPA2 ;
500
+ nxp_wlan_uap_network .security .key_mgmt |= WLAN_KEY_MGMT_PSK_SHA256 ;
501
+ nxp_wlan_uap_network .security .psk_len = params -> psk_length ;
502
+ strncpy (nxp_wlan_uap_network .security .psk , params -> psk , params -> psk_length );
500
503
}
501
504
#endif
502
505
else if (params -> security == WIFI_SECURITY_TYPE_SAE ) {
503
- nxp_wlan_network .security .type = WLAN_SECURITY_WPA3_SAE ;
504
- nxp_wlan_network .security .password_len = params -> psk_length ;
505
- strncpy (nxp_wlan_network .security .password , params -> psk ,
506
+ nxp_wlan_uap_network .security .type = WLAN_SECURITY_WPA3_SAE ;
507
+ nxp_wlan_uap_network .security .password_len = params -> psk_length ;
508
+ strncpy (nxp_wlan_uap_network .security .password , params -> psk ,
506
509
params -> psk_length );
507
510
} else {
508
511
status = NXP_WIFI_RET_BAD_PARAM ;
@@ -529,14 +532,14 @@ static int nxp_wifi_start_ap(const struct device *dev, struct wifi_connect_req_p
529
532
return - ENOENT ;
530
533
}
531
534
532
- ret = wlan_add_network (& nxp_wlan_network );
535
+ ret = wlan_add_network (& nxp_wlan_uap_network );
533
536
if (ret != WM_SUCCESS ) {
534
537
status = NXP_WIFI_RET_FAIL ;
535
538
}
536
539
537
- ret = wlan_start_network (nxp_wlan_network .name );
540
+ ret = wlan_start_network (nxp_wlan_uap_network .name );
538
541
if (ret != WM_SUCCESS ) {
539
- wlan_remove_network (nxp_wlan_network .name );
542
+ wlan_remove_network (nxp_wlan_uap_network .name );
540
543
status = NXP_WIFI_RET_FAIL ;
541
544
}
542
545
@@ -988,20 +991,20 @@ static int nxp_wifi_uap_status(const struct device *dev, struct wifi_iface_statu
988
991
989
992
if (connection_state == WLAN_UAP_STARTED ) {
990
993
991
- if (!wlan_get_current_uap_network (& nxp_wlan_network )) {
992
- strncpy (status -> ssid , nxp_wlan_network .ssid , WIFI_SSID_MAX_LEN );
994
+ if (!wlan_get_current_uap_network (& nxp_wlan_uap_network )) {
995
+ strncpy (status -> ssid , nxp_wlan_uap_network .ssid , WIFI_SSID_MAX_LEN );
993
996
status -> ssid [WIFI_SSID_MAX_LEN - 1 ] = 0 ;
994
997
status -> ssid_len = strlen (status -> ssid );
995
998
996
- memcpy (status -> bssid , nxp_wlan_network .bssid , WIFI_MAC_ADDR_LEN );
999
+ memcpy (status -> bssid , nxp_wlan_uap_network .bssid , WIFI_MAC_ADDR_LEN );
997
1000
998
- status -> rssi = nxp_wlan_network .rssi ;
1001
+ status -> rssi = nxp_wlan_uap_network .rssi ;
999
1002
1000
- status -> channel = nxp_wlan_network .channel ;
1003
+ status -> channel = nxp_wlan_uap_network .channel ;
1001
1004
1002
- status -> beacon_interval = nxp_wlan_network .beacon_period ;
1005
+ status -> beacon_interval = nxp_wlan_uap_network .beacon_period ;
1003
1006
1004
- status -> dtim_period = nxp_wlan_network .dtim_period ;
1007
+ status -> dtim_period = nxp_wlan_uap_network .dtim_period ;
1005
1008
1006
1009
if (if_handle -> state .interface == WLAN_BSS_TYPE_STA ) {
1007
1010
status -> iface_mode = WIFI_MODE_INFRA ;
@@ -1010,26 +1013,30 @@ static int nxp_wifi_uap_status(const struct device *dev, struct wifi_iface_statu
1010
1013
}
1011
1014
1012
1015
#ifdef CONFIG_NXP_WIFI_11AX
1013
- if (nxp_wlan_network .dot11ax ) {
1016
+ if (nxp_wlan_uap_network .dot11ax ) {
1014
1017
status -> link_mode = WIFI_6 ;
1015
1018
}
1016
1019
#endif
1017
1020
#ifdef CONFIG_NXP_WIFI_11AC
1018
- else if (nxp_wlan_network .dot11ac ) {
1021
+ else if (nxp_wlan_uap_network .dot11ac ) {
1019
1022
status -> link_mode = WIFI_5 ;
1020
1023
}
1021
1024
#endif
1022
- else if (nxp_wlan_network .dot11n ) {
1025
+ else if (nxp_wlan_uap_network .dot11n ) {
1023
1026
status -> link_mode = WIFI_4 ;
1024
1027
} else {
1025
1028
status -> link_mode = WIFI_3 ;
1026
1029
}
1027
1030
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 );
1031
+ status -> band = nxp_wlan_uap_network .channel > 14 ? WIFI_FREQ_BAND_5_GHZ
1032
+ : WIFI_FREQ_BAND_2_4_GHZ ;
1033
+ status -> security =
1034
+ nxp_wifi_security_type (nxp_wlan_uap_network .security .type );
1035
+ status -> mfp =
1036
+ nxp_wlan_uap_network .security .mfpr
1037
+ ? WIFI_MFP_REQUIRED
1038
+ : (nxp_wlan_uap_network .security .mfpc ? WIFI_MFP_OPTIONAL
1039
+ : 0 );
1033
1040
}
1034
1041
}
1035
1042
0 commit comments