[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABBYNZ+a32Y9VM-XsECBjTwN_bXaPxuYALBL_6S8b+s1vQ8EZw@mail.gmail.com>
Date: Wed, 7 Jan 2026 09:57:11 -0500
From: Luiz Augusto von Dentz <luiz.dentz@...il.com>
To: yang.li@...ogic.com
Cc: Marcel Holtmann <marcel@...tmann.org>, Johan Hedberg <johan.hedberg@...il.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
linux-bluetooth@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Bluetooth: mgmt: report extended advertising SID to userspace
Hi Yang,
On Wed, Jan 7, 2026 at 3:48 AM Yang Li via B4 Relay
<devnull+yang.li.amlogic.com@...nel.org> wrote:
>
> From: Yang Li <yang.li@...ogic.com>
>
> Add a new mgmt event to report the SID of extended advertising
> to userspace. This allows userspace to obtain the SID before
> initiating PA sync, without waiting for the next extended
> advertising report to update the SID.
>
> By providing the SID earlier, the PA sync flow can be simplified
> and the overall latency reduced.
>
> Link: https://github.com/bluez/bluez/issues/1758
This is a new API so it can't possible fix the userspace issue above,
there is clearly a bug when sid is set to 0xff we shall not proceed
until it is resolved.
> Signed-off-by: Yang Li <yang.li@...ogic.com>
> ---
> include/net/bluetooth/hci_core.h | 2 ++
> include/net/bluetooth/mgmt.h | 7 +++++++
> net/bluetooth/hci_event.c | 3 +++
> net/bluetooth/mgmt.c | 13 +++++++++++++
> 4 files changed, 25 insertions(+)
>
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index a7bffb908c1e..81ef3e94e3af 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -2469,6 +2469,8 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
> u8 addr_type, u8 *dev_class, s8 rssi, u32 flags,
> u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len,
> u64 instant);
> +void mgmt_ext_adv_sid_changed(struct hci_dev *hdev, bdaddr_t *bdaddr,
> + u8 addr_type, u8 sid);
> void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
> u8 addr_type, s8 rssi, u8 *name, u8 name_len);
> void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
> diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
> index 8234915854b6..7ee38ebaccd8 100644
> --- a/include/net/bluetooth/mgmt.h
> +++ b/include/net/bluetooth/mgmt.h
> @@ -1195,3 +1195,10 @@ struct mgmt_ev_mesh_device_found {
> struct mgmt_ev_mesh_pkt_cmplt {
> __u8 handle;
> } __packed;
> +
> +#define MGMT_EV_EXT_ADV_SID_CHANGED 0x0033
> +struct mgmt_ev_ext_adv_sid_changed {
> + struct mgmt_addr_info addr;
> + __u8 sid;
> +} __packed;
I rather have a new device found event, or somehow embed the SID into
the existing one.
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 467710a42d45..f4463e71b424 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -6519,6 +6519,9 @@ static void hci_le_ext_adv_report_evt(struct hci_dev *hdev, void *data,
> info->rssi, info->data, info->length,
> !(evt_type & LE_EXT_ADV_LEGACY_PDU),
> false, instant);
> + mgmt_ext_adv_sid_changed(hdev, &info->bdaddr,
> + info->bdaddr_type,
> + info->sid);
> }
> }
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 5be9b8c91949..4e0f8c43e387 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -208,6 +208,7 @@ static const u16 mgmt_untrusted_events[] = {
> MGMT_EV_EXT_INDEX_REMOVED,
> MGMT_EV_EXT_INFO_CHANGED,
> MGMT_EV_EXP_FEATURE_CHANGED,
> + MGMT_EV_EXT_ADV_SID_CHANGED,
> };
>
> #define CACHE_TIMEOUT secs_to_jiffies(2)
> @@ -10516,6 +10517,18 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
> mgmt_adv_monitor_device_found(hdev, bdaddr, report_device, skb, NULL);
> }
>
> +void mgmt_ext_adv_sid_changed(struct hci_dev *hdev, bdaddr_t *bdaddr,
> + u8 addr_type, u8 sid)
> +{
> + struct mgmt_ev_ext_adv_sid_changed ev;
> +
> + bacpy(&ev.addr.bdaddr, bdaddr);
> + ev.addr.type = link_to_bdaddr(LE_LINK, addr_type);
> + ev.sid = sid;
> +
> + mgmt_event(MGMT_EV_EXT_ADV_SID_CHANGED, hdev, &ev, sizeof(ev), NULL);
> +}
> +
> void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
> u8 addr_type, s8 rssi, u8 *name, u8 name_len)
> {
>
> ---
> base-commit: 030d2c0e9c1d68e67f91c08704482ad9881583eb
> change-id: 20260107-mgmt_ext_adv_sid-7ea503e46791
>
> Best regards,
> --
> Yang Li <yang.li@...ogic.com>
>
>
--
Luiz Augusto von Dentz
Powered by blists - more mailing lists