Re: [PATCH v4] Bluetooth: Add ncmd=0 recovery handling

From: Marcel Holtmann
Date: Fri May 07 2021 - 04:32:03 EST


Hi Manish,

> During command status or command complete event, the controller may set
> ncmd=0 indicating that it is not accepting any more commands. In such a
> case, host holds off sending any more commands to the controller. If the
> controller doesn't recover from such condition, host will wait forever,
> until the user decides that the Bluetooth is broken and may power cycles
> the Bluetooth.
>
> This patch triggers the hardware error to reset the controller and
> driver when it gets into such state as there is no other wat out.
>
> Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@xxxxxxxxxxxx>
> Signed-off-by: Manish Mandlik <mmandlik@xxxxxxxxxx>
> ---
>
> Changes in v4:
> - Update comment in hci_ncmd_timeout
> - Add a new inline function to handle cmd_cnt and timers
>
> Changes in v3:
> - Restructure ncmd_timer scheduling in hci_event.c
> - Cancel delayed work in hci_dev_do_close
> - Do not inject hw error during HCI_INIT
> - Update comment, add log message while injecting hw error
>
> Changes in v2:
> - Emit the hardware error when ncmd=0 occurs
>
> include/net/bluetooth/hci.h | 1 +
> include/net/bluetooth/hci_core.h | 1 +
> net/bluetooth/hci_core.c | 22 ++++++++++++++++++++++
> net/bluetooth/hci_event.c | 29 +++++++++++++++++++----------
> 4 files changed, 43 insertions(+), 10 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel