diff --git a/examples/light-switch-app/efr32/BUILD.gn b/examples/light-switch-app/efr32/BUILD.gn index 8849f790d06bd8..7d71569cd0ff76 100644 --- a/examples/light-switch-app/efr32/BUILD.gn +++ b/examples/light-switch-app/efr32/BUILD.gn @@ -79,6 +79,7 @@ assert(!(use_wf200 && chip_enable_openthread)) if (chip_enable_wifi) { assert(use_rs911x || use_wf200) enable_openthread_cli = false + import("${chip_root}/src/platform/EFR32/wifi_args.gni") } # ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) @@ -92,14 +93,28 @@ if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi" efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] - efr32_lwip_defs += [ - "LWIP_IPV4=1", - "LWIP_ARP=1", - "LWIP_ICMP=1", - "LWIP_DHCP=1", - "LWIP_IPV6_ND=1", - "LWIP_IGMP=1", - ] + if (lwip_ipv4) { + efr32_lwip_defs += [ + "LWIP_IPV4=1", + + # adds following options to provide + # them to .cpp source files + # flags ported from lwipopts file + # TODO: move lwipopts to one location + "LWIP_ARP=1", + "LWIP_ICMP=1", + "LWIP_IGMP=1", + "LWIP_DHCP=1", + "LWIP_DNS=0", + ] + } else { + efr32_lwip_defs += [ "LWIP_IPV4=0" ] + } + if (lwip_ipv6) { + efr32_lwip_defs += [ "LWIP_IPV6=1" ] + } else { + efr32_lwip_defs += [ "LWIP_IPV6=0" ] + } if (use_rs911x) { wiseconnect_sdk_root = diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index 0c36e3bba57314..1ca1b41e2ce62b 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -79,6 +79,7 @@ assert(!(use_wf200 && chip_enable_openthread)) if (chip_enable_wifi) { assert(use_rs911x || use_wf200) enable_openthread_cli = false + import("${chip_root}/src/platform/EFR32/wifi_args.gni") } # ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) @@ -97,14 +98,28 @@ if (chip_enable_wifi) { } wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi" efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] - efr32_lwip_defs += [ - "LWIP_IPV4=1", - "LWIP_ARP=1", - "LWIP_ICMP=1", - "LWIP_DHCP=1", - "LWIP_IPV6_ND=1", - "LWIP_IGMP=1", - ] + if (lwip_ipv4) { + efr32_lwip_defs += [ + "LWIP_IPV4=1", + + # adds following options to provide + # them to .cpp source files + # flags ported from lwipopts file + # TODO: move lwipopts to one location + "LWIP_ARP=1", + "LWIP_ICMP=1", + "LWIP_IGMP=1", + "LWIP_DHCP=1", + "LWIP_DNS=0", + ] + } else { + efr32_lwip_defs += [ "LWIP_IPV4=0" ] + } + if (lwip_ipv6) { + efr32_lwip_defs += [ "LWIP_IPV6=1" ] + } else { + efr32_lwip_defs += [ "LWIP_IPV6=0" ] + } if (use_rs911x) { wiseconnect_sdk_root = diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index 996cb0f086a67d..fdd3f9f9984b8d 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -79,6 +79,7 @@ assert(!(use_wf200 && chip_enable_openthread)) if (chip_enable_wifi) { assert(use_rs911x || use_wf200) enable_openthread_cli = false + import("${chip_root}/src/platform/EFR32/wifi_args.gni") } # ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) @@ -92,14 +93,28 @@ if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi" efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] - efr32_lwip_defs += [ - "LWIP_IPV4=1", - "LWIP_ARP=1", - "LWIP_ICMP=1", - "LWIP_DHCP=1", - "LWIP_IPV6_ND=1", - "LWIP_IGMP=1", - ] + if (lwip_ipv4) { + efr32_lwip_defs += [ + "LWIP_IPV4=1", + + # adds following options to provide + # them to .cpp source files + # flags ported from lwipopts file + # TODO: move lwipopts to one location + "LWIP_ARP=1", + "LWIP_ICMP=1", + "LWIP_IGMP=1", + "LWIP_DHCP=1", + "LWIP_DNS=0", + ] + } else { + efr32_lwip_defs += [ "LWIP_IPV4=0" ] + } + if (lwip_ipv6) { + efr32_lwip_defs += [ "LWIP_IPV6=1" ] + } else { + efr32_lwip_defs += [ "LWIP_IPV6=0" ] + } if (use_rs911x) { wiseconnect_sdk_root = diff --git a/examples/platform/efr32/rs911x/rsi_if.c b/examples/platform/efr32/rs911x/rsi_if.c index 872d82c411269b..ad72f6361c055c 100644 --- a/examples/platform/efr32/rs911x/rsi_if.c +++ b/examples/platform/efr32/rs911x/rsi_if.c @@ -738,6 +738,7 @@ void wfx_rsi_task(void * arg) } } +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 /******************************************************************************************** * @fn void wfx_dhcp_got_ipv4(uint32_t ip) * @brief @@ -761,6 +762,7 @@ void wfx_dhcp_got_ipv4(uint32_t ip) wfx_ip_changed_notify(IP_STATUS_SUCCESS); wfx_rsi.dev_state |= WFX_RSI_ST_STA_READY; } +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ /* * WARNING - Taken from RSI and broken up diff --git a/examples/platform/efr32/rs911x/wfx_rsi.h b/examples/platform/efr32/rs911x/wfx_rsi.h index 5899a0c45bc31e..380fc8f29e1693 100644 --- a/examples/platform/efr32/rs911x/wfx_rsi.h +++ b/examples/platform/efr32/rs911x/wfx_rsi.h @@ -82,7 +82,9 @@ extern "C" { void wfx_rsidev_init(void); void wfx_rsi_task(void * arg); void efr32Log(const char * aFormat, ...); +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 void wfx_ip_changed_notify(int got_ip); +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap); int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info); int32_t wfx_rsi_reset_count(); diff --git a/examples/platform/efr32/rs911x/wfx_rsi_host.c b/examples/platform/efr32/rs911x/wfx_rsi_host.c index 2a502356e6ae66..a55e0aeb5cab2e 100644 --- a/examples/platform/efr32/rs911x/wfx_rsi_host.c +++ b/examples/platform/efr32/rs911x/wfx_rsi_host.c @@ -294,7 +294,7 @@ sl_status_t wfx_sta_discon(void) WFX_RSI_LOG("%s: completed.", __func__); return status; } - +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 /********************************************************************* * @fn bool wfx_have_ipv4_addr(sl_wfx_interface_t which_if) * @brief @@ -317,6 +317,7 @@ bool wfx_have_ipv4_addr(sl_wfx_interface_t which_if) WFX_RSI_LOG("%s: status: %d", __func__, status); return status; } +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ /********************************************************************* * @fn bool wfx_have_ipv6_addr(sl_wfx_interface_t which_if) diff --git a/examples/platform/efr32/wf200/host_if.cpp b/examples/platform/efr32/wf200/host_if.cpp index 8015a0cb7a1caa..d6f90419613f22 100644 --- a/examples/platform/efr32/wf200/host_if.cpp +++ b/examples/platform/efr32/wf200/host_if.cpp @@ -1132,6 +1132,7 @@ static void sl_wfx_ap_client_rejected_callback(uint32_t status, uint8_t * mac) ******************************************************************************/ bool wfx_hw_ready(void) { return (wifiContext.state & SL_WFX_STARTED) ? true : false; } +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 /***************************************************************************** * @fn void wfx_dhcp_got_ipv4(uint32_t ip) * @brief @@ -1146,6 +1147,7 @@ static void sl_wfx_ap_client_rejected_callback(uint32_t status, uint8_t * mac) sta_ip = ip; wfx_ip_changed_notify(IP_STATUS_SUCCESS); } +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ /***************************************************************************** * @fn wfx_enable_sta_mode(void) diff --git a/examples/thermostat/efr32/BUILD.gn b/examples/thermostat/efr32/BUILD.gn index 9c74f3224df18f..da732a26122b1d 100644 --- a/examples/thermostat/efr32/BUILD.gn +++ b/examples/thermostat/efr32/BUILD.gn @@ -76,6 +76,7 @@ assert(!(use_wf200 && chip_enable_openthread)) if (chip_enable_wifi) { assert(use_rs911x || use_wf200) enable_openthread_cli = false + import("${chip_root}/src/platform/EFR32/wifi_args.gni") } # ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) @@ -89,14 +90,28 @@ if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi" efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] - efr32_lwip_defs += [ - "LWIP_IPV4=1", - "LWIP_ARP=1", - "LWIP_ICMP=1", - "LWIP_DHCP=1", - "LWIP_IPV6_ND=1", - "LWIP_IGMP=1", - ] + if (lwip_ipv4) { + efr32_lwip_defs += [ + "LWIP_IPV4=1", + + # adds following options to provide + # them to .cpp source files + # flags ported from lwipopts file + # TODO: move lwipopts to one location + "LWIP_ARP=1", + "LWIP_ICMP=1", + "LWIP_IGMP=1", + "LWIP_DHCP=1", + "LWIP_DNS=0", + ] + } else { + efr32_lwip_defs += [ "LWIP_IPV4=0" ] + } + if (lwip_ipv6) { + efr32_lwip_defs += [ "LWIP_IPV6=1" ] + } else { + efr32_lwip_defs += [ "LWIP_IPV6=0" ] + } if (use_rs911x) { wiseconnect_sdk_root = diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 8a62fa7f9cb069..c94685c6279da5 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -73,6 +73,7 @@ assert(!(use_wf200 && chip_enable_openthread)) if (chip_enable_wifi) { assert(use_rs911x || use_wf200) enable_openthread_cli = false + import("${chip_root}/src/platform/EFR32/wifi_args.gni") } # ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) @@ -91,14 +92,28 @@ if (chip_enable_wifi) { } wifi_sdk_dir = "${chip_root}/src/platform/EFR32/wifi" efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] - efr32_lwip_defs += [ - "LWIP_IPV4=1", - "LWIP_ARP=1", - "LWIP_ICMP=1", - "LWIP_DHCP=1", - "LWIP_IPV6_ND=1", - "LWIP_IGMP=1", - ] + if (lwip_ipv4) { + efr32_lwip_defs += [ + "LWIP_IPV4=1", + + # adds following options to provide + # them to .cpp source files + # flags ported from lwipopts file + # TODO: move lwipopts to one location + "LWIP_ARP=1", + "LWIP_ICMP=1", + "LWIP_IGMP=1", + "LWIP_DHCP=1", + "LWIP_DNS=0", + ] + } else { + efr32_lwip_defs += [ "LWIP_IPV4=0" ] + } + if (lwip_ipv6) { + efr32_lwip_defs += [ "LWIP_IPV6=1" ] + } else { + efr32_lwip_defs += [ "LWIP_IPV6=0" ] + } if (use_rs911x) { wiseconnect_sdk_root = diff --git a/src/lwip/efr32/lwipopts-rs911x.h b/src/lwip/efr32/lwipopts-rs911x.h index 839636b3ae7f0a..66fbf69f2c8a5b 100644 --- a/src/lwip/efr32/lwipopts-rs911x.h +++ b/src/lwip/efr32/lwipopts-rs911x.h @@ -50,7 +50,9 @@ #define LWIP_DHCP_AUTOIP_COOP (0) #define LWIP_SOCKET_SET_ERRNO 0 #define IP_REASS_MAX_PBUFS 0 -#define IP_REASSEMBLY 0 +#define IP_REASSEMBLY 1 +#define IP_FRAG 1 +#define IP_OPTIONS_ALLOWED 1 #define MEMP_NUM_REASSDATA 0 #define LWIP_SO_RCVTIMEO 0 #define SO_REUSE (1) @@ -77,32 +79,32 @@ #define MEMP_NUM_NETCONN (0) -#ifndef LWIP_IPV4 -#define LWIP_IPV4 1 -#endif -#ifndef LWIP_IPV6 -#define LWIP_IPV6 1 -#endif #ifndef LWIP_ARP -#define LWIP_ARP (1) -#endif -#define LWIP_DNS (0) +#define LWIP_ARP (LWIP_IPV4) +#endif /* LWIP_ARP */ +#ifndef LWIP_DNS +#define LWIP_DNS (LWIP_IPV4) +#endif /* LWIP_DNS */ #ifndef LWIP_ICMP -#define LWIP_ICMP (1) -#endif +#define LWIP_ICMP (LWIP_IPV4) +#endif /* LWIP_ICMP */ #ifndef LWIP_IGMP -#define LWIP_IGMP (1) -#endif +#define LWIP_IGMP (LWIP_IPV4) +#endif /* LWIP_IGMP */ #ifndef LWIP_DHCP -#define LWIP_DHCP (1) -#endif -#define LWIP_IPV6_REASS (0) +#define LWIP_DHCP (LWIP_IPV4) +#endif /* LWIP_DHCP */ + +#define LWIP_ETHERNET (LWIP_IPV6) // Required for IPV6 only mode +#define LWIP_IPV6_MLD (LWIP_IPV6) +#define LWIP_ICMP6 (LWIP_IPV6) +#define LWIP_IPV6_REASS (LWIP_IPV6) +#define LWIP_IPV6_FRAG (LWIP_IPV6) #define LWIP_IPV6_DHCP6 0 -#define LWIP_IPV6_AUTOCONFIG (1) +#define LWIP_IPV6_AUTOCONFIG (LWIP_IPV6) #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1 -#define LWIP_IPV6_ROUTER_SUPPORT 1 -#define LWIP_ND6_LISTEN_RA 1 - +#define LWIP_IPV6_ROUTER_SUPPORT (LWIP_IPV6) +#define LWIP_ND6_LISTEN_RA (LWIP_IPV6_ND) #define LWIP_ND6_NUM_NEIGHBORS (2) #define LWIP_ND6_NUM_DESTINATIONS (3) #define LWIP_ND6_NUM_PREFIXES (2) @@ -111,7 +113,7 @@ #define LWIP_ND6_MAX_UNICAST_SOLICIT (2) #define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT (3) #define LWIP_ND6_TCP_REACHABILITY_HINTS (0) -#define LWIP_ND6_ALLOW_RA_UPDATES 1 +#define LWIP_ND6_ALLOW_RA_UPDATES (LWIP_IPV6_ND) #if defined(EFR32MG21) #define MEMP_SEPARATE_POOLS (1) @@ -121,7 +123,7 @@ #define PBUF_POOL_BUFSIZE (1280) #define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL) #define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE) -#else +#else /* !(EFR32MG21) */ #define MEMP_SEPARATE_POOLS (1) #define LWIP_PBUF_FROM_CUSTOM_POOLS (0) #define MEMP_USE_CUSTOM_POOLS (0) @@ -129,7 +131,7 @@ #define PBUF_POOL_BUFSIZE (1280) // IPv6 path MTU #define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL) #define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE) -#endif +#endif /* EFR32MG21 */ #define TCP_MSS (1152) #define TCP_SND_BUF (2 * TCP_MSS) @@ -141,9 +143,9 @@ #if defined(EFR32MG21) #define TCPIP_THREAD_STACKSIZE (1536) -#else +#else /* !(EFR32MG21) */ #define TCPIP_THREAD_STACKSIZE (2048) -#endif +#endif /* EFR32MG21 */ #define TCPIP_THREAD_PRIO (2) @@ -151,10 +153,8 @@ #define LWIP_IPV6_NUM_ADDRESSES 5 -#ifndef LWIP_IPV6_ND -#define LWIP_IPV6_ND 1 -#endif -#define LWIP_ND6_QUEUEING 1 +#define LWIP_IPV6_ND (LWIP_IPV6) +#define LWIP_ND6_QUEUEING (LWIP_IPV6) #define LWIP_NUM_ND6_QUEUE 3 #define LWIP_MULTICAST_PING 0 @@ -185,6 +185,7 @@ #define IP6_DEBUG (LWIP_DBG_OFF) #define RAW_DEBUG (LWIP_DBG_OFF) #define ICMP_DEBUG (LWIP_DBG_OFF) +#define ICMP6_DEBUG (LWIP_DBG_OFF) #define UDP_DEBUG (LWIP_DBG_OFF) #define TCP_DEBUG (LWIP_DBG_OFF) #define TCP_INPUT_DEBUG (LWIP_DBG_OFF) @@ -196,9 +197,8 @@ #define TCP_QLEN_DEBUG (LWIP_DBG_OFF) #define TCP_RST_DEBUG (LWIP_DBG_OFF) #define PPP_DEBUG (LWIP_DBG_OFF) -#endif +#endif /* LWIP_DEBUG */ #define LWIP_DBG_TYPES_ON \ (LWIP_DBG_ON | LWIP_DBG_TRACE) /* (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) */ - -#endif /* __LWIPOPTS_H__ */ +#endif /* __LWIPOPTS_H__ */ diff --git a/src/lwip/efr32/lwipopts-wf200.h b/src/lwip/efr32/lwipopts-wf200.h index 0811154e84c1c1..b1dc32fb1a53b2 100644 --- a/src/lwip/efr32/lwipopts-wf200.h +++ b/src/lwip/efr32/lwipopts-wf200.h @@ -50,7 +50,9 @@ #define LWIP_DHCP_AUTOIP_COOP (0) #define LWIP_SOCKET_SET_ERRNO 0 #define IP_REASS_MAX_PBUFS 0 -#define IP_REASSEMBLY 0 +#define IP_REASSEMBLY 1 +#define IP_FRAG 1 +#define IP_OPTIONS_ALLOWED 1 #define MEMP_NUM_REASSDATA 0 #define LWIP_SO_RCVTIMEO 0 #define SO_REUSE (1) @@ -77,32 +79,32 @@ #define MEMP_NUM_NETCONN (0) -#ifndef LWIP_IPV4 -#define LWIP_IPV4 0 -#endif -#ifndef LWIP_IPV6 -#define LWIP_IPV6 1 -#endif #ifndef LWIP_ARP -#define LWIP_ARP (0) -#endif -#define LWIP_DNS (0) +#define LWIP_ARP (LWIP_IPV4) +#endif /* LWIP_ARP */ +#ifndef LWIP_DNS +#define LWIP_DNS (LWIP_IPV4) +#endif /* LWIP_DNS */ #ifndef LWIP_ICMP -#define LWIP_ICMP (1) -#endif +#define LWIP_ICMP (LWIP_IPV4) +#endif /* LWIP_ICMP */ #ifndef LWIP_IGMP -#define LWIP_IGMP (0) -#endif +#define LWIP_IGMP (LWIP_IPV4) +#endif /* LWIP_IGMP */ #ifndef LWIP_DHCP -#define LWIP_DHCP (0) -#endif -#define LWIP_IPV6_REASS (0) +#define LWIP_DHCP (LWIP_IPV4) +#endif /* LWIP_DHCP */ + +#define LWIP_ETHERNET (LWIP_IPV6) // Required for IPV6 only mode +#define LWIP_IPV6_MLD (LWIP_IPV6) +#define LWIP_ICMP6 (LWIP_IPV6) +#define LWIP_IPV6_REASS (LWIP_IPV6) +#define LWIP_IPV6_FRAG (LWIP_IPV6) #define LWIP_IPV6_DHCP6 0 -#define LWIP_IPV6_AUTOCONFIG (1) +#define LWIP_IPV6_AUTOCONFIG (LWIP_IPV6) #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1 -#define LWIP_IPV6_ROUTER_SUPPORT 1 -#define LWIP_ND6_LISTEN_RA 1 - +#define LWIP_IPV6_ROUTER_SUPPORT (LWIP_IPV6) +#define LWIP_ND6_LISTEN_RA (LWIP_IPV6_ND) #define LWIP_ND6_NUM_NEIGHBORS (2) #define LWIP_ND6_NUM_DESTINATIONS (3) #define LWIP_ND6_NUM_PREFIXES (2) @@ -111,7 +113,7 @@ #define LWIP_ND6_MAX_UNICAST_SOLICIT (2) #define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT (3) #define LWIP_ND6_TCP_REACHABILITY_HINTS (0) -#define LWIP_ND6_ALLOW_RA_UPDATES 1 +#define LWIP_ND6_ALLOW_RA_UPDATES (LWIP_IPV6_ND) #if defined(EFR32MG21) #define MEMP_SEPARATE_POOLS (1) @@ -121,15 +123,15 @@ #define PBUF_POOL_BUFSIZE (1280) #define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL) #define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE) -#else +#else /* !(EFR32MG21) */ #define MEMP_SEPARATE_POOLS (1) #define LWIP_PBUF_FROM_CUSTOM_POOLS (0) #define MEMP_USE_CUSTOM_POOLS (0) #define PBUF_POOL_SIZE (16) -#define PBUF_POOL_BUFSIZE (1280) +#define PBUF_POOL_BUFSIZE (1280) // IPv6 path MTU #define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL) #define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE) -#endif +#endif /* EFR32MG21 */ #define TCP_MSS (1152) #define TCP_SND_BUF (2 * TCP_MSS) @@ -141,9 +143,9 @@ #if defined(EFR32MG21) #define TCPIP_THREAD_STACKSIZE (1536) -#else +#else /* !(EFR32MG21) */ #define TCPIP_THREAD_STACKSIZE (2048) -#endif +#endif /* EFR32MG21 */ #define TCPIP_THREAD_PRIO (2) @@ -151,10 +153,8 @@ #define LWIP_IPV6_NUM_ADDRESSES 5 -#ifndef LWIP_IPV6_ND -#define LWIP_IPV6_ND 0 -#endif -#define LWIP_ND6_QUEUEING 1 +#define LWIP_IPV6_ND (LWIP_IPV6) +#define LWIP_ND6_QUEUEING (LWIP_IPV6) #define LWIP_NUM_ND6_QUEUE 3 #define LWIP_MULTICAST_PING 0 @@ -185,6 +185,7 @@ #define IP6_DEBUG (LWIP_DBG_OFF) #define RAW_DEBUG (LWIP_DBG_OFF) #define ICMP_DEBUG (LWIP_DBG_OFF) +#define ICMP6_DEBUG (LWIP_DBG_OFF) #define UDP_DEBUG (LWIP_DBG_OFF) #define TCP_DEBUG (LWIP_DBG_OFF) #define TCP_INPUT_DEBUG (LWIP_DBG_OFF) @@ -196,9 +197,8 @@ #define TCP_QLEN_DEBUG (LWIP_DBG_OFF) #define TCP_RST_DEBUG (LWIP_DBG_OFF) #define PPP_DEBUG (LWIP_DBG_OFF) -#endif +#endif /* LWIP_DEBUG */ #define LWIP_DBG_TYPES_ON \ (LWIP_DBG_ON | LWIP_DBG_TRACE) /* (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) */ - -#endif /* __LWIPOPTS_H__ */ +#endif /* __LWIPOPTS_H__ */ diff --git a/src/platform/EFR32/wifi/dhcp_client.cpp b/src/platform/EFR32/wifi/dhcp_client.cpp index b78e21f84411f2..f3e8c5597ad922 100644 --- a/src/platform/EFR32/wifi/dhcp_client.cpp +++ b/src/platform/EFR32/wifi/dhcp_client.cpp @@ -15,6 +15,8 @@ * limitations under the License. */ +#if LWIP_IPV4 && LWIP_DHCP + #include #include #include @@ -143,3 +145,5 @@ uint8_t dhcpclient_poll(void * arg) } return dhcp_state; } + +#endif /* LWIP_IPV4 && LWIP_DHCP */ diff --git a/src/platform/EFR32/wifi/dhcp_client.h b/src/platform/EFR32/wifi/dhcp_client.h index 5937f6a29d86d3..3040f7112fb954 100644 --- a/src/platform/EFR32/wifi/dhcp_client.h +++ b/src/platform/EFR32/wifi/dhcp_client.h @@ -15,6 +15,8 @@ * limitations under the License. */ +#if LWIP_IPV4 && LWIP_DHCP + #pragma once #ifdef __cplusplus extern "C" { @@ -39,3 +41,5 @@ uint8_t dhcpclient_poll(void * arg); #ifdef __cplusplus } #endif + +#endif /* LWIP_IPV4 && LWIP_DHCP */ diff --git a/src/platform/EFR32/wifi/ethernetif.cpp b/src/platform/EFR32/wifi/ethernetif.cpp index 09fbf421235fdd..4ac27d69f194e4 100644 --- a/src/platform/EFR32/wifi/ethernetif.cpp +++ b/src/platform/EFR32/wifi/ethernetif.cpp @@ -431,8 +431,12 @@ err_t sta_ethernetif_init(struct netif * netif) netif->name[0] = STATION_NETIF0; netif->name[1] = STATION_NETIF1; - netif->output = etharp_output; +#if LWIP_IPV4 && LWIP_ARP + netif->output = etharp_output; +#endif /* #if LWIP_IPV4 && LWIP_ARP */ +#if LWIP_IPV6 && LWIP_ETHERNET netif->output_ip6 = ethip6_output; +#endif /* LWIP_IPV6 && LWIP_ETHERNET */ netif->linkoutput = low_level_output; /* initialize the hardware */ diff --git a/src/platform/EFR32/wifi/lwip_netif.cpp b/src/platform/EFR32/wifi/lwip_netif.cpp index cd3a34292cf85a..e19cf97a7cefd2 100644 --- a/src/platform/EFR32/wifi/lwip_netif.cpp +++ b/src/platform/EFR32/wifi/lwip_netif.cpp @@ -58,6 +58,7 @@ static void netif_config(struct netif * sta_if, struct netif * ap_if) { if (sta_if != NULL) { +#if LWIP_IPV4 ip_addr_t sta_ipaddr; ip_addr_t sta_netmask; ip_addr_t sta_gw; @@ -66,10 +67,14 @@ static void netif_config(struct netif * sta_if, struct netif * ap_if) ip_addr_set_zero_ip4(&sta_ipaddr); ip_addr_set_zero_ip4(&sta_netmask); ip_addr_set_zero_ip4(&sta_gw); +#endif /* LWIP_IPV4 */ /* Add station interfaces */ - netif_add(sta_if, (const ip4_addr_t *) &sta_ipaddr, (const ip4_addr_t *) &sta_netmask, (const ip4_addr_t *) &sta_gw, NULL, - &sta_ethernetif_init, &tcpip_input); + netif_add(sta_if, +#if LWIP_IPV4 + (const ip4_addr_t *) &sta_ipaddr, (const ip4_addr_t *) &sta_netmask, (const ip4_addr_t *) &sta_gw, +#endif /* LWIP_IPV4 */ + NULL, &sta_ethernetif_init, &tcpip_input); /* Registers the default network interface */ netif_set_default(sta_if); @@ -87,7 +92,9 @@ void wfx_lwip_set_sta_link_up(void) { netifapi_netif_set_up(&sta_netif); netifapi_netif_set_link_up(&sta_netif); +#if LWIP_IPV4 && LWIP_DHCP dhcpclient_set_link_state(LINK_UP); +#endif /* LWIP_IPV4 && LWIP_DHCP */ /* * Enable IPV6 */ @@ -107,7 +114,9 @@ void wfx_lwip_set_sta_link_up(void) *****************************************************************************/ void wfx_lwip_set_sta_link_down(void) { +#if LWIP_IPV4 && LWIP_DHCP dhcpclient_set_link_state(LINK_DOWN); +#endif /* LWIP_IPV4 && LWIP_DHCP */ netifapi_netif_set_link_down(&sta_netif); netifapi_netif_set_down(&sta_netif); } diff --git a/src/platform/EFR32/wifi/wfx_host_events.h b/src/platform/EFR32/wifi/wfx_host_events.h index 6a1e367d29cad0..be64a8a65594b4 100644 --- a/src/platform/EFR32/wifi/wfx_host_events.h +++ b/src/platform/EFR32/wifi/wfx_host_events.h @@ -258,7 +258,9 @@ sl_status_t wfx_connect_to_ap(void); void wfx_setup_ip6_link_local(sl_wfx_interface_t); bool wfx_is_sta_connected(void); sl_status_t wfx_sta_discon(void); +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 bool wfx_have_ipv4_addr(sl_wfx_interface_t); +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ bool wfx_have_ipv6_addr(sl_wfx_interface_t); wifi_mode_t wfx_get_wifi_mode(void); bool wfx_start_scan(char * ssid, void (*scan_cb)(wfx_wifi_scan_result_t *)); /* true returned if successfuly started */ @@ -276,9 +278,13 @@ void wfx_lwip_set_sta_link_up(void); void wfx_lwip_set_sta_link_down(void); void wfx_lwip_start(void); struct netif * wfx_get_netif(sl_wfx_interface_t interface); +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 void wfx_dhcp_got_ipv4(uint32_t); +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ bool wfx_hw_ready(void); +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 void wfx_ip_changed_notify(int got_ip); +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ void wfx_ipv6_notify(int got_ip); #ifdef RS911X_WIFI