@@ -126,6 +126,7 @@ struct hci_conn_hash {
126
126
unsigned int acl_num ;
127
127
unsigned int amp_num ;
128
128
unsigned int sco_num ;
129
+ unsigned int iso_num ;
129
130
unsigned int le_num ;
130
131
unsigned int le_num_peripheral ;
131
132
};
@@ -474,13 +475,16 @@ struct hci_dev {
474
475
unsigned int acl_cnt ;
475
476
unsigned int sco_cnt ;
476
477
unsigned int le_cnt ;
478
+ unsigned int iso_cnt ;
477
479
478
480
unsigned int acl_mtu ;
479
481
unsigned int sco_mtu ;
480
482
unsigned int le_mtu ;
483
+ unsigned int iso_mtu ;
481
484
unsigned int acl_pkts ;
482
485
unsigned int sco_pkts ;
483
486
unsigned int le_pkts ;
487
+ unsigned int iso_pkts ;
484
488
485
489
__u16 block_len ;
486
490
__u16 block_mtu ;
@@ -657,6 +661,7 @@ enum conn_reasons {
657
661
CONN_REASON_PAIR_DEVICE ,
658
662
CONN_REASON_L2CAP_CHAN ,
659
663
CONN_REASON_SCO_CONNECT ,
664
+ CONN_REASON_ISO_CONNECT ,
660
665
};
661
666
662
667
struct hci_conn {
@@ -709,6 +714,7 @@ struct hci_conn {
709
714
__s8 rssi ;
710
715
__s8 tx_power ;
711
716
__s8 max_tx_power ;
717
+ struct bt_iso_qos iso_qos ;
712
718
unsigned long flags ;
713
719
714
720
enum conn_reasons conn_reason ;
@@ -739,6 +745,7 @@ struct hci_conn {
739
745
struct hci_dev * hdev ;
740
746
void * l2cap_data ;
741
747
void * sco_data ;
748
+ void * iso_data ;
742
749
struct amp_mgr * amp_mgr ;
743
750
744
751
struct hci_conn * link ;
@@ -747,6 +754,8 @@ struct hci_conn {
747
754
void (* connect_cfm_cb ) (struct hci_conn * conn , u8 status );
748
755
void (* security_cfm_cb ) (struct hci_conn * conn , u8 status );
749
756
void (* disconn_cfm_cb ) (struct hci_conn * conn , u8 reason );
757
+
758
+ void (* cleanup )(struct hci_conn * conn );
750
759
};
751
760
752
761
struct hci_chan {
@@ -954,6 +963,9 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
954
963
case ESCO_LINK :
955
964
h -> sco_num ++ ;
956
965
break ;
966
+ case ISO_LINK :
967
+ h -> iso_num ++ ;
968
+ break ;
957
969
}
958
970
}
959
971
@@ -980,6 +992,9 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
980
992
case ESCO_LINK :
981
993
h -> sco_num -- ;
982
994
break ;
995
+ case ISO_LINK :
996
+ h -> iso_num -- ;
997
+ break ;
983
998
}
984
999
}
985
1000
@@ -996,6 +1011,8 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
996
1011
case SCO_LINK :
997
1012
case ESCO_LINK :
998
1013
return h -> sco_num ;
1014
+ case ISO_LINK :
1015
+ return h -> iso_num ;
999
1016
default :
1000
1017
return 0 ;
1001
1018
}
@@ -1005,7 +1022,7 @@ static inline unsigned int hci_conn_count(struct hci_dev *hdev)
1005
1022
{
1006
1023
struct hci_conn_hash * c = & hdev -> conn_hash ;
1007
1024
1008
- return c -> acl_num + c -> amp_num + c -> sco_num + c -> le_num ;
1025
+ return c -> acl_num + c -> amp_num + c -> sco_num + c -> le_num + c -> iso_num ;
1009
1026
}
1010
1027
1011
1028
static inline __u8 hci_conn_lookup_type (struct hci_dev * hdev , __u16 handle )
@@ -1091,6 +1108,53 @@ static inline struct hci_conn *hci_conn_hash_lookup_le(struct hci_dev *hdev,
1091
1108
return NULL ;
1092
1109
}
1093
1110
1111
+ static inline struct hci_conn * hci_conn_hash_lookup_cis (struct hci_dev * hdev ,
1112
+ bdaddr_t * ba ,
1113
+ __u8 ba_type )
1114
+ {
1115
+ struct hci_conn_hash * h = & hdev -> conn_hash ;
1116
+ struct hci_conn * c ;
1117
+
1118
+ rcu_read_lock ();
1119
+
1120
+ list_for_each_entry_rcu (c , & h -> list , list ) {
1121
+ if (c -> type != ISO_LINK )
1122
+ continue ;
1123
+
1124
+ if (ba_type == c -> dst_type && !bacmp (& c -> dst , ba )) {
1125
+ rcu_read_unlock ();
1126
+ return c ;
1127
+ }
1128
+ }
1129
+
1130
+ rcu_read_unlock ();
1131
+
1132
+ return NULL ;
1133
+ }
1134
+
1135
+ static inline struct hci_conn * hci_conn_hash_lookup_cig (struct hci_dev * hdev ,
1136
+ __u8 handle )
1137
+ {
1138
+ struct hci_conn_hash * h = & hdev -> conn_hash ;
1139
+ struct hci_conn * c ;
1140
+
1141
+ rcu_read_lock ();
1142
+
1143
+ list_for_each_entry_rcu (c , & h -> list , list ) {
1144
+ if (c -> type != ISO_LINK )
1145
+ continue ;
1146
+
1147
+ if (handle == c -> iso_qos .cig ) {
1148
+ rcu_read_unlock ();
1149
+ return c ;
1150
+ }
1151
+ }
1152
+
1153
+ rcu_read_unlock ();
1154
+
1155
+ return NULL ;
1156
+ }
1157
+
1094
1158
static inline struct hci_conn * hci_conn_hash_lookup_state (struct hci_dev * hdev ,
1095
1159
__u8 type , __u16 state )
1096
1160
{
@@ -1111,6 +1175,27 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
1111
1175
return NULL ;
1112
1176
}
1113
1177
1178
+ typedef void (* hci_conn_func_t )(struct hci_conn * conn , void * data );
1179
+ static inline void hci_conn_hash_list_state (struct hci_dev * hdev ,
1180
+ hci_conn_func_t func , __u8 type ,
1181
+ __u16 state , void * data )
1182
+ {
1183
+ struct hci_conn_hash * h = & hdev -> conn_hash ;
1184
+ struct hci_conn * c ;
1185
+
1186
+ if (!func )
1187
+ return ;
1188
+
1189
+ rcu_read_lock ();
1190
+
1191
+ list_for_each_entry_rcu (c , & h -> list , list ) {
1192
+ if (c -> type == type && c -> state == state )
1193
+ func (c , data );
1194
+ }
1195
+
1196
+ rcu_read_unlock ();
1197
+ }
1198
+
1114
1199
static inline struct hci_conn * hci_lookup_le_connect (struct hci_dev * hdev )
1115
1200
{
1116
1201
struct hci_conn_hash * h = & hdev -> conn_hash ;
@@ -1134,6 +1219,8 @@ static inline struct hci_conn *hci_lookup_le_connect(struct hci_dev *hdev)
1134
1219
int hci_disconnect (struct hci_conn * conn , __u8 reason );
1135
1220
bool hci_setup_sync (struct hci_conn * conn , __u16 handle );
1136
1221
void hci_sco_setup (struct hci_conn * conn , __u8 status );
1222
+ bool hci_iso_setup_path (struct hci_conn * conn );
1223
+ int hci_le_create_cis (struct hci_conn * conn );
1137
1224
1138
1225
struct hci_conn * hci_conn_add (struct hci_dev * hdev , int type , bdaddr_t * dst ,
1139
1226
u8 role );
@@ -1158,6 +1245,10 @@ struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
1158
1245
enum conn_reasons conn_reason );
1159
1246
struct hci_conn * hci_connect_sco (struct hci_dev * hdev , int type , bdaddr_t * dst ,
1160
1247
__u16 setting , struct bt_codec * codec );
1248
+ struct hci_conn * hci_bind_cis (struct hci_dev * hdev , bdaddr_t * dst ,
1249
+ __u8 dst_type , struct bt_iso_qos * qos );
1250
+ struct hci_conn * hci_connect_cis (struct hci_dev * hdev , bdaddr_t * dst ,
1251
+ __u8 dst_type , struct bt_iso_qos * qos );
1161
1252
int hci_conn_check_link_mode (struct hci_conn * conn );
1162
1253
int hci_conn_check_secure (struct hci_conn * conn , __u8 sec_level );
1163
1254
int hci_conn_security (struct hci_conn * conn , __u8 sec_level , __u8 auth_type ,
@@ -1525,6 +1616,15 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
1525
1616
#define use_enhanced_conn_complete (dev ) (ll_privacy_capable(dev) || \
1526
1617
ext_adv_capable(dev))
1527
1618
1619
+ /* CIS Master/Slave support */
1620
+ #define iso_capable (dev ) (cis_capable(dev))
1621
+ #define cis_capable (dev ) \
1622
+ (cis_central_capable(dev) || cis_peripheral_capable(dev))
1623
+ #define cis_central_capable (dev ) \
1624
+ ((dev)->le_features[3] & HCI_LE_CIS_CENTRAL)
1625
+ #define cis_peripheral_capable (dev ) \
1626
+ ((dev)->le_features[3] & HCI_LE_CIS_PERIPHERAL)
1627
+
1528
1628
/* ----- HCI protocols ----- */
1529
1629
#define HCI_PROTO_DEFER 0x01
1530
1630
@@ -1539,6 +1639,10 @@ static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
1539
1639
case ESCO_LINK :
1540
1640
return sco_connect_ind (hdev , bdaddr , flags );
1541
1641
1642
+ case ISO_LINK :
1643
+ /* TODO: Handle connection indication */
1644
+ return - EINVAL ;
1645
+
1542
1646
default :
1543
1647
BT_ERR ("unknown link type %d" , type );
1544
1648
return - EINVAL ;
@@ -1746,6 +1850,7 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen,
1746
1850
const void * param );
1747
1851
void hci_send_acl (struct hci_chan * chan , struct sk_buff * skb , __u16 flags );
1748
1852
void hci_send_sco (struct hci_conn * conn , struct sk_buff * skb );
1853
+ void hci_send_iso (struct hci_conn * conn , struct sk_buff * skb );
1749
1854
1750
1855
void * hci_sent_cmd_data (struct hci_dev * hdev , __u16 opcode );
1751
1856
void * hci_recv_event_data (struct hci_dev * hdev , __u8 event );
0 commit comments