Use the vendor specific ticker resolution margin in the
central connection initiation offset calculation.
Related to commit 89ab68f242 ("bluetooth: controller:
Vendor specific ticker resolution margin").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove the redundant advanced scheduling event margin used
while finding a free space between existing active central
connections.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Move the initial connection event length calculation to
when initiating connection so that initiator with advanced
scheduling to place central connections in a non-overlapping
timeline has the correct ticks slot value available.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add checks to detect ACL data lengths greater than the
configured maximum Tx buffer size in the controller.
The Host should conform to the LE_ACL_Data_Packet_Length
returned by the LE Read Buffer Size command.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Optimize LOW_LAT_ULL scheduling by avoiding redundant
rx_demux mayfly enqueue. Only schedule after checking for
node rx or tx ack presence in the memq.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use the Subsystem defined BT_PER_ADV_SYNC_MAX Kconfig in the
controller implementation of Periodic Advertising Sync Sets.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
A line of code was guarded by CONFIG_BT_L2CAP_TX_FRAG_COUNT instead
of CONFIG_BT_ISO_TX_FRAG_COUNT.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
ISO is a building block for BT_AUDIO but it is not only
useful for AUDIO, and as such should be possible to
enable without enabling BT_AUDIO.
This commit moves iso.c and iso_internal.h to the
host directory (from host/audio) and removes
the CMakeLists.txt.
The /audio directory is left intact for the Kconfig options
it provides, and as a directory for future BLE Audio
content.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit moves the BT_ISO to a common (host and controller)
Kconfig and fixes the ISO buffers in hci_raw.c
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add release of memory acquired for periodic advetising sync. set
when:
- advertising set is removed
- advertising parameters are changed and past PDU type was
extended advertising PDU
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Remove LL_ASSERT from functions that return latest advertising PDU.
The LL_ASSERT was raised in situation that there is no memory to
store unused PDUs memory in a pdu_free queue or extra_data_free queue
Those functions return NULL in such sitation. The returned value is
verified by callers by LL_ASSERT. That gives better context if lack
of memory issue issue occurs.
Besides that there was removed a LL_ASSERT from lll_adv_pdu_and_extra_-
data_alloc. The reasons is the same as above, to give better context
when the lack of memory issue occurs.
This function is used in ULL context (ll_adv_sync_ad_data_set).
If it returns NULL the caller will return BT_HCI_ERR_MEM_CAPACITY_-
EXCEEDED to Host.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Add set of functions that will make possible to configure
radio Direction Finding Extension to transmit CTE for periodic
advertising.
Some of the new Radio API functions are provided as separate
functions changing the same Radio peripheral registers, e.g.
radio_df_mode_set_aoa, radio_df_mode_set_aod. This is done on
purpose and is related with lack of DFE in nrf52_bsim.
To avoid use of conditionally compiled constants to represent
e.g. CTE mode; separate functions were introduced.
Thanks to that DF unit tests are able to compile successfully
without changes in nrf52_bsim platform. Also if DFE is added
to nrf52_bsim there is no need to change the code until it is
desired.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
The storage for extra data is required for implementation of
CTE transmission with periodic advertising.
Data required to transmit CTE correctly are compound of two parts:
- PDU field CTEInfo
- radio configuration to transmit actual constant tone at the end
of PDU.
Extra data is a storage required for radio configuration data.
Nevertheless it must be in compliance with content of CTEInfo field.
Because of that extra data is stored as part of lll_adv_pdu and
is double buffered like PDU memory.
Bluetooth 5.1 spec. allows to enable or disable CTE TX
and change CTE TX parameters when periodic advertising is
enabled. Besides that CTE TX settings may be set before periodic
advertising parameters are set. In such situation ll_adv_sync_set
may be not yet created.
To overcome these constraints ULL should store CTE TX
settings and forward them to LLL only when CTE TX is enabled.
Because of above reasons ULL stores CTE TX settings in ll_adv_set.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Add Directin Finding related features:
- transmission of connectionless CTE,
- antenna switching during CTE transmission (AoD),
to list of features supported by controller.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Remove support for nRF5340 PDK in the BLE controller.
The controller will now support only the nRF5340 DK.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Fix cancel of Periodic Synchronization on Coded PHY. Reset
the association of periodic sync instance after validation
of command disallowed.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When address resolution is disabled, an identity address has
been added into the resolving list with peer IRK, and device
privacy has not been selected for the peer device then
connection indication shall not be sent to the peer that is
advertising using its identity address.
Fixes#24731.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fail after pairing request and response have been exchanged if the
selected pairing method would not result in the required security level.
This avoids the case where we would discover this after having encrypted
the connection and disconnect instead.
This was partially attempted but lacked checking for authentication
requirement when L3 was required, as well as skipping the check if L4
was required but remote did not support Secure Connections since the
check was after we had taken the legacy branch.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Set the error in the security changed callback when the encryption has
not reached the required security level.
Terminate the pairing procedure in SMP on failure to avoid the security
changed callback being called twice in this case.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Terminate the pairing procedure when disconnected while this was in
progress. This notifies the application that security has failed and
removes the key entry.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Set the SMP flag encryption pending in the case where a bond exists
with ediv and rand equal to zero, i.e LE Secure Connections bond.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
When receiving unexpected SMP PDUs with no pairing procedures in
progress don't treat it as a pairing procedure that has failed.
This causes unexpected SMP PDUs to trigger the pairing failed and
security changed callback at unexpected times.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Add status only pairing failed callbacks (complete and failed) so that
these handlers can be added without providing the ability for MITM
pairing procedures.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Rename auth_err_get to security_err_get which better reflect the
error namespace it converts to. Also update to using the enum definition
instead of uint8_t for local variable holding returned value.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
when BT_PASSKEY_INVALID was set, it never updated the fixed
passkey which made its use ineffective
Signed-off-by: Faisal Saleem <faisal.saleem@setec.com.au>
The ATT request buffers are held until the ATT response has been
received. This means that the ATT request buffers are released by the
RX thread, instead of the from the RX priority context of
num_complete.
This can cause a deadlock in the RX thread when we allocate buffers
and all the available buffers are ATT requests, since the RX thread is
the only thread that can release buffers.
Release the ATT request buffers once they have been sent and instead
handle ATT request resending by reconstructing the buffer from the
GATT parameters.
Also re-order the order of resource allocation by allocating the
request context before the buffer. This ensures that we cannot
allocate more buffers for ATT requests than there are ATT requests.
Fixed a buf reference leak that could occur when the ATT request buffer
has been allocated, but GATT returns an error before handing the
responsebility of the buffer to ATT, for example when bt_att_req_alloc
fails.
This is fixed by moving the functionality of att_req_destroy to
bt_att_req_free.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Remove the ATT request destroy callback which is never assigned
by any of the ATT requests.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix indicate without func not working properly, when sent as a
non-req by GATT this has two propblems:
- The indicate would not be treated as a transaction, and back
to back indicate would be sent without waiting for the confirm
- The destroy callback would not be called on the indicate parameters
since the indicate_rsp callback would not be called.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
ATT channels do support queueing buffer so it no longer need to block
waiting the tx_sem besides the buffer allocation already serves the
same purpose as the application will not be able to have more requests
than there are buffers available.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Allow to request a higher security level during the key distribution
phase.
This is required by ATT and L2CAP since they only react to the encrypt
change event where they resend the current request.
The current request might require a higher security level still and
might have to request a higher security level before the pairing
procedure has been finished.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
When ATT resends an ATT request it is sent as a "response" instead of
as a request. This causes the ATT request buffer to be released and
the ATT request cannot be resent one more time.
This causes a problem when the ATT request requires authentication
but the elevation of security is not enforcing MITM protection.
In this case the ATT will first require security level 2 and then resend
the request once this has been reached.
This will lead to a new ATT error response and ATT will require security
level L3.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix the update keys check allowing to overwrite the keys when using
debug keys. Instead the check disallowed overwriting keys made using
debug keys.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix gatt write command returned "write in progress" when either
hex2bin or bt_gatt_write returned an error.
The write_params.func should not be set if the write command was not
successful.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Sets the sequence number when re-encrypting messages from the friend to
the lpn.
This is a regression from #28511.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Set app_idx and net_idx in the msg_ctx before calling
bt_mesh_keys_resolve when re-encrypting friend messages, as they'll be
referenced inside the function.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Fix missing advertising PDU length initialization which
prevented advertising PDU to be transmitted by Radio. This
issue was reproduced when connectable undirected advertising
was enabled without setting an advertising data.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
After #31176, the network would get stored immediately in
bt_mesh_net_create, causing the address and devicekey to get stored as
their zero-initialized version, as they're only being set in the
bt_mesh_comp_provision call, which fires after.
Fixes#32067.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Reduces some user confusion regarding whether it is related
to "Connection ID", "Channel ID", or "Company ID" for the
uninitiated.
Signed-off-by: Emil Hammarstrom <emil.hammarstrom@assaabloy.com>
Fix OpenISA port to include compiler memory barrier as in
commit 1a14f8b3a6 ("Bluetooth: controller: Use DMB instead
of DSB").
Relates to commit 1af2b91c23 ("Bluetooth: controller: Fix
Tx Buffer Overflow") and to commit ef2ece82c0 ("Bluetooth:
controller: openisa: Fix sanitycheck failures") and to
commit c2fc629dd2 ("Bluetooth: controller: 255 byte AD
payload support").
Fixes#31937.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix for OpenISA rv32m1_vega_ri5cy board not supporting
different IRQ Priority levels for LLL, ULL_HIGH and ULL_LOW
execution contexts.
Fixes#31937.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>