Host stack supports to set BR security level to 4 but the security level
cannot be set to 4 by the shell command.
Update the code to support BR security level 4.
Signed-off-by: Can Wang <can.wang@nxp.com>
Add ll_conn_get() return value check for valid connection
context.
Build command:
cmake -GNinja -DBOARD=nrf52833dk/nrf52833
-DEXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf
-DDTC_OVERLAY_FILE=boards/nrf52833dk_nrf52833_df.overlay
-DSNIPPET="bt-ll-sw-split" ../../samples/bluetooth/hci_uart
ninja
Before:
Memory region Used Size Region Size %age Used
FLASH: 283716 B 512 KB 54.11%
RAM: 109752 B 128 KB 83.73%
IDT_LIST: 0 GB 32 KB 0.00%
After:
Memory region Used Size Region Size %age Used
FLASH: 284992 B 512 KB 54.36%
RAM: 109752 B 128 KB 83.73%
IDT_LIST: 0 GB 32 KB 0.00%
After (use of `conn != NULL`):
Memory region Used Size Region Size %age Used
FLASH: 285044 B 512 KB 54.37%
RAM: 109752 B 128 KB 83.73%
IDT_LIST: 0 GB 32 KB 0.00%
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing connection handle invalidate on Controller
power up.
The connection context are zero-initialized on startup and
calls to `ll_connected_get()` would incorrectly return a
valid connection context pointer for connection handle 0.
Relates to commit fa02dc4d02 ("Bluetooth: Controller: Fix
missing reset of connection handle").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Recent test specification added additional test for validating
invalid packet sizes on L2CAP signaling channel. IUT is allowed
to either disconnect link, ignore packet, reject packet or
issue a warning to upper tester if other action is taken.
To keep things in line with previous check for too small size
simply ignore fixed size packets of invalid length.
This was affecting L2CAP/COS/CED/BI-11-C qualification test.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
The bt_csip_set_member_register kept a counter that was not
decreased when bt_csip_set_member_unregister was called.
This meant that we could register and unregister CSIS,
but we could not re-register once it had been unregistered.
This commit fixes this by removing the counter and instead
rely on the service instance state, which also requires restoring
the original service definition, as well as adding a test that would
have failed with the previous version.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Based on a dicussion on the Bluetooth SIG GAWG reflector, it is
not allowed for a broadcast assistant to request specific BIS
indexes as well as BT_BAP_BIS_SYNC_NO_PREF in the same
request.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Based on a dicussion on the Bluetooth SIG GAWG reflector, it is
not allowed for a broadcast assistant to request specific BIS
indexes as well as BT_BAP_BIS_SYNC_NO_PREF in the same
request.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When execute `bt connections`, only the peer device address of selected
LE connection is flagged with `*`.
Improve the command `bt connections` to support BR connections.
Regardless of the connection type, `*` will be shown to indicate the
peer address of the current connection if the peer device address is
the peer address of selected connection.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The CR bit in DISC frames should be set as a command rather than a
response.
This patch fixes the rfcomm_send_disc function to correctly use
BT_RFCOMM_CMD_CR instead of BT_RFCOMM_RESP_CR when setting the CR bit in
the address field of DISC frames.
Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
Commit fixes bug when advertisements were disabled and stopped
during suspending without unreferencing allocated advertisements.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Previously, the interval was only checked for non-zero. Now it is
validated to be within the allowed range (BT_HCI_LE_INTERVAL_MIN
to BT_HCI_LE_INTERVAL_MAX) to avoid invalid values.
Signed-off-by: Babak Arisian <bbaa@demant.com>
Fix assertion observed establishing subsequent Peripheral
ISO connection due to a race between the new CIS context
being acquired into a CIG and LLL getting a CIS sorted by
CIS offset in that CIG. Get only active CISes from the CIG
in the LLL prepare.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix max tx octets value used as given to the Host by the
LE Read Buffer Size command response.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing removal of redundant ISO Rx size in ACL Rx PDU
allocation size.
Related to commit 7c89f1fe9f ("Bluetooth: controller:
Support for separate ISO RX data path").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
BASS server need to notify that both BIS and PA are no longer synced by
setting all required fields to 0 after client stops BIS by sending a
BIG control PDU with a BIG TERMINATED indication.
meanwhile BIG_Encryption in the notification should also be reset to be
BT_BAP_BIG_ENC_STATE_NO_ENC when BIS is not synced anymore.
Signed-off-by: Ping Wang <pinw@demant.com>
Fix missing nRF CCM disable on connection event abort.
There can be a problem on nRF SoC for example when a S8
"encrypted" reception is aborted, and a 2M "cleartext"
reception starts; slow CCM (that is not stopped as part of
radio disable) will corrupt a fast received "cleartext" when
the same current free rx buffer is reused in the Controller.
This is not a problem when the connection being abort-ee is
on a faster PHY than the abort-er.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use the macro NSEC_PER_SEC defined in sys_clock.h for nanoseconds per
second when updating write stats.
Signed-off-by: Alex Apostolu <apostolu240@gmail.com>
Fix MIC failure when 2 or more CISes in Peripheral is active
and any CIS before the last CIS does not have reception that
lead to the event count and payload count being incorrect.
Add the missing flush implementation when switching between
CISes in the CIG event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In current implementation, if the MITM flag of both sides is disabled,
the pairing method is incorrect.
Such as, the IOCAP of both sides is `display_yesorno`, the pairing
method is `PASSKEY_CONFIRM`. But actually, it should be `JUST_WORKS`
in this case.
Fix the issue by setting the pairing method to `JUST_WORKS` if the
MITM flag of both sides is false.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The Kconfig option has not been in use for anything for
a long time, and can safely be removed.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit prevents ATT request APIs from blocking waiting on the
req_slab pool on the system work queue. The API will instead return
-ENOMEM.
This aligns with commit 05b16b971b, which
establishes that the GATT request APIs are non-blocking on the system
work queue. That commit makes GATT request APIs fail with -ENOMEM when
they fail to allocate a buffer for the ATT PDU on the system work queue.
There is no reason to make this distinction between the two resources,
and this makes the API more consistent.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
For the control point operations, add/modify/
remove source, callbacks are added so that Application
can decide whether to accept/reject the control point
operations.
Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
After https://github.com/zephyrproject-rtos/zephyr/pull/72090,
`conn_tx_alloc` no longer blocks, and each buffer always has a
corresponding `bt_conn_tx` object. This eliminates the need to configure
the number of `bt_conn_tx` objects via `CONFIG_BT_CONN_TX_MAX`, since
every buffer now carries its own context even when no callback is used.
This commit deprecates `CONFIG_BT_CONN_TX_MAX` as it is no longer
necessary. Instead, `CONFIG_BT_BUF_ACL_TX_COUNT` is used to allocate
`bt_conn_tx` objects for outgoing ACL data. ZLL already uses
`CONFIG_BT_BUF_ACL_TX_COUNT` to configure the number of outgoing ACL
packets. With this change, modifying the packet count will automatically
adjust the number of corresponding contexts, preventing both context
starvatoin and underutilization.
This approach also aligns with ISO, where the number of `bt_conn_tx`
objects for outgoing ISOdata matches `CONFIG_BT_ISO_TX_BUF_COUNT`.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
After https://github.com/zephyrproject-rtos/zephyr/pull/72090, each
packet to be sent (wether ACL or ISO data) has a corresponding
`bt_conn_tx` object, regardless of whether a callback is used.
This means that number of packets Host can send to Controller is limited
by the smaller of two values: ACL/ISO packets Controller can receive,
and the number of `bt_conn_tx` objects allocated by Host.
A mismatch between these numbers may lead to inefficient resource usage
on either Host or Controller side. If Host allocates fewer `bt_conn_tx`
objects than the number of buffers available on Controller for a given
data type, some Controller buffers may go unused. Conversely, if Host
allocates more `bt_conn_tx` objects than Controller can consume, the
excess objects remain unused.
This commit adds a check and issues a warning if the number of
`bt_conn_tx` objects is not aligned with the number of ACL/ISO buffers
reported by Controller via the LE Read Buffer Size v1 or v2 command.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The building of cs.c based on the respective Kconfig option is already
taken care of CMakeLists.txt, so it's redundant to try to protect the code
through ifdefs in the c-file as well.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Add a prompt to the long workqueue stack size, so that it can be easily
fine-tuned by the application. The exact usage will depend on many factors,
such as the chosen crypto backend and target architecture, so it's not
possible to have "one size fits all" solutions based on the default values.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The context type PROHIBITED has been removed from
the Bluetooth assigned numbers document. It is, however,
still used in some profiles to indicate either "No context
type supported" or "None available", and thus a rename
to "NONE" makes sense.
It is still treating similar to prohibited in some cases,
as it is not a valid context type in all cases.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix Central CIS offset calculation for dissimilar ACL and
ISO intervals in use.
Mayfly execution of `mfy_cig_offset_get()` could be after
"LLL Prepare" or before depending on whether a previous radio
event is being preempted or not, respectively; the
`conn->lll.event_counter` may not be pre-incremented.
This race condition is fixed by the fact that we use a
constant instant delta value now.
Dissimilar ACL and ISO intervals may lead to ACL overlapping
or be too close to ISO event, causing preemption; under this
case ACLs "LLL Prepare" would run after `mfy_cig_offset_get`
causing incorrect calculation of CIS offset without the fix.
Remove redundant `instant` member in `ll_conn_iso_stream`
structure as a constant CIS Create instant delta is now
used.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
PSA Crypto API always allow psa_generate_random() to be called (i.e. there
is no PSA_WANT_xxx symbol that can be used to disable it). How random
numbers are generated internally is a library internal detail, but the
end user (Bluetooth) does not need to worry about this.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
sizeof(struct bt_le_cs_write_cached_remote_fae_table) = 74,
so the default value (65) was already too small in some cases.
Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
With BT_SETTINGS enabled, there doesn't seem to (anymore?) be any
substantial overhead in stack consumption:
0x200020b8 BT RX WQ
options: 0x0, priority: -8 timeout: -9223372036854775808
state: pending, entry: 0x5ba69
stack size 2240, unused 1072, usage 1168 / 2240 (52 %)
Let's just remove the conditional default and fall back to the
non-conditional one which is 1200.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Make sure iso_interval_us is in a multiple of 1.25 ms instead of directly
assigning it the value of SDU interval
Fixes EBQ failures in LL/CIS/CEN/BV-36-C and LL/CIS/CEN/BV-37-C
Signed-off-by: Troels Nilsson <trnn@demant.com>
The abs() function only takes an int as input - use llabs() instead
Fixes EBQ failure in LL/CON/PER/BV-105-C
Signed-off-by: Troels Nilsson <trnn@demant.com>
The "BT RX pri" and "BT RX" are too easily confused with host-side threads,
e.g. the host RX thread is called "BT RX WQ". Add "CTLR" to the Controller
side thread names to make it clear that they're managed by the controller.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
No window widening was applied to conn_offset_us causing the initial
ticker_cb to get called slightly too late
Apply window_widening_periodic_us to conn_offset_us, since this is the
worst-case window widening (win_offset is not allowed to be larger than
a connection interval) and is applied in the LLL window size already
Fixes EBQ failure in LL/TIM/PER/BV-02-C
Signed-off-by: Troels Nilsson <trnn@demant.com>
The bt_csip_set_member_get_sirk function is superseded by
bt_csip_set_member_get_info and uses of it has been replaced.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Updates the includes in a a few files to
avoid including unused header files and include the
ones that are used.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Updates the includes in a a few files to
avoid including unused header files and include the
ones that are used.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
There was a semaphore in hci_core which was given to early when
receiving the BT_HCI_EVT_NUM_COMPLETED_PACKETS message from the
controller. This would sometimes cause an assert to happen in
function hci_num_completed_packets, where there would arise a
mismatch in the bookkept count, and actually stored nodes. More
concretely, due to premature semaphore giveing, the tx_pending node
would be have been removed in another context before it could be
fetched and moved to complete list in this function.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>