Fix prepare pipeline processing of overlapping events by
including ticks_at_expire value to uniquely identify
overlapping events.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix long standing bug in processing resume events that cause
prepare pipeline overflow due to incorrectly enqueueing up
preemptor events as duplicate events in the pipeline where
being aborted before currently active event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Introduce prepare being deferred due to previous events
desire to continue. In such case the deferred prepare param
will have the defer flag set.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Disable connection event continuation on overlap with same
connection's next event. This implementation has bugs and
needs to be fixed in subsequent commits.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix stuck forced continuation of connection event under high
throughput scenario. At near supervision timeout the force
flag is set, but in the next connection event if full
connection interval is used for data transmission and a
subsequent request to abort happens it was not honoured
causing the tx-rx chain to keep continuing until supervision
timeout.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix window widening on connection update to current window
widening periodic at the instant, and use new periodic
window widening for subsequent new connection interval.
Relates to commit 247037bd3e ("Bluetooth: Controller: Fix
incorrect elapsed events value").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix drift compensation applied late under high throughput at
after the instant has passed for a connection update.
Workaround test failures due to Zephyr Controller scheduling
overlap causing Periodic Advertising Sync timeouts, ACL
connection failed to be established or Controller assertion
when having latency at the CIS setup instant.
Workaround by using `-start_offset` to ensure that the ACL
established does not overlap the sink being established.
Relates to commit 5f852998d0 ("tests: bsim: Bluetooth:
Workaround Zephyr Controller scheduling overlap").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Unlike legacy Zephyr Controller's double headed Tx queue
linked list, the new split Zephyr Controller's new LLCP does
not place a control PDU at the head of the Tx queue causing
control PDUs to be delayed on air.
Pause the data enqueue until pending PDUs are transmitted
across before enqueuing LE Connection Update Ind PDU, and
thereafter resume other PDUs being enqueued again.
There can still be connection timeout if enqueued PDUs are
not being transmitted/acked during repeated retransmissions.
Updated bap_unicast_audio_acl_disconnect test to not use
random seed, to be similar to unicast_client test; to get
it to pass without overlapping state/roles casing connection
failed to be established after the changes in this PR.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix LLCP to use event_counter in the current event to
compare instant when trying to check instant passed on
reception of PDU with instant.
Fixes regression in commit e3e410aeed ("Bluetooth: Controller:
Fix LLCP event_counter value used during prepare").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Move the declaration code to locality of reference and be
consistent in how the code pattern is, related to calling
LLL disable.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Single timer use needs additional event overhead to start
radio to ensure the software switch implementation executing
in radio completion ISR can correctly set the tIFS switching
after a maximum radio ISR latency.
The latency value shall be the used additional overhead so
that there is no spurious tIFS switch before radio ISR
executes.
The additional event overhead value is not considered in the
event overhead check.
Relates to commit 37bf99eee7 ("Bluetooth: Controller: Fix
radio_tmr_start_us for single timer use").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix an assertion detecting delayed prepare establishing an
ACL connection due to scanner or advertiser not disabled
immediately when scheduling the first connection event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix assertion on scan disable observed in BabbleSIM audio
tests due to clearing of pending radio IRQ under race
conditions between scanning being stopped by application
and scanning stopped on central connection setup.
irq_enable/disable is not needed either as radio_isr_set
is always called from Radio or LLL execution context which
are co-operative with each other at same execution priority.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing radio tmr status reset on radio_disable call,
without this which disables PPI/DPPI caused under race
conditions the radio to transition into Tx or Rx state and
put the Controller's state out of sync with the Radio
peripherals internal state. The symptoms being that the
Central role was not transmitting in the next interval;
also, caused the defer iterations to reach maximum events
being enqueued in the pipeline, and manifesting as large
CPU overheads in redundant prepare of deferred events.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
I believe there is some confusion about what this function does. This
function is doing some type-bending, so it's extra important to document
it.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Save the air_mode to SCO connect object.
Add a structure `struct bt_conn_sco_info` to return the SCO conn info.
Return SCO info through `struct bt_conn_sco_info` when calling the
function `bt_conn_get_info()`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
There are three aspects of changes involved:
1. The format of Service Category should be checked in set
configuration cmd and error code and Service Category
should be detailed in response.
2. There is no INT Stream Endpoint ID in re_config cmd,.
3. Fail ACP SEID should be added to start and suspend rej rsp.
Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
Move the CONFIG_BT_EXT_ADV fields up and have the 2
8-bit values first, so they can be placed in the same
word as the previous 2 when applicable.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Store the SID in the advertising set, and let it be possible
to get it again via bt_le_ext_adv_get_info.
The SID may be used by higher layers to shared information
about the advertising set.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of always using SID=0 for advertising sets (which can be
tricky if there are multiple advertising sets using the same SID
and address), the SID will be incremented and wrap around when
reaching the max to reduce the risk of 2 or more sets having the
same SID.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In function `parse_read_by_uuid()`, the response length is not checked
before parsing the response PDU. There is a potential issue that the
`len` will be underflowed if the `len` is less than the size of
`struct bt_att_data`.
Check the length before parsing the response PDU. If the length is less
then the size of `struct bt_att_data`, notify the upper layer with the
error `BT_ATT_ERR_INVALID_PDU` and stop the parsing.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Fix assertion under race conditions where LLL scheduling
did not have an auxiliary context assigned but when node rx
is released an auxiliary context is picked from the scan
context that has no parent assigned yet due to a previously
assigned auxiliary context to the scan context was not
cleared.
Relates to commit 49642efa41 ("Bluetooth: Controller: Fix
regression in scan aux release").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix extended scanning assert on invalid chan_idx received in
the aux pointer structure.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
- AVRCP SDP record updates for browsing channel
- L2CAP setup for AVCTP browsing channel, and add connect/disconnect
- Add SetBrowsedPlayer browsing command handling
Signed-off-by: Make Shi <make.shi@nxp.com>
- This patch refactors the AVCTP layer to support multiple L2CAP PSMs
- Introduced bt_avctp_server structure for dynamic L2CAP server
registration and new server register apis
- Added k_sem protected server list to support multiple AVCTP servers
Signed-off-by: Make Shi <make.shi@nxp.com>
Since the broadcast ID is generated at runtime, it is nice
to get it printed so that it can be shared.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Since the broadcast ID is generated at runtime, it is nice
to get it printed so that it can be shared.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When scanning, the broadcast_scan_recv now prints the broadcast ID
and the broadcast name (if found). Without this, it is not possible
to use the shell to scan for an unknown broadcast ID or broadcast
name.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
From avdtp spec, the get_all_capablities should be used if the avdtp
version is v1.3, otherwise the get_capabilities should be used.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
In bt_gatt_write_without_response_cb there is a check for
write != length. However since the call to bt_att_create_pdu
should ensure that this is possible, this should never happen.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Since there is a retry mechanism implement, this is not something
that the user needs to be warned about.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When an API function returns an appropriate error code,
LOG_DBG is better suited than LOG_WRN or LOG_ERR as the
caller can handle the return value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For user-initiated requests like notifications, read and write
requests, there will be an error code, so there does not need to be
a generic LOG_ERR if these fail to be allocated.
However if the response or (indication) confirmation PDUs fail
to be allocated, these should still be logged as errors.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Use LOG_DBG rather than LOG_WRN, as that is an expected
scenario when using K_NO_WAIT (e.g. when sending
GATT notifications), and it is better for higher layers
to determine if this is indeed an error.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
`bt_att_recv`, which parses ATT PDUs, already contains code that
responds with `BT_ATT_ERR_NOT_SUPPORTED` if a given handler is not
implemented.
Therefore, `att_prepare_write_req` and `att_exec_write_req` handlers do
not need to explicitly return `BT_ATT_ERR_NOT_SUPPORTED` when
`CONFIG_BT_ATT_PREPARE_COUNT` is set to 0 and can be completely removed.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If the range of the service search attribute request is set and the
start of the range is not 0x0000, the response data of the request is
not valid. It is caused by the data element sequence has not be added
to response data. The client cannot parse the response data properly.
The root cause of this issue is that the total length of service
record will be added only when adding the first attribute of service
record.
Fix the issue by reset the `state.last_att` and `state.last_att_index`
if the index of current record is not same with `state.current_svc`.
And do not update `state.last_att`, `state.last_att_index`, and
`state.current_svc` in the function `select_attrs()`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the received buffer is incorrectly used for
other SDP discover requests.
Release the RX buffer when the SDP discovery is done. And allocate the
new RX buffer from the pool of the new SDP discovery request.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>