Skip to content

Commit

Permalink
Bluetooth: Split bt_iso_qos into dedicated structures
Browse files Browse the repository at this point in the history
Split bt_iso_qos into dedicated unicast and broadcast
structures and add additional broadcast parameters.

Fixes: eca0ae4 ("Bluetooth: Add initial implementation of BIS connections")
Signed-off-by: Iulia Tanasescu <iulia.tanasescu@nxp.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
  • Loading branch information
Iulia Tanasescu authored and Luiz Augusto von Dentz committed Apr 24, 2023
1 parent af39533 commit 0fe8c8d
Show file tree
Hide file tree
Showing 5 changed files with 237 additions and 135 deletions.
43 changes: 30 additions & 13 deletions include/net/bluetooth/bluetooth.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
BlueZ - Bluetooth protocol stack for Linux
Copyright (C) 2000-2001 Qualcomm Incorporated
Copyright 2023 NXP
Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
Expand Down Expand Up @@ -171,23 +172,39 @@ struct bt_iso_io_qos {
__u8 rtn;
};

struct bt_iso_qos {
union {
__u8 cig;
__u8 big;
};
union {
__u8 cis;
__u8 bis;
};
union {
__u8 sca;
__u8 sync_interval;
};
struct bt_iso_ucast_qos {
__u8 cig;
__u8 cis;
__u8 sca;
__u8 packing;
__u8 framing;
struct bt_iso_io_qos in;
struct bt_iso_io_qos out;
};

struct bt_iso_bcast_qos {
__u8 big;
__u8 bis;
__u8 sync_interval;
__u8 packing;
__u8 framing;
struct bt_iso_io_qos in;
struct bt_iso_io_qos out;
__u8 encryption;
__u8 bcode[16];
__u8 options;
__u16 skip;
__u16 sync_timeout;
__u8 sync_cte_type;
__u8 mse;
__u16 timeout;
};

struct bt_iso_qos {
union {
struct bt_iso_ucast_qos ucast;
struct bt_iso_bcast_qos bcast;
};
};

#define BT_ISO_PHY_1M 0x01
Expand Down
9 changes: 5 additions & 4 deletions include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
BlueZ - Bluetooth protocol stack for Linux
Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved.
Copyright 2023 NXP
Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
Expand Down Expand Up @@ -1096,7 +1097,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_bis(struct hci_dev *hdev,
if (bacmp(&c->dst, ba) || c->type != ISO_LINK)
continue;

if (c->iso_qos.big == big && c->iso_qos.bis == bis) {
if (c->iso_qos.bcast.big == big && c->iso_qos.bcast.bis == bis) {
rcu_read_unlock();
return c;
}
Expand Down Expand Up @@ -1205,7 +1206,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_cig(struct hci_dev *hdev,
if (c->type != ISO_LINK)
continue;

if (handle == c->iso_qos.cig) {
if (handle == c->iso_qos.ucast.cig) {
rcu_read_unlock();
return c;
}
Expand All @@ -1228,7 +1229,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_big(struct hci_dev *hdev,
if (bacmp(&c->dst, BDADDR_ANY) || c->type != ISO_LINK)
continue;

if (handle == c->iso_qos.big) {
if (handle == c->iso_qos.bcast.big) {
rcu_read_unlock();
return c;
}
Expand Down Expand Up @@ -1337,7 +1338,7 @@ struct hci_conn *hci_connect_bis(struct hci_dev *hdev, bdaddr_t *dst,
__u8 dst_type, struct bt_iso_qos *qos,
__u8 data_len, __u8 *data);
int hci_pa_create_sync(struct hci_dev *hdev, bdaddr_t *dst, __u8 dst_type,
__u8 sid);
__u8 sid, struct bt_iso_qos *qos);
int hci_le_big_create_sync(struct hci_dev *hdev, struct bt_iso_qos *qos,
__u16 sync_handle, __u8 num_bis, __u8 bis[]);
int hci_conn_check_link_mode(struct hci_conn *conn);
Expand Down
Loading

0 comments on commit 0fe8c8d

Please sign in to comment.