Commit Graph

2256 Commits

Author SHA1 Message Date
Natalia Pluta
c9f9c144e9 samples: net: cellular_modem: fix division by zero in sample_echo_packet
A hard fault occurs when the `sample_echo_packet` function attempts
to print the average time per successful echo and no packets have
been sent, resulting in a division by zero error. This fix adds a check
to ensure that `packets_sent` is greater than 0 before performing
the division. This prevents the system from halting due to a usage fault.

Signed-off-by: Natalia Pluta <pluta.natalia.m@gmail.com>
2024-07-10 11:37:44 +02:00
Jukka Rissanen
794d7cf3c5 net: sockets: Remove async service support
As found in PR #75525, we should not modify the polled fd array
in multiple places. Because of this fix, the async version of
the socket service could start to trigger while it is being handled
by the async handler. This basically means that the async version
cannot work as intended so remove its support.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-07-10 11:36:59 +02:00
Robert Lubos
e91c47d338 samples: net: zperf: Optimize configuration for better performance
Increase the number of network packets and buffers for better TCP
performance in the sample out-of-the-box.
Decrease the network buffer data size for better buffer management in
the sample (less buffer space wasted for L2 header). The only drawback
of this is reduced TCP TX performance, but less than 2 Mbps in my case.
Finally, enable speed optimizations for another small performance boost.

As the RAM requirements of the sample now increase considerably in the
default configuration, add a note in the readme file about it, and how
to make it fit into smaller boards.

Tested on nucleo_h723zg:
  Before (current defaults):
    UDP      TX          RX
         76.47 Mbps  93.48 Mbps
    TCP      TX          RX
         76.18 Mbps  67.75 Mbps

  After (new defaults):
    UDP      TX          RX
         76.08 Mbps  93.62 Mbps
    TCP      TX          RX
         74.19 Mbps  85.51 Mbps

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-07-06 17:03:01 +02:00
Alberto Escolar Piedras
1a1032de48 samples/net/dhcpv4_client: Exclude native_posix due to EVENTFD
EVENTFD is not anymore compatible with these targets so let's
disable them with this sample to avoid a failure in twister
otherwise.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-07-04 17:59:34 +02:00
Robert Lubos
71f668d1f3 samples: net: dhcpv4_client: Enable DNS in the sample
The DHCP server can distribute DNS addresses, hence enable DNS resolver
in the sample to show this functionality.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-07-02 14:17:16 +02:00
Robert Lubos
28ed03afc4 samples: net: dhcpv4_client: Replace example DHCP server with kea
Currently used DHCP server in the sample, dhcpd, is no longer maintained
and reached EOL. Therefore, update the sample's readme file with a
sample configuration for its successor, kea.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-07-02 14:17:16 +02:00
Jukka Rissanen
c95f61f688 samples: net: txtime: Do not run qemu_x86 with twister
The txtime can be run manually with qemu_x86 but it is enough
to have native_sim compiled with twister.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-06-29 05:50:04 -04:00
Jukka Rissanen
ba88c50fb3 samples: net: txtime: Add e1000 overlay for qemu_x86
This allows user to run the sample in qemu_x86.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-06-29 05:50:04 -04:00
Jukka Rissanen
d9703934f1 samples: net: txtime: Add support for native_sim board
native_sim needs to enable PTP clock support

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-06-29 05:50:04 -04:00
Jukka Rissanen
d121e88390 samples: net: txtime: The option type should be int
When setting boolean options using setsockopt(), the option
type should be int as the size of the option type is checked
and only int is accepted.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-06-29 05:50:04 -04:00
Robert Lubos
125f1f593e samples: net: zperf: Fix sample performance issues
Sockets service thread need to be cooperative for best performance.

Enable CACHE_MANAGEMENT as some boards don't do it by default, it has
devastating impact on the performance as well.

Finally, increase FDS count, so that uploads still work when both TCP
and UDP receiver are enabled.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-27 08:47:26 -04:00
Jordan Yates
243eb36b18 everywhere: reindent .overlay files with tabs
`checkpatch.pl` requires that dts sources are indented with tabs,
fix all the spaces that slipped in while checkpatch wasn't watching.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-26 15:59:44 +02:00
Robert Lubos
4ba53a6325 samples: net: sockets: echo_client/server: Remove duplicate configs
A few configs in prj.conf were duplicated, remove duplicates.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-25 14:15:16 -04:00
Robert Lubos
67187f620b samples: net: sockets: echo_client/server: Bump ZVFS_OPEN_MAX config
Recent POSIX changes caused that 3 file descriptors are now preallocated
for stdin/out/err. This caused file descriptor shortage in all-in TLS
configuration of the sample, hence increase the maximum FD count.

In the server sample this manifested itself as an accept() error. This
triggered a busy loop though in the sample, as in case of accept()
errors it'd just try again w/o any delay. This made this issue hard to
investigate, so to avoid such cases in the future, make the accept()
failure fatal in the echo_server sample.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-25 14:15:16 -04:00
Robert Lubos
fa27d706ea samples: net: sockets: echo_client/server: Bump DTLS max frag len
Echo samples exchange data fragments longer than the default DTLS max
fragment length introduced in commit
f033cd5601. Hence, need to increase this
config value for the sample.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-25 14:15:16 -04:00
Robert Lubos
9391ca9893 samples: net: sockets: echo_client: Bump NET_SOCKETS_POLL_MAX config
Commit 3046e95d85 introduced eventfd use
in the sample, increasing the pollfd array size, however the config
indicating maximum number of monitored events remained intact, so the
sample didn't really work.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-25 14:15:16 -04:00
Bjarki Arge Andreasen
9f867a1893 samples: net: cellular_modem: disable AT shell for NRF91_SLM
The NRF91_SLM has no additional AT channel for the AT shell to
use. This commit disables the AT shell for boards which use
the NRF91_SLM.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-06-25 12:18:40 -04:00
Robert Lubos
913b06251d samples: net: sockets: net_mgmt: Increase main thread priority
net_mgmt sockets do not implement internal queue but use
net_mgmt_event_wait() internally to receive events. As a consequence,
in case of events burst, some events may be lost if the receiving
thread has lower priority than the net_mgmt thread.

This was visible in the sample, where only DAD event was reported
properly, as IPv6 Add/Remove events were triggered in pair with
corresponding multicast events (from solicited-node multicast
address).

We can mitigate this by increasing main thread priority to be at the
same priority as net_mgmt thread, so that the receiving thread (main)
has a chance to run in between event reports.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-25 10:25:37 -04:00
Robert Lubos
ca322ec3d4 samples: net: sockets: big_http_download: Fix build with TLS enabled
After enabled POSIX_API in the sample, not all headers were included in
the build due to #ifdefs around header inclusions. This commit fixes
this.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-24 12:42:16 -04:00
Robert Lubos
bed98044e3 samples: net: tftp_client: Bump main thread stack size
The sample was crashing due to stack overflow on the main thread.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-24 12:42:16 -04:00
Robert Lubos
648b3db443 samples: net: telnet: Bump IPv6 mcast address count
The multicast IPv6 address count was too low to create all
solicited-node multicast address, resulting in an error being
printed on boot:

  Cannot join solicit node address ff02::1:ff00:1 for 1 (-12)

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-24 12:42:16 -04:00
Robert Lubos
c8ce949ec7 samples: net: stats: Update project configuration
Fix two issues with the current configuration:
* The log buffer was too small for the sample, causing part of the stats
  printout to be dropped
* The sample set CONFIG_NET_CONFIG_NEED_IPV4 but did not actually set
  any IPv4 address, nor enable DHCP, causing the NET_CONFIG
  initialization failure.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-24 12:42:16 -04:00
Robert Lubos
63a5d26877 samples: net: mdns_responder: Bump CONFIG_NET_SOCKETS_POLL_MAX
Socket service library threw an error, the configured value was too
low for it to work.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-24 12:42:16 -04:00
Robert Lubos
65d9bf1ed7 samples: net: lwm2m_client: Bump IPv6 mcast address count
The multicast IPv6 address count was too low to create all
solicited-node multicast address, resulting in an error being
printed on boot:

  Cannot join solicit node address ff02::1:ff00:1 for 1 (-12)

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-24 12:42:16 -04:00
Robert Lubos
bd4469aa79 samples: net: dns_resolve: Increase socket-related configs
Current NET_SOCKETS_POLL_MAX and ZVFS_OPEN_MAX values were too low for
the sample after the DNS refactoring, making the sample unusable in
current state.

Bump those values accordingly to make the sample functional again.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-21 08:44:29 -04:00
Benjamin Cabé
3c3627b968 samples: net: vlan: improve README formatting
simple tweaks to improve HTML rendering of the
vLAN README

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-06-20 14:07:32 -04:00
Benjamin Cabé
dea2bcb214 samples: net: tftp: doc: formatting/spelling clean up
misc fixes to ensure proper formatting and spelling of the
TFTP sample README

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-06-20 14:07:32 -04:00
Benjamin Cabé
f6d0383a97 samples: net: http_server: use proper language in code-block
Achieve proper syntax highlighting using "console"
language when command snippets start with a prompt.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-06-20 14:07:32 -04:00
Benjamin Cabé
bd73073708 doc: samples: net: mqtt: improve formatting
use code literal formatting for KConfig identifiers

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-06-20 14:07:32 -04:00
Benjamin Cabé
b4b623c26c doc: use proper pygment for .conf code-blocks
config file snippets should use "cfg" pygment to get proper highlighting
This commit updates all occurences where "kconfig" or other languages
were used.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-06-20 14:07:32 -04:00
Adam Wojasinski
3684294a64 samples: net: ptp: Add sample for PTP
This application demonstrates PTP functionality

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-06-13 05:40:41 -04:00
Bjarki Arge Andreasen
597b838e84 samples: net: cellular_modem: include at shell
Include new AT shell alongside the PM device shell to allow
for powering back up the modem after the sample has completed
to test out the at shell.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-06-10 15:12:34 -05:00
Robert Lubos
0163ae5332 samples: net: sockets: http_server: Disable PSA crypto
The sample won't build with PSA crypto enabled on non-secure platform,
causing disturbances in the CI.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-07 16:45:05 +03:00
Robert Lubos
c26f1bef49 samples: net: sockets: Add netif dependency where missing
A few samples were not limiting the CI execution scope in any reasonable
way, they should at least limit the execution to platforms that support
netif capability.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-07 16:45:05 +03:00
Francois Ramu
f55391745b drivers: ethernet: stm32 eth hal driver align PTP Config Status
Align the name of the ETH PTP Config Status values
depending on the stm32HAL serie
to be the HAL_ETH_PTP_NOT_CONFIGURATED/HAL_ETH_PTP_CONFIGURATED
or HAL_ETH_PTP_NOT_CONFIGURED/HAL_ETH_PTP_CONFIGURED

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-06-07 13:00:44 +02:00
Stanislav Poboril
684885a7f3 boards: nxp: Support NXP ENET_1G on mimxrt1170_evk
Support NXP ENET_1G on mimxrt1170_evk/mimxrt1176/cm7 platform.
Added test configuration sample.net.zperf.nxp_enet1g and
documented the usage of the ethernet driver with ENET_1G
peripheral.

Fixes: #66348

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2024-06-06 20:08:27 -04:00
Chris Friedt
bc4374b5fe posix: deprecate POSIX_MAX_FDS and add POSIX_DEVICE_IO
The POSIX_MAX_FDS option does not correspond to any standard
POSIX option. It was used to define the size of the file
descriptor table, which is by no means exclusively used by
POSIX (also net, fs, ...).

POSIX_MAX_FDS is being deprecated in order to ensure that
Zephyr's POSIX Kconfig variables correspond to those defined in
the specification, as of IEEE 1003.1-2017. Namely,
POSIX_OPEN_MAX. CONFIG_POSIX_MAX_OPEN_FILES is being deprecated
for the same reason.

To mitigate any possible layering violations, that option is
not user selectable. It tracks the newly added
CONFIG_ZVFS_OPEN_MAX option, which is native to Zephyr.

With this deprecation, we introduce the following Kconfig
options that map directly to standard POSIX Option Groups by
simply removing "CONFIG_":

* CONFIG_POSIX_DEVICE_IO

Similarly, with this deprecation, we introduce the following
Kconfig options that map directly to standard POSIX Options by
simply removing "CONFIG":

* CONFIG_POSIX_OPEN_MAX

In order to maintain parity with the current feature set, we
introduce the following Kconfig options.

* CONFIG_POSIX_DEVICE_IO_ALIAS_CLOSE
* CONFIG_POSIX_DEVICE_IO_ALIAS_OPEN
* CONFIG_POSIX_DEVICE_IO_ALIAS_READ
* CONFIG_POSIX_DEVICE_IO_ALIAS_WRITE

Gate open(), close(), read(), and write() via the
CONFIG_POSIX_DEVICE_IO Kconfig option and move
implementations into device_io.c, to be conformant with the
spec.

Lastly, stage function names for upcoming ZVFS work, to be
completed as part of the LTSv3 Roadmap (e.g. zvfs_open(), ..).

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-04 16:27:12 -05:00
Chris Friedt
4a5c4e5f73 posix: timers: deprecate CONFIG_POSIX_CLOCK and TIMER
The POSIX_CLOCK option does not correspond to any standard
option. It was used to active features of several distinct
POSIX Options and Option Groups, which complicated API and
application configuration as a result.

POSIX_CLOCK is being deprecated in order to ensure that Zephyr's
POSIX Kconfig variables correspond to those defined in the
specification, as of IEEE 1003.1-2017.

Additionally, CONFIG_TIMER is being deprecated because it does
not match the corresponding POSIX Option (_POSIX_TIMERS).

With this deprecation, we introduce the following Kconfig
options that map directly to standard POSIX Option Groups by
simply removing "CONFIG_":

* CONFIG_POSIX_TIMERS

Similarly, we introduce the following Kconfig options that
map directly to standard POSIX Options by simply removing
"CONFIG":

* CONFIG_POSIX_CLOCK_SELECTION
* CONFIG_POSIX_CPUTIME
* CONFIG_POSIX_DELAYTIMER_MAX
* CONFIG_POSIX_MONOTONIC_CLOCK
* CONFIG_POSIX_TIMEOUTS
* CONFIG_POSIX_TIMER_MAX

In order to maintain parity with the current feature set, we
introduce the following Kconfig options that map directly to
standard POSIX Option Groups by simply removing "CONFIG_":

* CONFIG_POSIX_MULTI_PROCESS - sleep()

Similarly, in order to maintain parity with the current feature
set, we introduce the following additional Kconfig options that
map directly to standard POSIX Options by simply removing
"CONFIG":

* CONFIG_XSI_SINGLE_PROCESS - gettimeofday()

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-04 16:27:12 -05:00
Robert Lubos
3f9d21e721 samples: net: cloud: mqtt_azzure: Add missing mbed TLS configs
Due to the recent changes in mbed TLS area, and due to adding new
certificates to the sample, the mbed TLS configuration has to be update
to be able to support them all.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-04 13:38:45 +02:00
Robert Lubos
0749043ff4 samples: net: cloud: mqtt_azure: Update sample certificates
Baltimore certificate expires in 2025 and Azure is in the transition
period for the time being to the new certificates. Add support for all
certificates needed in the sample.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-04 13:38:45 +02:00
Jukka Rissanen
8363b8cfd9 samples: net: Increase CONFIG_NET_SOCKETS_POLL_MAX to pass checks
The number of suitable network IPv6/4 configurations in interfaces
affect the number of pollable sockets. So need to increase the value
from the default value of 3.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-06-03 09:49:01 +02:00
Hake Huang
83d087caa3 samples: net: mqtt_publisher: increase num of thread to allowed
according to the latest build log, we need increase the MAX_THREEED

/usr/bin/python3 scripts/build/gen_kobject_list.py \
--kernel twister-out/frdm_k64f/samples/net/mqtt_publisher/\
sample.net.mqtt_publisher.userspace/zephyr/zephyr_pre0.elf \
--gperf-output kobject_prebuilt_hash.gperf --include-subsystem-list \
twister-out/frdm_k64f/samples/net/mqtt_publisher/\
sample.net.mqtt_publisher.userspace/zephyr/misc/generated/struct_tags.json
Too many thread objects (17)
Increase CONFIG_MAX_THREAD_BYTES to 3

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2024-06-03 09:48:07 +02:00
Tomi Fontanilles
c1342b3aa9 modules: mbedtls: remove the default enabling of features
In an effort to shave off code size, remove out-of-the-box
enabling of crypto features (except SHA-256).

Configurations are adjusted to enable what they need.

Bonuses:

- When enabled, AES now defaults to using a smaller version
(`CONFIG_MBEDTLS_AES_ROM_TABLES` isn't default enabled anymore,
and if enabled, `CONFIG_MBEDTLS_AES_FEWER_TABLES` defaults to y).

- Conditions around Mbed TLS Kconfig options have been improved
to reflect the reality of the dependencies.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-31 16:33:06 -05:00
Markus Lassila
53ddff6395 samples: net: cellular_modem: Fix nRF9160
Add missing Kconfigs to nRF9160dk overlays.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
2024-05-31 09:04:03 +02:00
Bjarki Arge Andreasen
06c2762124 samples: net: cloud: tagoio: Remove GSM modem overlay
The gsm modem driver is deprecated and will be removed. Remove
the build overlay and dependency on the gsm modem from the
tagoio sample.

The new cellular modem driver and subsystem use the native
networking stack and the pm subsystem, so just like ethernet,
enabling the cellular modem is up to the board configuration.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-29 10:49:08 -07:00
Bjarki Arge Andreasen
c8050e2a83 samples: net: Remove deprecated gsm_modem sample
The gsm_modem driver is deprecated, and will be removed. Remove
the gsm modem sample which depends on the deprecated driver.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-29 10:49:08 -07:00
Jukka Rissanen
99693bee5f net: socket: Change the protocol field for AF_PACKET sockets
In order to be compatible with Linux AF_PACKET socket calls, the
protocol field needs to be in network byte order.
So for example, if user wants to receive all packets, then the
protocol field needs to be set as "htons(ETH_P_ALL)".
See Linux manual page at
https://www.man7.org/linux/man-pages/man7/packet.7.html
for details.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-29 10:48:34 -07:00
Marcin Niestroj
197a4b2f5f samples: net: http_get: fix typo in sections names in sample.yaml
Just do: s/sample.get/sample.net/.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-29 14:06:20 +02:00
Robert Lubos
63d4037e2f samples: net: Exclude native_posix when socket service lib is used
Socket service library uses eventfd, which does not work with
native_posix platform, hence need to exclude it from samples that now
rely on socket services.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-05-29 11:59:51 +02:00
Tomi Fontanilles
7669b58d9d samples: http_get: exclude native_posix in the CONFIG_POSIX_API=y build
CONFIG_POSIX_API depends on !CONFIG_NATIVE_APPLICATION, which is
incompatible with the native_posix platforms.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-29 08:39:26 +02:00