When socket errors call sm_handle_timeout_state() we might be
in a state where application assumes we are in registered state
but we are dropping it.
Therefore we must ensure that all registration states emit either
REGISTRATION_TIMEOUT event for application to indicate that
we have lost the connection to server.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Revise data type declarations to avoid implicit/explicit casts:
- Changed `unsigned char` to `uint8_t` for `zeros` array
to match with `longest`.
- Declared variables `i`, `j`, and `pos` as `int` to use the same type.
- Cast `value` to `uint16_t` instead of `uint32_t` since
`value` is `uint16_t`.
- Moved `bh` and `bl` declarations to narrow the scope of variables.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Simplify high and low byte conversion by removing redundant checks,
since `net_byte_to_hex` already takes care of zero padding.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Replace the loop with direct high and low nibble extraction,
and ensure the padding and zero suppression logic is simplified.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
number of counters have changed in gcc 14 by commit
08a5233180
Specifically, a new counter was added in gcc/gcov-counter.def:
```
/* Conditions. The counter is interpreted as a bit-set. */
DEF_GCOV_COUNTER(GCOV_COUNTER_CONDS, "conditions", _ior)
```
which in turn updates the value of GCOV_COUNTERS that is defined in
gcov-io.h like this:
```
enum {
GCOV_COUNTERS
};
```
Signed-off-by: Roman Studenikin <srv@meta.com>
If only 2 page frames are queued and code executing in one frame is
making an access to memory in the second frame then the access will trap
and k_mem_paging_eviction_accessed() will be called to move that frame
to the end of the queue ... marking the new head frame unaccessible.
But that newly unaccessible frame contains the code that has yet to be
resumed to perform its memory access. Since it is now unaccessible, a
trap is triggered, the frame is moved to the end of the queue and the
new head frame (the one we trapped for initially) is marked unaccessible.
Execution is resumed with the memory access which is unaccessible again
and the cycle repeats infinitely.
Fix this by not marking the new head unaccessible if there is only one
queued frame left in the queue.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Some offloaded ifaces have an L2, but lack support for
net_l2->send. This edge case is not handled by
net_if_send_data, resulting in a NULL dereference under
rare circumstances.
This patch expands the offloaded iface guard in
net_if_send_data to handle this edge case.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Fixes issues with net_ptp_time arithmetic where second
overflow/underflow would not be handled properly.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
Offset should be *subtracted* from current clock value, not added.
This was causing clock to accumulate error instead of actually
"converging".
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
For 2.4GHz and 6GHz bands, while counting the channels in configured
range, start of the range is being counted twice. Correct this
by advancing the index by 1 while counting channels in range.
Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
When periodic scanning reaches timeout and BIGinfo has not yet been
received, notify with BT_HCI_ERR_CONN_FAIL_TO_ESTAB for sync receiver.
Signed-off-by: Morten Priess <mtpr@oticon.com>
When an ISO stream fails to sync to a broadcaster within the first 6
events, the establishment fails (as expected). However, it did not stop
the ticker, and subsequently it was impossible to establish a new sync
after this.
Make asynchronous call to ticker_stop when establishment fails, and exit
done handling. Cleanup is handled via ll_rx_dequeue().
Signed-off-by: Morten Priess <mtpr@oticon.com>
When the ISO sync receiver has been disabled (terminted), ULL now calls
lll_sync_iso_flush in lower link layer, to allow cleanup and releasing
of resources.
Make sure ISO sync LLL flush is also called when terminating a stream
from local side (app). Add blocking mayfly call to lll_sync_iso_flush in
ll_big_sync_terminate.
Signed-off-by: Morten Priess <mtpr@oticon.com>
If a race condition occurs between stopping CIS stream and tearing down
data path, releasing TX PDUs was not possible for vendor data path, as
the DP configuration is gone.
In that case, call a new vendor specific function for cleaning up and
returning PDUs to correct pool.
Signed-off-by: Morten Priess <mtpr@oticon.com>
The MFIFO holding TX nodes on the ack path back to the host was only
sized to hold the possible number of ACL TX nodes. However, additional
TX nodes are allocated for LLCP and use the same FIFO.
By adding LLCP_TX_CTRL_BUF_COUNT to the size, the FIFO will be able to
hold the worst-case number of TX nodes.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Rename to BT_TICKER_START_REMAINDER better reflect what it
means in terms of providing remainder parameter to ticker
start interface.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Score was never increased for scan_aux events since they are
one-shot events; Fixed by keeping the scan_aux score as part
of the scan structure
Signed-off-by: Troels Nilsson <trnn@demant.com>
Support for separate SDU interval for C_to_P and P_to_C
directions when setting CIG parameters.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add commands to allow requesting a subrate change via the BT shell.
A new build configuration has been added to ensure this is tested in CI.
Signed-off-by: Aleksandar Stanoev <aleksandar.stanoev@nordicsemi.no>
Adds support for LE Connection Subrating as defined in Core 5.4
Vol 6, Part B, Section 5.1.19.
As this is primarily a controller feature, the host support is mostly
a wrapper around the relevant HCI commands.
Note that subrating provides a new method to update the connection's
peripheral latency and supervision timeout alongside subrating parameters.
Signed-off-by: Aleksandar Stanoev <aleksandar.stanoev@nordicsemi.no>
The default behavior for thread pending of completions should use
semaphores rather than yield/wait looping when multithreading is
available.
Disable by default only when multithreading isn't available.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Parse the more flag in coap_get_block2_option(), so that the function
can be used not only with requests but also with replies (where the more
flag should not be ignored).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The block number in block1/2 options can be encoded on up to 20 bits
according to RFC 7959, therefore the underlying type used in helper
functions to retrieve the block number should be large enough to hold
the result. Therefore, replace the container for block number with
uint32_t instead of uint8_t.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
With e.g. a 216MHz core clock, the 32-bit cycle counter overflows after
just 20 seconds. The 32-bit monitor timestamp (100us resolution) overflows
after around five days regardless of what we do, but we should try our best
to reach that.
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Add new config, ARCH_SUPPORTS_COREDUMP_THREADS, and
only enable it for ARM CORTEX M where the gdb server
can support it.
Signed-off-by: Mark Holden <mholden@meta.com>
Add z_test which uses new configs to capture multiple
threads in a core dump and with all of the context
necessary to debug the threads.
Signed-off-by: Mark Holden <mholden@meta.com>
Update core dump file format to support a new section which contains
metadata about threads necessary for debugging.
Define configs to capture that metadata and include it in the dumps
when enabled.
Update documentation to reflect the changes.
Signed-off-by: Mark Holden <mholden@meta.com>
Refactor pm_device_driver_init code to keep the normal execution path
inline and the early exit branches at a single indentation, this is
commonly done throughout the code base.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
`ret` holds the amount of bytes received from the modem. However during
processing of the bytes its value is overwritten by the return value of
`modem_ubx_process_received_byte`, in practice discarding all but the
first byte read.
To prevent this, store the length in a separate variable.
Signed-off-by: Anders T. Akre <anders@akre.io>
It was not being set, and thus if the user_data contained garbage from
before, then conn.c would attempt to call that garbage.
Static channels don't have this issue, as every "SDU" fits into one PDU.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Huajiang Zheng <nxf88597@lsv051208.swis.nl-cdc01.nxp.com>
Storing stuff in user_data? That's a paddlin'
We have been debugging issue after issue because ownership of this
"user" data is not clearly defined. Now it is. L2CAP owns the user_data
field entirely, as soon as `send()` is called.
Also add a warning and retval using CHECKIF.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Declare __stdout_hook_install in libc-hooks.h and use it in the console
drivers rather than redeclare it every time.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
With CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_LINKER_RAM, buffer_output() is
called on the entire RAM memory area. This includes the stack for the
coredump thread, which is where tmp_buf is stored. Eventually, it will copy
(parts of) tmp_buf into tmp_buf itself, which invokes Undefined Behaviour
in memcpy():
> The memory areas must not overlap. Use memmove(3) if the memory areas do
> overlap.
- memcpy(3)
With picolibc, this is detected in __memcpy_chk() and causes a fault in
__chk_fail().
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Adapting icmsg to work without the MULTITHREADING functionality.
Dependencies for kernel work_queue, mutexes and other functions
related to running multithreaded applications have been 'ifdefed'.
Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>