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>
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>
[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>
[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>
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>
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>
The version header is generated during build and generated path included
already has "zephyr" directory.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
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>
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>
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>
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>
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>
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>
'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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>