From ac63fe62b8ef61e126aa8e013e0e0ea34d5d741c Mon Sep 17 00:00:00 2001 From: Sharad Patil Date: Thu, 2 Jun 2022 01:39:23 +0530 Subject: [PATCH 1/2] Enable IPv6 for WiFi (rs911x) Added build flag for Enabling and disabling IPv4/IPv6 Signed-off-by: Sharad Patil --- examples/lighting-app/efr32/BUILD.gn | 7 +++++++ scripts/examples/gn_efr32_example.sh | 4 ++++ src/platform/EFR32/CHIPDevicePlatformConfig.h | 12 ++++++++++++ src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp | 5 ++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index e82be7a6cb5a03..90b84ffeb4b395 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -60,6 +60,9 @@ declare_args() { # Disable LCD on supported devices disable_lcd = false + + # Disable IPv4 for rs911 + chip_disable_wifi_ipv4 = false } declare_args() { @@ -214,6 +217,10 @@ efr32_executable("lighting_app") { sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] } +if (chip_disable_wifi_ipv4) { + defines += [ "WIFI_IPV4_DISABLED" ] + } + # WiFi Settings if (chip_enable_wifi) { if (use_rs911x) { diff --git a/scripts/examples/gn_efr32_example.sh b/scripts/examples/gn_efr32_example.sh index eab03e03dabac6..9eb3c5b3acbd57 100755 --- a/scripts/examples/gn_efr32_example.sh +++ b/scripts/examples/gn_efr32_example.sh @@ -137,6 +137,10 @@ else optArgs+="enable_sleepy_device=true chip_openthread_ftd=false " shift ;; + chip_disable_wifi_ipv4) + optArgs+="chip_disable_wifi_ipv4=true " + shift + ;; *) if [ "$1" =~ *"use_rs911x=true"* ] || [ "$1" =~ *"use_wf200=true"* ]; then USE_WIFI=true diff --git a/src/platform/EFR32/CHIPDevicePlatformConfig.h b/src/platform/EFR32/CHIPDevicePlatformConfig.h index 42d6e6f65d7b92..38a264727588a2 100644 --- a/src/platform/EFR32/CHIPDevicePlatformConfig.h +++ b/src/platform/EFR32/CHIPDevicePlatformConfig.h @@ -48,6 +48,18 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 +#if defined(RS911X_WIFI) + +#if defined(WIFI_IPV4_DISABLED) +#define CHIP_DEVICE_CONFIG_ENABLE_IPV4 0 +#define CHIP_DEVICE_CONFIG_ENABLE_IPV6 1 +#else +#define CHIP_DEVICE_CONFIG_ENABLE_IPV4 1 +#define CHIP_DEVICE_CONFIG_ENABLE_IPV6 1 +#endif + +#endif + // ========== Platform-specific Configuration ========= // These are configuration options that are unique to the EFR32 platform. diff --git a/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp b/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp index a279c808c4ccb5..5d0085d6569af5 100644 --- a/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp +++ b/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp @@ -33,6 +33,7 @@ #include #endif +#include "CHIPDevicePlatformConfig.h" #include "wfx_host_events.h" using namespace ::chip; @@ -388,8 +389,10 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void) if (mWiFiStationState == kWiFiStationState_Connected) { #if 1 //! defined (SL_WF200) || (SL_WF200 == 0) - haveIPv4Conn = wfx_have_ipv4_addr(SL_WFX_STA_INTERFACE); +#if (CHIP_DEVICE_CONFIG_ENABLE_IPV6) + haveIPv6Conn = wfx_have_ipv6_addr(SL_WFX_STA_INTERFACE); +#endif /* TODO - haveIPv6Conn */ #else /* Old code that needed LWIP and its internals */ // Get the LwIP netif for the WiFi station interface. From 9a87636698b42fbe862aa9963448786a3d147686 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 3 Jun 2022 05:53:55 +0000 Subject: [PATCH 2/2] Restyled by gn --- examples/lighting-app/efr32/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index 90b84ffeb4b395..1e9d610a0364c2 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -217,7 +217,7 @@ efr32_executable("lighting_app") { sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] } -if (chip_disable_wifi_ipv4) { + if (chip_disable_wifi_ipv4) { defines += [ "WIFI_IPV4_DISABLED" ] }