@@ -55,6 +55,9 @@ static struct k_event s_nxp_wifi_SyncEvent;
5555static struct nxp_wifi_dev nxp_wifi0 ; /* static instance */
5656
5757static struct wlan_network nxp_wlan_network ;
58+ #ifdef CONFIG_NXP_WIFI_SOFTAP_SUPPORT
59+ static struct wlan_network nxp_wlan_uap_network ;
60+ #endif
5861
5962#ifndef CONFIG_WIFI_NM_HOSTAPD_AP
6063static char uap_ssid [IEEEtypes_SSID_SIZE + 1 ];
@@ -278,18 +281,18 @@ int nxp_wifi_wlan_event_callback(enum wlan_event_reason reason, void *data)
278281 LOG_DBG ("Associated with Soft AP" );
279282 break ;
280283 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 );
282285#ifdef CONFIG_NXP_WIFI_11AX
283- if (nxp_wlan_network .dot11ax ) {
286+ if (nxp_wlan_uap_network .dot11ax ) {
284287 ap_sta_info .link_mode = WIFI_6 ;
285288 } else
286289#endif
287290#ifdef CONFIG_NXP_WIFI_11AC
288- if (nxp_wlan_network .dot11ac ) {
291+ if (nxp_wlan_uap_network .dot11ac ) {
289292 ap_sta_info .link_mode = WIFI_5 ;
290293 } else
291294#endif
292- if (nxp_wlan_network .dot11n ) {
295+ if (nxp_wlan_uap_network .dot11n ) {
293296 ap_sta_info .link_mode = WIFI_4 ;
294297 } else {
295298 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
443446 int status = NXP_WIFI_RET_SUCCESS ;
444447 int ret ;
445448 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 ;
447450
448451 if (if_handle -> state .interface != WLAN_BSS_TYPE_UAP ) {
449452 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
461464 }
462465
463466 if (status == NXP_WIFI_RET_SUCCESS ) {
464- wlan_remove_network (nxp_wlan_network .name );
467+ wlan_remove_network (nxp_wlan_uap_network .name );
465468
466- wlan_initialize_uap_network (& nxp_wlan_network );
469+ wlan_initialize_uap_network (& nxp_wlan_uap_network );
467470
468- memcpy (nxp_wlan_network .name , NXP_WIFI_UAP_NETWORK_NAME ,
471+ memcpy (nxp_wlan_uap_network .name , NXP_WIFI_UAP_NETWORK_NAME ,
469472 strlen (NXP_WIFI_UAP_NETWORK_NAME ));
470473
471- memcpy (nxp_wlan_network .ssid , params -> ssid , params -> ssid_length );
474+ memcpy (nxp_wlan_uap_network .ssid , params -> ssid , params -> ssid_length );
472475
473476 if (params -> channel == WIFI_CHANNEL_ANY ) {
474- nxp_wlan_network .channel = 0 ;
477+ nxp_wlan_uap_network .channel = 0 ;
475478 } else {
476- nxp_wlan_network .channel = params -> channel ;
479+ nxp_wlan_uap_network .channel = params -> channel ;
477480 }
478481
479482 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;
482485 } 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;
485488 }
486489
487490 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 ;
489492 } 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 );
493496 }
494497#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT
495498 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 );
500503 }
501504#endif
502505 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 ,
506509 params -> psk_length );
507510 } else {
508511 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
529532 return - ENOENT ;
530533 }
531534
532- ret = wlan_add_network (& nxp_wlan_network );
535+ ret = wlan_add_network (& nxp_wlan_uap_network );
533536 if (ret != WM_SUCCESS ) {
534537 status = NXP_WIFI_RET_FAIL ;
535538 }
536539
537- ret = wlan_start_network (nxp_wlan_network .name );
540+ ret = wlan_start_network (nxp_wlan_uap_network .name );
538541 if (ret != WM_SUCCESS ) {
539- wlan_remove_network (nxp_wlan_network .name );
542+ wlan_remove_network (nxp_wlan_uap_network .name );
540543 status = NXP_WIFI_RET_FAIL ;
541544 }
542545
@@ -988,20 +991,20 @@ static int nxp_wifi_uap_status(const struct device *dev, struct wifi_iface_statu
988991
989992 if (connection_state == WLAN_UAP_STARTED ) {
990993
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 );
993996 status -> ssid [WIFI_SSID_MAX_LEN - 1 ] = 0 ;
994997 status -> ssid_len = strlen (status -> ssid );
995998
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 );
9971000
998- status -> rssi = nxp_wlan_network .rssi ;
1001+ status -> rssi = nxp_wlan_uap_network .rssi ;
9991002
1000- status -> channel = nxp_wlan_network .channel ;
1003+ status -> channel = nxp_wlan_uap_network .channel ;
10011004
1002- status -> beacon_interval = nxp_wlan_network .beacon_period ;
1005+ status -> beacon_interval = nxp_wlan_uap_network .beacon_period ;
10031006
1004- status -> dtim_period = nxp_wlan_network .dtim_period ;
1007+ status -> dtim_period = nxp_wlan_uap_network .dtim_period ;
10051008
10061009 if (if_handle -> state .interface == WLAN_BSS_TYPE_STA ) {
10071010 status -> iface_mode = WIFI_MODE_INFRA ;
@@ -1010,26 +1013,30 @@ static int nxp_wifi_uap_status(const struct device *dev, struct wifi_iface_statu
10101013 }
10111014
10121015#ifdef CONFIG_NXP_WIFI_11AX
1013- if (nxp_wlan_network .dot11ax ) {
1016+ if (nxp_wlan_uap_network .dot11ax ) {
10141017 status -> link_mode = WIFI_6 ;
10151018 }
10161019#endif
10171020#ifdef CONFIG_NXP_WIFI_11AC
1018- else if (nxp_wlan_network .dot11ac ) {
1021+ else if (nxp_wlan_uap_network .dot11ac ) {
10191022 status -> link_mode = WIFI_5 ;
10201023 }
10211024#endif
1022- else if (nxp_wlan_network .dot11n ) {
1025+ else if (nxp_wlan_uap_network .dot11n ) {
10231026 status -> link_mode = WIFI_4 ;
10241027 } else {
10251028 status -> link_mode = WIFI_3 ;
10261029 }
10271030
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 );
10331040 }
10341041 }
10351042
0 commit comments