ad_len parameter is not length of complete advertising data, but number
of bt_data structs passed to bt_le_per_adv_set_data - we pass only one.
Also memset target buffer before converting hex string so data shorter
than specified will be right-padded with zeroes instead of some
leftovers.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
The mem_pool Kconfig API is deprecated as allocation now uses a k_heap.
Update to allocate a heap with the same amount of memory as was
defaulted with mem_pool customization.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Originally the file cache used a mem_pool, but that data structure has
been deprecated and replaced by a heap that includes metadata in the
heap area. As a result attempts to allocate all blocks will fail
because some of the reservation intended for cache data is now holding
metadata instead.
It's not immediately clear how to adjust the required heap size to
support this metadata as it depends on heap chunk units and data
structures that are not visible to the application. Experimentally a
value of 24 bytes works, while smaller values do not.
Further the previous Kconfig API to configure the allocation pool is
completely inappropriate with the new heap data structure which has
such different behavior.
So: Deprecate the old Kconfig API. Add a new Kconfig option to
directly control the cache size. Infer a default cache size that
works with the old mem_pool parameters assuming a per-block overhead.
But to avoid wasted memory use the heap allocation only when the
application customizes the size, and use a slab in other cases.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
When pushing received data to the application, check that app
was able to receive the data. If the application already closed
the socket, then we must free the received net_pkt in order to
avoid memory leak.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If we cannot allocate net_pkt or net_buf, then check this condition
properly and release other resources that were already allocated.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Some targets, such as network cores on a multi-core SoC, do not
support system power management because they do not control the SoC.
Provide a flag that can be selected to inihibit enabling system power
management on those targets.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This reverts commit f38ba314ea.
nrf5340dk_nrf5340_cpunet doesn't support power management, but that
should be handled another way.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
We need to make sure that when listening a connection establishment,
the connection gets cleared if we do not receive final ACK.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Fix the mayfly callee id for the rx_demux scheduling under
the LOW_LAT_ULL implementation. This could be causing
undefined mayfly execution behavior in nRF51x SoC.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove the deprecated bt_conn_create_slave_le function.
This was deprecated in the 2.3.0 release.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fixes problem when fs_open invoked on fs_file_t object, which is already
holding information on opened file, overwrites references to other
memory objects within the fs_file_t object causing resource leak.
If fs_open is invoked on already used fs_file_t object, it will return
-EBUSY.
Note: The change requires that all fs_file_t objects should be
initialized to 0.
Fixes: #29478
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds initializations of fs_file_t variables in preparation
for fs_open function change that will require fs_file_t object, passed
to the function, to be initialized before first usage.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds initializations of fs_file_t variables in preparation
for fs_open function change that will require fs_file_t object, passed
to the function, to be initialized before first usage.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds initializations of fs_file_t variables in preparation
for fs_open function change that will require fs_file_t object, passed
to the function, to be initialized before first usage.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Conform to Bluetooth Specification, if the LE_Scan_Enable
parameter is set to 0x01 and scanning is already enabled,
any change to the Filter_Duplicates setting shall take
effect. Disabling scanning when it is disabled has no
effect.
Fixes#31019.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
There was one case where the dummy policy was returning a wrong type
in the function pm_policy_next_state.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
CoAP RFC (RFC7252) states that end points should support
the CoRE Link Format of discoverable resources as described in RFC6690
(refer section 7.2 of the RFC7252).
Fixes#31609
Signed-off-by: Kasun Hewage <kasun.ch@gmail.com>
Fix regression in adding the state for Connection Parameter
Request being rejected where in Connection Parameter Request
Procedure state machine was prematurely reset before the
reject PDU was enqueued.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing initialization of ticks_to_offset value on
instantiation of new peripheral context.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix repeated offsets in LE Connection Parameter Request PDU
due to rounding errors. Use tick units of connection
interval to calculate the offset units.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix deferred Connection Parameter Request offset population
by introduction of explicit states waiting for the offset
calculations to complete in the ULL_LOW context.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix deferred Connection Update offset population by
introduction of explicit states waiting for the offset
calculation to complete in the ULL_LOW context.
Fixes#29636.
The problem was, in an encrypted connection the enqueued PDU
to be transmitted is encrypt in the prepare callback by the
hardware and swapped to a different buffer for transmission;
the deferred offset population did not reflect in the
transmitted PDU as it was filled in the cleartext buffer
while encryption completed into the encrypted buffer.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix error introduced by pull request:
https://github.com/zephyrproject-rtos/zephyr/pull/31591
Zephyrs CMake extension function zephyr_library_sources_ifdef()
does not allow to use complex conditions to toggle if
sources should be included in build or not.
It allows to use only single variable as an input for
feature_toggle argument because it is double-expanded
in contition statement in the function.
In case there is a requirement that source file is included
when more complicated condition is true we have to fall-back
to reqular if() statement and zephyr_library_sources().
The fix is required because without it radio_df.c source
is never compiled. If DF functionality is enabled build
will fail because of missing functions implementation.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
the implementation of spinlock validation uses two LSB bits in the
bottom of a pointer union to store a CPU index, which only has space
for 4 CPUS. the MP_NUM_CPUS should be <= 4.
Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
After the latest upmerge, OpenThread requires explicit configuration
of the Master Key. This commit adds a Kconfig symbol that can be
used to setup its value. By default no Master Key is configured and
OpenThread generates a random one.
The Sockets Echo samples are configured with a fixed key with this
commit.
Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Syncing here is done with a semaphore declared on a function stack
and released in a callback. In case of a cancelled transfer (eg.
cable disconnect) the callback is never called.
The fix introduces a periodic check if a transfer is still valid.
Signed-off-by: Jan Pohanka <xhpohanka@gmail.com>
Only start the network logging backend if the autostarting
option CONFIG_LOG_BACKEND_NET_AUTOSTART is enabled.
Also, call init to make sure that the backend is initialized
properly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Fix implementation to run local peripheral initiated control
procedure with instant in parallel with remote initiated
encryption procedure.
Relates to #28887.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
If a PHY update is waiting for the instant to be reached and the master
starts the encryption procedure, store the pending PHY update procedure
and handle it simultaneously with the encryption setup.
This fix prevents the encryption setup from stalling and thereby timing
out after 40s, after which the master drops the link.
The ll_conn::llcp::encryption can not longer be unioned with the
ll_conn::llcp:phy_upd_ind as one would overwrite the other.
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
Add conditional compilation on peripheral and central
specific control procedure implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix BIG Sync Terminate Command to generate Sync Established
event if Sync initiation is in progress.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added missing allocation of node rx buffer required for
generation of Broadcast ISO Sync Established.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Token and payload are appended from data buffers to a CoAP packet
being encoded. Keyword const was missing for parameters in functions
appending these parts to a packet.
Now token and paylod can be copied to CoAP packet from constant
buffers, that can be stored in ROM.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
This patch introduces COAP_TOKEN_MAX_LEN definition in coap.h file.
This definition replaces magic number across CoAP protocol
implementation and CoAP samples.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
Clean up logging menuconfig by grouping configuration into
sections like: mode, processing configuration, backends.
Additionlly, removed LOG_ENABLE_FANCY_OUTPUT_FORMATTING which is no
longer in use.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The net_buf was never unref'ed when the host received an
ISO package that was a SINGLE.
Also adds a few additional debug messages.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
`iso send` may take an optional "count" parameter but the
number of optional arguments was incorrect.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The DF tests are implemented to be executed with nrf52_bsim platform.
The nrf52_bsim platform does not include Direction Finding Extenstion.
Due to that, radio_df.c compilation failed with error about missing
antenna configuration in DTS.
To solve the problem, I've changed nrf.cmake to include radio_df.c
file when CONFIG_BT_CTLR_DF is defined and CONFIG_SOC_SERIES_BSIM_NRFXX
is not definded.
Thanks to that any other platform is not affected. The file will not
build if there is no appropriate configuration or there are missing
features in a hardwared.
Unit tests have provided stub imlpementation or radio functionality.
If nrf52_bsim has implemented Direction Finding Extension, the
DF unit tests code will stil work and will not require additional
changes. Also content of the file is not affected by contional
compilation entries.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Remove ATT modifying the L2CAP channel state by unassigning the
the connection pointer on timeout.
Unassigning this pointer does not prevent the ATT channel from receiving
since bt_l2cap_recv does not inspect this pointer before calling the
channel receive function.
This prevented the disconnected callback from being called on the
channel after the channel had timed out, but since the disconnected
callback now handles this case this workaroun is no longer needed.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Handle ATT timeout on disconnected ATT channel.
When the ATT channel is disconnected with a pending request the ATT
timeout is canceled and the response processed with an error code.
However canceling of delayed work is not guaranted to succeed, e.g:
"Work queue thread has removed the work item from the queue but has not
called its handler"
This could lead to timeout handler being invoked after the disconnected
handler.
Fixes: #29098
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>