Commit graph

22,555 commits

Author SHA1 Message Date
Stine Akredalen
8df332714b bluetooth: mesh: health_cli: Add callback to pull msg for periodic pub
The Health Client model supports periodic publication and thus requires
the update callback to be initialized.

This commit implements a callback inside the health client model and
adds a wrapper to it so that the user can fill up the msg buffer.
This way, the Config Server will always accept
Config Model Publication Set message with periodic publication
parameters. If the users callback returns an error or is not
implemented, the periodic publication will be aborted.

Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
2024-12-20 10:18:54 +01:00
Pete Skeggs
6ec5729a3d net: lib: tls_credentials: return size required
If either no buffer is provided or the size of it
is too small, return the required length.

Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
2024-12-20 03:17:10 +01:00
Riadh Ghaddab
e0f0256538 zms: optimize write function by skipping unnecessary reads
when performing a write ZMS checks if the data exists in the storage to
avoid double writing the same data and save some memory cycle life time.
However this downgrades the write performance.
Enable this feature only when CONFIG_ZMS_NO_DOUBLE_WRITE is enabled.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2024-12-19 19:55:30 +01:00
Valerio Setti
39068cc70e mbedtls: select ENTROPY_GENERATOR when a driver is available
This is based on the introduction of a helper Kconfig symbol in
"subsys/random/Kconfig" which is named CSPRNG_AVAILABLE. When this is
enabled it means that there is a "zephyr,entropy" property defined in the
device-tree, therefore Mbed TLS can select ENTROPY_GENERATOR to allow
the platform specific driver to be included into the build.

This commit also changes other locations where CSPRNG_ENABLED was used
moving it to CSPRNG_AVAILABLE in order to solve dependency loop
build failures.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-12-19 17:53:37 +01:00
Jukka Rissanen
3f4b5a6f3b net: shell: ping: Do not wait in ICMP Echo-Req
Use the net_icmp_send_echo_request_no_wait() when sending
ICMP Echo-Req so that we can avoid the warning message from
system workqueue handler.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 15:18:33 +01:00
Jukka Rissanen
81c60e7257 net: icmp: Add a way to send ICMP Echo-Req without waiting
Create a net_icmp_send_echo_request_no_wait() variant that will
not wait when allocating net_buf to be sent. This variant will avoid
a warning to be printed when sending Echo-Req from a system workqueue
because the work cannot sleep in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 15:18:33 +01:00
Kyra Lengfeld
b65f53dd76 Bluetooth: Mesh: enable scanner before enabling proxy gatt
Once proxy gatt is enabled, due to the nature of gatt advertisements
being continuous, the controller will reject starting the scanner after
enabling proxy gatt. As such we should start the scanner first.

Currently the order works as we are using k_work to postpone the proxy
gatt service registration, because services can't be registered between
initializing BT and loading the settings.
Once we start using the new settings priority feature, we are sure to
envoke enabling proxy gatt after loading the settings, so the delayed
enabling can and should be removed.

This preventetive fix has been tested by running relevant bsim tests
after rearranging in which order the settings of the subsystems are
loaded via `h_commit`.

Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
2024-12-19 12:37:54 +01:00
Jukka Rissanen
420c4b153e net: ethernet/vlan: Add support for embedding ll header
If Ethernet based network device driver is advertizing
ETHERNET_EMBEDDED_LL_HEADER, then the L2 driver will can
return the proper L2 header size for the network interface.
This info is then used in TX to determine whether to have a
separate net_buf for the link level header, or to embed the
header to the same net_buf as the L2 payload.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 10:21:28 +01:00
Jukka Rissanen
45ac1f9848 net: pkt: Add possibility to reserve link layer header
Allow network device driver to configure the system so that
when a network packet is sent to it, the link layer header
is stored just before the L2 payload in the same packet.

Currently the link layer header is stored in a separate
net_buf that is linked in front of the L2 payload.

This option can typically save one net_buf when sending
a network packet. Note that if you are using variable data
size buffers (CONFIG_NET_BUF_VARIABLE_DATA_SIZE) then this
embedding is not needed because one can allocate just the
right size network buffers and not waste any memory.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 10:21:28 +01:00
Jukka Rissanen
24bf9c2334 net: ipv4: Re-join multicast groups if needed
If network interface goes operative down, then re-join user defined
IPv4 multicast groups that where joined earlier when the interface comes
up again. If user takes the network interface down manually (admin down),
then the user specific groups are not re-joined. This works now the same
way as IPv6 re-joining.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 10:20:56 +01:00
Peter Mitsis
5710e034e7 kernel: Introduce _THREAD_SLEEPING state bit
At the present time, Zephyr does has overlap between sleeping and
suspending. Not only should sleeping and suspended be orthogonal
states, but we should ensure users always employ the correct API.
For example, to wake a sleeping thread, k_wakeup() should be used,
and to resume a suspended thread, k_thread_resume() should be used.
However, at the present time k_thread_resume() can be used on a
thread that called k_sleep(K_FOREVER). Sleeping should have nothing
to do with suspension.

This commit introduces the new _THREAD_SLEEPING thread state along
with some prep-work to facilitate the decoupling of the sleeping and
suspended thread states.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-12-18 18:17:03 +01:00
Robert Lubos
6e37d31c15 net: http_server: Support PUT/PATCH/DELETE for dynamic resources
Extend the list of methods supported by dynamic resources with
PUT/PATCH/DELETE. The methods does not require any extra handling
from the server perspective, so the existing method handlers could be
reused.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-12-18 18:15:02 +01:00
Yishai Jaffe
1b4cef325b shell: use shell_device_get_binding
Use shell_device_get_binding() instead of device_get_binding() so that
we get the device based on its name and in addition by its label.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2024-12-18 15:32:10 +01:00
Jordan Yates
d2bb5973ae zbus: optional unique channel numeric identifiers
Add the option for a unique numeric identifiers to be attached to a
zbus channel. This identifier can then be used to lookup the channel
structure at runtime. This is useful in two situations (that I can
immediately think of).

Firstly for external interaction, i.e a text shell or remote procedure
calls. The current state of a channel can be queried by an ID that never
changes, as opposed to the external entity needing to know the exact
memory address of the channel for a given application binary.

Secondly for integrating with dynamically loaded extensions (llext).
These extensions can hook into the existing data streams without each
individual channel needing to be exported and visible to the loader.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-12-18 12:47:24 +01:00
Johann Fischer
dd5492b3ce usb: device_next: rework wSequence check in CDC NCM implementation
The consequences of a wSequence mismatch are unspecified and are
primarily for debugging purposes. Our checks are a bit too strict, and
if the header check fails, the sequence is not updated, and the header
check subsequently fails. Rework the code to just log a warning on
mismatch and also reset OUT sequence counter the same way as the IN
sequence counter.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
82891d3d32 usb: device_next: do not stop when OUT transfer has zero length
Align the OUT handling with the CDC NCM and change the logic to track
when the alternate data interface is set/reset instead of the class
implementation being part of the active configuration.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
502e8116b5 usb: device_next: allow CDC ECM to survive alternate toggling
When interface alternate is set back to zero, the implementation still
attempts to submit OUT transfers, but the addressed endpoint is actually
disabled. Change the logic a bit to track when the alternate data
interface is set/reset instead of the class implementation being part of
the active configuration.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
8940f43f5d usb: device_next: rework CDC ECM connected/disconnected notifications
Do not fail in iface_start/iface_stop if sending notification fails,
just log the error and try to send connected notification when alternate
interface is set and network interface is started.

Do not block in notification send function and allow to submit more than
one notification which means that the last valid one will also be
delivered.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
376e965d04 usb: device_next: do not accidentally disable CDC NCM network interface
The Zephyr network interface should not be disabled by the USB device
functions. This sounds confusing, but in the current implementation they
are different ends of the connection.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
78c0072dd9 usb: device_next: rework notification handling
We need to handle notifications periodically, for example, when the
interface alternate changes and we also need to track whether the
notification was actually transfered to the host. There is no need to
trigger notification work on iface_start/iface_stop when the USB
interface is not in active configuration. This commit intentianly
changes log level in the notification handling code.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
c437230b58 usb: device_next: fix CDC NCM GET_NTB_INPUT_SIZE
The device should set the maximum size and maximum number of datagrams
within the IN NTB.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
7f39e1a9ec usb: device_next: fix block length check in CDC NCM
In the current implementation, the block length in the OUT direciton
should be equal to the transfer length.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
539961035b usb: device_next: make error logging more verbose in CDC NCM
Log errors with LOG_ERR.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
c7baf39126 usb: device_next: fix CDC NCM datagram pointers processing
The implementation should not assume that NDP is placed immediately
after NTH. According to the specification (revision 1.0), NDP can be
anywhere in the transfer buffer. There is also always a "terminating
zero datagram pointer entry", which we should also use to terminate the
datagram processing loop.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Lyle Zhu
830c1f8134 Bluetooth: AVDTP: Check buffer length before pulling it
Check the remaining data length of net buffer before pulling data from
it.

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

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-12-18 10:17:45 +01:00
Qingling Wu
d22026c440 net: wifi: hostap: add set RTS threshold command support
Add set RTS threshold command support for sta and sap.

Signed-off-by: Qingling Wu <qingling.wu@nxp.com>
2024-12-18 10:17:24 +01:00
Mikhail Siomin
a5a955d024 fs: littlefs: add littlefs disk version selection
Add the ability to select littlefs disk version
to maintain backward compatibility
with existing littlefs
with the same major disk version.

Signed-off-by: Mikhail Siomin <victorovich.01@mail.ru>
2024-12-17 20:55:51 +01:00
Guennadi Liakhovetski
024f43b1f0 llext: move a calculation to a more logical location
Currently llext_link_plt() calculates offsets to relocation addresses
relative to the .text section and passes them to
arch_elf_relocate_global() and arch_elf_relocate_local(), where then
.text memory address is added to them. Instead it's more logical to
concentrate the entire calculation in the caller, which then also
removes the assumption, that all sections have the same VMA - LMA
offset from those functions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-12-17 20:55:15 +01:00
Johann Fischer
704b36f78f usb: device_next: remove redundant memset() after net_buf_alloc.*()
With changes introduced in commit 6a3602a306
("net: buf: Clear `user_data` on allocation")
our memset() calls are redundant.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-17 11:38:22 +00:00
Chang Kim
98928c0a4f bluetooth: host: Add conditions to ATT_READ_BY_TYPE_REQ handler
Core spec V5.4 Vol. 3 Part G 2.5.2.1 Robust Caching specifies
the conditions where Database Out Of Sync (0x12) error needs to
be returned as follows:

If a client that has indicated support for robust caching (by
setting the Robust Caching bit in the Client Supported Features
characteristic) is change-unaware then the server shall send an
ATT_ERROR_RSP PDU with the Error Code parameter set to Database
Out Of Sync (0x12) when either of the following happen:
• That client requests an operation at any Attribute Handle or
list of Attribute Handles by sending an ATT request.
• That client sends an ATT_READ_BY_TYPE_REQ PDU with Attribute
Type other than «Include» or «Characteristic» and an Attribute
Handle range other than 0x0001 to 0xFFFF.

Add the conditions to ATT_READ_BY_TYPE_REQ handler.

Signed-off-by: Chang Kim <changshik@meta.com>
2024-12-17 11:37:27 +00:00
Johann Fischer
36e8144b90 usb: device: remove USB H4 Bluetooth function and sample
The Bluetooth HCI USB transport layer implementation is provided by
"subsys/usb/device/class/bluetooth.c". The USB H4 Bluetooth function
implements a non-standard transport layer. There is no known host-side
equivalent that uses this protocol.

Note that the H4 protocol functionality is also provided by the
"subsys/usb/device/class/bluetooth.c".

Since that there are no real USB H4 Bluetooth users, remove the
implementation and sample without deprecation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-17 11:35:57 +00:00
Tomi Fontanilles
23a6a78599 secure_storage: its: store: settings: improve debug logging
Align the debug logging with that of the ZMS-based implementation.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Tomi Fontanilles
9ef6788bd9 fs: zms: fix format string
Use %zu for size_t.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Tomi Fontanilles
45a54ba782 secure_storage: its: store: settings: allow using zephyr,settings-partition
Align with the behavior of the settings subsystem.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Tomi Fontanilles
bb003f7bd3 secure_storage: warn when there is no ITS store module implementation
Output a CMake error when the ITS store module is enabled but no
implementation ended up enabled (due to unfulfilled prerequisites).
This is to make it more clear than undefined references at link time.
Not a fatal error because CMake cannot fail for the twister filtering
to work on the tests.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Tomi Fontanilles
3eba06d559 secure_storage: its: store: settings: stop using SETTINGS_MAX_VAL_LEN
Remove the hard restriction on CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE.
SETTINGS_MAX_VAL_LEN is in practice not used by any settings backend
implementation.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Tomi Fontanilles
0ea6f352e7 secure_storage: add a ZMS-based implementation of the ITS store module
It becomes the new default when the secure_storage_its_partition
devicetree chosen property is defined as it is a preferred alternative.

See the help message of the
`CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS` Kconfig option
for more information.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Maochen Wang
b5007b5190 net: wifi: avoid adding duplicate mgd_ifaces
Add iface and type check to avoid adding duplicate mgd_ifaces.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-17 09:48:29 +01:00
Gaofeng Zhang
0e59cf41d7 hostap: support legacy roaming
There are currently four types of roaming, 11r roaming, 11v roaming, 11k
roaming and legacy roaming, The priority of the roaming mode is
11r-->11v-->11k-->legacy roaming. If the ap does not support 11r/11v/11k
roaming, we will use legacy roaming. legecy roaming needs to do
full channel scan, which is the same as the general scan connection
process, so the legacy roaming time will be longer.

Signed-off-by: Gaofeng Zhang <gaofeng.zhang@nxp.com>
2024-12-17 05:49:21 +01:00
Djordje Nedic
2750492e86 fs: littlefs: Fix cache and lookahead size checks
This fixes an issue where wrong values were checked against block device
defaults. Kconfig values are used when no filesystem config values are
provided, and the buffers are sized according to the Kconfig values,
but the checks were only performed against filesystem config variables.

Signed-off-by: Djordje Nedic <nedic.djordje2@gmail.com>
2024-12-16 20:49:21 +01:00
Ilya Tagunov
ce50ea2f1f llext: disable for Harvard ARC variants
Some ARC processor configurations have separate memory for code (ICCM)
and for data (DCCM). Such configurations are unsuitable for LLEXT,
except for some quite special cases. For now, disable LLEXT and its
tests for these devices completely.

Signed-off-by: Ilya Tagunov <Ilya.Tagunov@synopsys.com>
2024-12-16 18:25:16 +01:00
Rex Chen
ab948b080d net: wifi: shell: fix twt setup quick failed issue
The default exponent is 0, will cause twt setup quick failed,
set exponent value derived from twt interval to fix it.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Rex Chen
0406f9b403 net: wifi: shell: add parameters for twt setup
Add two parameters for twt setup.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Rex Chen
a1f579a2f3 net: wifi: shell: add btwt feature support
Add btwt_setup cmd for sap.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Rex Chen
f9a96f3503 net: wifi: shell: enhance twt parse parameters code
Enhance the parse parameters code for twt.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Hongquan Li
bda1e7677e Subsys: mgmt: mcumgr: Fix mcumgr assertion error
In the case of IPV6 not enabled, when NET_SOCKETS_PACKET is enabled,
the sizeof(struct sockarr) will change to 20, the value of
MCUMGR_TRANSPORT_NETBUF_MIN_USER_DATA_SIZE is 8, which is not able
to pass the compilation, so I change its default value to 20.

Fixes #82757

Signed-off-by: Hongquan Li <hongquan.prog@gmail.com>
2024-12-16 13:09:28 +01:00
Maochen Wang
91c4482267 net: wifi: fix ap status when enabled
Add WIFI_SAP_IFACE_NO_IR state to keep same as hostapd_iface_state,
which is updated as the hostap upmerge.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-16 13:08:37 +01:00
Maochen Wang
10d4de5237 net: wifi: remove HAPD in Wi-Fi shell layer
For CMD 'wifi ap status', removing HAPD related definition to make it
more commonly used for non-supplicant case.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-16 13:08:37 +01:00
Vinayak Kariappa Chettimada
da792a9e17 Bluetooth: Controller: Fix interleaved extended scanning assert
Fix interleaved extended scanning assert.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-12-16 10:53:30 +01:00
Maochen Wang
671f0f6cfa net: sockets: choose SOCKETPAIR_HEAP when MEM_POOL enabled
Don't check 'HEAP_MEM_POOL_SIZE != 0', as HEAP_MEM_POOL_SIZE might be 0,
but HEAP_MEM_POOL_ADD_SIZE_xxx is defined, which means the actual heap
size is not zero. So check KERNEL_MEM_POOL instead.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-16 10:53:21 +01:00