mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Li <yang.li@amlogic.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: hci_sync: use HCI_CMD_TIMEOUT for PA sync commands
Date: Fri, 9 Jan 2026 11:06:37 +0800	[thread overview]
Message-ID: <baca64ce-add3-4937-a4ce-1e372942e91b@amlogic.com> (raw)
In-Reply-To: <CABBYNZKATWfF+5ekMGGQxkq0_gu8UkEJ5Me3-d1c66rxJROy5A@mail.gmail.com>

Hi Luiz
> [ EXTERNAL EMAIL ]
>
> Hi Yang,
>
> On Thu, Jan 8, 2026 at 1:03 AM Yang Li via B4 Relay
> <devnull+yang.li.amlogic.com@kernel.org> wrote:
>> From: Yang Li <yang.li@amlogic.com>
>>
>> PA sync HCI commands incorrectly use conn->conn_timeout, which defaults
>> to 20s and is too long. If the PA Sync Established event is not
>> received, the command remains pending and causes userspace timeouts.
> Im pretty sure this is impossible scenario with bluetooth-next, since
> 1. only one work can be running hci_le_pa_create_sync at time so
> HCI_EV_LE_PA_SYNC_ESTABLISHED cannot be outstanding 2. The
> conn->timeout shall be aligned with socket timeout so perhaps the
> problem is userspace is not setting the socket timeout correctly or
> something.


Well, I got it.

I noticed that BlueZ has a default setting for sync_time with the value 
BT_ISO_SYNC_TIMEOUT=0x07d0 /* 20 secs */.

I would like to know the rationale behind setting it to 20 seconds 
initially. This value seems a bit long to me. Can I directly change this 
value as:

BT_ISO_SYNC_TIMEOUT=0x00C8 /* 2 secs */

>> Signed-off-by: Yang Li <yang.li@amlogic.com>
>> ---
>>   net/bluetooth/hci_sync.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
>> index f04a90bce4a9..58292b01f062 100644
>> --- a/net/bluetooth/hci_sync.c
>> +++ b/net/bluetooth/hci_sync.c
>> @@ -7159,7 +7159,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data)
>>          if (conn->sid == HCI_SID_INVALID) {
>>                  err = __hci_cmd_sync_status_sk(hdev, HCI_OP_NOP, 0, NULL,
>>                                                 HCI_EV_LE_EXT_ADV_REPORT,
>> -                                              conn->conn_timeout, NULL);
>> +                                              HCI_CMD_TIMEOUT, NULL);
>>                  if (err == -ETIMEDOUT)
>>                          goto done;
>>          }
>> @@ -7187,7 +7187,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data)
>>          err = __hci_cmd_sync_status_sk(hdev, HCI_OP_LE_PA_CREATE_SYNC,
>>                                         sizeof(cp), &cp,
>>                                         HCI_EV_LE_PA_SYNC_ESTABLISHED,
>> -                                      conn->conn_timeout, NULL);
>> +                                      HCI_CMD_TIMEOUT, NULL);
>>          if (err == -ETIMEDOUT)
>>                  __hci_cmd_sync_status(hdev, HCI_OP_LE_PA_CREATE_SYNC_CANCEL,
>>                                        0, NULL, HCI_CMD_TIMEOUT);
>>
>> ---
>> base-commit: bdb9aba465a85122bcba01a6154e237b9843e25b
>> change-id: 20260108-pa_sync_cmd_timeout-ff46f67b5d2a
>>
>> Best regards,
>> --
>> Yang Li <yang.li@amlogic.com>
>>
>>
>
> --
> Luiz Augusto von Dentz

      reply	other threads:[~2026-01-09  3:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08  6:03 Yang Li via B4 Relay
2026-01-08 15:20 ` Luiz Augusto von Dentz
2026-01-09  3:06   ` Yang Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=baca64ce-add3-4937-a4ce-1e372942e91b@amlogic.com \
    --to=yang.li@amlogic.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®