* [PATCH] Bluetooth: mgmt: report extended advertising SID to userspace
@ 2026-01-07 8:48 Yang Li via B4 Relay
2026-01-07 9:15 ` bluez.test.bot
2026-01-07 14:57 ` [PATCH] " Luiz Augusto von Dentz
0 siblings, 2 replies; 3+ messages in thread
From: Yang Li via B4 Relay @ 2026-01-07 8:48 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman
Cc: linux-bluetooth, netdev, linux-kernel, Yang Li
From: Yang Li <yang.li@amlogic.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
Signed-off-by: Yang Li <yang.li@amlogic.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;
+
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@amlogic.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: mgmt: report extended advertising SID to userspace
2026-01-07 8:48 [PATCH] Bluetooth: mgmt: report extended advertising SID to userspace Yang Li via B4 Relay
@ 2026-01-07 9:15 ` bluez.test.bot
2026-01-07 14:57 ` [PATCH] " Luiz Augusto von Dentz
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-01-07 9:15 UTC (permalink / raw)
To: linux-bluetooth, yang.li
[-- Attachment #1: Type: text/plain, Size: 3302 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1039290
---Test result---
Test Summary:
CheckPatch PENDING 0.39 seconds
GitLint PENDING 0.27 seconds
SubjectPrefix PASS 0.08 seconds
BuildKernel PASS 25.36 seconds
CheckAllWarning PASS 28.03 seconds
CheckSparse WARNING 31.58 seconds
BuildKernel32 PASS 25.32 seconds
TestRunnerSetup PASS 552.30 seconds
TestRunner_l2cap-tester FAIL 28.82 seconds
TestRunner_iso-tester FAIL 56.41 seconds
TestRunner_bnep-tester PASS 6.31 seconds
TestRunner_mgmt-tester FAIL 122.98 seconds
TestRunner_rfcomm-tester PASS 9.40 seconds
TestRunner_sco-tester FAIL 14.41 seconds
TestRunner_ioctl-tester PASS 10.06 seconds
TestRunner_mesh-tester FAIL 11.52 seconds
TestRunner_smp-tester PASS 8.62 seconds
TestRunner_userchan-tester PASS 6.72 seconds
IncrementalBuild PENDING 0.51 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
Test: TestRunner_l2cap-tester - FAIL
Desc: Run l2cap-tester with test-runner
Output:
Total: 96, Passed: 95 (99.0%), Failed: 1, Not Run: 0
Failed Test Cases
L2CAP BR/EDR Server - Set PHY 3M Failed 0.131 seconds
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
BUG: KASAN: slab-use-after-free in le_read_features_complete+0x7e/0x2b0
Total: 141, Passed: 141 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.102 seconds
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
WARNING: possible circular locking dependency detected
BUG: sleeping function called from invalid context at net/core/sock.c:3782
Total: 30, Passed: 30 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 1.903 seconds
Mesh - Send cancel - 2 Timed out 1.999 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: mgmt: report extended advertising SID to userspace
2026-01-07 8:48 [PATCH] Bluetooth: mgmt: report extended advertising SID to userspace Yang Li via B4 Relay
2026-01-07 9:15 ` bluez.test.bot
@ 2026-01-07 14:57 ` Luiz Augusto von Dentz
1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2026-01-07 14:57 UTC (permalink / raw)
To: yang.li
Cc: Marcel Holtmann, Johan Hedberg, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, linux-bluetooth,
netdev, linux-kernel
Hi Yang,
On Wed, Jan 7, 2026 at 3:48 AM Yang Li via B4 Relay
<devnull+yang.li.amlogic.com@kernel.org> wrote:
>
> From: Yang Li <yang.li@amlogic.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@amlogic.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@amlogic.com>
>
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-07 14:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-07 8:48 [PATCH] Bluetooth: mgmt: report extended advertising SID to userspace Yang Li via B4 Relay
2026-01-07 9:15 ` bluez.test.bot
2026-01-07 14:57 ` [PATCH] " Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox