Thread (4 messages) 4 messages, 2 authors, 2021-11-16

Re: [PATCH v3 1/2] Bluetooth: Ignore HCI_ERROR_CANCELLED_BY_HOST on adv set terminated event

From: Marcel Holtmann <marcel@holtmann.org>
Date: 2021-11-16 14:18:33
Also in: linux-bluetooth, lkml

Hi Archie,
This event is received when the controller stops advertising,
specifically for these three reasons:
(a) Connection is successfully created (success).
(b) Timeout is reached (error).
(c) Number of advertising events is reached (error).
(*) This event is NOT generated when the host stops the advertisement.
Refer to the BT spec ver 5.3 vol 4 part E sec 7.7.65.18. Note that the
section was revised from BT spec ver 5.0 vol 2 part E sec 7.7.65.18
which was ambiguous about (*).

Some chips (e.g. RTL8822CE) send this event when the host stops the
advertisement with status = HCI_ERROR_CANCELLED_BY_HOST (due to (*)
above). This is treated as an error and the advertisement will be
removed and userspace will be informed via MGMT event.

On suspend, we are supposed to temporarily disable advertisements,
and continue advertising on resume. However, due to the behavior
above, the advertisements are removed instead.

This patch returns early if HCI_ERROR_CANCELLED_BY_HOST is received.

Btmon snippet of the unexpected behavior:
@ MGMT Command: Remove Advertising (0x003f) plen 1
       Instance: 1
< HCI Command: LE Set Extended Advertising Enable (0x08|0x0039) plen 6
       Extended advertising: Disabled (0x00)
       Number of sets: 1 (0x01)
       Entry 0
         Handle: 0x01
         Duration: 0 ms (0x00)
         Max ext adv events: 0
quoted
HCI Event: LE Meta Event (0x3e) plen 6
     LE Advertising Set Terminated (0x12)
       Status: Operation Cancelled by Host (0x44)
       Handle: 1
       Connection handle: 0
       Number of completed extended advertising events: 5
quoted
HCI Event: Command Complete (0x0e) plen 4
     LE Set Extended Advertising Enable (0x08|0x0039) ncmd 2
       Status: Success (0x00)

Signed-off-by: Archie Pusaka <redacted>

---

(no changes since v2)

Changes in v2:
* Split clearing HCI_LE_ADV into its own patch
* Reword comments

include/net/bluetooth/hci.h |  1 +
net/bluetooth/hci_event.c   | 12 ++++++++++++
2 files changed, 13 insertions(+)
patch has been applied to bluetooth-next tree.

Regards

Marcel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help