Simplify the defines calculating the minimum required ISO
PDU length and the buffer count.
Co-authored-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISO Tx PDU buffer count required when SDU fragmentation
is used.
Rename BT_CTLR_CONN_ISO_SDU_LEN_MAX to
BT_CTLR_ISO_TX_SDU_LEN_MAX so the value is common to both
Broadcast and Connected ISO transmissions.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Rename the internal BT_CTLR_ISO_TX_BUFFERS to
BT_CTLR_ISO_TX_PDU_BUFFERS correct represent the number
of actual ISO PDU buffers allocated in the Controller.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
* This variable default value has to be true, so that the
application can return false in the expired callback
Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
This updates the help text for the Kconfig option BT_MESH_WORKQ_SYS to
take into account the change made in PR #84282 which causes the host to
no longer return -ENOBUFS. Since the mesh will now instead block the
work queue, a note has been added about a potential consequence of this.
Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
Fix HCI command buffer allocation failure, that can cause
loss of Host Number of Completed Packets command.
Fail by rejecting the HCI Host Buffer Size command if the
required number of HCI command buffers are not allocated in
the Controller implementation.
When Controller to Host data flow control is supported in
the Controller only build, ensure that BT_BUF_CMD_TX_COUNT
is greater than or equal to (BT_BUF_RX_COUNT + Ncmd),
where Ncmd is supported maximum Num_HCI_Command_Packets in
the Controller implementation.
Relates to commit 81614307e9 ("Bluetooth: Add workaround
for no command buffer available")'.
Relates to commit 297f4f481f ("Bluetooth: Split HCI
command & event buffers to two pools").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove nested allocation of HCI command buffer so that one
less HCI command buffer is needed starting extended
advertising with privacy enabled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When scanning is started on bt_bap_broadcast_assistant_scan_start then
BAP_BA_FLAG_SCANNING flag for the broadcast assistant instance should
not be cleared.
Fixes#85937
Signed-off-by: Jens Rehhoff Thomsen <jthm@demant.com>
When `bt_le_oob_get_local` or `bt_le_ext_adv_oob_get_local` is called
and SMP is enabled, `bt_smp_le_oob_generate_sc_data` is called to
generate a Random Number and a Confirmation Value needed for OOB data.
These values are based on the device's public key.
The public key is generated only once when `bt_smp_init` is called.
If public key generation fails, the callback passed to `bt_pub_key_get`
is called with `pkey` set to NULL. The `bt_smp_pkey_ready` callback
gets called, but it doesn't release the `sc_local_pkey_ready` semaphore
thus leaving `bt_smp_le_oob_generate_sc_data` wait for semaphore with
`K_FOREVER`.
This commit replaces the semaphore with a conditional variable and
requests a public key again if the key is NULL thus solving 2 issues:
- handling the case where the callback was triggered notifying about the
completion of the public key request, but the key was not generated,
- handling the case where multiple threads trying to acquire the same
sempahore.
The timeout is used instead of K_FOREVER to avoid cases when callback
has never been triggered.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
In function `avdtp_send`, there is case that if the session->req is not
NULL, then the buf will be lost.
Release the allocated buffer by buffer allocated function when the buf
is failed to send.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
When the stream enters the idle state, some values were not
properly reset (e.g. the stream->ep).
Use the bt_bap_stream_detach function to clean up the stream.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix regression in scan aux release now that aux context is
retrieved from the node rx when supporting multiple chain
reception.
Relates to commit a8065926ac ("Bluetooth: Controller: Fix
to release aux context stored in node rx").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Commit removes weak attribute and renames some functions
in crypto_psa.c since there is no centralized distribution
of the PSA key ID in bsim tests and no necessity to
reimplement native mesh approach.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The unicast server does not need GATT caching and it was likely
incorrectly added earlier as a dependency.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of providing NULL for bt_gatt_notify_uuid we
iterate on the connection objects and ensure that we
properly truncate the notification based on each
connection's GATT MTU.
This ensures that we send the right size for all
connections.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a common function to get the maximum notification
size, instead of having multiple implementations of this.
Ideally this function should be moved to the GATT API,
but for now just implement it for LE audio and then move to
GATT later.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added missing documentation for
bt_ccp_call_control_client_discover.
Added missing handling of -ENOTCONN in the function as well.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The total attributes list bytes count is only used to check the tail
room of response buffer. And the remaining frame length is used to
copy data from receiving buffer.
It does not check whether the remaining frame length is consistent with
the total attributes list bytes count.
Add the checking to make sure the attributes list is complete. And it
is used to make sure the response buffer can be accessed safety.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Extends the API for Advertising Coding Selection.
The API is extended to set the Advertising Coding Selection
(Host Support) bit. With this feature, the primary and
secondary PHY can now explicitly report S=2 or S=8 coding
in the extended advertising report. Previously, the report
only indicated LE Coded regardless of whether S=2 or S=8
data coding was used. The API now sets the host support bit
and ensures that the advertising PHY coding scheme is
conveyed to the application via the scan callback.
The support is enabled by CONFIG_BT_EXT_ADV_CODING_SELECTION,
and requires a controller that selects
CONFIG_BT_CTLR_ADV_EXT_CODING_SELECTION_SUPPORT.
Signed-off-by: Thomas Deppe <thomas.deppe@nordicsemi.no>
Add a missing break in supported_context_get, as it was not
intended to fallthrough to BT_AUDIO_DIR_SOURCE or default.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
We need to make sure that within Zephyr different users of the PSA APIs
don't interfere with each other because of using the same numerical IDs
for persistent assets.
This takes care of the PSA key IDs when using persistent keys through
the PSA Crypto API.
See the comments in `<zephyr/psa/key_ids.h>` for more information.
This removes the recently-introduced Kconfig options that allowed changing
the base IDs subsystems were using for their persistent keys.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Added new Kconfig option set that allows the user to control the
presence of the following optional characteristics:
- Manufacturer Name String
- Model Number String
Depreacted the old configuration that can be deleted in the future
Zephyr releases.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Change allows performing ECDH operations through system workq. This is
done to allow reducing memory consumption by disabling the long workq on
small SoCs.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
Fix to release aux context stored in node rx, and not in the
superior scan or sync context as the one in the superior scan
or sync context could be reset or have a different new aux
context when multiple advertising chain reception is used.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix assertion due to changes introduced to support multiple
advertising chain reception.
Auxiliary context association with the Periodic Sync context
was not cleared due to which when terminating a Periodic
Synchronization triggered an assertion check, under race
conditions, detecting that the auxiliary context was already
released.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The BLE acronym is not an official description of Bluetooth
LE, and the Bluetooth SIG only ever refers to it as Bluetooth
Low Energy or Bluetooth LE, so Zephyr should as well.
This commit does not change any board or vendor specific
documentation, and the term BLE may still be used in those.
It will be up to the vendors to update it if they want,
since many of them are using the term BLE in their
products.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix missing sync_delay and transport_latency information in HCI
LE BIG Complete event.
Relates to commit 1a640e4711 ("Bluetooth: controller:
Included transport latency in LE_Big_Established").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix incorrect device address reported in the LE Periodic
Advertising Sync Established event when using Periodic
Advertiser List.
During Extended Scanning there can be an ADV_EXT_IND PDU
received between currently being received ADV_EXT_IND PDU
and AUX_ADV_IND PDU; if the one received between has an
address match then incorrectly the Periodic Synchronization
was established to the device whos AUX_ADV_IND PDU is being
received. Fix by storing the auxiliary context that has the
address match and compare with it when matching the SID in
SyncInfo of AUX_ADV_IND PDU being received prior to creating
the synchronization.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix BT_CTLR_LOW_LAT_ULL conditional compilation code by
decoupling it from BT_CTLR_LOW_LAT code.
BT_CTLR_LOW_LAT_ULL makes ULL execution context to tailchain
in comparison to continuously process in a while loop.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Since the PACS service is not part of the bt_bap API it should
not use the bt_bap prefix, and instead just be bt_pacs like the
rest of the PACS API.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The code for checking for allocated BR/EDR PSMs was potentially resulting
in an integer overflow, due to doing a <= UINT16_MAX (0xffff) comparison
on a uint16_t variable. To avoid this, use a uint32_t variable internally.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Added a new function, bt_conn_is_type, that returns whether
the provided conn object is of the provided type.
This check is then used to ensure that the conn objects
supplied to other bt_conn function are of the right type.
The right type has also been documented for these functions.
This is an initial commit for a larger change in the BT Host,
as similar checks should be added to the L2CAP, GATT, ISO,
Audio and possibly Mesh APIs.
The type check could have been implemented by using the
bt_conn_get_info function, but that requires additional
function calls as well as memory allocation and copy.
Since bt_conn_is_type is designed to be widely used, it
was suited for its own function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Commit removes the double cdb node entry storing
into the settings if device was reprovisioned over
nppi interface.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
If BT_ISO_BROADCAST is enabled, then we shall support
at least 1 BIG and at most BT_EXT_ADV_MAX_ADV_SET since
each BIG requires its own advertising set.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove START_PENDING flag, and replace with
bt_mesh_adv_is_empty_by_tag
not only make adv_ext.c more readable, but also enhancement
In previous implementation, after proxy started, will check
this flag, and when the flag is true, will direct stop proxy
and re-enter schedule, but has one problem, this flag set true,
but buf will be empty, such as when sending mesh relay messages
will for-each every sets, until find not-active, but also set
previous set START_PENDING flags, so will cause proxy advertising
started->stop->started.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
The first why introduce ADV_FLAG_PROXY_START
see here(https://github.com/zephyrproject-rtos/zephyr/pull/58826)
The main core change is to mark ADV_FLAG_PROXY as moving to the last
enabled proxy instead of before.
But introducing the ADV_FLAG_PROXY_START flag seems meaningless.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
Building bluetooth.shell.audio.only_gtbs with clang warns:
subsys/bluetooth/audio/tbs.c:1646:6: error: variable 'ret' is used
uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
if (param->gtbs) {
^~~~~~~~~~~
subsys/bluetooth/audio/tbs.c:1667:9: note: uninitialized use occurs here
return ret;
^~~
subsys/bluetooth/audio/tbs.c:1646:2: note: remove the 'if' if its
condition is always true
if (param->gtbs) {
^~~~~~~~~~~~~~~~~
subsys/bluetooth/audio/tbs.c:1626:9: note: initialize the variable 'ret'
to silence this warning
int ret;
^
= 0
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
We have previously fixed an issue with shifting and
assigning the value without a cast, but coverity
is still complaining about aa[1] and aa[0] with:
"Casting narrower unsigned aa[1] to wider signed type
int effectively tests its lower bound."
Using the common function, sys_get_le24, should fix this issue.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Explicitly cast Kconfig option value to avoid truncation issue reported
by Coverity.
Fixes#84697
Coverity-CID: 487737
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>