Commit graph

720 commits

Author SHA1 Message Date
Ajay Parida
41e29c6cad drivers: wifi: Option for PS data retrieval
SHEL-2947] Option to set either PS-poll or QoS null frame based
power save data retrieval mechanism.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2024-08-22 14:23:56 -04:00
Sachin D Kulkarni
1f494387b1 nrf_wifi: Remove dependency on OSAL layer handle
Removes the requirement for the different layers in the OS agnostic
parts of the driver having to maintain a handle to the OS interface
layer in order to call the OS interface calls. The OS interface layer
now maitains the handle to OS-specific ops internally and invokes the
appropriate functions.

Fixes SHEL-2639

Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
2024-08-22 14:23:56 -04:00
Kapil Bhatt
e085d440c2 drivers: wifi: Reset interface statistics data
[SHEL-2542] When reset command is called this will
reset all statistics including firmware and host.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-22 14:23:56 -04:00
Kapil Bhatt
37a98bfa79 drivers: wifi: Add kconfig option to disable WMM feature
[SHEL-2054] Adding a kconfig option for WMM.
By default it will be enabled. If user needs
to disable it, set it as n.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-22 14:23:56 -04:00
Chaitanya Tata
2e52f0d154 drivers: wifi: Fix build error with conn_mgr
Fix the binding to the connection manager.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-08-20 18:58:08 -04:00
Morihisa Momona
9afc79d16a wifi: airoc: join/leave of multicast address
Add the support of join and leave of multicast address group.

Signed-off-by: Morihisa Momona <morihisa.momona@infineon.com>
2024-08-19 10:02:25 -04:00
Morihisa Momona
ba3d49f38f wifi: airoc: FIX interface up (in softap)
When creating softap, interface is not recognized as up.

Signed-off-by: Morihisa Momona <morihisa.momona@infineon.com>
2024-08-19 10:02:25 -04:00
Morihisa Momona
f95c878493 wifi: airoc: FIX Security modes of SoftAP
Updated security modes verification in ap_enable.
SoftAP supports following modes:
 - No security (WHD\_SECURITY\_OPEN)
 - WPA2-PSK security (WHD_SECURITY_WPA2_AES_PSK)
 - WPA3-SAE security (WHD_SECURITY_WPA3_SAE)

Signed-off-by: Morihisa Momona <morihisa.momona@infineon.com>
2024-08-19 10:02:25 -04:00
Morihisa Momona
6b21699f50 wifi: airoc: FIX connection to AP with open security
STA fails to connect AP, of which security is open.

Signed-off-by: Morihisa Momona <morihisa.momona@infineon.com>
2024-08-19 10:02:25 -04:00
Pisit Sawangvonganan
9347887b33 wifi: esp32: update link_mode to reflect actual negotiated PHY mode
Updated `link_mode` assignment to reflect the actual negotiated PHY mode
by using `esp_wifi_sta_get_negotiated_phymode`.

Since `ap_info.phy_11b` ... `ap_info.phy_11ax` represent the access point
capabilities and not the actual current link mode.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-16 16:29:36 +01:00
Maochen Wang
4c2ce36e6f drivers: wifi: Add NXP wifi shim driver support
Add NXP wifi shim driver code.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-08-07 07:17:23 -04:00
Chaitanya Tata
bf4d8cc2cc drivers: wifi: nrf: Fix build error in utils
When Wi-Fi utils is enabled it causes build error due to missing rename
in a couple of places.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-08-07 07:13:27 -04:00
Chaitanya Tata
8c3f1cf662 drivers: wifi: nrf: Fix include path for version
The version header is generated during build and generated path included
already has "zephyr" directory.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-08-07 07:13:27 -04:00
Chaitanya Tata
638ce2fbfd drivers: wifi: Add nRF70 Wi-Fi driver
Driver for Nordic nRF70 Wi-Fi6 companion chipset, depends on
hal_nordic/nrf_wifi for OS agnostic part of the driver.

This supports (Q)SPI interface to communicate from host to chip.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-08-06 10:27:21 +02:00
Léo BRIAND
cf0c2a5275 drivers: wifi: eswifi: Fix memory buffer allocation in off_read_work
When receiving data over the eswifi module, we currently read the data
first, then allocate a buffer, and finally write the data into the
buffer. The issue is that if we can't allocate the buffer, the data
that was read is lost. To fix this, we should first attempt to allocate
the buffer before reading any data. If we can't allocate the buffer, we
should not proceed with reading the data. By allocating a buffer with
the MTU size, we can read the packet, write it into the allocated buffer
and then resize by removing unused allocated buffer with
net_pkt_trim_buffer().

Signed-off-by: Léo BRIAND <leo.briand@smile.fr>
2024-08-02 18:42:53 -05:00
Marcin Niestroj
460b111fb4 drivers: wifi: esp_at: support listening UDP sockets in active mode
So far receving was possible in active mode, but IP and port information
was not fetched nor propagated to application layer. Support fetching that
information even in active mode, so that using bind() with recvfrom() is
working accordingly.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-08-01 12:36:07 +02:00
Marcin Niestroj
086ae6e84f drivers: wifi: esp_at: move socket allocation to cmd_ipd_parse_hdr()
This is just a step forward to make cmd_ipd_parse_hdr() capable of parsing
IP address and port when CONFIG_WIFI_ESP_AT_PASSIVE_MODE=n. After obtaining
this information (IP and port) it will be simply much easier to write this
information into 'struct esp_socket' directly, instead of passing to upper
layer.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-08-01 12:36:07 +02:00
Marcin Niestroj
0e11b68a32 drivers: wifi: esp_at: utilize esp_pull*() in cmd_ipd_parse_hdr()
Use common utilities for consuming parameters from AT response string.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-08-01 12:36:07 +02:00
Marcin Niestroj
d093783606 drivers: wifi: esp_at: handle ':' in esp_pull()
Treat ':' similar as ',', '\r' and '\n', so that AT response parameter
parsing can be gracefully stopped.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-08-01 12:36:07 +02:00
Marcin Niestroj
1caab70918 drivers: wifi: esp_at: introduce esp_pull_long() helper
Use it to get information about RSSI. In subsequent commits this helper
will be used to get other information as well.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-08-01 12:36:07 +02:00
Marcin Niestroj
806842b759 drivers: wifi: esp_at: s/ntohs/htons/ after parsing port number
'struct sockaddr_in' should contain port number in network byte order. This
means that htons() macro should be used, instead of ntohs().

This was working before since both htons() and ntohs() end up in calling
BSWAP_16().

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-08-01 12:36:07 +02:00
Marcin Niestroj
c368c332c4 drivers: wifi: esp_at: fix UDP socket setup
Right now AT+CIPSTART command is called with both "remote port" and "local
port" being set to the same number. This means that for outgoing UDP
traffic (e.g. when resolving DNS or when reaching out some application
server with CoAP over UDP) always the same outgoing port is used. Such
behavior is wrong, since by default a random outgoing port should be used.

Reusing the same port confuses server implementation that is reached out,
since especially in context of DTLS over UDP, outgoing port defines TLS
context/session to be used. Such servers often ignore TLS packets from new
sessions (e.g. after device reboot) and result in failed DTLS connection
attempts.

Commit dbf3d6e911 ("drivers: esp_at: implement bind() and recvfrom() for
UDP sockets") added support for "server-side listening" for incoming
traffic on UDP sockets, which introduced broken behavior of using the same
remote and local port.

In esp_bind() implementation assign newly intorduced 'src' member, instead
of reusing 'dst'. Don't call AT+CIPSTART yet at this stage, as in case of
connect() Zephyr syscall esp_bind() (via bind_default() helper function) is
called implicitly to assign random generated local port, so remote port is
yet to be assigned. Check in esp_recv() whether socket was already
connected (i.e. esp_connect() was called) and if not, invoke
AT+CIPSTART (via _sock_connect()) to start listening on "server-side" UDP
socket.

This patch fixes broken behavior of always reusing the same local port for
outgoing UDP traffic. Instead, randomly generated (by Zephyr net_context
subsys) local port is used. Additionally bind() and recvfrom()
implementation (to handle server-side UDP sockets) is improved, so that
binding to 0.0.0.0 (on any interface) is possible.

Fixes: dbf3d6e911 ("drivers: esp_at: implement bind() and recvfrom() for
  UDP sockets")
Fixes: 424ea9f5e4 ("drivers: wifi: esp_at: do not connect socket on
  bind(INADDR_ANY)")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-07-09 19:06:12 +02:00
Sylvio Alves
6ade0cf715 wifi: esp32: fix memory leak
In case where the system is overloaded, net stack buffer
could fail to allocate next packet. That scenario requires
wifi internal Wi-Fi driver to free current rx buffer. This is
currently not being called. This fixes it by making sure
esp_wifi_internal_free_rx_buffer() is called in all scenarios.

Fixes #63043

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-07-08 20:41:16 -04:00
Marcin Niestroj
2e956c239b drivers: wifi: esp_at: check if MAC address was parsed successfully
Log an error when MAC address was not parsed successfully.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-07-05 18:45:47 +02:00
Marcin Niestroj
4150765549 drivers: wifi: esp_at: use memcpy() to copy SSID
Target SSID buffer might not be NULL terminated, so use memcpy() instead of
strncpy() for copying it from temporary (AT response fragment) buffer.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-07-05 18:45:29 +02:00
Nazar Palamar
af04e0d3fa drivers: wifi/airoc: Update cb_search to check SSID length
Issue:
When there are two similar SSIDs (e.g. MySSID and MySSID_Guest),
the current implementation may use the wrong (truncated) SSID
for the connection. See issue#74910 for details.

Fix:
Updated airoc_wifi_scan_cb_search to filter all SSID where
length is different than the user-entered SSID.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-07-03 15:05:57 -04:00
Chris Friedt
9ada52f060 fdtable: replace z_ prefix with zvfs_ for fdtable.h functions
For each of the fdtable.h functions listed below, convert the
z_ prefixed semi-private functions to use the zvfs_ prefix.

ZVFS stands for Zephyr Virtual File System and
is intended to be a common library used by the C library,
POSIX API, Networking, Filesystem, and other areas.

There are already a few functions in fdtable.h that use the
zvfs_ prefix, so this change is mostly about unifying them in
a way that uses a suitable prefix ("namespace") so that it can
be considered a public API.

- z_alloc_fd
- z_fdtable_call_ioctl
- z_finalize_fd
- z_finalize_typed_fd
- z_free_fd
- z_get_fd_obj
- z_get_fd_obj_and_vtable
- z_get_obj_lock_and_cond
- z_reserve_fd

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-26 12:33:02 +02:00
Nazar Palamar
f41cb40a6e drivers: wifi/airoc: update airoc_wifi_host_buffer_get
Update airoc_wifi_host_buffer_get function to set final
buff size based on input “size” param.

Update airoc_mgmt_send to use airoc_wifi_host_buffer_get
instead net_buf_alloc_len.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-06-18 15:55:19 +02:00
Chris Friedt
12cc7bbd8a net: sockets: use z_finalize_typed_fd() to identify as sockets
Fill-in the mode field of the fd_entry so that the
implementation can be made aware that the specific file
descriptors created are sockets.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-15 07:47:12 -04:00
barry batsbak
2b7a39e83c drivers: wifi: add bssid/mac to wifi_scan result
copy bssid in wifi scan result if set

Signed-off-by: barry batsbak <sonofviking@protonmail.com>
2024-06-13 17:50:08 +02:00
Ryan Erickson
2eef28a624 drivers: change Laird references to Ezurio
Laird is now Ezurio.
Update web links.

Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2024-06-05 17:37:54 -05:00
Chris Friedt
0fa97326c7 posix: create kconfig options for pse51, pse52, pse53
Create Kconfig "shortcuts" for PSE51, PSE52, and PSE53.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-04 16:27:12 -05:00
Tomi Fontanilles
3efdbe6c0c modules: mbedtls: rename CONFIG_MBEDTLS_MAC_*_ENABLED and rm duplicates
Remove the `_MAC` part because those Kconfig options enable only hash
algorithms, nothing MAC-related, and the `_ENABLED` part to align the
naming to the Mbed TLS defines (plus we don't need such a part).

As a bonus, enabling SHA-256 does not automatically enable SHA-224
anymore.

See the migration guide entries for more details on the practical
changes.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-29 08:39:26 +02:00
Sylvio Alves
bda05fb51a drivers: wifi: esp32: remove pre-defined mbedTLS requirements
In #72651, build fails due to conflict when enabling mbedTLS components.
Current Wi-Fi implementation for ESP32 can discard those selected cryptos.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-05-16 18:54:43 -04:00
John Johnson
15a1b6d5c2 drivers: esp_at: make esp_pull_quoted() to only return -EAGAIN
If no " character is found in buffer by esp_pull_quoted() it
returns -EAGAIN which causes a loop that never ends. This is because
the buffer dont get filled up with new data so no " chrachter will be
found. This commit changes esp_pull_quoted() to only return -EAGAIN,
so the buffer can get filled with new data and thus the loop can come
to an end.

Signed-off-by: John Johnson <john.filip.johnson@gmail.com>
2024-05-15 14:59:03 +02:00
Marcin Niestroj
3431d09f09 drivers: wifi: esp_at: fix missing channel in scan result
WiFi scan results were not updated with information about channel, after
scan results parsing was updated. Fix that.

Fixes: a6b06004c2 ("drivers: wifi: esp_at: handle commas in SSIDs during
  scan and status")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-04-12 16:51:52 -04:00
Marcin Niestroj
424ea9f5e4 drivers: wifi: esp_at: do not connect socket on bind(INADDR_ANY)
All connect() syscalls result in EISCONN error, since underlying
_sock_connect() is attempted to be called twice. Once from net_context.c'
bind_default() (with INADDR_ANY) as part of esp_bind() and second time as
part of esp_connect().

Do not call _sock_connect() from esp_bind(INADDR_ANY), which happens as
part of connect().

Fixes: dbf3d6e911 ("drivers: esp_at: implement bind() and recvfrom() for
  UDP sockets")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-04-10 12:23:12 -05:00
Nazar Palamar
a83d2dad8d wifi: airoc: remove dependency on CYHAL
Removing dependency on cyhal in airoc wifi driver.

It need to build airoc wifi driver with different than
PSoC 6 Soc like STM32

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-04-09 16:57:49 +02:00
Lucas Tamborrino
fe57a12cf2 drivers: esp32: update to hal_espressif v5.1
Modify necessary drivers to meet updated hal.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-04-05 13:39:53 +02:00
Samy Francelet
4163ea0207 drivers: eswifi: Add option for maximum data size
Default MAX_DATA_SIZE might be too small depending
on application (e.g. handling the scan result with 12 APs detected)
Added config option for MAX_DATA_SIZE and warning for the user

Signed-off-by: Samy Francelet <samy.francelet@ik.me>
2024-03-15 15:16:27 -05:00
Jukka Rissanen
8860a81cfe drivers: Change drivers to support new IPv4 netmask setting API
Make sure that the drivers use the new IPv4 netmask setting API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-03 18:58:29 +01:00
Marcin Niestroj
a6b06004c2 drivers: wifi: esp_at: handle commas in SSIDs during scan and status
SSIDs can contains commas (,) when receiving scan results (+CWLAP) or
status (+CWJAP) over AT command from ESP-AT chip. This is in conflict with
modem subsystem argument parsing, which separates arguments automatically
whenever comma is encountered.

Use a direct modem command parsing, so that commas within quoted strings
are taken into account to be part of that string, instead of being treated
as delimiter.

This solves `wifi scan` and `wifi status` Zephyr shell commands output, for
networks containing commas (like "My_2,4GHz_AP") as part of SSID.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-02-28 18:02:44 +00:00
Marcin Niestroj
de30757d21 drivers: wifi: esp_at: escape SSID and PSK
According to [1], SSID and PSK need to be escaped:

  Escape character syntax is needed if SSID or password contains any
  special characters, such as , or " or \

Implement character escaping to fix connection attempt to WiFi APs
containing special characters as part of SSID, like "My_2,4GHz_AP".
Increase "connect command" buffer length to handle worst-case scenario of
all the SSID and PSK characters being special characters.

[1] https://docs.espressif.com/projects/esp-at/en/release-v2.4.0.0/esp32/AT_Command_Set/Wi-Fi_AT_Commands.html#id6

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-02-28 18:02:44 +00:00
John Johnson
dbf3d6e911 drivers: esp_at: implement bind() and recvfrom() for UDP sockets
Implement bind() and recvfrom() for UDP sockets. This is achived by
setting remote field in net_pkt which in return makes recvfrom() fill
in *src_addr. This is only implemented for passiv mode and CIPDINFO needs
to be enabled. Also set net_if to non-dormant when enabling AP mode to
make binding to a port and address possible.

Signed-off-by: John Johnson <john.filip.johnson@gmail.com>
2024-02-26 12:21:47 +01:00
Thomas Stranger
ade3c72a35 drivers: wifi: esp_at: fix ssid_len calucation for AP query.
The driver seems to be designed to use the very last byte of the
buffer(scan, connect), so null terminating the status query
might have unintended consequences.
However we should not use strlen to determine the ssid_len,
to avoid depending on the following buffer(bssid) to be zeroed.
Related to CID 316354

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2024-02-16 10:15:37 -06:00
Jordan Yates
ef21569ac9 wifi: conn_mgr connectivity bindings
Bind WiFi network devices to the generic WiFi connectivity backend if
the appropriate option is set.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-01-30 18:51:46 -05:00
Keith Packard
07943eae86 drivers/wifi/esp32: Remove _POSIX_C_SOURCE define as unneeded
This driver doesn't use any APIs outside of the Zephyr C library list, so
it doesn't need this _POSIX_C_SOURCE define.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-01-26 07:48:55 -05:00
Jordan Yates
7e7ab495c3 wifi: esp_at: compile without NET_NATIVE_IPV4
Allow the driver to compile without `CONFIG_NET_NATIVE_IPV4`. This can
happen if the driver is only desired for SSID scanning.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-01-17 14:42:19 +01:00
Chun-Chieh Li
173e4983fd drivers: wifi: esp_at: fix last rx data loss in Passive Receive mode
In Passive Receive mode, ESP modem will buffer rx data.
This fix makes the data still available to user,
even though the peer has closed the socket.
Otherwise, user will fail to get the last rx data,
when the socket is closed by the peer.

Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
2024-01-03 10:21:09 +01:00
Sylvio Alves
b8d887f0e1 net: wifi: esp32: disable automatic reconnection on leaving
Automatic Wi-Fi station reconnection is forced even when
application requests disconnection. This PR adds a check
in the disconnection event reason to decide whether or not
perform the reconnection.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-12-11 09:57:02 +01:00