Commit graph

21 commits

Author SHA1 Message Date
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 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
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
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
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 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
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
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
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
Chris Coleman cb1d588ea7 drivers: wifi: eswifi: Fix err log & NET_SOCKETS_OFFLOAD=n config
Change Highlights:

- Fix error check after `k_work_reschedule_for_queue`. A value of 1
  means job was scheduled which was resulting in a ton of "<err>
  wifi_eswifi: Rescheduling socket read error" logs getting printed
  due to the erroneous check
- When using the B-L475E-IOT01A, attempts to use a TLS socket result
  in a hang when socket offload is enabled so I'd like to have a way
  to disable the option. To accomplish this, I I switched the
  `CONFIG_NET_SOCKETS_OFFLOAD=n` Kconfig option from `select` to
  `imply`.
- There was a missing `net_context_set_state()` call when
  `CONFIG_NET_SOCKETS_OFFLOAD=n`. I applied the same fix from #30664
  for this case to fix the issue.

Signed-off-by: Chris Coleman <chris@memfault.com>
2021-06-17 12:41:03 +02:00
Peter Bigot 9fcd75160e drivers: wifi: rote conversion of k_work API
Replace all existing deprecated API with the recommended alternative.

Be aware that this does not address architectural errors in the use
of the work API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-14 07:07:40 -04:00
Loic Poulain 733af9a709 drivers: wifi: eswifi: Improve read work
Schedule read work every 100ms for better latency.
Reschedule read work directly in case of a packet is received
(fast dequeue).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-09-04 09:51:09 +03:00
Loic Poulain 377f6c2a31 drivers: wifi: eswifi: rework read work
Remove non necessary eswifi lock/unlock in read procedure (eswifi
lock support nesting).

Return NULL packet in case socket is closed by remote (tested with
net shell and net recv).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-08-28 13:18:31 +03:00
Parthiban Nallathambi 352e2a7ad4 drivers: wifi: eswifi: Coverity fix
Fix https://github.com/zephyrproject-rtos/zephyr/issues/27325
unchecked return value

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-08-14 18:50:17 -04:00
Loic Poulain 0a1de7e96a drivers: wifi: eswifi: Stop client before starting
Stop any TCP/UDP client session before starting a new one.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-07-30 16:35:58 +03:00
Parthiban Nallathambi 1cb20aee34 driver: wifi: eswifi: use common log module
use common log module across all eswifi sources, which allows
to compile with CONFIG_NET_SOCKETS_OFFLOAD.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-24 11:13:31 +03:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Xavier Chapron 2a8ff02ef2 drivers: Replace printf by printk when applicable
Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-05-09 21:25:33 +02:00
NavinSankar Velliangiri e5328b8931 drivers: wifi: Fix the use of net_pkt_write() in eswifi driver
net_pkt_write() function returns 0 on success. But in this driver a
warning is thrown when zero is returned. Hence fix the driver to throw
the warning only when the negative value is returned.

Signed-off-by: NavinSankar Velliangiri <navin@linumiz.com>
2019-12-18 21:58:21 +01:00
Peter Bigot ab91eef23b coccinelle: standardize kernel API timeout arguments
Use the int_literal_to_timeout Coccinelle script to convert literal
integer arguments for kernel API timeout parameters to the standard
timeout value representations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-03 11:55:44 -07:00
Saravanan Sekar 1aa696bc2b wifi: eswifi: Implement TCP/UDP socket offload with TLS
Newly implement socket based communication on eswifi mainly to
achive TLS. Tested with Inventek ISM43362-M3G-L44.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
2019-09-13 16:54:57 +03:00