Bluetooth: hci_core: Introduce hci_recv_event_data
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH v7 1/7 Bluetooth: hci_core: Introduce hci_recv_event_data
From: Luiz Augusto von Dentz <[email protected]>
This introduces hci_recv_event_data to make it simpler to access the contents of last received event rather than having to pass its contents to the likes of *_ind/*_cfm callbacks.
---
v2: Fixes CI/kernel test robot findings
v3: Fix crash when disabling ISO Socket experimental UUID.
v4: Fix crashes when running iso-tester Defer and Defer Send tests which just binds the CIS using DEFER_SETUP without attempting to connect it at first.
v5: Fix kbuild findings
v6: Fix checkpatch findings
v7: Fix setting timeout on connect when DEFER_SETUP is used
include/net/bluetooth/hci_core.h | 2 ++ net/bluetooth/hci_core.c | 32 ++++++++++++++++++++++++++++++++ net/bluetooth/hci_event.c | 3 +++ 3 files changed, 37 insertions(+)
include/net/bluetooth/hci_core.h +2 -0
@@ -530,6 +530,7 @@ struct hci_dev {struct sk_buff_head cmd_q;struct sk_buff *sent_cmd; +struct sk_buff *recv_event;struct mutex req_lock;wait_queue_head_t req_wait_q;
@@ -1755,6 +1756,7 @@ void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags);void hci_send_sco (struct hci_conn *conn,struct sk_buff *skb);void *hci_sent_cmd_data (struct hci_dev *hdev,__u16 opcode); +void *hci_recv_event_data (struct hci_dev *hdev,__u8 event);u32 hci_conn_get_phy (struct hci_conn *conn);
net/bluetooth/hci_core.c +32 -0
@@ -2742,6 +2742,7 @@ void hci_release_dev(struct hci_dev *hdev)ida_simple_remove (&hci_index_ida, hdev->id);kfree_skb (hdev->sent_cmd); +kfree_skb (hdev->recv_event);kfree (hdev); }EXPORT_SYMBOL (hci_release_dev);
@@ -3048,6 +3049,37 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode)return hdev->sent_cmd->data +HCI_COMMAND_HDR_SIZE ; } +/* Get data from last received event */ +void *hci_recv_event_data (struct hci_dev *hdev,__u8 event) +{ +struct hci_event_hdr *hdr; +int offset; + +if (!hdev->recv_event) +return NULL ; + + hdr = (void *)hdev->recv_event->data; + offset =sizeof (*hdr); + +if (hdr->evt != event) { +/* In case of LE metaevent check the subevent match */ +if (hdr->evt ==HCI_EV_LE_META ) { +struct hci_ev_le_meta *ev; + + ev = (void *)hdev->recv_event->data + offset; + offset +=sizeof (*ev); +if (ev->subevent == event) + goto found; + } +return NULL ; + } + +found: +bt_dev_dbg (hdev,"event 0x%2.2x" , event); + +return hdev->recv_event->data + offset; +} +/* Send ACL data */ static void hci_add_acl_hdr (struct sk_buff *skb,__u16 handle,__u16 flags) {
net/bluetooth/hci_event.c +3 -0
@@ -6936,6 +6936,9 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) goto done; } +kfree_skb (hdev->recv_event); + hdev->recv_event =skb_clone (skb,GFP_KERNEL ); + event = hdr->evt;if (!event) { bt_dev_warn(hdev, "Received unexpected HCI Event 0x%2.2x",
Signature · 1 line
2.35.3
Luiz Augusto von Dentz
maintainerPATCH v7 2/7 Bluetooth: Add initial implementation of CIS connections
From: Luiz Augusto von Dentz <[email protected]>
This adds the initial implementation of CIS connections and introduces the ISO packets/links.
== Central: Set CIG Parameters, create a CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-s <address>
< HCI Command: LE Extended Create... (0x08|0x0043) plen 26
...
Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
LE Extended Create Connection (0x08|0x0043) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 31
LE Enhanced Connection Complete (0x0a)
...< HCI Command: LE Create Connected... (0x08|0x0064) plen 5
...
Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
LE Create Connected Isochronous Stream (0x08|0x0064) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29
LE Connected Isochronous Stream Established (0x19)
...< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6
LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6
LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257== Peripheral: Accept CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-d
HCI Event: LE Meta Event (0x3e) plen 7
LE Connected Isochronous Stream Request (0x1a)
...
< HCI Command: LE Accept Co.. (0x08|0x0066) plen 2
...
Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29
LE Connected Isochronous Stream Established (0x19)
...
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6
LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6
LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257--- include/net/bluetooth/bluetooth.h | 33 ++- include/net/bluetooth/hci.h | 28 +- include/net/bluetooth/hci_core.h | 107 +++++++- include/net/bluetooth/hci_sock.h | 2 + include/net/bluetooth/hci_sync.h | 3 + net/bluetooth/Kconfig | 1 + net/bluetooth/hci_conn.c | 440 ++++++++++++++++++++++++++++++ net/bluetooth/hci_core.c | 230 ++++++++++++---- net/bluetooth/hci_event.c | 307 ++++++++++++++++++++- net/bluetooth/hci_sync.c | 49 +++- 10 files changed, 1145 insertions(+), 55 deletions(-)
include/net/bluetooth/bluetooth.h +32 -1
@@ -55,6 +55,8 @@#define BTPROTO_CMTP 5#define BTPROTO_HIDP 6#define BTPROTO_AVDTP 7 +#define BTPROTO_ISO 8 +#define BTPROTO_LAST BTPROTO_ISO#define SOL_HCI 0#define SOL_L2CAP 6
@@ -149,10 +151,39 @@ struct bt_voice {#define BT_MODE_LE_FLOWCTL 0x03#define BT_MODE_EXT_FLOWCTL 0x04 -#define BT_PKT_STATUS 16 +#define BT_PKT_STATUS 16#define BT_SCM_PKT_STATUS 0x03 +#define BT_ISO_QOS 17 + +#define BT_ISO_QOS_CIG_UNSET 0xff +#define BT_ISO_QOS_CIS_UNSET 0xff + +struct bt_iso_io_qos { +__u32 interval; +__u16 latency; +__u16 sdu; +__u8 phy; +__u8 rtn; +}; + +struct bt_iso_qos { +__u8 cig; +__u8 cis; +__u8 sca; +__u8 packing; +__u8 framing; +struct bt_iso_io_qos in; +struct bt_iso_io_qos out; +}; + +#define BT_ISO_PHY_1M 0x01 +#define BT_ISO_PHY_2M 0x02 +#define BT_ISO_PHY_CODED 0x04 +#define BT_ISO_PHY_ANY (BT_ISO_PHY_1M | BT_ISO_PHY_2M | \ + BT_ISO_PHY_CODED) +#define BT_CODEC 19struct bt_codec_caps {
include/net/bluetooth/hci.h +26 -2
@@ -1999,7 +1999,7 @@ struct hci_rp_le_read_iso_tx_sync {struct hci_cis_params {__u8 cis_id;__le16 c_sdu; -__le16 p_pdu; +__le16 p_sdu;__u8 c_phy;__u8 p_phy;__u8 c_rtn;
@@ -2010,7 +2010,7 @@ struct hci_cp_le_set_cig_params {__u8 cig_id;__u8 c_interval[3 ];__u8 p_interval[3 ]; -__u8 wc_sca; +__u8 sca;__u8 packing;__u8 framing;__le16 c_latency;
@@ -2053,6 +2053,30 @@ struct hci_cp_le_reject_cis {__u8 reason; } __packed; +#define HCI_OP_LE_SETUP_ISO_PATH 0x206e +struct hci_cp_le_setup_iso_path { +__le16 handle; +__u8 direction; +__u8 path; +__u8 codec; +__le16 codec_cid; +__le16 codec_vid; +__u8 delay[3 ]; +__u8 codec_cfg_len; +__u8 codec_cfg[0 ]; +} __packed; + +struct hci_rp_le_setup_iso_path { +__u8 status; +__le16 handle; +} __packed; + +#define HCI_OP_LE_SET_HOST_FEATURE 0x2074 +struct hci_cp_le_set_host_feature { +__u8 bit_number; +__u8 bit_value; +} __packed; +/* ---- HCI Events ---- */ struct hci_ev_status {__u8 status;
include/net/bluetooth/hci_core.h +106 -1
216 lines not on this page · raw message
include/net/bluetooth/hci_sock.h +2 -0
@@ -124,6 +124,8 @@ struct hci_dev_info {__u16 acl_pkts;__u16 sco_mtu;__u16 sco_pkts; +__u16 iso_mtu; +__u16 iso_pkts;struct hci_dev_stats stat; };
include/net/bluetooth/hci_sync.h +3 -0
@@ -106,3 +106,6 @@ int hci_resume_sync(struct hci_dev *hdev);struct hci_conn ;int hci_le_create_conn_sync (struct hci_dev *hdev,struct hci_conn *conn); + +int hci_le_remove_cig_sync (struct hci_dev *hdev,u8 handle); +int hci_le_remove_cig (struct hci_dev *hdev,u8 handle);
net/bluetooth/Kconfig +1 -0
@@ -29,6 +29,7 @@ menuconfig BT SCO audio links L2CAP (Logical Link Control and Adaptation Protocol) SMP (Security Manager Protocol) on LE (Low Energy) links + ISO isochronous links HCI Device drivers (Interface to the hardware) RFCOMM Module (RFCOMM Protocol) BNEP Module (Bluetooth Network Encapsulation Protocol)
net/bluetooth/hci_conn.c +440 -0
458 lines not on this page · raw message
net/bluetooth/hci_core.c +183 -47
292 lines not on this page · raw message
net/bluetooth/hci_event.c +304 -3
355 lines not on this page · raw message
net/bluetooth/hci_sync.c +48 -1
88 lines not on this page · raw message
Signature · 1 line
2.35.3
Re: [PATCH v7 2/7] Bluetooth: Add initial implementation of CIS connections
Hi Luiz,
Quoted 54 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
This adds the initial implementation of CIS connections and introduces the ISO packets/links.
== Central: Set CIG Parameters, create a CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-s <address>< HCI Command: LE Extended Create... (0x08|0x0043) plen 26
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Extended Create Connection (0x08|0x0043) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 31LE Enhanced Connection Complete (0x0a) ...< HCI Command: LE Create Connected... (0x08|0x0064) plen 5
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Create Connected Isochronous Stream (0x08|0x0064) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19) ...< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257== Peripheral: Accept CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-dHCI Event: LE Meta Event (
0x3e) plen 7LE Connected Isochronous Stream Request (0x1a)...
< HCI Command: LE Accept Co.. (0x08|0x0066) plen 2
...Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19)...
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257
Quoted 8 lines
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257Signed-off-by Luiz Augusto von Dentz <[email protected]>
This patch landed recently in linux-next as commit 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections"). Unfortunately it causes a regression on my test systems. On almost all I've observed that calling a simple 'hcitool scan' command in a shell fails in an unexpected way:
$ hcitool scan *** stack smashing detected ***: <unknown> terminated Aborted
$
The above 'stack smashing' issue I've observed on Raspberry Pi4 with ARM 32bit kernel.
Bisecting this lead me to this commit. Reverting it on top of next-20220808, together with the following commits due to dependencies, fixes the issue:
26afbd826ee326e63a334c37fd45e82e50a615ec "Bluetooth: Add initial implementation of CIS connections" e78165d2ce798451d08ac09d704cd72caa962b81 "Bluetooth: hci_conn: Fix updating ISO QoS PHY" ccf74f2390d60a2f9a75ef496d2564abb478f46a "Bluetooth: Add BTPROTO_ISO socket type"f764a6c2c1e446f560faa3232271a0637369170b "Bluetooth: ISO: Add broadcast support"c85008a4e748051cddc6be6333f55df476f35362 "Bluetooth: ISO: unlock on error path in iso_sock_setsockopt()" 82e07ef4b474f466b4b2955bad76c52d6df98a30 "Bluetooth: ISO: Fix info leak in iso_sock_getsockopt()" c5d36b8a7dbdcf41da7316252b717c60c409992b "Bluetooth: ISO: Fix memory corruption"8a3fd9bb4fac67ad5d44d6540c7ac20004767076 "Bluetooth: ISO: Fix iso_sock_getsockopt for BT_DEFER_SETUP" aac59090a068139550f9b73d46d1116e31cdd2d1 "Bluetooth: ISO: Fix not using the correct QoS"eca0ae4aea66914515e5e3098ea051b518ee5316 "Bluetooth: Add initial implementation of BIS connections"
Let me know if I can help fixing this issue.
Quoted 13 lines
--- include/net/bluetooth/bluetooth.h | 33 ++- include/net/bluetooth/hci.h | 28 +- include/net/bluetooth/hci_core.h | 107 +++++++- include/net/bluetooth/hci_sock.h | 2 + include/net/bluetooth/hci_sync.h | 3 + net/bluetooth/Kconfig | 1 + net/bluetooth/hci_conn.c | 440 ++++++++++++++++++++++++++++++ net/bluetooth/hci_core.c | 230 ++++++++++++---- net/bluetooth/hci_event.c | 307 ++++++++++++++++++++- net/bluetooth/hci_sync.c | 49 +++- 10 files changed, 1145 insertions(+), 55 deletions(-)
Quoted 1 line
...
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Luiz Augusto von Dentz
maintainerRe: [PATCH v7 2/7] Bluetooth: Add initial implementation of CIS connections
Hi Marek,
Quoted 73 lines · Marek Szyprowski
Hi Luiz,
Quoted 54 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
This adds the initial implementation of CIS connections and introduces the ISO packets/links.
== Central: Set CIG Parameters, create a CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-s <address>< HCI Command: LE Extended Create... (0x08|0x0043) plen 26
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Extended Create Connection (0x08|0x0043) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 31LE Enhanced Connection Complete (0x0a) ...< HCI Command: LE Create Connected... (0x08|0x0064) plen 5
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Create Connected Isochronous Stream (0x08|0x0064) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19) ...< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257== Peripheral: Accept CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-dHCI Event: LE Meta Event (
0x3e) plen 7LE Connected Isochronous Stream Request (0x1a)...
< HCI Command: LE Accept Co.. (0x08|0x0066) plen 2
...Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19)...
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257Quoted 8 lines
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257Signed-off-by Luiz Augusto von Dentz <[email protected]>This patch landed recently in linux-next as commit
26afbd826ee3("Bluetooth: Add initial implementation of CIS connections"). Unfortunately it causes a regression on my test systems. On almost all I've observed that calling a simple 'hcitool scan' command in a shell fails in an unexpected way:
Quoted 3 lines
$ hcitool scan *** stack smashing detected ***: <unknown> terminated Aborted
Not really sure how it would be related to ISO changes though, have you even enabled ISO sockets UUID? Perhaps check if there is something on dmesg indicating what is going on since I tried here and that doesn't seem to cause any problem:
tools/hcitool scan
Scanning ...
Perhaps it is a combination of using old userspace tools with new kernel, but then again these changes should affect something like hcitool.
Quoted 52 lines
$
The above 'stack smashing' issue I've observed on Raspberry Pi4 with ARM 32bit kernel.
Bisecting this lead me to this commit. Reverting it on top of next-20220808, together with the following commits due to dependencies, fixes the issue:
26afbd826ee326e63a334c37fd45e82e50a615ec"Bluetooth: Add initial implementation of CIS connections"e78165d2ce798451d08ac09d704cd72caa962b81"Bluetooth:hci_conn: Fix updating ISO QoS PHY"ccf74f2390d60a2f9a75ef496d2564abb478f46a"Bluetooth: AddBTPROTO_ISOsocket type"f764a6c2c1e446f560faa3232271a0637369170b"Bluetooth: ISO: Add broadcast support"c85008a4e748051cddc6be6333f55df476f35362"Bluetooth: ISO: unlock on error path iniso_sock_setsockopt()"82e07ef4b474f466b4b2955bad76c52d6df98a30"Bluetooth: ISO: Fix info leak iniso_sock_getsockopt()"c5d36b8a7dbdcf41da7316252b717c60c409992b"Bluetooth: ISO: Fix memory corruption"8a3fd9bb4fac67ad5d44d6540c7ac20004767076"Bluetooth: ISO: Fixiso_sock_getsockoptforBT_DEFER_SETUP"aac59090a068139550f9b73d46d1116e31cdd2d1"Bluetooth: ISO: Fix not using the correct QoS"eca0ae4aea66914515e5e3098ea051b518ee5316"Bluetooth: Add initial implementation of BIS connections"Let me know if I can help fixing this issue.
Quoted 13 lines
--- include/net/bluetooth/bluetooth.h | 33 ++- include/net/bluetooth/hci.h | 28 +- include/net/bluetooth/hci_core.h | 107 +++++++- include/net/bluetooth/hci_sock.h | 2 + include/net/bluetooth/hci_sync.h | 3 + net/bluetooth/Kconfig | 1 + net/bluetooth/hci_conn.c | 440 ++++++++++++++++++++++++++++++ net/bluetooth/hci_core.c | 230 ++++++++++++---- net/bluetooth/hci_event.c | 307 ++++++++++++++++++++- net/bluetooth/hci_sync.c | 49 +++- 10 files changed, 1145 insertions(+), 55 deletions(-)Quoted 1 line
...
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Signature · 1 line
Luiz Augusto von Dentz
Re: [PATCH v7 2/7] Bluetooth: Add initial implementation of CIS connections
Hi Luiz,
Quoted 79 lines · Luiz Augusto von Dentz
Quoted 69 lines · Marek Szyprowski
Quoted 54 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz<[email protected]>
This adds the initial implementation of CIS connections and introduces the ISO packets/links.
== Central: Set CIG Parameters, create a CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-s <address>< HCI Command: LE Extended Create... (0x08|0x0043) plen 26
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Extended Create Connection (0x08|0x0043) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 31LE Enhanced Connection Complete (0x0a) ...< HCI Command: LE Create Connected... (0x08|0x0064) plen 5
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Create Connected Isochronous Stream (0x08|0x0064) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19) ...< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257== Peripheral: Accept CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-dHCI Event: LE Meta Event (
0x3e) plen 7LE Connected Isochronous Stream Request (0x1a)...
< HCI Command: LE Accept Co.. (0x08|0x0066) plen 2
...Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19)...
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257Quoted 8 lines
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257Signed-off-by Luiz Augusto von Dentz<[email protected]>This patch landed recently in linux-next as commit
26afbd826ee3("Bluetooth: Add initial implementation of CIS connections"). Unfortunately it causes a regression on my test systems. On almost all I've observed that calling a simple 'hcitool scan' command in a shell fails in an unexpected way:Quoted 3 lines
$ hcitool scan *** stack smashing detected ***: <unknown> terminated AbortedNot really sure how it would be related to ISO changes though, have you even enabled ISO sockets UUID? Perhaps check if there is something on dmesg indicating what is going on since I tried here and that doesn't seem to cause any problem:
Quoted 6 lines
tools/hcitoolscan
Scanning ...Perhaps it is a combination of using old userspace tools with new kernel, but then again these changes should affect something like hcitool.
Indeed my userspace is old, but still, the kernel changes shouldn't make it to crash. I didn't change anything in userspace since ages, so I assume that ISO sockets UUIDs are not enabled. Maybe it is somehow architecture related or specific? It looks that only ARM 32bit userspace apps crashes. I've just checked 64bit userspace on ARM64 (RPi4) and it works fine with that commit.
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Luiz Augusto von Dentz
maintainerRe: [PATCH v7 2/7] Bluetooth: Add initial implementation of CIS connections
Hi Marek,
Quoted 90 lines · Marek Szyprowski
Hi Luiz,
Quoted 79 lines · Luiz Augusto von Dentz
Quoted 69 lines · Marek Szyprowski
Quoted 54 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz<[email protected]>
This adds the initial implementation of CIS connections and introduces the ISO packets/links.
== Central: Set CIG Parameters, create a CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-s <address>< HCI Command: LE Extended Create... (0x08|0x0043) plen 26
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Extended Create Connection (0x08|0x0043) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 31LE Enhanced Connection Complete (0x0a) ...< HCI Command: LE Create Connected... (0x08|0x0064) plen 5
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Create Connected Isochronous Stream (0x08|0x0064) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19) ...< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257== Peripheral: Accept CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-dHCI Event: LE Meta Event (
0x3e) plen 7LE Connected Isochronous Stream Request (0x1a)...
< HCI Command: LE Accept Co.. (0x08|0x0066) plen 2
...Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19)...
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257Quoted 8 lines
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257Signed-off-by Luiz Augusto von Dentz<[email protected]>This patch landed recently in linux-next as commit
26afbd826ee3("Bluetooth: Add initial implementation of CIS connections"). Unfortunately it causes a regression on my test systems. On almost all I've observed that calling a simple 'hcitool scan' command in a shell fails in an unexpected way:Quoted 3 lines
$ hcitool scan *** stack smashing detected ***: <unknown> terminated AbortedNot really sure how it would be related to ISO changes though, have you even enabled ISO sockets UUID? Perhaps check if there is something on dmesg indicating what is going on since I tried here and that doesn't seem to cause any problem:
Quoted 6 lines
tools/hcitoolscan
Scanning ...Perhaps it is a combination of using old userspace tools with new kernel, but then again these changes should affect something like hcitool.
Quoted 6 lines
Indeed my userspace is old, but still, the kernel changes shouldn't make it to crash. I didn't change anything in userspace since ages, so I assume that ISO sockets UUIDs are not enabled. Maybe it is somehow architecture related or specific? It looks that only ARM 32bit userspace apps crashes. I've just checked 64bit userspace on ARM64 (RPi4) and it works fine with that commit.
That would be the first time it happens to me that a change in kernel would crash the userspace in such odd fashion, btw perhaps run with valgrind so it generates a backtrace of where it would be crashing, well if that is reproducible with valgrind.
Quoted 5 lines
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Signature · 1 line
Luiz Augusto von Dentz
Re: [PATCH v7 2/7] Bluetooth: Add initial implementation of CIS connections
Hi Luiz,
Quoted 98 lines · Luiz Augusto von Dentz
Hi Marek,
Quoted 88 lines · Marek Szyprowski
Hi Luiz,
Quoted 79 lines · Luiz Augusto von Dentz
Quoted 69 lines · Marek Szyprowski
Quoted 54 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz<[email protected]>
This adds the initial implementation of CIS connections and introduces the ISO packets/links.
== Central: Set CIG Parameters, create a CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-s <address>< HCI Command: LE Extended Create... (0x08|0x0043) plen 26
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Extended Create Connection (0x08|0x0043) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 31LE Enhanced Connection Complete (0x0a) ...< HCI Command: LE Create Connected... (0x08|0x0064) plen 5
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Create Connected Isochronous Stream (0x08|0x0064) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19) ...< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257== Peripheral: Accept CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-dHCI Event: LE Meta Event (0x3e) plen 7 LE Connected Isochronous Stream Request (0x1a)...
< HCI Command: LE Accept Co.. (0x08|0x0066) plen 2
...Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19)...
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257Quoted 8 lines
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257Signed-off-by Luiz Augusto von Dentz<[email protected]>This patch landed recently in linux-next as commit
26afbd826ee3("Bluetooth: Add initial implementation of CIS connections"). Unfortunately it causes a regression on my test systems. On almost all I've observed that calling a simple 'hcitool scan' command in a shell fails in an unexpected way:Quoted 3 lines
$ hcitool scan *** stack smashing detected ***: <unknown> terminated AbortedNot really sure how it would be related to ISO changes though, have you even enabled ISO sockets UUID? Perhaps check if there is something on dmesg indicating what is going on since I tried here and that doesn't seem to cause any problem:
Quoted 6 lines
tools/hcitoolscan
Scanning ...Perhaps it is a combination of using old userspace tools with new kernel, but then again these changes should affect something like hcitool.
Quoted 6 lines
Indeed my userspace is old, but still, the kernel changes shouldn't make it to crash. I didn't change anything in userspace since ages, so I assume that ISO sockets UUIDs are not enabled. Maybe it is somehow architecture related or specific? It looks that only ARM 32bit userspace apps crashes. I've just checked 64bit userspace on ARM64 (RPi4) and it works fine with that commit.
Quoted 4 lines
That would be the first time it happens to me that a change in kernel would crash the userspace in such odd fashion, btw perhaps run with valgrind so it generates a backtrace of where it would be crashing, well if that is reproducible with valgrind.
Well, its not that easy. I've checked and Debian doesn't provide a valgrind package for the buster/armel arch, which I use on my test systems (for some historical reasons). Building everything from the source will take some time, though. I will try to do this after getting back from my holidays after 24th Aug.
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Re: [PATCH v7 2/7] Bluetooth: Add initial implementation of CIS connections
Hi All,
Quoted 110 lines · Marek Szyprowski
Hi Luiz,
Quoted 102 lines · Luiz Augusto von Dentz
Hi Marek,
Quoted 90 lines · Marek Szyprowski
Hi Luiz,
Quoted 81 lines · Luiz Augusto von Dentz
Quoted 71 lines · Marek Szyprowski
Quoted 57 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz<[email protected]>
This adds the initial implementation of CIS connections and introduces
the ISO packets/links.== Central: Set CIG Parameters, create a CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-s <address>< HCI Command: LE Extended Create... (0x08|0x0043) plen 26
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Extended Create Connection (0x08|0x0043) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 31LE Enhanced Connection Complete (
0x0a)
...
< HCI Command: LE Create Connected... (0x08|0x0064) plen 5
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Create Connected Isochronous Stream (0x08|0x0064) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (
0x19)
...
< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257
< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257== Peripheral: Accept CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-dHCI Event: LE Meta Event (
0x3e) plen 7
LE Connected Isochronous Stream Request (0x1a)
...
< HCI Command: LE Accept Co.. (0x08|0x0066) plen 2
...Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (
0x19)
...
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 6 lines
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257Signed-off-by Luiz Augusto von Dentz<[email protected]>This patch landed recently in linux-next as commit
26afbd826ee3("Bluetooth: Add initial implementation of CIS connections"). Unfortunately it causes a regression on my test systems. On almost all
I've observed that calling a simple 'hcitool scan' command in a shell fails in an unexpected way:Quoted 3 lines
$ hcitool scan *** stack smashing detected ***: <unknown> terminated AbortedNot really sure how it would be related to ISO changes though, have you even enabled ISO sockets UUID? Perhaps check if there is something on dmesg indicating what is going on since I tried here and that doesn't seem to cause any problem:
Quoted 6 lines
tools/hcitoolscan
Scanning ...Perhaps it is a combination of using old userspace tools with new kernel, but then again these changes should affect something like hcitool.
Quoted 8 lines
Indeed my userspace is old, but still, the kernel changes shouldn't make
it to crash. I didn't change anything in userspace since ages, so I assume that ISO sockets UUIDs are not enabled. Maybe it is somehow architecture related or specific? It looks that only ARM 32bit userspace
apps crashes. I've just checked 64bit userspace on ARM64 (RPi4) and it works fine with that commit.Quoted 4 lines
That would be the first time it happens to me that a change in kernel would crash the userspace in such odd fashion, btw perhaps run with valgrind so it generates a backtrace of where it would be crashing, well if that is reproducible with valgrind.
Quoted 5 lines
Well, its not that easy. I've checked and Debian doesn't provide a valgrind package for the buster/armel arch, which I use on my test systems (for some historical reasons). Building everything from the source will take some time, though. I will try to do this after getting back from my holidays after 24th Aug.
Unfortunately my holidays trip didn't start, so I had a chance to play a bit with this issue.
Valgrind doesn't really provide any useful information here:
$ valgrind hcitool scan ==1391== Memcheck, a memory error detector ==1391== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==1391== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info ==1391== Command: hcitool scan ==1391== *** stack smashing detected ***: <unknown> terminated ==1391== ==1391== Process terminating with default action of signal 6 (SIGABRT) ==1391== at 0x48EB6AC: raise (raise.c:51) ==1391== by 0x48D6283: abort (abort.c:79) ==1391== by 0x4928E3B: __libc_message (libc_fatal.c:181) ==1391== by 0x49ACFE3: __fortify_fail_abort (fortify_fail.c:33) ==1391== by 0x49ACFA7: __stack_chk_fail (stack_chk_fail.c:29) ==1391== by 0x117DFB: ??? (in /usr/bin/hcitool) ==1391== ==1391== HEAP SUMMARY: ==1391== in use at exit: 132 bytes in 1 blocks ==1391== total heap usage: 1 allocs, 0 frees, 132 bytes allocated ==1391== ==1391== LEAK SUMMARY: ==1391== definitely lost: 0 bytes in 0 blocks ==1391== indirectly lost: 0 bytes in 0 blocks ==1391== possibly lost: 0 bytes in 0 blocks ==1391== still reachable: 132 bytes in 1 blocks ==1391== suppressed: 0 bytes in 0 blocks ==1391== Rerun with --leak-check=full to see details of leaked memory ==1391== ==1391== For counts of detected and suppressed errors, rerun with: -v ==1391== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Aborted
I've also checked the ARM 32bit 'armhf' userspace abi on vanilla Raspberry Pi OS Lite 32-bit image (from April 4th 2022). The issue is same:
$ hcitool scan *** stack smashing detected ***: terminated Aborted
It is enough to boot that image with init=/bin/bash and run 'hcitool scan' to reproduce the issue...
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Re: [PATCH v7 2/7] Bluetooth: Add initial implementation of CIS connections
Hi All,
Quoted 157 lines · Marek Szyprowski
Quoted 107 lines · Marek Szyprowski
Quoted 101 lines · Luiz Augusto von Dentz
Quoted 91 lines · Marek Szyprowski
Quoted 84 lines · Luiz Augusto von Dentz
Quoted 73 lines · Marek Szyprowski
Quoted 58 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz<[email protected]>
This adds the initial implementation of CIS connections and introduces
the ISO packets/links.== Central: Set CIG Parameters, create a CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-s <address>< HCI Command: LE Extended Create... (0x08|0x0043) plen 26
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Extended Create Connection (0x08|0x0043) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 31LE Enhanced Connection Complete (
0x0a)
...
< HCI Command: LE Create Connected... (0x08|0x0064) plen 5
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Create Connected Isochronous Stream (0x08|0x0064) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (
0x19)
...
< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257
< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257== Peripheral: Accept CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-dHCI Event: LE Meta Event (
0x3e) plen 7
LE Connected Isochronous Stream Request (0x1a)
...
< HCI Command: LE Accept Co.. (0x08|0x0066) plen 2
...Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (
0x19)
...
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 6 lines
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 257Signed-off-by Luiz Augusto von Dentz<[email protected]>This patch landed recently in linux-next as commit
26afbd826ee3("Bluetooth: Add initial implementation of CIS connections"). Unfortunately it causes a regression on my test systems. On almost all
I've observed that calling a simple 'hcitool scan' command in a shell
fails in an unexpected way:Quoted 3 lines
$ hcitool scan *** stack smashing detected ***: <unknown> terminated AbortedNot really sure how it would be related to ISO changes though, have you even enabled ISO sockets UUID? Perhaps check if there is something
on dmesg indicating what is going on since I tried here and that doesn't seem to cause any problem:Quoted 6 lines
tools/hcitoolscan
Scanning ...Perhaps it is a combination of using old userspace tools with new kernel, but then again these changes should affect something like hcitool.
Quoted 8 lines
Indeed my userspace is old, but still, the kernel changes shouldn't make
it to crash. I didn't change anything in userspace since ages, so I assume that ISO sockets UUIDs are not enabled. Maybe it is somehow architecture related or specific? It looks that only ARM 32bit userspace
apps crashes. I've just checked 64bit userspace on ARM64 (RPi4) and it works fine with that commit.Quoted 4 lines
That would be the first time it happens to me that a change in kernel would crash the userspace in such odd fashion, btw perhaps run with valgrind so it generates a backtrace of where it would be crashing, well if that is reproducible with valgrind.
Quoted 5 lines
Well, its not that easy. I've checked and Debian doesn't provide a valgrind package for the buster/armel arch, which I use on my test systems (for some historical reasons). Building everything from the source will take some time, though. I will try to do this after getting back from my holidays after 24th Aug.
Unfortunately my holidays trip didn't start, so I had a chance to play a bit with this issue.
Valgrind doesn't really provide any useful information here:
$ valgrind hcitool scan ==1391== Memcheck, a memory error detector ==1391== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==1391== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info ==1391== Command: hcitool scan ==1391== *** stack smashing detected ***: <unknown> terminated ==1391== ==1391== Process terminating with default action of signal 6 (SIGABRT) ==1391== at 0x48EB6AC: raise (raise.c:51) ==1391== by 0x48D6283: abort (abort.c:79) ==1391== by 0x4928E3B: __libc_message (libc_fatal.c:181) ==1391== by 0x49ACFE3: __fortify_fail_abort (fortify_fail.c:33) ==1391== by 0x49ACFA7: __stack_chk_fail (stack_chk_fail.c:29) ==1391== by 0x117DFB: ??? (in /usr/bin/hcitool) ==1391== ==1391== HEAP SUMMARY: ==1391== in use at exit: 132 bytes in 1 blocks ==1391== total heap usage: 1 allocs, 0 frees, 132 bytes allocated ==1391== ==1391== LEAK SUMMARY: ==1391== definitely lost: 0 bytes in 0 blocks ==1391== indirectly lost: 0 bytes in 0 blocks ==1391== possibly lost: 0 bytes in 0 blocks ==1391== still reachable: 132 bytes in 1 blocks ==1391== suppressed: 0 bytes in 0 blocks ==1391== Rerun with --leak-check=full to see details of leaked memory ==1391== ==1391== For counts of detected and suppressed errors, rerun with: -v ==1391== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) AbortedI've also checked the ARM 32bit 'armhf' userspace abi on vanilla Raspberry Pi OS Lite 32-bit image (from April 4th 2022). The issue is same:
Quoted 7 lines
$ hcitool scan *** stack smashing detected ***: terminated AbortedIt is enough to boot that image with init=/bin/bash and run 'hcitool scan' to reproduce the issue...
I've had some time to analyze this issue further and I've finally found which change is responsible for this issue. It is caused by the following chunk:
(quoted diff) +0 -0
b/include/net/bluetooth/hci_sock.h
index 9949870f7d78..0520e21ab698 100644
include/net/bluetooth/hci_sock.h +2 -0
@@ -124,6 +124,8 @@ struct hci_dev_info { __u16 acl_pkts; __u16 sco_mtu; __u16 sco_pkts; + __u16 iso_mtu; + __u16 iso_pkts; struct hci_dev_stats stat; };
It looks that this is an ABI break for some old userspace tools. I've confirmed this by applying only the above chunk on top of v5.19-rc1 and running my tests. 'hcitool scan' crashes in such case.
I've also removed that chunk from the v6.0-rc1 release and surprisingly I found that it is not used by the bluetooth code! Kernel compiled successfully. Is that change intentional? Or is it just a leftover from the development process that accidentally made its way into final patch?
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Luiz Augusto von Dentz
maintainerRe: [PATCH v7 2/7] Bluetooth: Add initial implementation of CIS connections
Hi Marek,
Quoted 188 lines · Marek Szyprowski
Hi All,
Quoted 157 lines · Marek Szyprowski
Quoted 107 lines · Marek Szyprowski
Quoted 101 lines · Luiz Augusto von Dentz
Quoted 91 lines · Marek Szyprowski
Quoted 84 lines · Luiz Augusto von Dentz
Quoted 73 lines · Marek Szyprowski
Quoted 56 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz<[email protected]>
This adds the initial implementation of CIS connections and introduces
the ISO packets/links.== Central: Set CIG Parameters, create a CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-s <address>< HCI Command: LE Extended Create... (0x08|0x0043) plen 26
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Extended Create Connection (0x08|0x0043) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 31LE Enhanced Connection Complete (0x0a) ...< HCI Command: LE Create Connected... (0x08|0x0064) plen 5
...Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4LE Create Connected Isochronous Stream (0x08|0x0064) ncmd 1 Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19) ...< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257== Peripheral: Accept CIS and Setup Data Path ==
Quoted 1 line
tools/isotest-dHCI Event: LE Meta Event (0x3e) plen 7 LE Connected Isochronous Stream Request (0x1a)...
< HCI Command: LE Accept Co.. (0x08|0x0066) plen 2
...Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29LE Connected Isochronous Stream Established (0x19)...
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257Quoted 8 lines
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 257Signed-off-by Luiz Augusto von Dentz<[email protected]>This patch landed recently in linux-next as commit
26afbd826ee3("Bluetooth: Add initial implementation of CIS connections"). Unfortunately it causes a regression on my test systems. On almost all
I've observed that calling a simple 'hcitool scan' command in a shell
fails in an unexpected way:Quoted 3 lines
$ hcitool scan *** stack smashing detected ***: <unknown> terminated AbortedNot really sure how it would be related to ISO changes though, have you even enabled ISO sockets UUID? Perhaps check if there is something
on dmesg indicating what is going on since I tried here and that doesn't seem to cause any problem:Quoted 6 lines
tools/hcitoolscan
Scanning ...Perhaps it is a combination of using old userspace tools with new kernel, but then again these changes should affect something like hcitool.
Quoted 8 lines
Indeed my userspace is old, but still, the kernel changes shouldn't make
it to crash. I didn't change anything in userspace since ages, so I assume that ISO sockets UUIDs are not enabled. Maybe it is somehow architecture related or specific? It looks that only ARM 32bit userspace
apps crashes. I've just checked 64bit userspace on ARM64 (RPi4) and it works fine with that commit.Quoted 4 lines
That would be the first time it happens to me that a change in kernel would crash the userspace in such odd fashion, btw perhaps run with valgrind so it generates a backtrace of where it would be crashing, well if that is reproducible with valgrind.
Quoted 5 lines
Well, its not that easy. I've checked and Debian doesn't provide a valgrind package for the buster/armel arch, which I use on my test systems (for some historical reasons). Building everything from the source will take some time, though. I will try to do this after getting back from my holidays after 24th Aug.
Unfortunately my holidays trip didn't start, so I had a chance to play a bit with this issue.
Valgrind doesn't really provide any useful information here:
$ valgrind hcitool scan ==1391== Memcheck, a memory error detector ==1391== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==1391== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info ==1391== Command: hcitool scan ==1391== *** stack smashing detected ***: <unknown> terminated ==1391== ==1391== Process terminating with default action of signal 6 (SIGABRT) ==1391== at 0x48EB6AC: raise (raise.c:51) ==1391== by 0x48D6283: abort (abort.c:79) ==1391== by 0x4928E3B: __libc_message (libc_fatal.c:181) ==1391== by 0x49ACFE3: __fortify_fail_abort (fortify_fail.c:33) ==1391== by 0x49ACFA7: __stack_chk_fail (stack_chk_fail.c:29) ==1391== by 0x117DFB: ??? (in /usr/bin/hcitool) ==1391== ==1391== HEAP SUMMARY: ==1391== in use at exit: 132 bytes in 1 blocks ==1391== total heap usage: 1 allocs, 0 frees, 132 bytes allocated ==1391== ==1391== LEAK SUMMARY: ==1391== definitely lost: 0 bytes in 0 blocks ==1391== indirectly lost: 0 bytes in 0 blocks ==1391== possibly lost: 0 bytes in 0 blocks ==1391== still reachable: 132 bytes in 1 blocks ==1391== suppressed: 0 bytes in 0 blocks ==1391== Rerun with --leak-check=full to see details of leaked memory ==1391== ==1391== For counts of detected and suppressed errors, rerun with: -v ==1391== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) AbortedI've also checked the ARM 32bit 'armhf' userspace abi on vanilla Raspberry Pi OS Lite 32-bit image (from April 4th 2022). The issue is same:
Quoted 7 lines
$ hcitool scan *** stack smashing detected ***: terminated AbortedIt is enough to boot that image with init=/bin/bash and run 'hcitool scan' to reproduce the issue...
I've had some time to analyze this issue further and I've finally found which change is responsible for this issue. It is caused by the following chunk:
include/net/bluetooth/hci_sock.h +2
-0@@ -124,6 +124,8 @@ struct hci_dev_info {__u16 acl_pkts;__u16 sco_mtu;__u16 sco_pkts; +__u16 iso_mtu; +__u16 iso_pkts;struct hci_dev_stats stat; };
Quoted 3 lines
It looks that this is an ABI break for some old userspace tools. I've confirmed this by applying only the above chunk on top of v5.19-rc1 and running my tests. 'hcitool scan' crashes in such case.
Oh that indeed is not intended, this is the old IOCTL interface for HCIGETDEVINFO opcode which apparently breaks due to the change in size of hci_dev_info.
Quoted 4 lines
I've also removed that chunk from the v6.0-rc1 release and surprisingly I found that it is not used by the bluetooth code! Kernel compiled successfully. Is that change intentional? Or is it just a leftover from the development process that accidentally made its way into final patch?
We should definitely remove these changes, I will send a patch shortly.
Quoted 6 lines
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Signature · 1 line
Luiz Augusto von Dentz
Luiz Augusto von Dentz
maintainerPATCH v7 3/7 Bluetooth: Add BTPROTO_ISO socket type
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This introduces a new socket type BTPROTO_ISO which can be enabled with use of ISO Socket experiemental UUID, it can used to initiate/accept connections and transfer packets between userspace and kernel similarly to how BTPROTO_SCO works:
Central -> uses connect with address set to destination bdaddr:
Quoted 1 line
tools/isotest-s 00:AA:01:00:00:00
Peripheral -> uses listen:
Quoted 1 line
tools/isotest-d
--- include/net/bluetooth/bluetooth.h | 21 + include/net/bluetooth/hci_core.h | 18 +- include/net/bluetooth/iso.h | 21 + net/bluetooth/Makefile | 1 + net/bluetooth/af_bluetooth.c | 4 +- net/bluetooth/hci_core.c | 6 +- net/bluetooth/iso.c | 1501 +++++++++++++++++++++++++++++ net/bluetooth/mgmt.c | 69 +- 8 files changed, 1636 insertions(+), 5 deletions(-) create mode 100644 include/net/bluetooth/iso.h create mode 100644 net/bluetooth/iso.c
include/net/bluetooth/bluetooth.h +21 -0
@@ -590,6 +590,27 @@ static inline void sco_exit(void) }#endif +#if IS_ENABLED (CONFIG_BT_LE ) +int iso_init (void ); +int iso_exit (void ); +bool iso_enabled (void ); +#else +static inline int iso_init (void ) +{ +return 0 ; +} + +static inline int iso_exit (void ) +{ +return 0 ; +} + +static inline bool iso_enabled (void ) +{ +return false; +} +#endif +int mgmt_init (void );void mgmt_exit (void );
include/net/bluetooth/hci_core.h +16 -2
@@ -848,6 +848,21 @@ static inline void sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb) }#endif +#if IS_ENABLED (CONFIG_BT_LE ) +int iso_connect_ind (struct hci_dev *hdev,bdaddr_t *bdaddr,__u8 *flags); +void iso_recv (struct hci_conn *hcon,struct sk_buff *skb,u16 flags); +#else +static inline int iso_connect_ind (struct hci_dev *hdev,bdaddr_t *bdaddr, +__u8 *flags) +{ +return 0 ; +} +static inline void iso_recv (struct hci_conn *hcon,struct sk_buff *skb, +u16 flags) +{ +} +#endif +/* ----- Inquiry cache ----- */ #define INQUIRY_CACHE_AGE_MAX (HZ*30)/* 30 seconds */ #define INQUIRY_ENTRY_AGE_MAX (HZ*60)/* 60 seconds */
@@ -1648,8 +1663,7 @@ static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,return sco_connect_ind (hdev, bdaddr, flags);case ISO_LINK : -/* TODO: Handle connection indication */ -return -EINVAL ; +return iso_connect_ind (hdev, bdaddr, flags);default :BT_ERR ("unknown link type %d" , type);
include/net/bluetooth/iso.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* BlueZ - Bluetooth protocol stack for Linux +* +* Copyright (C) 2022 Intel Corporation +*/ + +#ifndef __ISO_H +#define __ISO_H + +/* ISO defaults */ +#define ISO_DEFAULT_MTU 251 + +/* ISO socket address */ +struct sockaddr_iso { +sa_family_t iso_family; +bdaddr_t iso_bdaddr; +__u8 iso_bdaddr_type; +}; + +#endif /* __ISO_H */
net/bluetooth/Makefile +1 -0
@@ -18,6 +18,7 @@ bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o \ eir.o hci_sync.o bluetooth-$(CONFIG_BT_BREDR) += sco.o +bluetooth-$(CONFIG_BT_LE) += iso.o bluetooth-$(CONFIG_BT_HS) += a2mp.o amp.o bluetooth-$(CONFIG_BT_LEDS) += leds.o bluetooth-$(CONFIG_BT_MSFTEXT) += msft.o
net/bluetooth/af_bluetooth.c +3 -1
@@ -38,7 +38,7 @@#include "selftest.h" /* Bluetooth sockets */ -#define BT_MAX_PROTO 8 +#define BT_MAX_PROTO (BTPROTO_LAST + 1)static const struct net_proto_family *bt_proto[BT_MAX_PROTO ];static DEFINE_RWLOCK (bt_proto_lock);
@@ -52,6 +52,7 @@ static const char *const bt_key_strings[BT_MAX_PROTO] = {"sk_lock-AF_BLUETOOTH-BTPROTO_CMTP" ,"sk_lock-AF_BLUETOOTH-BTPROTO_HIDP" ,"sk_lock-AF_BLUETOOTH-BTPROTO_AVDTP" , + "sk_lock-AF_BLUETOOTH-BTPROTO_ISO", };static struct lock_class_key bt_slock_key[BT_MAX_PROTO ];
@@ -64,6 +65,7 @@ static const char *const bt_slock_key_strings[BT_MAX_PROTO] = {"slock-AF_BLUETOOTH-BTPROTO_CMTP" ,"slock-AF_BLUETOOTH-BTPROTO_HIDP" ,"slock-AF_BLUETOOTH-BTPROTO_AVDTP" , + "slock-AF_BLUETOOTH-BTPROTO_ISO", };void bt_sock_reclassify_lock (struct sock *sk,int proto)
net/bluetooth/hci_core.c +5 -1
@@ -3852,12 +3852,16 @@ static void hci_isodata_packet(struct hci_dev *hdev, struct sk_buff *skb) conn =hci_conn_hash_lookup_handle (hdev, handle);hci_dev_unlock (hdev); -/* TODO: Send to upper protocol */ if (!conn) {bt_dev_err (hdev,"ISO packet for unknown connection handle %d" , handle); + goto drop; } +/* Send to upper protocol */ +iso_recv (conn, skb, flags); +return ; + drop:kfree_skb (skb); }
net/bluetooth/iso.c new file +1501 -0
1,501 lines not on this page · raw message
net/bluetooth/mgmt.c +68 -1
96 lines not on this page · raw message
Signature · 1 line
2.35.3
Luiz Augusto von Dentz
maintainerPATCH v7 4/7 Bluetooth: Add initial implementation of BIS connections
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This adds initial support for BIS/BIG which includes:
== Broadcaster role: Setup a periodic advertising and create a BIG ==
Quoted 1 line
tools/isotest-s 00:00:00:00:00:00
isotest[63]: Connected [00:00:00:00:00:00]
isotest[63]: QoS BIG 0x00 BIS 0x00 Packing 0x00 Framing 0x00] isotest[63]: Output QoS [Interval 10000 us Latency 10 ms SDU 40 PHY 0x02 RTN 2]
isotest[63]: Sending ...
isotest[63]: Number of packets: 1
isotest[63]: Socket jitter buffer: 80 buffer
< HCI Command: LE Set Perio.. (0x08|0x003e) plen 7
...
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4
LE Set Periodic Advertising Parameters (0x08|0x003e) ncmd 1
Status: Success (0x00)< HCI Command: LE Set Perio.. (0x08|0x003f) plen 7
...
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4
LE Set Periodic Advertising Data (0x08|0x003f) ncmd 1
Status: Success (0x00)< HCI Command: LE Set Perio.. (0x08|0x0040) plen 2
...
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4
LE Set Periodic Advertising Enable (0x08|0x0040) ncmd 1
Status: Success (0x00)< HCI Command: LE Create B.. (0x08|0x0068) plen 31
...
Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
LE Create Broadcast Isochronous Group (0x08|0x0068) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 21
LE Broadcast Isochronous Group Complete (0x1b)
...== Broadcast Receiver role: Create a PA Sync and BIG Sync ==
Quoted 1 line
tools/isotest-i hci1 -d 00:AA:01:00:00:00
isotest[66]: Waiting for connection 00:AA:01:00:00:00... < HCI Command: LE Periodic Advert.. (0x08|0x0044) plen 14
...
Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
LE Periodic Advertising Create Sync (0x08|0x0044) ncmd 1
Status: Success (0x00)< HCI Command: LE Set Extended Sca.. (0x08|0x0041) plen 8
...
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4
LE Set Extended Scan Parameters (0x08|0x0041) ncmd 1
Status: Success (0x00)< HCI Command: LE Set Extended Sca.. (0x08|0x0042) plen 6
...
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4
LE Set Extended Scan Enable (0x08|0x0042) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 29
LE Extended Advertising Report (0x0d)
...Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 16
LE Periodic Advertising Sync Established (0x0e)
...< HCI Command: LE Broadcast Isoch.. (0x08|0x006b) plen 25
...
Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
LE Broadcast Isochronous Group Create Sync (0x08|0x006b) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 17
LE Broadcast Isochronous Group Sync Estabilished (0x1d)
...--- include/net/bluetooth/bluetooth.h | 18 +- include/net/bluetooth/hci.h | 162 ++++++++- include/net/bluetooth/hci_core.h | 89 ++++- include/net/bluetooth/hci_sync.h | 12 +- net/bluetooth/eir.c | 21 ++ net/bluetooth/eir.h | 1 + net/bluetooth/hci_conn.c | 561 +++++++++++++++++++++++++++--- net/bluetooth/hci_core.c | 80 +++-- net/bluetooth/hci_event.c | 206 +++++++++++ net/bluetooth/hci_request.c | 36 +- net/bluetooth/hci_request.h | 9 + net/bluetooth/hci_sync.c | 249 ++++++++++++- net/bluetooth/mgmt.c | 15 +- 13 files changed, 1333 insertions(+), 126 deletions(-)
include/net/bluetooth/bluetooth.h +15 -3
@@ -160,6 +160,9 @@ struct bt_voice {#define BT_ISO_QOS_CIG_UNSET 0xff#define BT_ISO_QOS_CIS_UNSET 0xff +#define BT_ISO_QOS_BIG_UNSET 0xff +#define BT_ISO_QOS_BIS_UNSET 0xff +struct bt_iso_io_qos {__u32 interval;__u16 latency;
@@ -169,9 +172,18 @@ struct bt_iso_io_qos { };struct bt_iso_qos { -__u8 cig; -__u8 cis; -__u8 sca; +union { +__u8 cig; +__u8 big; + }; +union { +__u8 cis; +__u8 bis; + }; +union { +__u8 sca; +__u8 sync_interval; + };__u8 packing;__u8 framing;struct bt_iso_io_qos in;
include/net/bluetooth/hci.h +155 -7
219 lines not on this page · raw message
include/net/bluetooth/hci_core.h +80 -9
167 lines not on this page · raw message
include/net/bluetooth/hci_sync.h +11 -1
@@ -65,6 +65,10 @@ int hci_enable_ext_advertising_sync(struct hci_dev *hdev, u8 instance);int hci_enable_advertising_sync (struct hci_dev *hdev);int hci_enable_advertising (struct hci_dev *hdev); +int hci_start_per_adv_sync (struct hci_dev *hdev,u8 instance,u8 data_len, +u8 *data,u32 flags,u16 min_interval, +u16 max_interval,u16 sync_interval); +int hci_remove_advertising_sync (struct hci_dev *hdev,struct sock *sk,u8 instance,bool force);int hci_disable_advertising_sync (struct hci_dev *hdev);
@@ -82,6 +86,7 @@ int hci_update_scan_sync(struct hci_dev *hdev);int hci_write_le_host_supported_sync (struct hci_dev *hdev,u8 le,u8 simul);int hci_remove_ext_adv_instance_sync (struct hci_dev *hdev,u8 instance,struct sock *sk); +int hci_remove_ext_adv_instance (struct hci_dev *hdev,u8 instance);struct sk_buff *hci_read_local_oob_data_sync (struct hci_dev *hdev,bool ext,struct sock *sk);
@@ -108,4 +113,9 @@ struct hci_conn;int hci_le_create_conn_sync (struct hci_dev *hdev,struct hci_conn *conn);int hci_le_remove_cig_sync (struct hci_dev *hdev,u8 handle); -int hci_le_remove_cig (struct hci_dev *hdev,u8 handle); + +int hci_le_terminate_big_sync (struct hci_dev *hdev,u8 handle,u8 reason); + +int hci_le_big_terminate_sync (struct hci_dev *hdev,u8 handle); + +int hci_le_pa_terminate_sync (struct hci_dev *hdev,u16 handle);
net/bluetooth/eir.c +21 -0
@@ -236,6 +236,27 @@ void eir_create(struct hci_dev *hdev, u8 *data) ptr =create_uuid128_list (hdev, ptr,HCI_MAX_EIR_LENGTH - (ptr - data)); } +u8 eir_create_per_adv_data (struct hci_dev *hdev,u8 instance,u8 *ptr) +{ +struct adv_info *adv =NULL ; +u8 ad_len =0 ; + +/* Return 0 when the current instance identifier is invalid. */ +if (instance) { + adv =hci_find_adv_instance (hdev, instance); +if (!adv) +return 0 ; + } + +if (adv) { +memcpy (ptr, adv->per_adv_data, adv->per_adv_data_len); + ad_len += adv->per_adv_data_len; + ptr += adv->per_adv_data_len; + } + +return ad_len; +} +u8 eir_create_adv_data (struct hci_dev *hdev,u8 instance,u8 *ptr) {struct adv_info *adv =NULL ;
net/bluetooth/eir.h +1 -0
@@ -11,6 +11,7 @@ void eir_create(struct hci_dev *hdev, u8 *data);u8 eir_create_adv_data (struct hci_dev *hdev,u8 instance,u8 *ptr);u8 eir_create_scan_rsp (struct hci_dev *hdev,u8 instance,u8 *ptr); +u8 eir_create_per_adv_data (struct hci_dev *hdev,u8 instance,u8 *ptr);u8 eir_append_local_name (struct hci_dev *hdev,u8 *eir,u8 ad_len);u8 eir_append_appearance (struct hci_dev *hdev,u8 *ptr,u8 ad_len);
net/bluetooth/hci_conn.c +508 -53
622 lines not on this page · raw message
net/bluetooth/hci_core.c +50 -30
107 lines not on this page · raw message
net/bluetooth/hci_event.c +206 -0
248 lines not on this page · raw message
net/bluetooth/hci_request.c +21 -15
@@ -827,7 +827,6 @@ void __hci_req_disable_advertising(struct hci_request *req) {if (ext_adv_capable (req->hdev)) {__hci_req_disable_ext_adv_instance (req,0x00 ); - }else {u8 enable =0x00 ;
@@ -1338,15 +1337,15 @@ int __hci_req_setup_ext_adv_instance(struct hci_request *req, u8 instance)bdaddr_t random_addr;u8 own_addr_type;int err; -struct adv_info *adv_instance; -bool secondary_adv; +struct adv_info *adv; +bool secondary_adv, require_privacy;if (instance >0 ) { - adv_instance =hci_find_adv_instance (hdev, instance); -if (!adv_instance) + adv =hci_find_adv_instance (hdev, instance); +if (!adv)return -EINVAL ; }else { - adv_instance =NULL ; + adv =NULL ; } flags =hci_adv_instance_flags (hdev, instance);
@@ -1364,18 +1363,24 @@ int __hci_req_setup_ext_adv_instance(struct hci_request *req, u8 instance)* advertising is used. In that case it is fine to use a * non-resolvable private address. */ - err =hci_get_random_address (hdev, !connectable, -adv_use_rpa (hdev, flags), adv_instance, + require_privacy = !connectable; + +/* Don't require privacy for periodic adv? */ +if (adv && adv->periodic) + require_privacy = false; + + err =hci_get_random_address (hdev, require_privacy, +adv_use_rpa (hdev, flags), adv, &own_addr_type, &random_addr);if (err <0 )return err;memset (&cp,0 ,sizeof (cp)); -if (adv_instance) { -hci_cpu_to_le24 (adv_instance->min_interval, cp.min_interval); -hci_cpu_to_le24 (adv_instance->max_interval, cp.max_interval); - cp.tx_power = adv_instance->tx_power; +if (adv) { +hci_cpu_to_le24 (adv->min_interval, cp.min_interval); +hci_cpu_to_le24 (adv->max_interval, cp.max_interval); + cp.tx_power = adv->tx_power; }else {hci_cpu_to_le24 (hdev->le_adv_min_interval, cp.min_interval);hci_cpu_to_le24 (hdev->le_adv_max_interval, cp.max_interval);
@@ -1396,7 +1401,8 @@ int __hci_req_setup_ext_adv_instance(struct hci_request *req, u8 instance)else cp.evt_properties =cpu_to_le16 (LE_LEGACY_ADV_SCAN_IND ); }else { -if (secondary_adv) +/* Secondary and periodic cannot use legacy PDUs */ +if (secondary_adv || (adv && adv->periodic)) cp.evt_properties =cpu_to_le16 (LE_EXT_ADV_NON_CONN_IND );else cp.evt_properties =cpu_to_le16 (LE_LEGACY_NONCONN_IND );
@@ -1426,8 +1432,8 @@ int __hci_req_setup_ext_adv_instance(struct hci_request *req, u8 instance)struct hci_cp_le_set_adv_set_rand_addr cp;/* Check if random address need to be updated */ -if (adv_instance) { -if (!bacmp (&random_addr, &adv_instance->random_addr)) +if (adv) { +if (!bacmp (&random_addr, &adv->random_addr))return 0 ; }else {if (!bacmp (&random_addr, &hdev->random_addr))
net/bluetooth/hci_request.h +9 -0
@@ -85,6 +85,9 @@ void __hci_req_enable_advertising(struct hci_request *req);void __hci_req_disable_advertising (struct hci_request *req);void __hci_req_update_adv_data (struct hci_request *req,u8 instance);int hci_req_update_adv_data (struct hci_dev *hdev,u8 instance); +int hci_req_start_per_adv (struct hci_dev *hdev,u8 instance,u32 flags, +u16 min_interval,u16 max_interval, +u16 sync_interval);void __hci_req_update_scan_rsp_data (struct hci_request *req,u8 instance); int __hci_req_schedule_adv_instance(struct hci_request *req, u8 instance,
@@ -94,8 +97,14 @@ void hci_req_clear_adv_instance(struct hci_dev *hdev, struct sock *sk, bool force);int __hci_req_setup_ext_adv_instance (struct hci_request *req,u8 instance); +int __hci_req_setup_per_adv_instance (struct hci_request *req,u8 instance, +u16 min_interval,u16 max_interval);int __hci_req_start_ext_adv (struct hci_request *req,u8 instance); +int __hci_req_start_per_adv (struct hci_request *req,u8 instance,u32 flags, +u16 min_interval,u16 max_interval, +u16 sync_interval);int __hci_req_enable_ext_advertising (struct hci_request *req,u8 instance); +int __hci_req_enable_per_advertising (struct hci_request *req,u8 instance);int __hci_req_disable_ext_adv_instance (struct hci_request *req,u8 instance);int __hci_req_remove_ext_adv_instance (struct hci_request *req,u8 instance);void __hci_req_clear_ext_adv_sets (struct hci_request *req);
net/bluetooth/hci_sync.c +248 -1
276 lines not on this page · raw message
net/bluetooth/mgmt.c +8 -7
@@ -8166,7 +8166,7 @@ static int add_advertising(struct sock *sk, struct hci_dev *hdev,u16 timeout, duration;unsigned int prev_instance_cnt;u8 schedule_instance =0 ; -struct adv_info *next_instance; +struct adv_info *adv, *next_instance;int err;struct mgmt_pending_cmd *cmd;
@@ -8217,7 +8217,7 @@ static int add_advertising(struct sock *sk, struct hci_dev *hdev, prev_instance_cnt = hdev->adv_instance_cnt; - err = hci_add_adv_instance(hdev, cp->instance, flags, + adv = hci_add_adv_instance(hdev, cp->instance, flags, cp->adv_data_len, cp->data, cp->scan_rsp_len, cp->data + cp->adv_data_len,
@@ -8225,7 +8225,7 @@ static int add_advertising(struct sock *sk, struct hci_dev *hdev,HCI_ADV_TX_POWER_NO_PREFERENCE , hdev->le_adv_min_interval, hdev->le_adv_max_interval); -if (err <0 ) { +if (IS_ERR (adv)) { err =mgmt_cmd_status (sk, hdev->id,MGMT_OP_ADD_ADVERTISING ,MGMT_STATUS_FAILED ); goto unlock;
@@ -8356,6 +8356,7 @@ static int add_ext_adv_params(struct sock *sk, struct hci_dev *hdev,struct mgmt_cp_add_ext_adv_params *cp = data;struct mgmt_rp_add_ext_adv_params rp;struct mgmt_pending_cmd *cmd =NULL ; +struct adv_info *adv;u32 flags, min_interval, max_interval;u16 timeout, duration;u8 status;
@@ -8425,11 +8426,11 @@ static int add_ext_adv_params(struct sock *sk, struct hci_dev *hdev,HCI_ADV_TX_POWER_NO_PREFERENCE ;/* Create advertising instance with no advertising or response data */ - err =hci_add_adv_instance (hdev, cp->instance, flags, -0 ,NULL ,0 ,NULL , timeout, duration, - tx_power, min_interval, max_interval); + adv =hci_add_adv_instance (hdev, cp->instance, flags,0 ,NULL ,0 ,NULL , + timeout, duration, tx_power, min_interval, + max_interval); -if (err <0 ) { +if (IS_ERR (adv)) { err =mgmt_cmd_status (sk, hdev->id,MGMT_OP_ADD_EXT_ADV_PARAMS ,MGMT_STATUS_FAILED ); goto unlock;
Signature · 1 line
2.35.3
Luiz Augusto von Dentz
maintainerPATCH v7 5/7 Bluetooth: ISO: Add broadcast support
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This adds broadcast support for BTPROTO_ISO by extending the sockaddr_iso with a new struct sockaddr_iso_bc where the socket user can set the broadcast address when receiving, the SID and the BIS indexes it wants to synchronize.
When using BTPROTO_ISO for broadcast the roles are:
Broadcaster -> uses connect with address set to BDADDR_ANY:
Quoted 1 line
tools/isotest-s 00:00:00:00:00:00
Broadcast Receiver -> uses listen with address set to broadcaster:
Quoted 1 line
tools/isotest-d 00:AA:01:00:00:00
--- include/net/bluetooth/bluetooth.h | 2 + include/net/bluetooth/iso.h | 11 + net/bluetooth/iso.c | 393 +++++++++++++++++++++++++++--- 3 files changed, 371 insertions(+), 35 deletions(-)
include/net/bluetooth/bluetooth.h +2 -0
@@ -220,6 +220,8 @@ struct bt_codecs {#define BT_CODEC_TRANSPARENT 0x03#define BT_CODEC_MSBC 0x05 +#define BT_ISO_BASE 20 + __printf(1, 2)void bt_info (const char *fmt, ...);__printf (1 ,2 )
include/net/bluetooth/iso.h +11 -0
@@ -10,12 +10,23 @@/* ISO defaults */ #define ISO_DEFAULT_MTU 251 +#define ISO_MAX_NUM_BIS 0x1f + +/* ISO socket broadcast address */ +struct sockaddr_iso_bc { +bdaddr_t bc_bdaddr; +__u8 bc_bdaddr_type; +__u8 bc_sid; +__u8 bc_num_bis; +__u8 bc_bis[ISO_MAX_NUM_BIS ]; +};/* ISO socket address */ struct sockaddr_iso {sa_family_t iso_family;bdaddr_t iso_bdaddr;__u8 iso_bdaddr_type; +struct sockaddr_iso_bc iso_bc[]; };#endif /* __ISO_H */
net/bluetooth/iso.c +358 -35
540 lines not on this page · raw message
Signature · 1 line
2.35.3
Luiz Augusto von Dentz
maintainerPATCH v7 6/7 Bluetooth: btusb: Add support for ISO packets
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This enabled btusb driver to properly transmit ISO packets.
--- drivers/bluetooth/btusb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/bluetooth/btusb.c +14 -0
@@ -1765,6 +1765,13 @@ static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) hdev->stat.sco_tx++;return submit_tx_urb (hdev, urb); + +case HCI_ISODATA_PKT : + urb =alloc_bulk_urb (hdev, skb); +if (IS_ERR (urb)) +return PTR_ERR (urb); + +return submit_or_queue_tx_urb (hdev, urb); }return -EILSEQ ;
@@ -2258,6 +2265,13 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb) hdev->stat.sco_tx++;return submit_tx_urb (hdev, urb); + +case HCI_ISODATA_PKT : + urb =alloc_bulk_urb (hdev, skb); +if (IS_ERR (urb)) +return PTR_ERR (urb); + +return submit_or_queue_tx_urb (hdev, urb); }return -EILSEQ ;
Signature · 1 line
2.35.3
Luiz Augusto von Dentz
maintainerPATCH v7 7/7 Bluetooth: btusb: Detect if an ACL packet is in fact an ISO packet
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
Fix up the packet type if ISO packets are sent over the bulk endpoint.
Note: This is a stopgap since the Bluetooth specification currently doesn't define any endpoint to transport ISO packets.
--- drivers/bluetooth/btusb.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/bluetooth/btusb.c +10 -0
@@ -896,11 +896,21 @@ static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count)hci_skb_expect (skb) -= len;if (skb->len ==HCI_ACL_HDR_SIZE ) { +__u16 handle =__le16_to_cpu (hci_acl_hdr (skb)->handle);__le16 dlen =hci_acl_hdr (skb)->dlen; +__u8 type;/* Complete ACL header */ hci_skb_expect (skb) =__le16_to_cpu (dlen); +/* Detect if ISO packet has been sent over bulk */ +if (hci_conn_num (data->hdev,ISO_LINK )) { + type =hci_conn_lookup_type (data->hdev, +hci_handle (handle)); +if (type ==ISO_LINK ) +hci_skb_pkt_type (skb) =HCI_ISODATA_PKT ; + } +if (skb_tailroom (skb) <hci_skb_expect (skb)) {kfree_skb (skb); skb =NULL ;
Signature · 1 line
2.35.3
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=658721
---Test result---
Test Summary:
CheckPatch FAIL 10.05 seconds GitLint PASS 7.54 seconds SubjectPrefix PASS 6.65 seconds BuildKernel PASS 31.44 seconds BuildKernel32 PASS 28.64 seconds Incremental Build with patchesPASS 164.47 seconds TestRunner: Setup PASS 460.91 seconds TestRunner: l2cap-tester PASS 16.46 seconds TestRunner: bnep-tester PASS 5.40 seconds TestRunner: mgmt-tester FAIL 95.53 seconds TestRunner: rfcomm-tester PASS 8.79 seconds TestRunner: sco-tester PASS 8.60 seconds TestRunner: smp-tester PASS 8.66 seconds TestRunner: userchan-tester PASS 5.60 seconds
Details
##############################
Test: CheckPatch - FAIL - 10.05 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
[v7,3/7] Bluetooth: Add BTPROTO_ISO socket type\Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #176:
new file mode 100644
total: 0 errors, 1 warnings, 0 checks, 1721 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/12914365.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: TestRunner: mgmt-tester - FAIL - 95.53 seconds Run test-runner with mgmt-tester
Total: 494, Passed: 492 (99.6%), Failed: 2, Not Run: 0
Failed Test Cases
Read Exp Feature - Success Failed 0.091 seconds Read Exp Feature - Success (Index None) Failed 0.096 seconds
---
Regards,
Linux Bluetooth
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 9 lines · On Mon, 11 Jul 2022 16:35:29 -0700 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
This introduces
hci_recv_event_datato make it simpler to access the contents of last received event rather than having to pass its contents to the likes of *_ind/*_cfm callbacks.Signed-off-by Luiz Augusto von Dentz <[email protected]>[...]
Here is the summary with links:
- [v7,1/7] Bluetooth: hci_core: Introduce hci_recv_event_data
https://git.kernel.org/bluetooth/bluetooth-next/c/dfe6d5c3ec23
- [v7,2/7] Bluetooth: Add initial implementation of CIS connections (no matching commit)
- [v7,3/7] Bluetooth: Add BTPROTO_ISO socket type
https://git.kernel.org/bluetooth/bluetooth-next/c/8cdb3ca6b616 - [v7,4/7] Bluetooth: Add initial implementation of BIS connections https://git.kernel.org/bluetooth/bluetooth-next/c/336c0d956419 - [v7,5/7] Bluetooth: ISO: Add broadcast support (no matching commit) - [v7,6/7] Bluetooth: btusb: Add support for ISO packets https://git.kernel.org/bluetooth/bluetooth-next/c/f64201d50966 - [v7,7/7] Bluetooth: btusb: Detect if an ACL packet is in fact an ISO packet https://git.kernel.org/bluetooth/bluetooth-next/c/768677808478
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html