Skip to content

Commit 87222e6

Browse files
rosahay-silabsrerasool
authored andcommitted
Pull request project-chip#226: Cherry-Pick "[EFR32] Adds support to toggle LwIP IPv4 flags (project-chip#23106)" from silabs to silabs_1.0
Merge in WMN_TOOLS/matter from cherry-pick/lwip-ipv4-macro-toggle to silabs_1.0 Squashed commit of the following: commit f65ba67f854c0aae4045c4da7f4fe296496911a4 Author: Rohan Sahay <103027015+rosahay-silabs@users.noreply.github.com> Date: Thu Oct 27 02:03:09 2022 +0530 [EFR32] Adds support to toggle LwIP IPv4 flags (project-chip#23106) * Adds LWIP flag changes to toggle LWIP_IPV4 builds * Adds fix for openthread compilation * Restyled by whitespace Co-authored-by: Restyled.io <commits@restyled.io> # Conflicts: # src/lwip/efr32/lwipopts-rs911x.h # src/lwip/efr32/lwipopts-wf200.h
1 parent c6cd282 commit 87222e6

File tree

16 files changed

+220
-109
lines changed

16 files changed

+220
-109
lines changed

examples/light-switch-app/efr32/BUILD.gn

+23-8
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ assert(!(use_wf200 && chip_enable_openthread))
7979
if (chip_enable_wifi) {
8080
assert(use_rs911x || use_wf200)
8181
enable_openthread_cli = false
82+
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
8283
}
8384

8485
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
@@ -92,14 +93,28 @@ if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
9293
if (chip_enable_wifi) {
9394
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
9495
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
95-
efr32_lwip_defs += [
96-
"LWIP_IPV4=1",
97-
"LWIP_ARP=1",
98-
"LWIP_ICMP=1",
99-
"LWIP_DHCP=1",
100-
"LWIP_IPV6_ND=1",
101-
"LWIP_IGMP=1",
102-
]
96+
if (lwip_ipv4) {
97+
efr32_lwip_defs += [
98+
"LWIP_IPV4=1",
99+
100+
# adds following options to provide
101+
# them to .cpp source files
102+
# flags ported from lwipopts file
103+
# TODO: move lwipopts to one location
104+
"LWIP_ARP=1",
105+
"LWIP_ICMP=1",
106+
"LWIP_IGMP=1",
107+
"LWIP_DHCP=1",
108+
"LWIP_DNS=0",
109+
]
110+
} else {
111+
efr32_lwip_defs += [ "LWIP_IPV4=0" ]
112+
}
113+
if (lwip_ipv6) {
114+
efr32_lwip_defs += [ "LWIP_IPV6=1" ]
115+
} else {
116+
efr32_lwip_defs += [ "LWIP_IPV6=0" ]
117+
}
103118

104119
if (use_rs911x) {
105120
wiseconnect_sdk_root =

examples/lighting-app/efr32/BUILD.gn

+23-8
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ assert(!(use_wf200 && chip_enable_openthread))
7979
if (chip_enable_wifi) {
8080
assert(use_rs911x || use_wf200)
8181
enable_openthread_cli = false
82+
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
8283
}
8384

8485
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
@@ -97,14 +98,28 @@ if (chip_enable_wifi) {
9798
}
9899
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
99100
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
100-
efr32_lwip_defs += [
101-
"LWIP_IPV4=1",
102-
"LWIP_ARP=1",
103-
"LWIP_ICMP=1",
104-
"LWIP_DHCP=1",
105-
"LWIP_IPV6_ND=1",
106-
"LWIP_IGMP=1",
107-
]
101+
if (lwip_ipv4) {
102+
efr32_lwip_defs += [
103+
"LWIP_IPV4=1",
104+
105+
# adds following options to provide
106+
# them to .cpp source files
107+
# flags ported from lwipopts file
108+
# TODO: move lwipopts to one location
109+
"LWIP_ARP=1",
110+
"LWIP_ICMP=1",
111+
"LWIP_IGMP=1",
112+
"LWIP_DHCP=1",
113+
"LWIP_DNS=0",
114+
]
115+
} else {
116+
efr32_lwip_defs += [ "LWIP_IPV4=0" ]
117+
}
118+
if (lwip_ipv6) {
119+
efr32_lwip_defs += [ "LWIP_IPV6=1" ]
120+
} else {
121+
efr32_lwip_defs += [ "LWIP_IPV6=0" ]
122+
}
108123

109124
if (use_rs911x) {
110125
wiseconnect_sdk_root =

examples/lock-app/efr32/BUILD.gn

+23-8
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ assert(!(use_wf200 && chip_enable_openthread))
7979
if (chip_enable_wifi) {
8080
assert(use_rs911x || use_wf200)
8181
enable_openthread_cli = false
82+
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
8283
}
8384

8485
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
@@ -92,14 +93,28 @@ if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
9293
if (chip_enable_wifi) {
9394
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
9495
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
95-
efr32_lwip_defs += [
96-
"LWIP_IPV4=1",
97-
"LWIP_ARP=1",
98-
"LWIP_ICMP=1",
99-
"LWIP_DHCP=1",
100-
"LWIP_IPV6_ND=1",
101-
"LWIP_IGMP=1",
102-
]
96+
if (lwip_ipv4) {
97+
efr32_lwip_defs += [
98+
"LWIP_IPV4=1",
99+
100+
# adds following options to provide
101+
# them to .cpp source files
102+
# flags ported from lwipopts file
103+
# TODO: move lwipopts to one location
104+
"LWIP_ARP=1",
105+
"LWIP_ICMP=1",
106+
"LWIP_IGMP=1",
107+
"LWIP_DHCP=1",
108+
"LWIP_DNS=0",
109+
]
110+
} else {
111+
efr32_lwip_defs += [ "LWIP_IPV4=0" ]
112+
}
113+
if (lwip_ipv6) {
114+
efr32_lwip_defs += [ "LWIP_IPV6=1" ]
115+
} else {
116+
efr32_lwip_defs += [ "LWIP_IPV6=0" ]
117+
}
103118

104119
if (use_rs911x) {
105120
wiseconnect_sdk_root =

examples/platform/efr32/rs911x/rsi_if.c

+2
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,7 @@ void wfx_rsi_task(void * arg)
738738
}
739739
}
740740

741+
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
741742
/********************************************************************************************
742743
* @fn void wfx_dhcp_got_ipv4(uint32_t ip)
743744
* @brief
@@ -761,6 +762,7 @@ void wfx_dhcp_got_ipv4(uint32_t ip)
761762
wfx_ip_changed_notify(IP_STATUS_SUCCESS);
762763
wfx_rsi.dev_state |= WFX_RSI_ST_STA_READY;
763764
}
765+
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
764766

765767
/*
766768
* WARNING - Taken from RSI and broken up

examples/platform/efr32/rs911x/wfx_rsi.h

+2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ extern "C" {
8282
void wfx_rsidev_init(void);
8383
void wfx_rsi_task(void * arg);
8484
void efr32Log(const char * aFormat, ...);
85+
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
8586
void wfx_ip_changed_notify(int got_ip);
87+
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
8688
int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap);
8789
int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info);
8890
int32_t wfx_rsi_reset_count();

examples/platform/efr32/rs911x/wfx_rsi_host.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ sl_status_t wfx_sta_discon(void)
294294
WFX_RSI_LOG("%s: completed.", __func__);
295295
return status;
296296
}
297-
297+
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
298298
/*********************************************************************
299299
* @fn bool wfx_have_ipv4_addr(sl_wfx_interface_t which_if)
300300
* @brief
@@ -317,6 +317,7 @@ bool wfx_have_ipv4_addr(sl_wfx_interface_t which_if)
317317
WFX_RSI_LOG("%s: status: %d", __func__, status);
318318
return status;
319319
}
320+
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
320321

321322
/*********************************************************************
322323
* @fn bool wfx_have_ipv6_addr(sl_wfx_interface_t which_if)

examples/platform/efr32/wf200/host_if.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,7 @@ static void sl_wfx_ap_client_rejected_callback(uint32_t status, uint8_t * mac)
11321132
******************************************************************************/
11331133
bool wfx_hw_ready(void) { return (wifiContext.state & SL_WFX_STARTED) ? true : false; }
11341134

1135+
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
11351136
/*****************************************************************************
11361137
* @fn void wfx_dhcp_got_ipv4(uint32_t ip)
11371138
* @brief
@@ -1146,6 +1147,7 @@ static void sl_wfx_ap_client_rejected_callback(uint32_t status, uint8_t * mac)
11461147
sta_ip = ip;
11471148
wfx_ip_changed_notify(IP_STATUS_SUCCESS);
11481149
}
1150+
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
11491151

11501152
/*****************************************************************************
11511153
* @fn wfx_enable_sta_mode(void)

examples/thermostat/efr32/BUILD.gn

+23-8
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ assert(!(use_wf200 && chip_enable_openthread))
7676
if (chip_enable_wifi) {
7777
assert(use_rs911x || use_wf200)
7878
enable_openthread_cli = false
79+
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
7980
}
8081

8182
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
@@ -89,14 +90,28 @@ if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
8990
if (chip_enable_wifi) {
9091
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
9192
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
92-
efr32_lwip_defs += [
93-
"LWIP_IPV4=1",
94-
"LWIP_ARP=1",
95-
"LWIP_ICMP=1",
96-
"LWIP_DHCP=1",
97-
"LWIP_IPV6_ND=1",
98-
"LWIP_IGMP=1",
99-
]
93+
if (lwip_ipv4) {
94+
efr32_lwip_defs += [
95+
"LWIP_IPV4=1",
96+
97+
# adds following options to provide
98+
# them to .cpp source files
99+
# flags ported from lwipopts file
100+
# TODO: move lwipopts to one location
101+
"LWIP_ARP=1",
102+
"LWIP_ICMP=1",
103+
"LWIP_IGMP=1",
104+
"LWIP_DHCP=1",
105+
"LWIP_DNS=0",
106+
]
107+
} else {
108+
efr32_lwip_defs += [ "LWIP_IPV4=0" ]
109+
}
110+
if (lwip_ipv6) {
111+
efr32_lwip_defs += [ "LWIP_IPV6=1" ]
112+
} else {
113+
efr32_lwip_defs += [ "LWIP_IPV6=0" ]
114+
}
100115

101116
if (use_rs911x) {
102117
wiseconnect_sdk_root =

examples/window-app/efr32/BUILD.gn

+23-8
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ assert(!(use_wf200 && chip_enable_openthread))
7373
if (chip_enable_wifi) {
7474
assert(use_rs911x || use_wf200)
7575
enable_openthread_cli = false
76+
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
7677
}
7778

7879
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
@@ -91,14 +92,28 @@ if (chip_enable_wifi) {
9192
}
9293
wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi"
9394
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
94-
efr32_lwip_defs += [
95-
"LWIP_IPV4=1",
96-
"LWIP_ARP=1",
97-
"LWIP_ICMP=1",
98-
"LWIP_DHCP=1",
99-
"LWIP_IPV6_ND=1",
100-
"LWIP_IGMP=1",
101-
]
95+
if (lwip_ipv4) {
96+
efr32_lwip_defs += [
97+
"LWIP_IPV4=1",
98+
99+
# adds following options to provide
100+
# them to .cpp source files
101+
# flags ported from lwipopts file
102+
# TODO: move lwipopts to one location
103+
"LWIP_ARP=1",
104+
"LWIP_ICMP=1",
105+
"LWIP_IGMP=1",
106+
"LWIP_DHCP=1",
107+
"LWIP_DNS=0",
108+
]
109+
} else {
110+
efr32_lwip_defs += [ "LWIP_IPV4=0" ]
111+
}
112+
if (lwip_ipv6) {
113+
efr32_lwip_defs += [ "LWIP_IPV6=1" ]
114+
} else {
115+
efr32_lwip_defs += [ "LWIP_IPV6=0" ]
116+
}
102117

103118
if (use_rs911x) {
104119
wiseconnect_sdk_root =

0 commit comments

Comments
 (0)