Commit graph

139 commits

Author SHA1 Message Date
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
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
Declan Snyder 4cc80097d3 drivers: wifi: include sockets headers
Some wifi drivers need internal sockets headers
included to build, put this in CMakeLists

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-11-21 08:48:04 +00:00
Benedikt Schmidt 49ce054200 drivers: adc: fix thread function signatures
Fix the data acquisition thread function signatures to avoid a stack
corruption on thread exit.
Fixes #62637

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-10-30 12:24:34 +01:00
Jukka Rissanen 493fe169a8 drivers: eswifi: Fix the SSID copying
The wrong ssid_len was used which causes build error.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-10-10 15:50:22 +03:00
Flavio Ceolin ea109f6a20 drivers: eswifi: shell: Fix possible overflow
Limit the copied data to the buffer's size.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 11:41:49 +02:00
Flavio Ceolin 2504329b76 drivers: eswifi: Fix possible buffer overflow
Limit the number of the copied ssid to WIFI_SSID_MAX_LEN
and avoid a possible one byte overflow.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 11:41:49 +02:00
Chien Hung Lin cad51f874c driver: wifi: eswifi: Fix spi buffer length
The eswifi spi driver sets up spi buffer length as number of frames,
but the length shall be number of bytes. Because eswifi use 16 bit as
frame size, so this turns out reading and writing half of data and
fails to sending any at command request and getting any responds from
eswifi module.

Fix it by setting up length as number of bytes.

Fixes #62056

Signed-off-by: Chien Hung Lin <chienhung.lin.tw@gmail.com>
2023-09-05 10:05:37 +02:00
Fabio Baltieri 2a2b314fc4 drivers: fix few mismatched CONTAINER_OF
Fix few mismatched CONTAINER_OF, one missing k_work_delayable_from_work
conversion and few cases where the target should be pointing at the
first element explicitly.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:21:23 +02:00
Nick Ward 2d65acca3a drivers: gpio: use gpio_is_ready_dt helper function
Update `struct gpio_dt_spec` use with gpio_is_ready_dt()

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-08-28 08:48:35 -05:00
Chaitanya Tata a132487fec net: wifi: Move Wi-Fi ops to a separate struct
Decouple interface and Wi-Fi APIs, Wi-Fi APIs are common independent of
Wi-Fi offload or implemented natively (This is preparation for
introducing Native Wi-Fi).

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2023-07-11 14:55:30 +02:00
Ajay Parida 69fead1998 net: mgmt: Support for forced Passive scan
Default scan mode is Active. User can force the scan mode to passive
through Kconfig option or using 'passive' option from shell.
Using either of this option will override regulatory settings and
forces all scan channels to be passive only.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2023-06-29 21:05:41 +02:00
Chaitanya Tata 7987098497 drivers: wifi: Register Wi-Fi architecture type
Identify the Wi-Fi capability to the networking stack and also the type
of Wi-Fi (Native vs Offloaded), this helps identifying Wi-Fi interfaces
that can be used by applications.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2023-06-26 16:12:32 +02:00
Gerard Marull-Paretas 667eeb11fb shell: fix MISRA 5.7 violations on struct shell
MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-14 12:21:08 +02:00
Loic Poulain df7871c412 wifi: eswifi: Add support for wifi mgmt status command
Implement wifi iface status interface.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-04-07 13:27:12 +02:00
Loic Poulain 78940f52fc wifi: eswifi: Add status work to track connection
There is no event reporting WiFi disconnect, create a polling
work for this and report the event.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-04-07 13:27:12 +02:00
Loic Poulain c8f48681ed wifi: eswifi: Fix socket client initialization
It has been observed that sockets can be in bad state after
boot. Be sure to correctly reset local port and any 'server'
mode before configuring client mode.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-04-07 13:27:12 +02:00
Loic Poulain 836ace829b wifi: eswifi: Fix infinite offloaded poll
- We should wait indefinitely if msecs is -1 (FOREVER).
- We can directly return if data is already available in FIFO.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-04-07 13:27:12 +02:00
Loic Poulain 54e8d10e61 wifi: eswifi: Fix UDP receiving
There is no listen or accept for UDP, we need to enable the UDP
server mode (P5=1) as soon as bind is complete.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-04-07 13:27:12 +02:00
Georges Oates_Larsen 3c6b7dc35a net: dummy L2 for offloaded ifaces
Adds dummy link layer for offloaded ifaces, allowing
ifaces to directly receive l2_enable calls

Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
2023-03-20 09:53:25 +01:00
Brian Dunlay 491933b185 drivers: wifi: eswifi: Guard net_ctx state change
Previously, a call to set the net_context state was added here to
accommodate a new KConfig scenario that permitted disabling offload
sockets. This code path is used by both local and offloaded sockets.
While it is necessary to update the state of the net_context for a
locally managed socket, setting the net_context for an offloaded socket
is an error, as the net_context is invalid (in fact, it points to a
hard-coded dummy socket), as observed in #52346 and #38544.

A prior commit (a9ac0a88) attempting to remedy the offload socket
scenario removed this line, which resulted in problems for the local
socket scenario. The socket never got updated to the connected state,
and thus was unusable.

Adding this guard allows the eswifi socket to set the socket net_context
only if the socket is NOT offloaded.

Signed-off-by: Brian Dunlay <brian@nubix.io>
2022-12-12 14:55:03 +01:00
Bartosz Bilas e077fb73ec drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt
`spi_is_ready` function is being deprecated in favor of
`spi_is_ready_dt` so let's replace the old usage in the tree.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-12-07 09:40:23 -06:00
Brian Dunlay a9ac0a884e drivers: wifi: eswifi: Offload sockets regression
This change fixes a regression from commit 1cbc0acd.

Socket offload uses a dummy socket context, and setting
the socket state in this dummy context is invalid.

Fixes #52317

Signed-off-by: Brian Dunlay <brian@nubix.io>
2022-11-28 10:48:10 +01:00
Michał Zając f93c68239e wifi: eswifi: fix random crash due to work->handler set to NULL
This fixes a random crash caused by race condition in the eswifi
driver used by the disco L475 iot1 board.

Signed-off-by: Michał Zając <m.zajac@avsystem.com>
2022-10-19 16:06:49 +02:00
Kumar Gala 25cb2bff74 drivers: wifi: Update drivers to use devicetree Kconfig symbol
Update Wifi drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-31 21:57:06 +00:00
Sylvio Alves 20c3256016 net: wifi: Allow to use offloaded wifi_mgmt API with native stack
wifi drivers that depends on native ethernet stack cannot perform
wifi API calls missing availability. This changes adds the ethernet_api
interface in wifi_mgmt so that it becomes possible.

Naming "offload" in "struct net_wifi_mgmt_offload" is kept because
Zephyr still has no supplicant to handle a full non-offloaded driver.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-08-29 17:31:17 +02:00
Brian Dunlay 9f94db1805 drivers: eswifi: fix spi initialization
This change reverts a portion of a prior change that results
in an uninitialized eswifi_spi_data struct to be passed to
the `is_spi_ready` function.
See commit 48c87f2bf8

Signed-off-by: Brian Dunlay <brian.dunlay@gmail.com>
2022-08-17 12:10:02 +02:00
Kumar Gala 1cce353536 drivers: eswifi: Remove unused 'csn' field from struct
The 'csn' field is not being used so remove it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 12:42:45 -05:00
Anas Nashif 49b36ead95 drivers: add mising braces to single line if statements
Following zephyr's style guideline, all if statements, including single
line statements shall have braces.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 11:00:45 -04:00
Kumar Gala 48c87f2bf8 wifi: eswifi: spi: Move spi bus into config
Move 'struct spi_dt_spec bus' into the config struct so it
can be const and than possibly placed in ROM.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 08:45:25 -05:00
Kumar Gala c4f5439221 wifi: eswifi: Update driver to use gpio_dt_spec
Replace eswifi_gpio with gpio_dt_spec.  We can replace devicetree
label based access with this change as we try and phase out the
usage of the 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 08:45:25 -05:00
Kumar Gala 9dfbae0ba5 wifi: eswifi: Convert to DEVICE_DT_GET
Move to using DEVICE_DT_GET so we can phase out DT_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 11:09:03 +02:00
Krzysztof Chruscinski 041f0e5379 all: logging: Remove log_strdup function
Logging v1 has been removed and log_strdup wrapper function is no
longer needed. Removing the function and its use in the tree.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 13:42:23 +02:00
Gerard Marull-Paretas fd2052d524 drivers: remove redundant <zephyr/zephyr.h> includes
Files including <zephyr/kernel.h> do not have to include
<zephyr/zephyr.h>, a shim to <zephyr/kernel.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-15 09:13:11 +02:00
Loic Poulain 9b3e6042d9 wifi: eswifi: Fix socket offload TCP server
- The listen callback was not implemented.
- EOF packet not reported
- accept cb was broken

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2022-06-05 14:44:46 +02:00
Loic Poulain 8923fc3186 wifi: eswifi: Implement listen helper
The listen helper will be used by eswifi socket offload layer.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2022-06-05 14:44:46 +02:00
Loic Poulain 2bcd469ca2 wifi: eswifi: Fix missing peer addr family on TCP connect
The sin_family was not filled properly.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2022-06-05 14:44:46 +02:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Robert Lubos 7946988b16 net: sockets: Add separate macro for registering offloaded sockets
Add a separate macro for registering offloaded sockets implementation,
along with information in the structure whether the implementation is
offloaded or not. This allows to differentiate between native and
offloaded socket implementations, which is critical for binding socket
API with an interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-04-20 11:27:05 +02:00
Robert Lubos fa8ba73833 net: if: Connect interface with offloaded socket implementation
Instead of keeping a boolean informing whether a network interface is
offloaded at socket layer or not, keep a pointer to a function which
allows to create an offloaded socket. Native interfaces keep this as
NULL, while for offloaded interfaces it allows to connect an offloaded
socket implementation with an interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-04-20 11:27:05 +02:00
Marcin Niestroj 9531db73d0 wifi: eswifi: implement 'is_supported' socket offload cb
Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

There is explicit support for UDP, TCP and TLS on top of IPv4.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:24 -07:00
Marcin Niestroj fe90e4932b wifi: eswifi: use NET_SOCKETS_OFFLOAD_PRIORITY
Use NET_SOCKETS_OFFLOAD_PRIORITY instead of
NET_SOCKETS_OFFLOAD_PRIORITY, so that by default offloaded sockets will
be used instead of native sockets.

Addiitonally this allows to select relative priority of offloaded TLS
versus native TLS when used together with NET_SOCKETS_TLS_PRIORITY.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:50:11 -07:00
Nazar Kazakov 9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Bartosz Bilas b5497d7d2f drivers: wifi: eswifi: fix spi bus initialization
spi_dt_spec structure initialization should not be done
in the runtime during spi bus initialization because it
caues kernel panic.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/43046

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-02-28 10:52:17 +01:00
Yong Cong Sin 731241f8d0 kernel: workq: Fix type errors in delayable work handlers
A common pattern here was to take the work item as the subfield of a
containing object. But the contained field is not a k_work, it's a
k_work_delayable.

Things were working only because the work field was first, so the
pointers had the same value. Do things right and fix things to
produce correct code if/when that field ever moves within delayable.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-02 18:43:12 -05:00
Mateusz Kwiatkowski e8c12f2af0 drivers: wifi: eswifi: fix socket poll timeout
Fix a problem introduced in 6ea54db334 that caused the poll operation to
take 10x more time than intended.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
2021-12-23 11:19:00 +01:00
Tomasz Bursztyka f6be2835bd drivers: Apply SPI API change to relevant places
Mostly drivers, but also one sample and one test.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-19 11:50:38 +01:00
Bartosz Bilas 7965d7582b drivers: wifi: eswifi: convert to spi_dt_spec
Convert eswifi driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-10-26 17:40:54 -04:00
Robert Lubos 0dbdcc770d net: sockets: Add socket processing priority
When creating a socket, all of the registered socket implementation are
processed in a sequence, allowing to find appropriate socket
implementation for specified family/type/protocol. So far however,
the order of processing was not clearly defined, leaving ambiguity if
multiple implmentations supported the same set of parameters.

Fix this, by registering socket priority along with implementation. This
makes the processing order of particular socket implementations
explicit, giving more flexibility to the user, for example when it's
neeed to prioritze one implementation over another if they support the
same set of parameters.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-28 20:11:26 -04:00