Skip to content

Commit

Permalink
Enable IPv6 for WiFi (rs911x) (#19070)
Browse files Browse the repository at this point in the history
Added build flag for Enabling and disabling IPv4/IPv6

Signed-off-by: Sharad Patil <sharad.patil@silabs.com>
  • Loading branch information
sharad-patil24 authored Jun 3, 2022
1 parent 63eec80 commit 87c5997
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 1 deletion.
7 changes: 7 additions & 0 deletions examples/light-switch-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ declare_args() {

# Disable LCD on supported devices
disable_lcd = false

# Argument to Disable IPv4 for wifi(rs911)
chip_disable_wifi_ipv4 = false
}

declare_args() {
Expand Down Expand Up @@ -215,6 +218,10 @@ efr32_executable("light_switch_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) {
Expand Down
7 changes: 7 additions & 0 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ declare_args() {

# Disable LCD on supported devices
disable_lcd = false

# Argument to Disable IPv4 for wifi(rs911)
chip_disable_wifi_ipv4 = false
}

declare_args() {
Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 7 additions & 0 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ declare_args() {

# Disable LCD on supported devices
disable_lcd = false

# Argument to Disable IPv4 for wifi(rs911)
chip_disable_wifi_ipv4 = false
}

declare_args() {
Expand Down Expand Up @@ -216,6 +219,10 @@ efr32_executable("lock_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) {
Expand Down
7 changes: 7 additions & 0 deletions examples/window-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ declare_args() {

# Disable LCD on supported devices
disable_lcd = false

# Argument to Disable IPv4 for wifi(rs911)
chip_disable_wifi_ipv4 = false
}

declare_args() {
Expand Down Expand Up @@ -203,6 +206,10 @@ efr32_executable("window_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) {
Expand Down
4 changes: 4 additions & 0 deletions scripts/examples/gn_efr32_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/platform/EFR32/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <platform/internal/GenericConnectivityManagerImpl_BLE.ipp>
#endif

#include "CHIPDevicePlatformConfig.h"
#include "wfx_host_events.h"

using namespace ::chip;
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 87c5997

Please sign in to comment.