Skip to content

Adding SiWx917 Network Stack Application APIs #89716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions drivers/wifi/siwx91x/Kconfig.siwx91x
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,157 @@ config WIFI_SILABS_SIWX91X_LIMIT_PACKET_BUF_PER_STA
would be buffered when the STA is in Power Save (PS) mode.
This helps manage buffer usage and ensures efficient packet handling.

config WIFI_SILABS_SIWX91X_SNTP_CLIENT
bool "Offloaded implementation of SNTP client"
help
Enable this option to allow to use the SNTP (Simple Network Time
protocol) implementation provided by the Network Co-Processor present
on SiWx91x series. This implementation usually require less resources
than the Zephyr one. See also sl_sntp.h in Silabs HAL for more
information about the API.

config WIFI_SILABS_SIWX91X_HTTP_CLIENT
bool "Offloaded implementation of HTTP client"
help
Enable this option to allow to use the HTTP (hypertext transfer
protocol) implementation provided by the Network Co-Processor present
on SiWx91x series. This implementation usually require less resources
than the Zephyr one. See also sl_http_client.h in Silabs HAL for more
information about the API.

config WIFI_SILABS_SIWX91X_MQTT_CLIENT
bool "Offloaded implementation of MQTT client"
help
Enable this option to allow to use the MQTT(Message Queuing Telemetry
Transport) implementation provided by the Network Co-Processor present
on SiWx91x series. This implementation usually require less resources
than the Zephyr one. See also sl_mqtt_client.h in Silabs HAL for more
information about the API.

config WIFI_SILABS_SIWX91X_PING
bool "Offloaded implementation of ICMP client"
help
Enable this option to allow to use the MQTT(Internet Control Message
Protocol) implementation provided by the Network Co-Processor present
on SiWx91x series. This implementation usually require less resources
than the Zephyr one. See also sl_net_ping.h in Silabs HAL for more
information about the API.

config WIFI_SILABS_SIWX91X_WEBSOCKET_CLIENT
bool "Offloaded implementation of Websocket client"
help
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can websocket be used without http?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes websocket can be used without http

Enable this option to allow to use the Websocket client implementation
provided by the Network Co-Processor present on SiWx91x series. This
implementation usually require less resources than the Zephyr one.
See also sl_websocket_client.h in Silabs HAL for more information
about the API.

config WIFI_SILABS_SIWX91X_MDNS_RESPONDER
bool "Offloaded implementation of MDNS responder"
help
Enable this option to allow to use the MDNS(Multicast Domain Name
System) implementation provided by the Network Co-Processor present
on SiWx91x series. This implementation usually require less resources
than the Zephyr one. See also sl_mdns.h in Silabs HAL for more
information about the API.

config WIFI_SILABS_SIWX91X_DNS_CLIENT
bool "Offloaded implementation of DNS client"
help
Enable this option to allow to use the DNS(Domain Name System)
implementation provided by the Network Co-Processor present on
SiWx91x series. This implementation usually require less
resources than the Zephyr one. See also sl_net_dns.h in Silabs
HAL for more information about the API.

config WIFI_SILABS_SIWX91X_ENABLE_TLS
bool "Offloaded implementation of TLS"
help
Enable this option to allow to use the TLS(Transport layer Security)
implementation over the network provided by the Network Co-Processor
present on SiWx91x series. This implementation usually require less
resources than the Zephyr one.

config WIFI_SILABS_SIWX91X_ENABLE_SINGLE_TLS_SOCKET
bool "Offloaded implementation of single TLS socket"
depends on WIFI_SILABS_SIWX91X_ENABLE_TLS
help
Enable this option to allow to use the single TLS socket
implementation over the network provided by the Network
Co-Processor present on SiWx91x series.

config WIFI_SILABS_SIWX91X_ENABLE_THREE_SSL_SOCKETS
bool "Offloaded implementation of 3 SSL/TLS sockets"
help
Enable this option to support up to three SSL socket implementations
over the network, utilizing the Network Co-Processor available in
the SiWx91x series.

config WIFI_SILABS_SIWX91X_SSL_HIGH_STREAMING
bool "Offloaded implementation for SSL/TLS high speed"
help
Enable this option to achieve high-throughput SSL/TLS streaming,
This implementation is provided by the Network Co-Processor present
on SiWx91x series.

config WIFI_SILABS_SIWX91X_SSL_VERSIONS_SUPPORT
bool "Offloaded implementation of SSL/TLS multiple versions support"
help
Enable this option to allow the device to support multiple versions
of SSL/TLS over TCP, providing flexibility in handling different
SSL/TLS versions.This implementation is provided by the Network
Co-Processor present on SiWx91x series.

config WIFI_SILABS_SIWX91X_ENABLE_SSL_16K_RECORD
bool "Offloaded implementation to support SSL 16K record"
help
Enable this option to support for 16K SSL record sizes, which improves
performance for SSL connections that use larger record sizes. This
implementation is provided by the Network Co-Processor present on
SiWx91x series.

config WIFI_SILABS_SIWX91X_SSL_MEMORY_CLOUD
bool "Offloaded implementation for the SSL/TLS cloud connections"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option is unclear. Why handshake with cloud servers would be different than a normale TLS server?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enabling this bitmap option in the SiWx917 provides additional RAM memory. To prevent failures during communication with the cloud server, it is necessary to enable this option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the issue is specific to cloud servers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cloud server certificates are typically larger in size.

help
Enable this option to allocate additional memory for SSL/TLS
connections, typically required for connections to cloud servers,
to avoid handshake failure.This implementation is provided by the
Network Co-Processor present on SiWx91x series.

config WIFI_SILABS_SIWX91X_SOCKET_SELECT
bool "Offloaded implementation for socket select"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am really unsure of this option. The idea of pselect() is to be able to watch any file descriptor. I believe we have to provide compatibility with existing pselect implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To use the select option in the SiWx917, need to configure the number of selects. RAM memory will be allocated based on the number of selects specified by the host.

help
Enable this option for the configuration of socket select
implementation over the network provided by the Network
Co-Processor present on SiWx91x series.

config WIFI_SILABS_SIWX91X_SOCKET_SELECT_COUNT
int "Offloaded implementation of select"
default 10
range 1 10
depends on WIFI_SILABS_SIWX91X_SOCKET_SELECT
help
Configure this option for the number of select operations the
device can handle, with a maximum value of 10. This implementation
is provided by the Network Co-Processor present on SiWx91x series.

config WIFI_SILABS_SIWX91X_SOCKETS
bool "Offloaded implementation to configure sockets"
help
Enable this option to configure the number of sockets in SiWx91x.
over the network .This implementation is provided by the Network
Co-Processor present on SiWx91x series.

config WIFI_SILABS_SIWX91X_TOTAL_SOCKETS
int "Offloaded implementation for maximum number of sockets"
default 10
range 1 10
depends on WIFI_SILABS_SIWX91X_SOCKETS
help
Configure this option for total number of sockets to use. A maximum
of 10 sockets are allowed to use. This implementation is provided
by the Network Co-Processor present on SiWx91x series.

config WIFI_SILABS_SIWX91X_ENABLE_ROAMING
bool "WiFi roaming support"
default y
Expand Down
55 changes: 55 additions & 0 deletions modules/hal_silabs/wiseconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ zephyr_include_directories(

zephyr_library_sources(
${SISDK_DIR}/platform/common/src/sl_core_cortexm.c
${SISDK_DIR}/platform/common/src/sl_slist.c
${WISECONNECT_DIR}/components/device/silabs/si91x/mcu/core/chip/src/rsi_deepsleep_soc.c
${WISECONNECT_DIR}/components/device/silabs/si91x/mcu/core/chip/src/system_si91x.c
${WISECONNECT_DIR}/components/device/silabs/si91x/mcu/drivers/peripheral_drivers/src/clock_update.c
Expand Down Expand Up @@ -110,6 +111,60 @@ if(CONFIG_WIFI_SILABS_SIWX91X)
)
endif() # CONFIG_WIFI_SILABS_SIWX91X

if(CONFIG_WIFI_SILABS_SIWX91X_NET_STACK_OFFLOAD)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can merge this section with the files declared in zephyr_library_*_ifdef(CONFIG_WIFI_SILABS_SIWX91X_NET_STACK_OFFLOAD.

zephyr_compile_definitions_ifdef(CONFIG_WIFI_SILABS_SIWX91X_SNTP_CLIENT
SLI_SI91X_INTERNAL_SNTP_CLIENT
)
zephyr_include_directories_ifdef(CONFIG_WIFI_SILABS_SIWX91X_SNTP_CLIENT
${WISECONNECT_DIR}/components/service/sntp/inc
${WISECONNECT_DIR}/components/device/silabs/si91x/wireless/inc/sntp
)
zephyr_library_sources_ifdef(CONFIG_WIFI_SILABS_SIWX91X_SNTP_CLIENT
${WISECONNECT_DIR}/components/service/sntp/si91x/sl_sntp.c
)
zephyr_compile_definitions_ifdef(CONFIG_WIFI_SILABS_SIWX91X_HTTP_CLIENT
SLI_SI91X_INTERNAL_HTTP_CLIENT
)
zephyr_include_directories_ifdef(CONFIG_WIFI_SILABS_SIWX91X_HTTP_CLIENT
${WISECONNECT_DIR}/components/service/http_client/inc
${WISECONNECT_DIR}/components/device/silabs/si91x/wireless/inc/http_client/inc
)
zephyr_library_sources_ifdef(CONFIG_WIFI_SILABS_SIWX91X_HTTP_CLIENT
${WISECONNECT_DIR}/components/service/http_client/si91x_socket/sl_http_client.c
${WISECONNECT_DIR}/components/device/silabs/si91x/wireless/src/sl_si91x_http_client_callback_framework.c
)
zephyr_compile_definitions_ifdef(CONFIG_WIFI_SILABS_SIWX91X_MQTT_CLIENT
SLI_SI91X_EMBEDDED_MQTT_CLIENT
)
zephyr_include_directories_ifdef(CONFIG_WIFI_SILABS_SIWX91X_MQTT_CLIENT
${WISECONNECT_DIR}/components/service/mqtt/inc
${WISECONNECT_DIR}/components/device/silabs/si91x/wireless/inc/mqtt/inc
)
zephyr_library_sources_ifdef(CONFIG_WIFI_SILABS_SIWX91X_MQTT_CLIENT
${WISECONNECT_DIR}/components/service/mqtt/si91x/sl_mqtt_client.c
)
zephyr_include_directories_ifdef(CONFIG_WIFI_SILABS_SIWX91X_PING
${WISECONNECT_DIR}/components/device/silabs/si91x/wireless/icmp
)
zephyr_library_sources_ifdef(CONFIG_WIFI_SILABS_SIWX91X_PING
${WISECONNECT_DIR}/components/device/silabs/si91x/wireless/icmp/sl_net_ping.c
)
zephyr_include_directories_ifdef(CONFIG_WIFI_SILABS_SIWX91X_WEBSOCKET_CLIENT
${WISECONNECT_DIR}/components/service/sl_websocket_client/inc
)
zephyr_library_sources_ifdef(CONFIG_WIFI_SILABS_SIWX91X_WEBSOCKET_CLIENT
${WISECONNECT_DIR}/components/service/sl_websocket_client/src/sl_websocket_client.c
)
zephyr_include_directories_ifdef(CONFIG_WIFI_SILABS_SIWX91X_MDNS_RESPONDER
${WISECONNECT_DIR}/components/service/mdns/inc
)
zephyr_library_sources_ifdef(CONFIG_WIFI_SILABS_SIWX91X_MDNS_RESPONDER
${WISECONNECT_DIR}/components/service/mdns/si91x/sl_mdns.c
)
zephyr_library_sources_ifdef(CONFIG_WIFI_SILABS_SIWX91X_DNS_CLIENT
${WISECONNECT_DIR}/components/device/silabs/si91x/wireless/sl_net/src/sl_net_si91x.c
)
endif() # CONFIG_WIFI_SILABS_SIWX91X_NET_STACK_OFFLOAD
if(CONFIG_BT_SILABS_SIWX91X)
zephyr_compile_definitions(
SLI_SI91X_ENABLE_BLE
Expand Down
8 changes: 8 additions & 0 deletions samples/boards/siwx91x/siwx91x_sample_app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(siwx91x_sample_app)

target_sources(app PRIVATE src/main.c)
40 changes: 40 additions & 0 deletions samples/boards/siwx91x/siwx91x_sample_app/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.. zephyr:code-sample:: siwx91x_sample_app
:name: siwx91x sample app

Overview
********

A sample application that demonstrates the DNS client and ICMP functionality.
This program will get the IP address of the given hostname and the ICMP will
initiate a PING request to the address obtained from the DNS client.

Requirements
************

* Windows PC (Remote PC).
* SiWx91x Wi-Fi Evaluation Kit(SoC).

Configuration Parameters
************************
The below confgurations are available in app_config.h file

#define SSID "SiWx91x_AP" // Wi-Fi Network Name
#define PSK "12345678" // Wi-Fi Password
#define SECURITY_TYPE WIFI_SECURITY_TYPE_PSK // Wi-Fi Security Type: WIFI_SECURITY_TYPE_NONE/WIFI_SECURITY_TYPE_WPA_PSK/WIFI_SECURITY_TYPE_PSK
#define CHANNEL_NO WIFI_CHANNEL_ANY // Wi-Fi channel
#define HOSTNAME "www.zephyrproject.org" //Hostname to ping

Building and Running
********************

* This sample can be found under :zephyr_file:`zephyr/samples/boards/siwx91x/siwx91x_sample_app` in the Zephyr tree.

* Build:- west build -b siwx917_rb4338a samples/boards/siwx91x/siwx91x_sample_app/ -p

* Flash:- west flash

Test the Application
********************
* Open any serial console to view logs.
* After program gets executed, SiWx91x EVK will be connected to an Access Point with configured **SSID** and **PSK**
* The device will start sending ping requests to the given hostname and the response can be seen in network_event_handler().
10 changes: 10 additions & 0 deletions samples/boards/siwx91x/siwx91x_sample_app/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CONFIG_WIFI=y
CONFIG_NETWORKING=y
CONFIG_WIFI_SILABS_SIWX91X_NET_STACK_OFFLOAD=y
CONFIG_NET_IPV4=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_IPV6=n
CONFIG_NET_DHCPV6=n
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_WIFI_SILABS_SIWX91X_PING=y
CONFIG_WIFI_SILABS_SIWX91X_DNS_CLIENT=y
11 changes: 11 additions & 0 deletions samples/boards/siwx91x/siwx91x_sample_app/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sample:
name: siwx91x sample app
description: Demonstrates ICMP functionality
tests:
sample.boards.siwx91x.siwx91x_sample_app:
harness: Wi-Fi
platform_allow:
- siwx917_rb4338a
tags: Wi-Fi
integration_platforms:
- siwx917_rb4338a
45 changes: 45 additions & 0 deletions samples/boards/siwx91x/siwx91x_sample_app/src/app_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _CONFIG_H_
#define _CONFIG_H_

/* Wi-Fi Network Name */
#define SSID "SiWx91x_AP"
/* Wi-Fi Password */
#define PSK "12345678"
/* Wi-Fi Security Type:
* WIFI_SECURITY_TYPE_NONE/WIFI_SECURITY_TYPE_WPA_PSK/WIFI_SECURITY_TYPE_PSK
*/
#define SECURITY_TYPE WIFI_SECURITY_TYPE_PSK
/* Wi-Fi channel */
#define CHANNEL_NO WIFI_CHANNEL_ANY
#define STACK_SIZE 4096
#define STATUS_OK 0
#define STATUS_FAIL -1
#define CMD_WAIT_TIME 180000

/* Hostname to ping */
#define HOSTNAME "www.zephyrproject.org"
#define DNS_TIMEOUT (20 * MSEC_PER_SEC)
#define PING_PACKET_SIZE 64
#define PING_PACKETS 30

static struct {
const struct shell *sh;
uint32_t scan_result;

union {
struct {
uint8_t connecting: 1;
uint8_t disconnecting: 1;
uint8_t _unused: 6;
};
uint8_t all;
};
} context;

#define WIFI_SHELL_MGMT_EVENTS (NET_EVENT_WIFI_CONNECT_RESULT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this symbol useful?


#endif /* _CONFIG_H_ */
Loading
Loading