Bluetooth: ISO: Add support for connecting multiple BISes
Subsystems (2)
v3 cover Bluetooth: ISO: Add support for connecting multiple BISes
This patch implements support for connecting multiple BISes as part of the same BIG.
This proposes a flow similar to the one implemented for unicast:DEFER_SETUP is used to bind a BIS to a BIG, without starting periodic advertising or creating the BIG.
Connecting a socket without DEFER_SETUP will start periodic advertising and will create the BIG, with a BIS for each bound connection.
Iulia Tanasescu (1):
Bluetooth: ISO: Add support for connecting multiple BISes
include/net/bluetooth/hci_core.h | 30 ++++++ net/bluetooth/hci_conn.c | 152 +++++++++++++++++++++---------- net/bluetooth/hci_event.c | 50 ++++++---- net/bluetooth/iso.c | 28 ++++-- 4 files changed, 187 insertions(+), 73 deletions(-)
base-commit: a088d769ef3adfbc59ed86660d0de2abd86660e5
Signature · 1 line
2.34.1
PATCH v3 1/1 Bluetooth: ISO: Add support for connecting multiple BISes
It is required for some configurations to have multiple BISes as part of the same BIG.
Similar to the flow implemented for unicast, DEFER_SETUP will also be used to bind multiple BISes for the same BIG, before starting Periodic Advertising and creating the BIG.
The user will have to open a new socket for each BIS. By setting the BT_DEFER_SETUP socket option and calling connect, a new connection will be added for the BIG and advertising handle set by the socket QoS parameters. Since all BISes will be bound for the same BIG and advertising handle, the socket QoS options and base parameters should match for all connections.
By calling connect on a socket that does not have the BT_DEFER_SETUP option set, periodic advertising will be started and the BIG will be created, with a BIS for each previously bound connection. Since a BIG cannot be reconfigured with additional BISes after creation, no more connections can be bound for the BIG after the start periodic advertising and create BIG commands have been queued.
The bis_cleanup function has also been updated, so that the advertising set and the BIG will not be terminated unless there are no more bound or connected BISes.
The HCI_CONN_BIG_CREATED connection flag has been added to indicate that the BIG has been successfully created. This flag is checked at bis_cleanup, so that the BIG is only terminated if the HCI_LE_Create_BIG_Complete has been received.
This implementation has been tested on hardware, using the "isotest" tool with an additional command line option, to specify the number of BISes to create as part of the desired BIG:
tools/isotest -i hci0 -s 00:00:00:00:00:00 -N 2 -G 1 -T 1
The btmon log shows that a BIG containing 2 BISes has been created:
< HCI Command: LE Create Broadcast Isochronous Group (0x08|0x0068) plen 31
Handle: 0x01
Advertising Handle: 0x01
Number of BIS: 2
SDU Interval: 10000 us (0x002710)
Maximum SDU size: 40
Maximum Latency: 10 ms (0x000a)
RTN: 0x02
PHY: LE 2M (0x02)
Packing: Sequential (0x00)
Framing: Unframed (0x00)
Encryption: 0x00
Broadcast Code: 00000000000000000000000000000000Quoted 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 23
LE Broadcast Isochronous Group Complete (0x1b)
Status: Success (0x00)
Handle: 0x01
BIG Synchronization Delay: 1974 us (0x0007b6)
Transport Latency: 1974 us (0x0007b6)
PHY: LE 2M (0x02)
NSE: 3
BN: 1
PTO: 1
IRC: 3
Maximum PDU: 40
ISO Interval: 10.00 msec (0x0008)
Connection Handle #0: 10
Connection Handle #1: 11< HCI Command: LE Setup Isochronous Data Path (0x08|0x006e) plen 13
Handle: 10
Data Path Direction: Input (Host to Controller) (0x00)
Data Path: HCI (0x00)
Coding Format: Transparent (0x03)
Company Codec ID: Ericsson Technology Licensing (0)
Vendor Codec ID: 0
Controller Delay: 0 us (0x000000)
Codec Configuration Length: 0
Codec Configuration:Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6
LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 10< HCI Command: LE Setup Isochronous Data Path (0x08|0x006e) plen 13
Handle: 11
Data Path Direction: Input (Host to Controller) (0x00)
Data Path: HCI (0x00)
Coding Format: Transparent (0x03)
Company Codec ID: Ericsson Technology Licensing (0)
Vendor Codec ID: 0
Controller Delay: 0 us (0x000000)
Codec Configuration Length: 0
Codec Configuration:Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 6
LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
Status: Success (0x00)
Handle: 11< ISO Data TX: Handle 10 flags 0x02 dlen 44
< ISO Data TX: Handle 11 flags 0x02 dlen 44
Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5
Num handles: 1
Handle: 10
Count: 1
Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5
Num handles: 1
Handle: 11
Count: 1
--- include/net/bluetooth/hci_core.h | 30 ++++++ net/bluetooth/hci_conn.c | 152 +++++++++++++++++++++---------- net/bluetooth/hci_event.c | 50 ++++++---- net/bluetooth/iso.c | 28 ++++-- 4 files changed, 187 insertions(+), 73 deletions(-)
include/net/bluetooth/hci_core.h +30 -0
@@ -975,6 +975,7 @@ enum {HCI_CONN_SCANNING ,HCI_CONN_AUTH_FAILURE ,HCI_CONN_PER_ADV , + HCI_CONN_BIG_CREATED, };static inline bool hci_conn_ssp_enabled (struct hci_conn *conn)
@@ -1116,6 +1117,32 @@ static inline struct hci_conn *hci_conn_hash_lookup_bis(struct hci_dev *hdev,return NULL ; } +static inline struct hci_conn * +hci_conn_hash_lookup_per_adv_bis (struct hci_dev *hdev, +bdaddr_t *ba, +__u8 big,__u8 bis) +{ +struct hci_conn_hash *h = &hdev->conn_hash; +struct hci_conn *c; + +rcu_read_lock (); + +list_for_each_entry_rcu (c, &h->list, list) { +if (bacmp (&c->dst, ba) || c->type !=ISO_LINK || + !test_bit (HCI_CONN_PER_ADV , &c->flags)) +continue ; + +if (c->iso_qos.bcast.big == big && + c->iso_qos.bcast.bis == bis) { +rcu_read_unlock (); +return c; + } + } +rcu_read_unlock (); + +return NULL ; +} +static inline struct hci_conn *hci_conn_hash_lookup_handle (struct hci_dev *hdev,__u16 handle) {
@@ -1351,6 +1378,9 @@ struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, __u16 setting, struct bt_codec *codec);struct hci_conn *hci_bind_cis (struct hci_dev *hdev,bdaddr_t *dst,__u8 dst_type,struct bt_iso_qos *qos); +struct hci_conn *hci_bind_bis (struct hci_dev *hdev,bdaddr_t *dst, +struct bt_iso_qos *qos, +__u8 base_len,__u8 *base);struct hci_conn *hci_connect_cis (struct hci_dev *hdev,bdaddr_t *dst,__u8 dst_type,struct bt_iso_qos *qos); struct hci_conn *hci_connect_bis(struct hci_dev *hdev, bdaddr_t *dst,
net/bluetooth/hci_conn.c +106 -46
255 lines not on this page · raw message
net/bluetooth/hci_event.c +30 -20
69 lines not on this page · raw message
net/bluetooth/iso.c +21 -7
@@ -284,13 +284,24 @@ static int iso_connect_bis(struct sock *sk) goto unlock; } - hcon =hci_connect_bis (hdev, &iso_pi (sk)->dst, -le_addr_type (iso_pi (sk)->dst_type), - &iso_pi (sk)->qos,iso_pi (sk)->base_len, -iso_pi (sk)->base); -if (IS_ERR (hcon)) { - err =PTR_ERR (hcon); - goto unlock; +/* Just bind if DEFER_SETUP has been set */ +if (test_bit (BT_SK_DEFER_SETUP , &bt_sk (sk)->flags)) { + hcon =hci_bind_bis (hdev, &iso_pi (sk)->dst, + &iso_pi (sk)->qos,iso_pi (sk)->base_len, +iso_pi (sk)->base); +if (IS_ERR (hcon)) { + err =PTR_ERR (hcon); + goto unlock; + } + }else { + hcon =hci_connect_bis (hdev, &iso_pi (sk)->dst, +le_addr_type (iso_pi (sk)->dst_type), + &iso_pi (sk)->qos,iso_pi (sk)->base_len, +iso_pi (sk)->base); +if (IS_ERR (hcon)) { + err =PTR_ERR (hcon); + goto unlock; + } } conn =iso_conn_add (hcon);
@@ -315,6 +326,9 @@ static int iso_connect_bis(struct sock *sk)if (hcon->state ==BT_CONNECTED ) {iso_sock_clear_timer (sk); sk->sk_state =BT_CONNECTED ; + }else if (test_bit (BT_SK_DEFER_SETUP , &bt_sk (sk)->flags)) { +iso_sock_clear_timer (sk); + sk->sk_state =BT_CONNECT ; }else { sk->sk_state =BT_CONNECT ;iso_sock_set_timer (sk, sk->sk_sndtimeo);
Signature · 1 line
2.34.1
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=752269
---Test result---
Test Summary:
CheckPatch PASS 1.50 seconds GitLint PASS 0.26 seconds SubjectPrefix PASS 0.08 seconds BuildKernel PASS 38.88 seconds CheckAllWarning PASS 43.17 seconds CheckSparse WARNING 48.97 seconds CheckSmatch WARNING 130.37 seconds BuildKernel32 PASS 38.66 seconds TestRunnerSetup PASS 536.46 seconds TestRunner_l2cap-tester PASS 19.48 seconds TestRunner_iso-tester PASS 26.38 seconds TestRunner_bnep-tester PASS 6.79 seconds TestRunner_mgmt-tester PASS 133.06 seconds TestRunner_rfcomm-tester PASS 10.68 seconds TestRunner_sco-tester PASS 10.02 seconds TestRunner_ioctl-tester PASS 11.81 seconds TestRunner_mesh-tester PASS 8.74 seconds TestRunner_smp-tester PASS 9.85 seconds TestRunner_userchan-tester PASS 7.32 seconds IncrementalBuild PASS 36.95 seconds
Details
##############################
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: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
---
Regards,
Linux Bluetooth