2021-04-29 18:18:31

by Yu Liu

[permalink] [raw]
Subject: [Bluez PATCH v1] doc/mgmt-api - Add a new error code for HCI status 0x3e

We want to retry the pairing when HCI status 0x3e (Connection failed to
established/Synchronization timeout) is returned from the controller.
This is to add a new MGMT error code so that we can catch this 0x3e
failure and issue a retry in the user space.

Reviewed-by: Abhishek Pandit-Subedi <[email protected]>
---

Changes in v1:
- Initial change

doc/mgmt-api.txt | 2 ++
1 file changed, 2 insertions(+)

diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 5355fedb0..f7cbf7ab2 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -200,6 +200,7 @@ and Command Complete events:
0x12 RFKilled
0x13 Already Paired
0x14 Permission Denied
+0x15 Connection Not Established

As a general rule all commands generate the events as specified below,
however invalid lengths or unknown commands will always generate a
@@ -1112,6 +1113,7 @@ Pair Device Command
Not Powered
Invalid Index
Already Paired
+ Connection Not Established


Cancel Pair Device Command
--
2.31.1.527.g47e6f16901-goog


2021-05-05 20:03:36

by Yu Liu

[permalink] [raw]
Subject: Re: [Bluez PATCH v1] doc/mgmt-api - Add a new error code for HCI status 0x3e

ping for attention.


On Thu, Apr 29, 2021 at 11:15 AM Yu Liu <[email protected]> wrote:
>
> We want to retry the pairing when HCI status 0x3e (Connection failed to
> established/Synchronization timeout) is returned from the controller.
> This is to add a new MGMT error code so that we can catch this 0x3e
> failure and issue a retry in the user space.
>
> Reviewed-by: Abhishek Pandit-Subedi <[email protected]>
> ---
>
> Changes in v1:
> - Initial change
>
> doc/mgmt-api.txt | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> index 5355fedb0..f7cbf7ab2 100644
> --- a/doc/mgmt-api.txt
> +++ b/doc/mgmt-api.txt
> @@ -200,6 +200,7 @@ and Command Complete events:
> 0x12 RFKilled
> 0x13 Already Paired
> 0x14 Permission Denied
> +0x15 Connection Not Established
>
> As a general rule all commands generate the events as specified below,
> however invalid lengths or unknown commands will always generate a
> @@ -1112,6 +1113,7 @@ Pair Device Command
> Not Powered
> Invalid Index
> Already Paired
> + Connection Not Established
>
>
> Cancel Pair Device Command
> --
> 2.31.1.527.g47e6f16901-goog
>

2021-05-05 22:36:53

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [Bluez PATCH v1] doc/mgmt-api - Add a new error code for HCI status 0x3e

Hi Yu,

On Thu, Apr 29, 2021 at 11:15 AM Yu Liu <[email protected]> wrote:
>
> We want to retry the pairing when HCI status 0x3e (Connection failed to
> established/Synchronization timeout) is returned from the controller.
> This is to add a new MGMT error code so that we can catch this 0x3e
> failure and issue a retry in the user space.
>
> Reviewed-by: Abhishek Pandit-Subedi <[email protected]>
> ---
>
> Changes in v1:
> - Initial change
>
> doc/mgmt-api.txt | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> index 5355fedb0..f7cbf7ab2 100644
> --- a/doc/mgmt-api.txt
> +++ b/doc/mgmt-api.txt
> @@ -200,6 +200,7 @@ and Command Complete events:
> 0x12 RFKilled
> 0x13 Already Paired
> 0x14 Permission Denied
> +0x15 Connection Not Established
>
> As a general rule all commands generate the events as specified below,
> however invalid lengths or unknown commands will always generate a
> @@ -1112,6 +1113,7 @@ Pair Device Command
> Not Powered
> Invalid Index
> Already Paired
> + Connection Not Established
>
>
> Cancel Pair Device Command
> --
> 2.31.1.527.g47e6f16901-goog
>

Applied, thanks.

--
Luiz Augusto von Dentz

2021-05-07 09:21:55

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez PATCH v1] doc/mgmt-api - Add a new error code for HCI status 0x3e

Hi Yu,

> We want to retry the pairing when HCI status 0x3e (Connection failed to
> established/Synchronization timeout) is returned from the controller.
> This is to add a new MGMT error code so that we can catch this 0x3e
> failure and issue a retry in the user space.
>
> Reviewed-by: Abhishek Pandit-Subedi <[email protected]>
> ---
>
> Changes in v1:
> - Initial change
>
> doc/mgmt-api.txt | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> index 5355fedb0..f7cbf7ab2 100644
> --- a/doc/mgmt-api.txt
> +++ b/doc/mgmt-api.txt
> @@ -200,6 +200,7 @@ and Command Complete events:
> 0x12 RFKilled
> 0x13 Already Paired
> 0x14 Permission Denied
> +0x15 Connection Not Established
>
> As a general rule all commands generate the events as specified below,
> however invalid lengths or unknown commands will always generate a
> @@ -1112,6 +1113,7 @@ Pair Device Command
> Not Powered
> Invalid Index
> Already Paired
> + Connection Not Established

I really dislike the naming. And even more so, I request the motive here.

So looking at our code, we have 3 cases where we use the previous status:

MGMT_STATUS_CONNECT_FAILED, /* Page Timeout */
MGMT_STATUS_CONNECT_FAILED, /* Connection Establishment Failed */
MGMT_STATUS_CONNECT_FAILED, /* MAC Connection Failed */

And they do map to the 3 available transports, either via BR/EDR or LE or AMP. That means if you call Pair Device you already know well today when it fails to establish the link and can retry it.

My question, what are you trying to fix here.

Regards

Marcel

2021-05-07 17:38:29

by Yu Liu

[permalink] [raw]
Subject: Re: [Bluez PATCH v1] doc/mgmt-api - Add a new error code for HCI status 0x3e

Hi Marcel,

We have a couple of bugs where the controller failed on the Read
Remote Feature command after initial connection with the 0x3E error,
guy.damary@intel made some suggestions after root caused the issues,
you can see his detailed suggestions here:
https://buganizer.corp.google.com/issues/174806913#comment98. To
summarize: he suggests us to retry up to 3 times if 0x3E is
encountered during LE pairing.

Regarding this change: I see MGMT_STATUS_CONNECT_FAILED could be
returned under 4 different scenarios, 3 in the mgmt_status_table table
and 1 in pair_device as a fallback error to cover all the other cases,
so I decided to introduce a new error code to make sure we don't retry
in the cases where we shouldn't. If you think this cae be avoided by
checking other flags at the same time, I can then drop the change from
the kernel and only change the user space.

Thanks


On Fri, May 7, 2021 at 1:19 AM Marcel Holtmann <[email protected]> wrote:
>
> Hi Yu,
>
> > We want to retry the pairing when HCI status 0x3e (Connection failed to
> > established/Synchronization timeout) is returned from the controller.
> > This is to add a new MGMT error code so that we can catch this 0x3e
> > failure and issue a retry in the user space.
> >
> > Reviewed-by: Abhishek Pandit-Subedi <[email protected]>
> > ---
> >
> > Changes in v1:
> > - Initial change
> >
> > doc/mgmt-api.txt | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> > index 5355fedb0..f7cbf7ab2 100644
> > --- a/doc/mgmt-api.txt
> > +++ b/doc/mgmt-api.txt
> > @@ -200,6 +200,7 @@ and Command Complete events:
> > 0x12 RFKilled
> > 0x13 Already Paired
> > 0x14 Permission Denied
> > +0x15 Connection Not Established
> >
> > As a general rule all commands generate the events as specified below,
> > however invalid lengths or unknown commands will always generate a
> > @@ -1112,6 +1113,7 @@ Pair Device Command
> > Not Powered
> > Invalid Index
> > Already Paired
> > + Connection Not Established
>
> I really dislike the naming. And even more so, I request the motive here.
>
> So looking at our code, we have 3 cases where we use the previous status:
>
> MGMT_STATUS_CONNECT_FAILED, /* Page Timeout */
> MGMT_STATUS_CONNECT_FAILED, /* Connection Establishment Failed */
> MGMT_STATUS_CONNECT_FAILED, /* MAC Connection Failed */
>
> And they do map to the 3 available transports, either via BR/EDR or LE or AMP. That means if you call Pair Device you already know well today when it fails to establish the link and can retry it.
>
> My question, what are you trying to fix here.
>
> Regards
>
> Marcel
>