Adds calls to the set_src_ctrl of TCPC driver to enable and disable
the VBUS sourcing. If the TCPC doesn't support these functions,
no errors should be printed.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
When validating the parameters for broadcast reception start some
return statements were missing, they have been added, as well as
proper initialisation of a variable
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
If we are merging subgroup and BIS codec configuration data
for a codec other than LC3, then we just append them, but
did not properly update the length.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The 3-byte value suits the assigned number much better,
and also allows for less memory copies when getting and
setting the values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove the "stream" part of the value and functions to
better fit with the name in the assigned numbers document.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
View buffers are now also a limited resource. Acquire them before
attempting to pull data. `CONFIG_BT_CONN_FRAG_COUNT` should be tuned on
a per-application basis to avoid this.
A possible optimization, that was present before, is to not create a
frag when the original buffer fits the controller's HCI size.
I prefer deferring this optimization to a future patchset.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
We can get rid of the view pool for SDU segments :)
We have to make the code slightly more complex :'(
The basic idea is always giving the original SDU buffer to `conn.c` for it
to pull ACL fragments from.
In order to do this, we need to add the PDU headers just-in-time.
`bt_l2cap_send_pdu()` does not add them before putting the PDU on the queue
anymore. They are added by `l2cap_data_pull()` right before the data leaves
`l2cap.c` for `conn.c`.
We also have to inform `conn.c` "out of band" of the real L2CAP PDU size so
it doesn't fragment across segment boundaries. This oob is the new `length`
parameter to the `.pull()` method.
This is the added complexity mentioned above.
Since SDU segmentation concerns only LE-L2CAP, ISO and Classic L2CAP don't
need this extra logic.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
We don't need the TX thread anymore.
Generalizing the pull-based architecture (ie. `tx_processor`) to HCI
commands makes it possible to run the whole TX path from the the system
workqueue, or any workqueue really.
There is an edge-case, where we call `bt_hci_cmd_send_sync()` from the
syswq, stalling the system. The proposed mitigation is to attempt to drain
the command queue from within `bt_hci_cmd_send_sync()`.
My spidey sense tingles however, and it would be better to just remove the
capability of calling this fn from the syswq. But doing this requires
refactoring a bunch of synchronous procedures in the stack (e.g. stack
init, connection establishment, address setting etc), dragging in more
work. I will do it, but in a later patch.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This API replaces `bt_l2cap_send()` and `bt_l2cap_send_cb()`.
The difference is that it takes the `struct bt_l2cap_le_chan` object
directly instead of a connection + CID.
We need the channel object in order to put the PDU on the TX queue. It
is inefficient to do a search for every PDU when the caller knows the
channel object's address and can just pass it down.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
The current TX pattern in the host is to try to push a buffer through all
the layers up until it is ingested by the controller.
Since sending can fail at any layer, we need error-handling and separate
retry logic on pretty much all layers. That logic obscures the "happy path"
for people trying ot understand the code.
This commit inverts the control, in a way that doesn't require changing the
host or HCI driver API (yet):
Layers don't send buffers synchronously, they instead put their buffer in a
private queue of their own and raise a TX flag on the lower layer. Think of
it as a `READY` interrupt line that has to be serviced by the lower layer.
Sending is now non-blocking, rate depends on the size of buffer pools.
There is a single TX processing function. This can be thought as the
Interrupt Service Routine that will handle the `READY` interrupt from the
layers above.
That `tx_processor()` will then attempt to allocate enough resources in
order to send the buffer through to the controller. This allocation logic
does not block.
After acquiring all the resources, the TX processor will attempt to pull
data from the upper layer. The upper layer has to figure out which buffer
to pass to the controller. This is a good spot to put scheduling or QoS
logic in the upper layer.
Notes:
- user-facing API for tuning QoS will be implemented in a future patch
- this scheme could (and probably will) be extended to upper layers (e.g.
ATT, L2CAP CoC segmentation).
- this patch removes the `pending_no_cb()` memory optimization for
clarity/correctness. It might get re-implemented after a stabilization
period. Hopefully with more documentation.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Instead of allocating segments/fragments and copying data into them, we
allocate segments as "views" (or slices) into the original buffer.
The view also gives access to the headroom of the original buffer, allowing
lower layers to push their headers.
We choose not to allow multiple views into the same buffer as the headroom
of a view would overlap with the data of the previous view.
We mark a buffer as locked (or "in-view") by temporarily setting its
headroom to zero. This effectively stops create_view because the requested
headroom is not available.
Each layer that does some kind of fragmentation and wants to use views for
that needs to maintain a buffer pool (bufsize 0, count = max views) and a
metadata array (size = max views) for the view mechanism to work.
Maximum number of views: number of parallel buffers from the upper layer,
e.g. number of L2CAP channels for L2CAP segmentation or number of ACL
connections for HCI fragmentation.
Reason for the change:
1. prevent deadlocks or (ATT/SMP) requests timing out
2. save time (zero-copy)
3. save memory (gets rid of frag pools)
L2CAP CoC: would either allocate from the `alloc_seg` application callback,
or worse _steal_ from the same pool, or allocate from the global ACL pool.
Conn/HCI: would either allocate from `frag_pool` or the global ACL pool.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
`bt_conn_send_cb` used to allocate a TX context (K_FOREVER).
Instead, we now put the context in the userdata of the buffer.
This means that now this fn will never block and always succeed since the
tx_queue is a FIFO (infinite size). It just puts the buf on the queue.
The metadata is stored safely in there until we have acquired all the
necessary resources to send it to the controller without failing: TX
context and controller buffer.
I.e. when `bt_conn_process_tx` is called, that's when a TX context is
try-allocated and the contents of `buf->userdata` is moved into it.
The buffer is now ready to be sent to the lower layer.
`bt_conn_process_tx` will return -EWOULDBLOCK if it's not able to acquire a
TX context, this PR modifies `bt_conn_prepare_events` to respond to this by
also waiting on the TX context pool.
Unfortunately, this increases the required userdata size for any buffers
handed to `bt_conn_send_cb`. This will be fixed in a later commit.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
In case we want to immediately send empty Ack to server,
we should bypass all send queues.
This is required when we try to send Ack from callbacks
that happen from socket-loop context. On those cases
the Ack would have not been send because the callback
might be blocking the socket-loop while processing
a request (like write callbacks).
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The `LOG_BACKEND_FORMAT_TIMESTAMP` Kconfig currently depends on
a list of hardcoded backends.
Let's modify it to depend on an intermediary Kconfig
`LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP` instead, which can be
selected by a OOT log backend.
Updated all exisitng supported backends to select this new
Kconfig.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Add an option to reset gcov counters before running tests.
This ensures that only code lines triggered by test itself are counted in
the coverage report and all the board initialization code and pre-test
bootstrap is not counted. This is useful when, for example, you are
testing code that is also executed during bootup
Test Plan:
west build -p always -b qemu_x86_64 tests/ztest/base/ -- \
-DCONFIG_COVERAGE=y -DCONFIG_COVERAGE_GCOV=y -DCONFIG_COVERAGE_DUMP=y \
-DCONFIG_ZTEST_COVERAGE_RESET_BEFORE_TESTS=y
ninja -Cbuild run | tee log.log
Signed-off-by: Roman Studenikin <srv@meta.com>
Ability to reset gcov counters allows better isolation of tests
coverage. Specifically it allows to:
1. Not include counters for any code that was executed prior running the
test, which includes all the code executed during the board boot.
2. Run multiple tests without firmware reload by resetting counters
between each.
Signed-off-by: Roman Studenikin <srv@meta.com>
If the length of the string literal reserved for the serial number
descriptor is odd, the string is not used because its length is always
even and therefore one character longer. Fix this by using the shortest
length for the copy.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
If the new encryption state is the same as the old one, there's no point in
doing additional processing or callbacks. Simply log a warning and ignore
the HCI event in such a case.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The drivers should be independent after the move to the new HCI driver
API. Having them as a choice also has unexpected consequences with some
drivers being unexpectedly enabled.
Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
Update the native controller to the new HCI driver API. The devicetree
node is placed under existing `radio` nodes, which seemed like the most
intuitive option.
Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
Add support for HCI drivers which use the newly defined HCI driver API.
Since Zephyr (currently) only supports a single HCI driver instance,
boards are expected to indicate the instance using a new devicetree
chosen property `zephyr,bt_hci`.
In order to maintain compatibility with not-yet-converted drivers the
code has been placed behind `#if DT_HAS_CHOSEN(zephyr_bt_hci)`
conditionals.
Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
https://github.com/zephyrproject-rtos/zephyr/pull/72674 fixed
a bug where this configuration did not work.
Now that this configuration is tested, we should mark it
as supported.
The timeout check that was present in the code before
was useless and was not working because the check was
run before a default timeout of 0 was converted to a timeout.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
ull_adv_sync_pdu_set_clear does pretty much everything, causing
it to be very complex and awkward to use. In addition, it only handles
a single PDU, meaning callers have to handle the chain.
It has been replaced with simpler, more complete functions for handling
the relevant operations
Fixed issues include:
- Fragmentation of adv data over HCI is now decoupled from PDU
fragmentation, fixing HCI/DDI/BI-13-C, LL/DDI/ADV/BV-26-C and
LL/DDI/ADV/BV-55-C
- Adding BigInfo now preserves the PDU chain
- Enabling periodic advertising with ADI on would sometimes fail
due to insufficient space in a single PDU to add ADI
Signed-off-by: Troels Nilsson <trnn@demant.com>
These macros tend to be defined by too many headers.
Let's guard these definition with ifdefs to avoid
redefining them to practically the same.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
that utilizes the fact that the ldpc recovery matrix is triangular and only
stores the half with non-zero values.
This implementation is hopefully going to make forward error correction
usable on lower memory devices.
Signed-off-by: Lucas Romero <luqasn@gmail.com>
to no longer be a long-lived status variable because we already map it into
is_active and this reduces the number of states the transport can be in.
It also helps us prepare for being able to plug in more decoders by
removing implementation specific bits from the general transport interface.
Signed-off-by: Lucas Romero <luqasn@gmail.com>
Add modem pipelink module which exposes modem pipes globally.
The pipelink module implements a callback to inform when a
pipe becomes available to use by whichever modem is attached
to it. This could be a shell, or a network interface.
The module aims to allow modem drivers to be split into modules,
and allowing applications to implement their own custom logic
without altering the modem drivers.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
If network socket tracing is enabled, then the system will track
various socket API calls for usage.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Replaced tcp_out() with tcp_out_ext() when sending
SYN during tcp connect, so we can intercept error value,
beacuse in such case the packet would not be sent at all
and the stack would not trigger any mechanism to flush
this context so it ends up leaking. These scenarios can
arise when the underlaying interface is not properly
configured or is disconnected. The conn is marked to be
closed and is closed before exiting tcp_in().
Since we can now identify this case we can also exit
early in the net_tcp_connect() function and not wait
for any timeout.
Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
This commit fixes the issue where a serialization
error was reported after properly sending a data with 'icbmsg' backend.
The icbmsg send function's return code is set to
the sent data's len as in other backends.
The related docs were fixed and updated.
Signed-off-by: Piotr Koziar <piotr.koziar@nordicsemi.no>
Add descriptions for recently introduced IPv4 and IPv6
connectivity events to the net event monitor.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
conn_mgr now fires:
- NET_EVENT_L4_IPV4_CONNECTED
- NET_EVENT_L4_IPV4_DISCONNECTED
- NET_EVENT_L4_IPV6_CONNECTED
- NET_EVENT_L4_IPV6_DISCONNECTED
These events track whether there are any ready ifaces offering
specifically IPv4 or specifically IPv6 connectivity.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Don't track up/down blame separately.
Instead, track a single last-blame iface.
Don't track blame iface inside set_ready.
Instead, track directly inside handle_update.
These two changes will simplify the addition
of blame for IPv4- and IPv6-specific events.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Instead of incrementing and decrementing global counter,
just recompute the ready-count from scratch every time
conn_mgr_mon_handle_update is called.
This will simplify the introduction of additional ready count types.
This should have no externally observable impact on the behavior of
conn_mgr.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
In case of ACD Probe/Announcement, all we need is to generate ARP
packet, we don't really want any cache entries to be created or searched
for. There was a bug, that a cache entry was created for the
Announcement sent, resulting in skipped ARP packet generation and
malformed packet being sent by the ACD module.
Therefore, simplify all this, by simply returning early in case of
conflict detection packets.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The autoconf module can now reuse generic address conflict detection,
which was added for all address types.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case a conflict was detected on a DHCP-assigned address, send a
Decline message to the server and start over.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case IPv4 conflict detection is enabled, monitor network events to
determine whether IPv4 address is ready to use or not, so that the
library returns only after the network setup is fully complete.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Connection manager needs to monitor ACD events as well to determine
whether a preferred IPv4 address is available.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for IPv4 conflict detection, as specified in RFC 5227.
The new feature is optional and disabled by default.
Address conflict detection was implemented as a part of the IPv4
autoconf feature can be generalized to be available for all address
types.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The VDED was adding the channel information per clone. But it could be
done in the original buffer. This commit fixes that by adding the
channel information to the original buffer and not for each clone. As a
result, we have a more straightforward VDED execution with fewer copies.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
Add a symbol to enable device power state constraints this
saves resources when this feature is not needed.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Declare power state constraints for a device in devicetree.
It allows a map between device instances and power states that disable
their power. This information is used by a new API
(pm_policy_device_power_lock_put/get) that automically set/release
pm state constraints.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Make call to de-initialize disk in fatfs_unmount(). This will permit the
disk to be reinitialized when it is mounted with fatfs_mount().
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Add DISK_IOCTL_CTRL_DEINIT ioctl command to disk subsystem. When
disk_access_ioctl() is called with this command, the disk will be
de-initialized. After this IOCTL completes, the disk can safely be
reinitialized.
Fixes#60628
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Add DISK_IOCTL_CTRL_INIT IOCTL to initialize a disk. This IOCTL is
intended to replace disk_access_init() for new applications, but
disk_access_init() is kept for legacy compatibility. The INIT IOCTL is
added to better match the path that will be used for disk
de-initialization. Like the disk_access_init() calls,
DISK_IOCTL_CTRL_INIT calls are reference counted
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Reference count initialization calls for disks. This changes the
behavior of the disk_access_init() function, such that disks will no
longer be initialized again if the first disk access init call
succeeds.
Disk access is reference counted in preparation for supporting disk
de-initialization, where a balanced number of disk de-initialization
calls with disk initialization calls will de-initialize the disk.
Also, remove code in disk drivers that was already checking against
duplicate disk_access_init() calls.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit moves ELF loading and linking code to separate files. This
is done to make the code more manageable and to make it easier to add
new features in the future.
No functional changes are introduced by this commit, except for a few
static functions now made public to allow this file split to occur.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Move all memory management code to a separate file, llext_mem.c, to
allow for better separation of concerns and to make the code more
readable.
No functional changes are introduced by this commit.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This patch moves the initial checks performed on the ELF file, that were
split between llext_load() and do_llext_load(), to the newly defined
llext_load_elf_data() function.
This way:
- only one function deals with ELF internal data checks;
- do_llext_load() is reduced to a list of tasks;
- llext_load() only focuses on the extension management.
One totally misplaced line initializing the number of symbols has been
moved to llext_count_export_syms().
No functional change except that the `struct llext` allocation may be
performed unnecessarily if the ELF file is not valid.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Add llext_alloc(), llext_aligned_alloc() and llext_free() wrapper
functions to manage memory allocation and deallocation from the llext
heap. Also add a helper to free all memory regions allocated by an
extension.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Use the compatible kconfig option so that for the simulated
nRF54L15 we build the same code as for the real platform.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
For the Nordic HW, the BT_CTLR_DATA_LEN_UPDATE_SUPPORT
does not require CCM HW enabled, hence support Data Length
Update if Encryption Support is disabled.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In some nRF54 devices, DATAWHITEIV was renamed to
DATAWHITE,
and the CRCCNF SKIADDR field was renamed OFFSET.
The nrf HAL hid this change internally,
so let's use it so we don't need to ifdef these
in the Bluetooth Controller HAL code.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add preliminary support for nRF54L15 SoC. This commit does
not support Controller Random Number Generation and
Controller Cryptography (AES-128 encryption) commands, nor
does it support encrypted connections.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use NRF_RTC and NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk instead
to prepare towards using configurable use of RTC and Radio
hardware defines.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add unit tests to cover explicit LLCP error code check and
cover the same in the Controller implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
A Host shall consider any error code that it does not
explicitly understand equivalent to the error code
Unspecified Error (0x1F).
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Introduce BT_CTLR_CRYPTO_SUPPORT so that preliminary port to
support nRF54L15 SoC can be upstreamed without encryption
support.
ENTROPY_GENERATOR now selected when BT_CTLR_CRYPTO enabled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When CP has a secure channel active, it should never receive a
REPLY_CCRYPT or REPLY_RMAC_I. Since these responses change the SC state,
let's also make sure that they are accepted only when they are
expected: in response to commands CMD_CHLNG and CMD_SCRYPT respectively.
Reported-by: Eran Jacob <eran.jacob@otorio.com>
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
This commit adds host support for the Path Loss Monitoring
feature see Bluetooth Core specification, Version 5.4,
Vol 6, Part B, Section 4.6.32.
Limited logic is required, just adding a wrapper around the
HCI command and callback for HCI event.
Add new zone - BT_CONN_LE_PATH_LOSS_ZONE_UNAVAILABLE, to
convert 0xFF path loss to a useful zone.
Add new Kconfigs and functionality to the bt shell.
Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
The existing code in the cap_stream.c that handled the
check before calling CAP initiator unicast functions
seemingly did not work for x86 targets such as native_sim
or native_posix.
Modified the check so that IS_ENABLED is used directly.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Introduced temporary variables `buf0_xor` and `buf1_xor` to store
XOR results and added an explicit cast to `uint16_t` for
the `*len` variable.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Correct the boundary condition in `fcb_put_len` function to
properly include `FCB_MAX_LEN` and change the #define to address
the potential flaw where `CHAR_MAX` might be treated as unsigned by
the compiler flag `-funsigned-char`, which would yield `FCB_MAX_LEN`
to 0x7fff instead of 0x3fff.
Fixes#73868
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
The assert was verifying that the current sensor address was greater
or equal than the start of the iterable section - 1 which isn't quite
right as the start is inclusive.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Moves the rtio_ prefixed lockfree queues to sys alongside existing
mpsc/spsc pbuf, ringbuf, and similar queue-like data structures.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Previously the schedule_next_timeout() function was feeding the hardware
watchdog irrespective of whether or not it was started. This is now
fixed.
Signed-off-by: Balaji Srinivasan <balaji.srinivasan@nordicsemi.no>
The simulated targets support the same power levels as the
real targets. Let's correct the kconfig dependencies
accordingly.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
When we receive CoAP packets, it is in input buffer
that is size of NET_IPV6_MTU.
So in reality, we can handle bigger Block-Wise writes
than CONFIG_LWM2M_COAP_BLOCK_SIZE.
So if parsing of CoAP packet has passed, continue
with the same block-size instead of going to default.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
PM_DEVICE is not attached to system managed device power management.
It is a very common use case targets with device runtime power
management that don't want system device power management enabled.
We introduce a new symbol (PM_DEVICE_SYSTEM_MANAGED) to explicit
control whether or not system device power management should be
globally enabled.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Remove device pm path when there is no is no power state in DT with
device pm enabled. This basically does the same thing that was done
by PM_DEVICE_RUNTIME_EXCLUSIVE.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Make it possible to disble device power management individually per
power state. This allows targets tuning which states should
(and which should not) trigger device power management.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
That is option has shown confusing on it is attempt to prevent
system pm doing device power management. Lets address this
problem properly.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Until recently, the posix api was purely a consumer of the
network subsystem. However, a dependency cycle was added as
a stop-gap solution for challenges with the native platform.
Specifically,
1. eventfd symbols conflict with those of the host
2. eventfd was excluded from native libc builds via cmake
If any part of the posix were then to select the network
subsystem (which is a legitimate use case, given that networking
is a part of the posix api), we would get a build error due to
the Kconfig dependency cycle.
As usual, with dependency cycles, the cycle can be broken
via a third, mutual dependency.
What is the third mutual dependency? Naturally, it is ZVFS
which was planned some time ago. ZVFS will be where we
collect file-descriptor and FILE-pointer APIs so that we can
ensure consistency for Zephyr users.
This change deprecates EVENTFD_MAX in favour of
ZVFS_EVENTFD_MAX.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The functions fnmatch(), getopt(), getentropy()
and others are grouped into the standard Option Group
POSIX_C_LIB_EXT.
The getentropy() function is currently in-draft for
Issue 8 as of 2021.
https://www.opengroup.org/austin/docs/austin_1110.pdf
Not surprisingly, the POSIX_C_LIB_EXT Option Group
also includes the highly debated strnlen() function.
Moving that function will be deferred until later.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
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>
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>
Make `struct arch_esf` compulsory for all architectures by
declaring it in the `arch_interface.h` header.
After this commit, the named struct `z_arch_esf_t` is only used
internally to generate offsets, and is slated to be removed
from the `arch_interface.h` header in the future.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Fixes issue where PB GATT Server will drop
advertising device name if optional provisioning
URI is not provided.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
The control and data settings are set improperly for packet filter
operation for sniffer operation. The change sets them properly.
Signed-off-by: Vivekananda Uppunda <vivekananda.uppunda@nordicsemi.no>
Adds, removes and modifies includes in all LE audio
files.
Fixes any found spelling mistakes as well.
Fixes a few places where incorrect types were used.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This patch changes the way sections are mapped to memories. Instead of
looking at the section name, each section in the ELF file is mapped to
the llext_mem enum by looking at the section type and flags.
This allows for a more generic mapping that works for both the ARM and
Xtensa cases, and also allows for sections to be merged if they are
contiguous and non-overlapping in the ELF file.
This patch also fixes a number of corner cases, such as in the logging
test where a section with read-only data was being ignored (not copied
and not relinked).
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
The invocation of flash_area_erase, in boot_erase_img_bank,
has been replaced by flash_area_flatten.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit replaces flash_area_erase with flash_area_flatten.
The function is used in to places:
1) in image management commands IMG_MGMT_ID_UPLOAD
and IMG_MGMT_ID_ERASE: to erase an image in secondary slot
or to scramble trailer part of image, which could be misunderstood
by MCUboot as valid image operation request;
2) in command ZEPHYR_MGMT_GRP_BASIC_CMD_ERASE_STORAGE to
erase/scramble data partition.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The NVS currently requires explict erase capability of
a device to work, so usage of flash_erase has been replaced
with flash_flatten.
There has been additional LOG_WRN added to warn user that
NVS may not efficiently work with device that do not really
have erase.
Currently NVS relies on devices that require erase.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
LittleFS is based on program-erase devices and require that
characteristics to work; the commit replaces flash_area_erase
with flash_area_flatten to allow LFS work on devices that
do not provide erase callback.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Replace usage of flash_area_erase with flash_area_flatten to
allow code to work with devices that do not provide erase
callback.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Replace flash_area_erase with flash_area_flatten to allow FCB
Settings backend to work on devices that do not provide erase
callback.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The flash_area_erase has been replaced with flash_area_flatten,
allowing code to work with devices that do not provide
erase callback.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Add equivalent of flash_erase, from Flash API, to Flash Map API;
idea is the same: function tries to erase area if driver provides
erase function, otherwise writes erase_value across the defined
area.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
After the get_report() callback, we need to determine how many bytes the
HID device wrote to the report buffer. Use the callback return value to
do this, and modify the net_buf data length value if get_report was
successful.
Reported-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
APIs for enabling and disabling the scanner may take larger time than
expected and scheduling of the lpn state machine is affected by it.
Since these type of latencies are factored into timeouts and scheduling
times, we need to call scan enable/disable APIs after scheduling the
next event time for LPN state machine to be more accurate.
Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
The `Remote wakeup feature not enabled or not suspended` log is not
related to an actual error (connected host might not enable USB remote
wakeup feature). Use warning log level.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
PR #72475 disabled default enabling of many Mbed TLS features
including AES. This means that now it must be explicitly added
when required.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
This commit introduces support for an alternate linking method in the
LLEXT subsystem, called "SLID" (short for Symbol Link Identifier),
enabled by the CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID Kconfig option.
SLID-based linking uses a unique identifier (integer) to identify
exported symbols, instead of using the symbol name as done currently.
This approach provides several benefits:
* linking is faster because the comparison operation to determine
whether we found the correct symbol in the export table is now an
integer compare, instead of a string compare
* binary size is reduced as symbol names can be dropped from the binary
* confidentiality is improved as a side-effect, as symbol names are no
longer present in the binary
Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
Removes the CIS connection establishment from bt_bap_stream_start
and move the behavior to a new funciton bt_bap_stream_connect.
This has 2 advantages:
1) The behavior of bt_bap_stream_start is much more clear and more aligned
with the spec's behavior for the receiver start ready opcode.
2) It is possible to connect streams in both the enabling
and the QoS configured state with bt_bap_stream_connect as
per the spec. This allows us to pass additional PTS test cases.
To implement this new behavior, samples and tests have been updated.
The CAP Initiator implementation has also been updated
to accomodate for the change in BAP, but the CAP
initiator implementation should work the same for application, except
that it's now possible to do unicast start on ASEs in any order
(https://github.com/zephyrproject-rtos/zephyr/issues/72138).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When reading the error message:
"ASSERTION_FAIL: command opcode 0x0c03 timeout with err -11" it may not be
obvious what is wrong with their setup unless you are very familiar
with HCI.
This commit adds some more documentation to make this more obvious.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
The chunked response was not sent properly. There were extra
"\r\n" before the chunk lenght and the length of the string
to be sent was calculated incorrectly.
Fixes#72887
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Explicitly initialize bNumDeviceCaps to 0 because the bos descriptor is
stored on stack.
Fixes: b0d7d70834 ("usb: device_next: add initial BOS support")
Coverity-CID: 368798
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
When calculating the offset for blockwise writes,
we should not advance the block_ctx->current field
past the block boundary.
It causes CoAP layer to reply with the next NUM field
instead of the current one being processed.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The ring buffer API is explicitly not thread safe, with users needing to
implement their own locking. As `poll_out` and `fifo_fill` are operating
on the same ringbuffer, these locks are needed.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Removes the requirement that CAS is found on the remove
device for ad-hoc sets. This makes the CAP API more
versatile as it allows applications to use it with
remote non-CAP devices.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix the dependencies of `CONFIG_EXCEPTION_STACK_TRACE`:
- Architecture-specific Kconfig, i.e.
`X86_EXCEPTION_STACK_TRACE`, will be enabled automatically
when all the dependencies are met.
- `EXCEPTION_STACK_TRACE` depends on architecture-specific
Kconfig to be enabled.
- The stack trace implementations should be compiled only if
user enables `CONFIG_EXCEPTION_STACK_TRACE`.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
The `DEBUG_INFO` in the `EXCEPTION_STACK_TRACE` is only
required by x86. Move that to `X86_EXCEPTION_STACK_TRACE`
instead.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
The `PRINTK` was required for `EXCEPTION_STACK_TRACE` because
it's initial implementation for x86 in #6653 uses `printk()`.
We are using `LOG_ERR()` now, so this is not required anymore.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
PR #72475 disabled default enabling of most Mbed TLS features.
This means that:
- CONFIG_MBEDTLS_CIPHER_AES_ENABLED needs to be manually enabled
when required;
- CONFIG_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC does not need to
be (almost) always added because there is no default RSA
key-exchange enabled, so PSA can be built without RSA support.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Instead of printing either A or AAAA resource query type,
print the correct query type value.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Do not depend on init level but start the socket service
already in net core init because DNS init code depends on
socket service API to be ready to serve. And we call DNS
init at the net core init.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow mDNS resolver and responder to to be used at the same
time so that both can use the port 5353. This requires
a DNS traffic dispatcher which affects also the normal DNS
resolver.
Fixes#72553
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The function is useful for application to lookup set
members from bt_conn pointers, e.g. when iterating on
connected devices.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Supplicant create AF_PACKET proto ETH_P_PAE socket but receive other
frames like ICMP, UDP and causes following issues.
1. When frame len exceeds MTU, net_pkt_clone cannot clone pkt.
Thus dropped it and print warning log.
2. It will lower throughput performance as every packet is cloned.
Fix it by conn_raw_socket does not deliver pkts protocol not macted,
after l2 processed, unless conn is all packets.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
In the current implementation, the LLEXT linker will only apply
relocations targeting a given symbol if it has a specfic symbol type.
This is overzealous and causes issues on some platforms, as some symbols
that need to be relocated are skipped due to being of a "bad" type.
Ignore the symbol type when performing relocation to solve this problem,
but also add checks to ensure we don't attempt to relocate symbols with
an invalid section index. If such a relocation is found, return an error
instead of ignoring the relocation entry to ensure that it is impossible
to execute code from a (partially) unrelocated LLEXT.
Also remove all hacks added to circumvent this issue:
* qemu_cortex_r5 exclusion from test cases
* unnecessary exclusion of some flags when building with LLEXT EDK
Fixes#72832.
Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
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>
Some IPv4/IPv6 functions were ifdef-sliced internally, despite being
compiled in conditionally in top-level #ifdef block under the same
condition.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In some cases the comment after #endif did not match the opening #if, in
some cases it was missing.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>