Commit graph

21541 commits

Author SHA1 Message Date
Erik Brockhoff
f41b3d7879 Bluetooth: Controller: Fix conn param req ack/req reset
llcp.conn_param.ack was reset on tx of conn param rsp, however this
should only be done once the expected conn update ind is received
and sets the cu.ack flag to indicate cu procedure 'takes over'.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:07:35 -04:00
Vinayak Kariappa Chettimada
5123b45761 Bluetooth: Controller: Initial support for advertising on S2/S8 coding
Added implementation to support advertising on S2/S8 coding
scheme.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:06:47 -04:00
Vinayak Kariappa Chettimada
193ce73109 Bluetooth: Controller: Fix missing resume of primary channel scanning
Fix missing implementation to release Auxiliary PDU chains
and then resume back to scanning on primary channel.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:06:47 -04:00
Vinayak Kariappa Chettimada
1ce46fd7a6 Bluetooth: Controller: Add PDU time calculation for S2 Coded PHY
Add PDU time calculation macro for S2 and S8 Coded PHY.
Rename PKT_AC_US to PDU_AC_MAX_US.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:06:47 -04:00
Vinayak Kariappa Chettimada
88b155de31 Bluetooth: Controller: Rename PKT_US to PDU_DC_MAX_US
Rename PKT_US to PDU_DC_MAX_US.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:06:47 -04:00
Vinayak Kariappa Chettimada
869d3c24d7 Bluetooth: Controller: Rename PKT_DC_US to PDU_MAX_US
Rename PKT_DC_US to PDU_MAX_US.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:06:47 -04:00
Vinayak Kariappa Chettimada
48f5990eea Bluetooth: Controller: Add missing range delay for extended active scan
Add missing range delay value when calculating the header
complete timeout value for the reception of extended scan
response PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:06:47 -04:00
Vinayak Kariappa Chettimada
6911e7e1d8 Bluetooth: Controller: Use the received coding scheme when scanning
Use the received coding scheme when scanning for correctly
calculating the receive chain delay and on-air PDU time.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:06:47 -04:00
Vinayak Kariappa Chettimada
cee9ce6b8e Bluetooth: Controller: Add Coded PHY Rx-ed coding get interface
Added a radio interface to fetch the received Coded PHY
coding scheme of the PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:06:47 -04:00
Emil Gydesen
7854088116 Bluetooth: ISO: Fixes missing handling of broadcast ISO TX
After 31045c7 was merged, it was possible to use broadcast
iso without CONFIG_BT_CONN, but it did not properly handle
TX as there were missing support to read the buffer
size from the controller, as well as missing support
for handling the number of completed packets event.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-25 18:06:09 -04:00
Emil Gydesen
96dfad0eef Bluetooth: host: Add ISO support for num_completed_packets event
Change so that num_completed_packets event handling is also
enabled for broadcast ISO only builds. This is because sending
data on a broadcast ISO still generates this event.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-25 18:06:09 -04:00
Emil Gydesen
24226b0135 Bluetooth: Host: Move bt_conn_create_pdu* out of ACL group
Move the function out of the ACL group as it may be used
for broadcast ISO only builds.

er 31045c7 was merged, it was possible to use broadcast
iso without CONFIG_BT_CONN, but it did not properly handle
TX and RX as there were missing support to read the buffer
size from the controller, as well as missing support
for handling the number of completed packets event.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-25 18:06:09 -04:00
Johann Fischer
9ad610d1a7 bluetooth: remove Kconfig options CONFIG_BT_*_ON_DEV_NAME
Follow up on commit bfd45e5b8c
("drivers: remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME")
Remove Kconfig options
CONFIG_BT_UART_ON_DEV_NAME and CONFIG_BT_MONITOR_ON_DEV_NAME
since all UART drivers are converted to devicetree and we can just use
DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_uart)) and
DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_mon_uart)).

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-25 18:05:17 -04:00
Carlo Caione
3dd7fd4f70 ipc: Call ipm_set_enabled() on RX channel also for dual IPM support
The IPC drivers rpmsg_service and rpmsg_multi_instance are not
explicitly enabling the RX IPM channel when two different devices are
used for TX and RX. While this could be redundant for some IPM drivers,
in some cases the hardware needs to be enabled before using it.

Add the missing calls to ipm_set_enabled() for both the devices.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-08-25 18:04:01 -04:00
Piotr Pryga
0395f46126 Bluetooth: controller: hci: Add missing DF conn-less cmds to supp list
There were missing commands in local supported commands list that
are related with connectionless direction finding.
The commands are implemented but they haven't been added
to HCI_Read_Local_Supported_Commands list.
The commit fixes that.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-08-25 18:02:39 -04:00
Flavio Ceolin
7aa6fe148e pm: system: Suspend devices on STATE_SOFT_OFF
Suspend devices when the system goes to STATE_SOFT_OFF.
This state was not triggering any device power management. This should
at least suspend devices as it is done for SUSPEND_TO_RAM and
SUSPEND_TO_DISK.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-24 22:29:34 -04:00
Johann Fischer
741ae93ce2 shell: remove Kconfig option CONFIG_UART_SHELL_ON_DEV_NAME
Follow up on commit bfd45e5b8c
("drivers: remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME")
Now we can also remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME
since all UART drivers are converted to devicetree and we can just use
DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_uart)).

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-24 17:15:58 -04:00
Vinayak Kariappa Chettimada
e4ed1d32be Bluetooth: Controller: Schedule LLL prepare before scan train code
Move the implementation of scan trains after call to LLL
prepare, so that LLL prepare executes without any latency.

To increase radio utilization, LLL prepare should be
scheduled as early in the `ticker_cb` of the radio event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-24 07:35:59 -04:00
Vinayak Kariappa Chettimada
7d1404a717 Bluetooth: Controller: Fix return value for unassigned aux context
Fix the return value use to indicate unassigned auxiliary
context when scanning is using LLL scheduling. This can
happen only under LLL scheduling where in LLL auxiliary
channel PDU reception has been spawn from LLL primary
channel scanning and on completion will join back to resume
primary channel PDU scanning.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-24 07:35:24 -04:00
Vinayak Kariappa Chettimada
01393382d7 Bluetooth: Controller: Update AD Data PDU allocation configurability
Update the calculation for configurable amount of shared
PDUs across advertising sets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-24 07:33:48 -04:00
Vinayak Kariappa Chettimada
41bb453948 Bluetooth: Controller: Keep the default AD Data length to 31 octets
Keep the default AD Data length to Bluetooth Specification
defined minimum of 31 octets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-24 07:33:48 -04:00
Emil Gydesen
76091850c5 Bluetooth: sample: Update iso_connected_benchmark to use new ISO API
Update the sample to use the new ISO API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-24 07:29:11 -04:00
Emil Gydesen
7037b11e1a Bluetooth: shell: Update ISO shell to new API
Update the ISO shell commands to use the new
ISO API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-24 07:29:11 -04:00
Emil Gydesen
c47dae8c6d Bluetooth: ISO: Update connected ISO API
Update the connected ISO API to be more
similar to the broadcast ISO API as well
as the HCI spec.

This updated API allows for more flexibility
and will better support scenarios such as true
wireless setup, as ISO channels and connections
are more independent now.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-24 07:29:11 -04:00
Vinayak Kariappa Chettimada
c74fe1f009 Bluetooth: Controller: Fix scan window resume after extended scan
Fix implementation to not to put back the primary channel
scanning to resume state when Extended Scan has used ULL
scheduling which pre-empts the scan window.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-24 07:27:35 -04:00
Johann Fischer
1de84d2208 usb: cdc_acm: configure CDC ACM UART instances using devicetree only
Remove the possibility to configure number of CDC ACM UART
instances in Kconfig.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
c3313c1dc1 bluetooth: monitor: remove CONFIG_UART_CONSOLE_ON_DEV_NAME
Replace with DT_LABEL(DT_CHOSEN(zephyr_console)).

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
e78b0785b3 console: remove device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME)
Remove device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME)
and use DEVICE_DT_GET(DT_CHOSEN(zephyr_console)) to get
chosen "zephyr,console" node.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
f460848002 net: ot: rework NCP interface configuration
Rework NCP interface configuration and NCP sample. Remove
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME and
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM Kconfig
options in favor of chosen node zephyr,ot-uart usage.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
5e3319f091 usb: cdc_acm: allow to configure CDC ACM UART device from devicetree
Add hidden Kconfig option to Kconfig.cdc and allow
to configure CDC ACM UART device from devicetree.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Flavio Ceolin
b91baf46b7 pm: device_runtime: Simplify variable name
Simplify an internal variable name.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-23 17:46:33 -04:00
Flavio Ceolin
83b222d7a6 pm: device_runtime: Do not directly set the state
The state variable is already set in pm_device_state_set. Do not change
it again.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-23 17:46:33 -04:00
Flavio Ceolin
73b9a28b27 pm: device_runtime: Fix power state type
Internal function was still using uint32_t instead of the proper enum.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-23 17:46:33 -04:00
Vinayak Kariappa Chettimada
14fbcffbc7 Bluetooth: Controller: Simplify clearing of extended scan response data
Simplify implementation that clears extended scan response
data by moving the length check after the new PDU buffer
has been correctly initialized.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-23 08:23:36 -04:00
Vinayak Kariappa Chettimada
c0d569d233 Bluetooth: Controller: Check for invalid PHY in Aux Ptr
Add check to validate PHY value in the Auxiliary Pointer
structure in the common extended header format.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-23 08:22:32 -04:00
Vinayak Kariappa Chettimada
95e0f63bbd Bluetooth: Controller: Use one bit for Extended Scan Filter Directed
Use one bit to represent the Extended Scan Filter Directed
Advertising Report.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-23 08:22:10 -04:00
Mark Wang
c11ef74605 Bluetooth: SDP: add one API bt_sdp_get_add_proto_param
The bt_sdp_get_add_proto_param is used to get the protocol
parameter from Additional Protocol Descriptor List.
In order to implement it, one parameter
(proto_profile_index) is added to sdp_get_uuid_data_index
to get the indexed item.
Fix one bug in sdp_get_uuid_data because there may be more
than 2 consequent "seq len item".

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2021-08-23 15:11:24 +03:00
Joakim Andersson
d76bba4b5e Bluetooth: host: Device name handling of invalid length
Add a build assert if the device name has been misconfigured. The device
name has a max length of 248. When configured as dynamic make sure that
the initial device length can fit in the dynamic max length.
This prevents us from having to handle length overflow when setting
device name in advertising data which has an 8-bit length field.

Log a warning if failing to set the device name in bt_enable.
Remove unused defines in the shell.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-08-20 18:56:38 -04:00
Joakim Andersson
8672976120 Bluetooth: shell: Fix adv-data command hex data input
Fix adv-data command when given arbitrary advertising data in
hexadecimal format. The data_len field should contain the length of the
data which does not include the data type. Instead the AD len field in
the data was given. This caused the AD len field to be increased by 1
in the advertising dat.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-08-20 18:56:38 -04:00
Rubin Gerritsen
1aa3a77130 bluetooth: smp: Fix duplicate pairing_failed callback
In the case where keys are distributed on an unencrypted link,
we got the following call trace:
  - bt_smp_recv()
    - smp_error()
    - smp_pairing_complete()
      - bt_conn_security_changed()
      - smp_pairing_complete()
        - bt_auth->pairing_failed()
        - smp_reset()
      - bt_auth->pairing_failed()
      - smp_reset()

To avoid the second call to bt_auth->pairing_failed()
we validate the that smp flags before calling the callback.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2021-08-20 18:55:33 -04:00
Emil Gydesen
aa9a2aac0c Bluetooth: host: Remove reset of conn handle on disconnect
(Re)setting the connection handle in hci_disconn_complete
should not be done as the handle are used for
logging/debugging purposes after this, and makes it
impossible to lookup the handle of disconnected
connections.

The connection handle is set to 0 during bt_conn_new
in any case.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-20 12:54:39 +02:00
Krzysztof Kopyściński
852656d1ff Bluetooth: host: initialise mps_reduced to false in ecred reconf req
No initialisation will lead to undefined behaviour in check for
BT_L2CAP_RECONF_INVALID_MPS.

This is affecting L2CAP/ECFC/BV-23-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-08-20 12:54:29 +02:00
Vinayak Kariappa Chettimada
80f382e51e Bluetooth: Controller: Fix sync of primary and auxiliary adv terminate
Fix missing synchronization when stopping primary and
auxiliary PDU scheduling.

Added implementation to ensure primary and auxiliary event
count match when terminating extended advertising on maximum
number of events or on duration.

Fixes #37571.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-20 12:49:43 +02:00
Vinayak Kariappa Chettimada
462ac6dcd1 Bluetooth: Controller: Minor refactor of extra done type set function
Minor refactor of extra done memory get and type set
functions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-20 12:49:43 +02:00
Vinayak Kariappa Chettimada
76d7f6364e Bluetooth: Controller: Correctly initialize max events and duration
Max events and duration parameter are not used in high duty
cycle directed, hence correctly initialized them and not
depend on the caller of advertising start API to set them
to zeroes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-20 12:49:43 +02:00
Trond Einar Snekvik
69fcaaa592 Bluetooth: Mesh: Use separate net_bufs for bt_mesh_app_decrypt in friend
unseg_app_sdu_decrypt decrypts messages in place using a single net_buf.
While this is safe in terms of data access, the buffer state is
manipulated with the assumption that they're two different buffers, and
the output buffer's length field is increased at the end. When
assertions are enabled and the pdu length is 11 or 12 bytes, this
triggers the net_buf length assert, as the decrypt function attempts to
add the pdu length to the out buffer, with the assumption that it was
reset before decryption was started.

Create a separate output buffer with len = 0 to avoid triggering the
assert. Improve readability of the unseg_app_sdu functions to highlight
the need for the additional buffer.

Fixes #37519.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-08-20 12:49:28 +02:00
Joakim Andersson
ce2fdd84ff Bluetooth: host: Allow app to set scannable when not providing scan data
Allow the application to configure the advertiser as scannable when it
does not provide scan data in the call to bt_le_adv_start. This makes it
possible for the application to later add scan response data in the
bt_le_adv_update_data call.
This aligns the legacy code path with the extended code path which
already had this behavior.

This also stops a directed connectable advertiser from being marked
internally in the host as scannable. This appears to not have been
causing any issues.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-08-20 12:49:06 +02:00
Joakim Andersson
750782ba46 Bluetooth: host: Fix non-connectable advertiser configured as scannable
Fix non-connectable advertiser configured as ADV_SCAN_IND when
configured by application to have the device name appear in the
advertising data instead of the scan response data.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-08-20 12:49:06 +02:00
Joakim Andersson
5ab34fab13 Bluetooth: host: Fail create ext scannable advertiser with name in AD
Disallow creating an extended scannable advertiser with the device name
configured to appear in the advertising data.
This would fail in either the call to bt_le_ext_adv_start or
bt_le_ext_adv_set_data when the host would try to set advertising data
in the controller.
Instead this now fails in the bt_le_ext_adv_create call.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-08-20 12:49:06 +02:00
Joakim Andersson
2ad039d9d0 Bluetooth: shell: Add option to set name in advertising data
Add advertising option to set the force advertising name in advertising
data option.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-08-20 12:49:06 +02:00