Commit graph

15409 commits

Author SHA1 Message Date
Robert Lubos
05e974cab0 net: openthread: Fix TX time inconsistency in multi-CCA TX mode docs
Align with other delayed TX modes, by specifying the transmit time as
the start of the frame PHR, not SHR.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-09-22 09:27:35 +02:00
Jaxson Han
5878898328 arch: arm64: Add stack guard support for MPU
To make the stack guard works well, clean and refine the MPU code. To
save the MPU regions (the number of MPU regions are limited), we choose
to remove the guard region. Comparing to add an individual region to
guard the stack, removing the guard region can at least save 2 regions
per core.

Similarly with userspace, the stack guard will leverage the dynamic
regions switching mechanism which means we need a region switch during
the context switch. Otherwise, the other option is using stack guard
region, but this is very limited since the number of MPU regions is
limited.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-09-22 09:25:12 +02:00
Jaxson Han
d3ec98806d arch: arm64: Refactor the stack relevant macros
Refactor the stack relevant macros to prepare to introduce the stack
guard. Also add comments about the changes related to stack layout.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-09-22 09:25:12 +02:00
Jaxson Han
c57fa2c231 arch: arm64: Fix the cache coherence issue
Accessing mem before mmu or mpu init will cause a cache coherence issue.
To avoid such a problem, move the safe exception stack init function
after the mmu or mpu is initiated.

Also change the data section attribute from INNER_SHAREABLE to
OUTER_SHAREABLE. Otherwise there will be a cache coherence issue during
the memory regions switch. Because we are using background region to do
the regions switch, and the default background region is
OUTER_SHAREABLE, if we use INNER_SHAREABLE as the foreground region,
then we have to flush all cache regions to make sure the cached values
are right. However, flushing all regions is too heavy, so we set
OUTER_SHAREABLE to fix this issue.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-09-22 09:25:12 +02:00
Tomasz Bursztyka
ba02d85c74 doc/nvme: NVMe mandates dword-aligned buffer addresses
In Zephyr, this is let to the disk access API user. There is nothing the
driver can do about it.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-09-22 09:23:18 +02:00
Gerard Marull-Paretas
beec8b05a8 device: only allow PRE_KERNEL_1/2 and POST_KERNEL levels
Because devices share the same underlying infrastructure with SYS_INIT,
the same levels have always been available. However, not all of them are
needed, and some are not even usable. For example, `EARLY` can't be used
because when initialized `z_device_state_init` has not been called yet.
`SMP` has never been used by device drivers, and it is now in question,
likely to be moved to SMP specific hooks. Finally, `APPLICATION` does
not make much sense in the context of Kernel devices. Note that of the 3
levels just mentioned, only one was actively tested (`APPLICATION`) by
Kernel tests, meaning others were likely never considered in the context
of devices.

This patch leaves `PRE_KERNEL_1`, `PRE_KERNEL_2` and `POST_KERNEL`
available to devices. Others have been deprecated, and will generate a
compiler warning if used.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-21 15:02:45 +02:00
Grant Ramsay
663826a9f9 drivers: can: mcan: Add CAN statistics
Add CAN stats for MCAN drivers.

Update MCAN drivers to use CAN_DEVICE_DT_INST_DEFINE
which initialises and registers CAN stats if enabled.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-09-21 13:36:52 +02:00
Marcin Gasiorek
0564345715 net: Follow coding style when converting int to bool
Added double exclamation mark where missing in order to keep
code in one convention.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2023-09-21 13:36:20 +02:00
Marcin Gasiorek
c668fbc4d2 net: ip: Add cloning of missing attributes
A few attributes isn't cloned togerder with pkt.
This commit add missing part.
Additionally, because the `eof` flag in net_pkt structure is
avilable unconditionally hence `#if defined(CONFIG_NET_SOCKETS)`
guard has been removed form setter and getter functions for
this flag.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2023-09-21 13:36:20 +02:00
Marcin Gasiorek
a3cde71fbb net: Remove '#ifdef CONFIG_NET_ROUTE' around forwarding getter and setter.
Because `forwarding` flag is available unconditionally the compilation
guard has no make sense. Additionally this flag and related getter and
setter can be used for e.g. IPv4 packets forwarding in future, which
would be impossible looking at `NET_ROUTE` dependencies.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2023-09-21 13:36:20 +02:00
Marcin Gasiorek
6a536f9f8c net: Deprecated and unused flags cleanup.
In net_pkt structure couple of flags are no longer used.
Flag pkt_queued can be removed permanently togeter with setter
and getter functions.
Second flag sent_or_eof has been renamed because it is still
used partially only for indicating EOF. Additionally unused setter
and getter for 'sent_' part of this flag are removed.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2023-09-21 13:36:20 +02:00
Jamie McCrae
0d5c508fc7 mgmt: mcumgr: grp: fs_mgmt: Update file upload errors
Updates possible return errors for fs mgmt file upload, to clarify
when a provided path is on a read-only filesystem or if the mount
point does not exist.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-09-21 11:54:26 +02:00
Martin Jäger
6b0135b151 canbus: isotp: rename ctx function parameters to rctx/sctx
This makes clear if the context is a recv_ctx or a send_ctx and
improves code readability.

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-09-21 11:54:11 +02:00
Dawid Niedzwiecki
340ffe1c48 mgmt: ec_host_cmd: fix struct init order
Order structure members according to the structure definition.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-21 09:28:59 +02:00
Kapil Bhatt
4b9f5cc455 net: l2: wifi: Change arrays to functions
The header file contains mixture of functions and static arrays.
Replacing static arrays to functions.
Initialize functions in C file.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2023-09-21 09:28:46 +02:00
Declan Snyder
b1d2a8a9b6 drivers: regulator: Add NXP VREF driver
Add binding, include header, and driver for NXP VREF IP block.

NXP VREF is an internal voltage reference generator on some SOCs
that fits well with the regulator API in zephyr.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-09-21 09:26:57 +02:00
Emil Gydesen
5cc14b6c50 Bluetooth: Audio: Replace BT_AUDIO_CODEC_PARSE_ERR_ with errno
Replace the BT_AUDIO_CODEC_PARSE_ERR_ values with errno values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:22:24 +01:00
Emil Gydesen
9693ae3021 Bluetooth: Audio: Add parsers for getting metadata values
Add parsers to retrieve metadata values from codec
capabilities and codec configuration structs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:21:24 +01:00
Emil Gydesen
3c34dd3724 Bluetooth: Audio: Remove struct BT_AUDIO_CODEC_LC3_frame_len
Remove this unused and malnamed struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:19:55 +01:00
Emil Gydesen
f93caa3903 Bluetooth: Audio: BT_AUDIO_CODEC_LC3_ID -> BT_HCI_CODING_FORMAT_LC3
Replace the BT_AUDIO_CODEC_LC3_ID macro with the
BT_HCI_CODING_FORMAT_LC3 as there is no reason to
define and use the LC3 ID different than the other
allowed codec IDs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:19:50 +01:00
Emil Gydesen
d327b1625c Bluetooth: BAP: Broadcast source reconfig with subgroups
Modify the bt_bap_broadcast_source_reconfig to use the same
parameter struct as bt_bap_broadcast_source_create so that
the two are more similar, since they both set the same values.

This allow for full control of which subgroups and stream
are updated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:16:52 +01:00
Manuel Argüelles
7fca0aa8a6 nxp_s32: enable clock control for S32ZE
Enable clock control driver for NXP S32ZE SoCs and add clock sources
definitions for devicetree.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-20 17:25:44 +01:00
Rait Rääk
2e0981b658 bluetooth: ead: Add C++ include support
Bluetooth EAD header is missing C++ include support (extern C).
Add support for including from C++.
Signed-off-by: Rait Rääk <raitraak@gmail.com>
2023-09-20 11:35:58 +01:00
Théo Battrel
da11b5fc09 Documentation: Update bt_gatt_discover_params & bt_gatt_discover_params
Documentation for `bt_gatt_subscribe_params` and
`bt_gatt_discover_params` is not complete.
`CONFIG_BT_GATT_AUTO_DISCOVER_CCC` need to be selected so Doxygen add
see `end_handle`, `disc_params` and `sub_params`.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-09-20 11:35:04 +01:00
Tobias Frauenschläger
dcc63120cf net: sockets: add support for SO_REUSEPORT
This commits adds support for the SO_REUSEPORT socket option.

The implementation follows the behavior of BSD and tries to also follow
the specific additional features of linux with the following
limitations:
* SO_REUSEADDR and SO_REUSEPORT are not "the same" for client sockets,
  as we do not have a trivial way so identify a socket as "client"
  during binding. To get the Linux behavior, one has to use SO_REUSEPORT
  with Zephyr
* No prevention of "port hijacking"
* No support for the load balancing stuff for incoming
  packets/connections

There is also a new Kconfig option to control this feature, which is
enabled by default if TCP or UDP is enabled.

Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
2023-09-20 08:56:31 +02:00
Tobias Frauenschläger
3d3a221b1e net: sockets: add support for SO_REUSEADDR
This commit adds support for the SO_REUSEADDR option to be enabled for
a socket using setsockopt(). With this option, it is possible to bind
multiple sockets to the same local IP address / port combination, when
one of the IP address is unspecified (ANY_ADDR).

The implementation strictly follows the BSD implementation and tries to
follow the Linux implementation as close as possible. However, there is
one limitation: for client sockets, the Linux implementation of
SO_REUSEADDR behaves exactly like the one for SO_REUSEPORT and enables
multiple sockets to have exactly the same specific IP address / port
combination. This behavior is not possible with this implementation, as
there is no trivial way to identify a socket to be a client socket
during the bind() call. For this behavior, one has to use the
SO_REUSEPORT option in Zephyr.

There is also a new Kconfig to control this feature similar to other
socket options: CONFIG_NET_CONTEXT_REUSEADDR. This option is enabled by
default if TCP or UDP are enabled. However, it can still be disabled
explicitly.

Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
2023-09-20 08:56:31 +02:00
Emil Gydesen
9d62bef3ac Bluetooth: BAP: Broadcast source state checks for ID and BASE
Add state checks for the get_id and get_base functions, as the
ID and base are not valid when the state of the broadcast
source is BT_BAP_EP_STATE_IDLE.

Since the broadcast_source_get_state uses the slist functions,
the broadcast source object for bt_bap_broadcast_source_get_id
can no longer be `const`.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-19 15:23:10 +01:00
Benjamin Cabé
9f4cd4a727 net: openthread: doc: Fix doxygen group for openthread
Fix the name/brief of the openthread doxygen group

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-09-19 15:22:59 +01:00
Juha Heiskanen
0c6a3faeb4 mgmt: mcumgr: Image management client fix
Fix broken MCUmgr image group client.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2023-09-19 15:21:08 +01:00
Kuno Heltborg
2d02cae964 MGMT: Add user data to mgmt_handler
RFC: #60616

Signed-off-by: Kuno Heltborg <kunoh@live.dk>
2023-09-19 15:20:58 +01:00
Tom Burdick
cbc6af0d09 spi: Cleanup and fix SPI docs build
Use the defined(__DOXYGEN__) more specifically in the header to better
match i2c.h and make things more explicit. Removes the define being
setup in zephyr.doxyfile.in.

Fixes some of the deprecation notes and what to look for instead. Fixes
some typos.

The async, signal, and rtio APIs for SPI are now shown in the built docs
as would be expected.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-09-19 08:46:16 -05:00
Tom Burdick
be6dd12f3a i2c: Fix documentation ifdefry
The docs should be viewable if doxygen is being run, and that
requires checking for the __DOXYGEN__ define. This should fix
the missing I2C callback, k_poll_signal, and rtio API sections
not being shown in the built documentation.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-09-19 08:38:47 -05:00
Anas Nashif
a04a1d8991 tracing: remove references to deprecated k_pipe_block_put
k_pipe_block_put was deprecated some time ago.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-18 19:20:02 -04:00
Jukka Rissanen
0b24aaad2c net: socket: Use network interface name length for IFNAMSIZ
If the network interface naming is enabled, then use the
interface name length (CONFIG_NET_INTERFACE_NAME_LEN) for
IFNAMSIZ instead of device name length.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-09-18 15:54:39 +02:00
Bjarki Arge Andreasen
7310adaa49 modem: chat: Optimize const usage
This commit removes const declarations for members
inside structures used for chat scripts to allow for
modifying them at runtime.

Macros like MODEM_CHAT_SCRIPT_DEFINE() cover the
whole struct when declaring them const, ensuring
they remain placed in ROM.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-09-18 14:11:40 +01:00
Bjarki Arge Andreasen
586504bed8 modem: chat: Track size of script_chat request to avoid strlen()
This commit optimizes the performance of the script chats by
storing the size of requests with the chat script chat, negating
the need to use strlen() within the modem_chat module every time
a chat script chat request is sent.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-09-18 14:11:40 +01:00
Bjarki Arge Andreasen
c9bc07a4f3 modem: chat: Add synchronous functions for script exec
This commit adds one new feature, modem_chat_run_script(),
which synchronously runs a script.

The existing function modem_chat_script_run() is async,
and doesn't follow the naming convention created for the
other modem modules, specifically, all functions are sync,
unless appended with _async.

To preserve backwards compatibility, the existing function
modem_chat_script_run() will remain until deprecated. It
simply calls modem_chat_run_script_async().

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-09-18 14:11:40 +01:00
Ludvig Samuelsen Jordet
b990a74f8b Bluetooth: Mesh: Add support for Upload OOB Start
This adds support for the Upload OOB Start message to the DFD server, by
providing callbacks that the application can use to hook any OOB scheme
into the model behavior.

There are also extensive changes to the dfu_slot module, to accomodate
the new needs that appeared with the support for OOB transfer (mainly,
fwid, size and metadata are no longer available when the slot is
allocated, they appear later in the handling).

Signed-off-by: Ludvig Samuelsen Jordet <ludvig.jordet@nordicsemi.no>
2023-09-18 10:55:20 +01:00
Jordan Yates
dd090f06b7 net: wifi_mgmt: change type of wifi_scan_params->chan
All WiFi channel numbers fit within a 8 bit number, as the maximum
allocated channel is 233. This halves the memory requirement.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-09-18 10:54:31 +01:00
Aaron Massey
a7b25d599b fuel_gauge: Join get/set prop structs
The fuel gauge API uses separate get/set property structs to indicate what
properties are readable or writable. This lead to duplication in property
names and potential confusion for new users of the API. See issue #61818.
In addition to above, drivers already determine at runtime if a property is
supported for read or write actions.

Join the get/set fuel gauge property structs as a single struct.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-18 10:38:59 +01:00
Anas Nashif
a4de2eb3d1 kernel: doc: mark sections as internal in kernel.h
Add doxygen conditionals around internal segments of the header.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-17 07:59:30 -04:00
Anas Nashif
c4e190f414 kernel: header: remove unused z_queue_node_peek from kernel.h
This function is private to the kernel and should not be exposed in a
public header.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-17 07:59:30 -04:00
Anas Nashif
8dc2746c0e kernel: z_handle_obj_poll_events is internal not kernel.h material
This internal kernel API is misplaced in a public kernel header. Just
make it available to the code using it in the kernel.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-17 07:59:30 -04:00
Anas Nashif
cc4ab45a45 kernel: header: k_queue struct should not be hidden
This is not a private struct, it should not be hidden in the docs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-17 07:59:30 -04:00
Anas Nashif
c64ab30859 kernel: kernel_includes.h: double guard header
This header should not be included directly, only via kernel.h.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-17 07:59:30 -04:00
Anas Nashif
ceb42a688e kernel: remove reference to non existing z_thread_heap_assign
we have no z_thread_heap_assign, was suppoosed to reference
k_thread_heap_assign.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-17 07:59:30 -04:00
Peter Mitsis
c7255cf374 kernel: Remove references to _EXPIRED
The _EXPIRED macro is no longer necessary. It is a relic of an older
timeout processing algorithm from several years ago.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-09-15 19:16:20 -04:00
Wojciech Slenska
798b863f36 modem: modem_ppp: added net stats
Added ppp net stats to modem subsys.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-09-15 15:13:06 -05:00
Gerard Marull-Paretas
87c4b7e043 sensing: use POST_KERNEL level
In a first place, hardcoding priorities like this is a bad idea, but
this patch just moves the device to late POST_KERNEL stage, as
APPLICATION level should be avoided for device drivers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 16:04:19 +02:00
Fabio Baltieri
4856fd4cb6 can: rework the table lookup code in can_dlc_to_bytes
Rework the can_dlc_to_bytes table lookup code in a way that allow the
compiler to guess the resulting output and somehow fix the build
warning:

zephyr/drivers/can/can_nxp_s32_canxl.c:757:9: warning:
'__builtin___memcpy_chk' forming offset [16, 71] is out of the bounds
[0, 16] of object 'frame' with type 'struct can_frame' [-Warray-bounds]
 757 | memcpy(frame->data, msg_data.data, can_dlc_to_bytes(frame->dlc));

where the compiler detects that frame->data is 8 bytes long but
can_dlc_to_bytes could return more than that.

Can be reproduced with:

west build -p -b s32z270dc2_rtu1_r52 \
	-T samples/net/sockets/can/sample.net.sockets.can.one_socket

Suggested-by: Martin Jäger <martin@libre.solar>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-15 15:05:57 +02:00