Skip to content

Commit

Permalink
[Silabs] Removes RS911X legacy socket macro cleanup (#25941)
Browse files Browse the repository at this point in the history
* Removes RS911X_SOCKETS support

* Removes use_rs911x_sockets

* Restyled by gn

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Feb 12, 2024
1 parent c133044 commit 2659797
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 193 deletions.
62 changes: 0 additions & 62 deletions examples/platform/silabs/SiWx917/SiWx917/rsi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,7 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t
* Join was complete - Do the DHCP
*/
WFX_RSI_LOG("%s: join completed.", __func__);
#ifdef RS911X_SOCKETS
xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_DO_DHCP);
#else
xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_CONN);
#endif
wfx_rsi.join_retries = 0;
retryInterval = WLAN_MIN_RETRY_TIMER_MS;
if (is_wifi_disconnection_event)
Expand All @@ -235,34 +231,7 @@ static void wfx_rsi_join_fail_cb(uint16_t status, uint8_t * buf, uint32_t len)
is_wifi_disconnection_event = true;
xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN);
}
#ifdef RS911X_SOCKETS

/******************************************************************
* @fn wfx_rsi_ipchange_cb(uint16_t status, uint8_t *buf, uint32_t len)
* @brief
* DHCP should end up here
* @param[in] status:
* @param[in] buf:
* @param[in] len:
* @return
* None
*********************************************************************/
static void wfx_rsi_ipchange_cb(uint16_t status, uint8_t * buf, uint32_t len)
{
WFX_RSI_LOG("%s: status: %02x", __func__, status);
if (status != RSI_SUCCESS)
{
/* Restart DHCP? */
xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_DO_DHCP);
}
else
{
wfx_rsi.dev_state |= WFX_RSI_ST_STA_DHCP_DONE;
xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_DHCP_DONE);
}
}

#else
/*************************************************************************************
* @fn wfx_rsi_wlan_pkt_cb(uint16_t status, uint8_t *buf, uint32_t len)
* @brief
Expand All @@ -282,7 +251,6 @@ static void wfx_rsi_wlan_pkt_cb(uint16_t status, uint8_t * buf, uint32_t len)
}
wfx_host_received_sta_frame_cb(buf, len);
}
#endif /* !Socket support */

/*************************************************************************************
* @fn static int32_t wfx_rsi_init(void)
Expand Down Expand Up @@ -357,15 +325,11 @@ static int32_t wfx_rsi_init(void)
WFX_RSI_LOG("%s: RSI callback register join failed with status: %02x", __func__, status);
return status;
}
#ifdef RS911X_SOCKETS
(void) rsi_wlan_register_callbacks(RSI_IP_CHANGE_NOTIFY_CB, wfx_rsi_ipchange_cb);
#else
if ((status = rsi_wlan_register_callbacks(RSI_WLAN_DATA_RECEIVE_NOTIFY_CB, wfx_rsi_wlan_pkt_cb)) != RSI_SUCCESS)
{
WFX_RSI_LOG("%s: RSI callback register data-notify failed with status: %02x", __func__, status);
return status;
}
#endif
wfx_rsi.dev_state |= WFX_RSI_ST_DEV_READY;
rsi_semaphore_post(&sl_rs_ble_init_sem);
WFX_RSI_LOG("%s: RSI: OK", __func__);
Expand Down Expand Up @@ -538,22 +502,18 @@ void wfx_rsi_task(void * arg)
{
EventBits_t flags;
int32_t status = 0;
#ifndef RS911X_SOCKETS
TickType_t last_dhcp_poll, now;
struct netif * sta_netif;
#endif
(void) arg;
uint32_t rsi_status = wfx_rsi_init();
if (rsi_status != RSI_SUCCESS)
{
WFX_RSI_LOG("%s: error: wfx_rsi_init with status: %02x", __func__, rsi_status);
return;
}
#ifndef RS911X_SOCKETS
wfx_lwip_start();
last_dhcp_poll = xTaskGetTickCount();
sta_netif = wfx_get_netif(SL_WFX_STA_INTERFACE);
#endif
wfx_started_notify();

WFX_RSI_LOG("%s: starting event wait", __func__);
Expand All @@ -566,9 +526,6 @@ void wfx_rsi_task(void * arg)
*/
flags = xEventGroupWaitBits(wfx_rsi.events,
WFX_EVT_STA_CONN | WFX_EVT_STA_DISCONN | WFX_EVT_STA_START_JOIN
#ifdef RS911X_SOCKETS
| WFX_EVT_STA_DO_DHCP | WFX_EVT_STA_DHCP_DONE
#endif /* RS911X_SOCKETS */
#ifdef SL_WFX_CONFIG_SOFTAP
| WFX_EVT_AP_START | WFX_EVT_AP_STOP
#endif /* SL_WFX_CONFIG_SOFTAP */
Expand All @@ -584,20 +541,6 @@ void wfx_rsi_task(void * arg)
{
WFX_RSI_LOG("%s: wait event encountered: %x", __func__, flags);
}
#ifdef RS911X_SOCKETS
if (flags & WFX_EVT_STA_DO_DHCP)
{
/*
* Do DHCP -
*/
if ((status = rsi_config_ipaddress(RSI_IP_VERSION_4, RSI_DHCP | RSI_DHCP_UNICAST_OFFER, NULL, NULL, NULL,
&wfx_rsi.ip4_addr[0], IP_CONF_RSP_BUFF_LENGTH_4, STATION)) != RSI_SUCCESS)
{
/* We should try this again.. (perhaps sleep) */
/* TODO - Figure out what to do here */
}
}
#else /* !RS911X_SOCKET - using LWIP */
/*
* Let's handle DHCP polling here
*/
Expand Down Expand Up @@ -639,7 +582,6 @@ void wfx_rsi_task(void * arg)
last_dhcp_poll = now;
}
}
#endif /* RS911X_SOCKETS */
if (flags & WFX_EVT_STA_START_JOIN)
{
// saving the AP related info
Expand All @@ -654,14 +596,12 @@ void wfx_rsi_task(void * arg)
*/
WFX_RSI_LOG("%s: starting LwIP STA", __func__);
wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTED;
#ifndef RS911X_SOCKETS
hasNotifiedWifiConnectivity = false;
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
hasNotifiedIPV4 = false;
#endif // CHIP_DEVICE_CONFIG_ENABLE_IPV4
hasNotifiedIPV6 = false;
wfx_lwip_set_sta_link_up();
#endif /* !RS911X_SOCKETS */
/* We need to get AP Mac - TODO */
// Uncomment once the hook into MATTER is moved to IP connectivity instead
// of AP connectivity. wfx_connected_notify(0, &wfx_rsi.ap_mac); // This
Expand All @@ -673,7 +613,6 @@ void wfx_rsi_task(void * arg)
~(WFX_RSI_ST_STA_READY | WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE);
WFX_RSI_LOG("%s: disconnect notify", __func__);
/* TODO: Implement disconnect notify */
#ifndef RS911X_SOCKETS
wfx_lwip_set_sta_link_down(); // Internally dhcpclient_poll(netif) ->
// wfx_ip_changed_notify(0) for IPV4
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
Expand All @@ -683,7 +622,6 @@ void wfx_rsi_task(void * arg)
wfx_ipv6_notify(GET_IPV6_FAIL);
hasNotifiedIPV6 = false;
hasNotifiedWifiConnectivity = false;
#endif /* !RS911X_SOCKETS */
}
#ifdef SL_WFX_CONFIG_SCAN
if (flags & WFX_EVT_SCAN)
Expand Down
63 changes: 0 additions & 63 deletions examples/platform/silabs/efr32/rs911x/rsi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,7 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t
* Join was complete - Do the DHCP
*/
WFX_RSI_LOG("%s: join completed.", __func__);
#ifdef RS911X_SOCKETS
xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_DO_DHCP);
#else
xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_CONN);
#endif
wfx_rsi.join_retries = 0;
retryInterval = WLAN_MIN_RETRY_TIMER_MS;
}
Expand All @@ -261,34 +257,6 @@ static void wfx_rsi_join_fail_cb(uint16_t status, uint8_t * buf, uint32_t len)
is_wifi_disconnection_event = true;
xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN);
}
#ifdef RS911X_SOCKETS

/******************************************************************
* @fn wfx_rsi_ipchange_cb(uint16_t status, uint8_t *buf, uint32_t len)
* @brief
* DHCP should end up here
* @param[in] status:
* @param[in] buf:
* @param[in] len:
* @return
* None
*********************************************************************/
static void wfx_rsi_ipchange_cb(uint16_t status, uint8_t * buf, uint32_t len)
{
WFX_RSI_LOG("%s: status: %02x", __func__, status);
if (status != RSI_SUCCESS)
{
/* Restart DHCP? */
xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_DO_DHCP);
}
else
{
wfx_rsi.dev_state |= WFX_RSI_ST_STA_DHCP_DONE;
xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_DHCP_DONE);
}
}

#else
/*************************************************************************************
* @fn wfx_rsi_wlan_pkt_cb(uint16_t status, uint8_t *buf, uint32_t len)
* @brief
Expand All @@ -308,7 +276,6 @@ static void wfx_rsi_wlan_pkt_cb(uint16_t status, uint8_t * buf, uint32_t len)
}
wfx_host_received_sta_frame_cb(buf, len);
}
#endif /* !Socket support */

/*************************************************************************************
* @fn static int32_t wfx_rsi_init(void)
Expand Down Expand Up @@ -403,15 +370,11 @@ static int32_t wfx_rsi_init(void)
WFX_RSI_LOG("%s: RSI callback register join failed with status: %02x", __func__, status);
return status;
}
#ifdef RS911X_SOCKETS
(void) rsi_wlan_register_callbacks(RSI_IP_CHANGE_NOTIFY_CB, wfx_rsi_ipchange_cb);
#else
if ((status = rsi_wlan_register_callbacks(RSI_WLAN_DATA_RECEIVE_NOTIFY_CB, wfx_rsi_wlan_pkt_cb)) != RSI_SUCCESS)
{
WFX_RSI_LOG("%s: RSI callback register data-notify failed with status: %02x", __func__, status);
return status;
}
#endif

#if (RSI_BLE_ENABLE)
rsi_semaphore_post(&sl_rs_ble_init_sem);
Expand Down Expand Up @@ -590,22 +553,18 @@ static void wfx_rsi_do_join(void)
void wfx_rsi_task(void * arg)
{
EventBits_t flags;
#ifndef RS911X_SOCKETS
TickType_t last_dhcp_poll, now;
struct netif * sta_netif;
#endif
(void) arg;
uint32_t rsi_status = wfx_rsi_init();
if (rsi_status != RSI_SUCCESS)
{
WFX_RSI_LOG("%s: error: wfx_rsi_init with status: %02x", __func__, rsi_status);
return;
}
#ifndef RS911X_SOCKETS
wfx_lwip_start();
last_dhcp_poll = xTaskGetTickCount();
sta_netif = wfx_get_netif(SL_WFX_STA_INTERFACE);
#endif
wfx_started_notify();

WFX_RSI_LOG("%s: starting event wait", __func__);
Expand All @@ -618,9 +577,6 @@ void wfx_rsi_task(void * arg)
*/
flags = xEventGroupWaitBits(wfx_rsi.events,
WFX_EVT_STA_CONN | WFX_EVT_STA_DISCONN | WFX_EVT_STA_START_JOIN
#ifdef RS911X_SOCKETS
| WFX_EVT_STA_DO_DHCP | WFX_EVT_STA_DHCP_DONE
#endif /* RS911X_SOCKETS */
#ifdef SL_WFX_CONFIG_SOFTAP
| WFX_EVT_AP_START | WFX_EVT_AP_STOP
#endif /* SL_WFX_CONFIG_SOFTAP */
Expand All @@ -636,20 +592,6 @@ void wfx_rsi_task(void * arg)
{
WFX_RSI_LOG("%s: wait event encountered: %x", __func__, flags);
}
#ifdef RS911X_SOCKETS
if (flags & WFX_EVT_STA_DO_DHCP)
{
/*
* Do DHCP -
*/
if ((status = rsi_config_ipaddress(RSI_IP_VERSION_4, RSI_DHCP | RSI_DHCP_UNICAST_OFFER, NULL, NULL, NULL,
&wfx_rsi.ip4_addr[0], IP_CONF_RSP_BUFF_LENGTH_4, STATION)) != RSI_SUCCESS)
{
/* We should try this again.. (perhaps sleep) */
/* TODO - Figure out what to do here */
}
}
#else /* !RS911X_SOCKET - using LWIP */
/*
* Let's handle DHCP polling here
*/
Expand Down Expand Up @@ -705,7 +647,6 @@ void wfx_rsi_task(void * arg)
last_dhcp_poll = now;
}
}
#endif /* RS911X_SOCKETS */
if (flags & WFX_EVT_STA_START_JOIN)
{
// saving the AP related info
Expand All @@ -720,14 +661,12 @@ void wfx_rsi_task(void * arg)
*/
WFX_RSI_LOG("%s: starting LwIP STA", __func__);
wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTED;
#ifndef RS911X_SOCKETS
hasNotifiedWifiConnectivity = false;
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
hasNotifiedIPV4 = false;
#endif // CHIP_DEVICE_CONFIG_ENABLE_IPV4
hasNotifiedIPV6 = false;
wfx_lwip_set_sta_link_up();
#endif /* !RS911X_SOCKETS */
/* We need to get AP Mac - TODO */
// Uncomment once the hook into MATTER is moved to IP connectivty instead
// of AP connectivity. wfx_connected_notify(0, &wfx_rsi.ap_mac); // This
Expand All @@ -739,7 +678,6 @@ void wfx_rsi_task(void * arg)
~(WFX_RSI_ST_STA_READY | WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE);
WFX_RSI_LOG("%s: disconnect notify", __func__);
/* TODO: Implement disconnect notify */
#ifndef RS911X_SOCKETS
wfx_lwip_set_sta_link_down(); // Internally dhcpclient_poll(netif) ->
// wfx_ip_changed_notify(0) for IPV4
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
Expand All @@ -749,7 +687,6 @@ void wfx_rsi_task(void * arg)
wfx_ipv6_notify(GET_IPV6_FAIL);
hasNotifiedIPV6 = false;
hasNotifiedWifiConnectivity = false;
#endif /* !RS911X_SOCKETS */
}
#ifdef SL_WFX_CONFIG_SCAN
if (flags & WFX_EVT_SCAN)
Expand Down
12 changes: 0 additions & 12 deletions examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,8 @@
#define RSI_FEATURE_BIT_MAP (FEAT_SECURITY_OPEN)

//! TCP IP BYPASS feature check
#ifdef RS911X_SOCKETS
#define RSI_TCP_IP_BYPASS RSI_DISABLE

#define RSI_TCP_IP_FEATURE_BIT_MAP \
(TCP_IP_FEAT_DHCPV4_CLIENT | /*TCP_IP_FEAT_HTTP_CLIENT | */ \
TCP_IP_FEAT_EXTENSION_VALID | /*TCP_IP_FEAT_SSL |*/ /*TCP_IP_FEAT_DNS_CLIENT |*/ \
0)
//! To set custom feature select bit map
#define RSI_CUSTOM_FEATURE_BIT_MAP FEAT_CUSTOM_FEAT_EXTENTION_VALID

#else /* Don't use RSI_SOCKETS */
#define RSI_TCP_IP_BYPASS RSI_ENABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_BYPASS /*| TCP_IP_FEAT_EXTENSION_VALID*/)
#endif

//! To set Extended custom feature select bit map
#if WIFI_ENABLE_SECURITY_WPA3
Expand Down
8 changes: 0 additions & 8 deletions src/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ if (chip_crypto == "platform") {
config("siwx917-platform-wifi-config") {
include_dirs = [ "wifi" ]
defines = []

if (use_rs911x_sockets) {
include_dirs += [ "wifi/rsi-sockets" ]
defines += [
"RS911X_SOCKETS",
"RSI_IPV6_ENABLE",
]
}
}
static_library("SiWx917") {
sources = [
Expand Down
3 changes: 0 additions & 3 deletions src/platform/silabs/SiWx917/wifi/lwip_netif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

#ifndef RS911X_SOCKETS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -149,5 +148,3 @@ struct netif * wfx_get_netif(sl_wfx_interface_t interface)
#endif
return (struct netif *) 0;
}

#endif /* RS911X_SOCKETS */
3 changes: 0 additions & 3 deletions src/platform/silabs/SiWx917/wifi/wfx_host_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#define SL_WFX_SCAN_COMPLETE_ID 4
#define WFX_RSI_SSID_SIZE 64

#ifndef RS911X_SOCKETS
/* LwIP includes. */
#include "lwip/apps/httpd.h"
#include "lwip/ip_addr.h"
Expand All @@ -44,8 +43,6 @@
#define SL_WFX_SCAN_COMPLETE (1 << 6)
#define SL_WFX_RETRY_CONNECT (1 << 7)

#endif /* RS911X_SOCKETS */

#include "sl_status.h"

#define WLAN_TASK_STACK_SIZE 1024
Expand Down
Loading

0 comments on commit 2659797

Please sign in to comment.