Commit graph

30 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Kamil Panek 8a23205a22 drivers: wifi: eswifi: fix swapped protocols in eswifi_off_getaddrinfo
As a result, when values returned by getaddrinfo were used, the wrong
socket was created.

Signed-off-by: Kamil Panek <kamil.panek@wbudowane.pl>
2021-05-25 16:59:17 -05: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
Carles Cufi c37e167b8c drivers: eswifi: Fix macro names for offloading
When offloading only ZSOCK_POLLIN and DNS_EAI_MEMORY are available, so
use those instead of the standard ones.

Fixes #28069.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-09-04 14:47:57 -04:00
Loic Poulain 4eba946e2b drivers: wifi: eswifi: Implement dns offload callbacks
Implement getaddrinfo and freeaddrinfo callbacks.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-09-04 09:51:09 +03:00
Loic Poulain 6ea54db334 drivers: wifi: eswifi: fix socket poll
- Fix return value, must be number structures with events
- set revents flag

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
Paul Sokolovsky 9ef03bb54c drivers: eswifi: Remove unused variable in ioctl routine
Variable "sd" is no longer referenced after refactoring in 2ed6b6a8ed.
It caused warning-as-error when building using sanitycheck, e.g. in CI.
This is 2nd fixed of the above refactor, after eb9a18432.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-08-19 14:35:10 +03:00
Vincent Wan eb9a184324 drivers: fix socket close() implementations for socket offloading
PR #27485 introduced new implementations for close() that do not build
correctly. This commit fixes the problem by re-implementing them.

Fixes #27587

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-08-18 10:41:01 +03:00
Jukka Rissanen 2ed6b6a8ed lib: fdtable: Add callback for close() calls
Do not route close() calls via ioctl() as that is error prone
and quite pointless. Instead create a callback for close() in
fdtable and use it directly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-14 09:47:51 -07:00
David Leach f4caf7b890 drivers: wifi: eswifi: fix coverity Out-of-bounds access errors
There are multiple CID errors all based on the test of
'socket > ESWIFI_OFFLOAD_MAX_SOCKETS'. The test needs to
be '>=' in all cases.

Fixes: #27138
Fixes: #27139
Fixes: #27140
Fixes: #27141
Fixes: #27142
Fixes: #27143

Signed-off-by: David Leach <david.leach@nxp.com>
2020-07-28 07:03:55 -04:00
Parthiban Nallathambi 13808b7d83 drivers: wifi: eswifi: fix compilation warnings
Fix compilation warnings when CONFIG_NET_SOCKETS_OFFLOAD enabled

warning: passing argument 5 of '__eswifi_socket_new' makes pointer
 from integer without a cast [-Wint-conversion]
  395 |  idx = __eswifi_socket_new(eswifi, family, type, proto, 0x50CE);
      |                                                         ^~~~~~
      |                                                         |
      |                                                         int
eswifi.h:137:21: note: expected 'void *' but argument is of type 'int'
  137 |    int proto, void *context);
      |               ~~~~~~^~~~~~~
In function 'eswifi_socket_bind':
warning: comparison between pointer and integer
  461 |  if ((addrlen == NULL) || (addr == NULL) ||
      |

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-24 11:13:31 +03:00
Parthiban Nallathambi 0725719ada drivers: wifi: eswifi: Convert raw timeout values to use K_MSEC()
Use K_MSEC instead of raw timeout value.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-24 11:13:31 +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
Adam Porter 722a85aea2 drivers: wifi: remove dependency on NET_SOCKETS_POSIX_NAMES
This change removes references to raw POSIX types and functions,
allowing the drivers to build without NET_SOCKETS_POSIX_NAMES.

After this, the dependency between NET_SOCKETS_OFFLOAD and
NET_SOCKETS_POSIX_NAMES can be removed.

See issue #26033 for additional context

Signed-off-by: Adam Porter <porter.adam@gmail.com>
2020-06-15 16:59:36 +02: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
Robert Lubos aa17850455 drivers: wifi: eswifi: Rework offloading mechanism
Switch to `NET_SOCKET_REGISTER` mechanism over the offloaded API
registration.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-01-31 11:36:02 -05: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